Mercurial > hg > CbC > CbC_xv6
comparison src/old_makefiles/makefile.inc @ 120:ed85941a7514
mv old-makefiel
author | anatofuz |
---|---|
date | Mon, 02 Dec 2019 19:12:01 +0900 |
parents | src/makefile.inc@58ec26c64601 |
children |
comparison
equal
deleted
inserted
replaced
119:94ee7046d190 | 120:ed85941a7514 |
---|---|
1 # Cross-compiling (e.g., on Mac OS X, install arm-none-eabi-gcc with MacPorts) | |
2 | |
3 CROSSCOMPILE := arm-linux-gnu- | |
4 | |
5 CPU = armv8 | |
6 #CC = /usr/local/cbclang/bin/clang | |
7 AS = $(CROSSCOMPILE)as | |
8 LD = $(CROSSCOMPILE)ld | |
9 OBJCOPY = $(CROSSCOMPILE)objcopy | |
10 OBJDUMP = $(CROSSCOMPILE)objdump | |
11 | |
12 # CFLAGS = -march=${CPU} -fno-pic -static -fno-builtin -fno-strict-aliasing -Wall -Werror -I. -g -O0 | |
13 CFLAGS = -target ${CPU}-none-eabi -I /net/open/Linux/arm/gcc-arm-none-eabi-7-2017-q4-major/arm-none-eabi/include/ /net/open/Linux/arm/gcc-arm-none-eabi-7-2017-q4-major/lib/gcc/arm-none-eabi/7.2.1/include-fixed/ -fno-pic -static -fno-builtin -fno-strict-aliasing -Wall -I. -g -O0 | |
14 LDFLAGS = -L. | |
15 # ASFLAGS = -march=${CPU} | |
16 ASFLAGS = -target ${CPU}-none-eabi | |
17 | |
18 #LIBGCC = $(shell $(gcc) -print-libgcc-file-name) | |
19 LIBGCC = /net/open/Linux/arm/gcc-arm-none-eabi-7-2017-q4-major/lib/gcc/arm-none-eabi/7.2.1/libgcc.a | |
20 | |
21 # host compiler | |
22 HOSTCC_preferred = gcc | |
23 #HOSTCC_preferred = /usr/local/cbclang/bin/clang | |
24 define get_hostcc | |
25 $(if $(shell which $(HOSTCC_preferred)),$(HOSTCC_preferred),"cc") | |
26 endef | |
27 HOSTCC := $(call get_hostcc) | |
28 | |
29 # general rules | |
30 quiet-command = $(if $(V),$1,$(if $(2),@echo $2 && $1, @$1)) | |
31 | |
32 LINK_BIN = $(call quiet-command,$(LD) $(LDFLAGS) \ | |
33 -T $(1) -o $(2) $(3) $(LIBS) -b binary $(4), " LINK $(TARGET_DIR)$@") | |
34 | |
35 LINK_INIT = $(call quiet-command,$(LD) $(LDFLAGS) \ | |
36 $(1) -o $@.out $<, " LINK $(TARGET_DIR)$@") | |
37 OBJCOPY_INIT = $(call quiet-command,$(OBJCOPY) \ | |
38 -S -O binary --prefix-symbols="_binary_$@" $@.out $@, " OBJCOPY $(TARGET_DIR)$@") | |
39 | |
40 build-directory = $(shell mkdir -p build build/device build/lib) | |
41 | |
42 build/%.o: %.c | |
43 $(call build-directory) | |
44 $(call quiet-command,$(CC) $(CFLAGS) \ | |
45 -c -o $@ $<," CC $(TARGET_DIR)$@") | |
46 | |
47 build/%.o: %.cbc | |
48 $(call build-directory) | |
49 $(call quiet-command,$(CC) $(CFLAGS) \ | |
50 -c -o $@ $<," CC $(TARGET_DIR)$@") | |
51 | |
52 AS_WITH = $(call quiet-command,$(CC) $(ASFLAGS) \ | |
53 $(1) -c -o $@ $<," AS $(TARGET_DIR)$@") | |
54 | |
55 build/%.o: %.S | |
56 $(call build-directory) | |
57 $(call AS_WITH, ) |