annotate src/makefile-osx.inc @ 52:1adde248a61f default tip

merge
author anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
date Fri, 07 Jun 2019 17:30:15 +0900
parents 0bbeb1a284e2
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3
0bbeb1a284e2 fix entry asmcode
tobaru
parents:
diff changeset
1 # Cross-compiling (e.g., on Mac OS X, install arm-none-eabi-gcc with MacPorts)
0bbeb1a284e2 fix entry asmcode
tobaru
parents:
diff changeset
2 CROSSCOMPILE :=
0bbeb1a284e2 fix entry asmcode
tobaru
parents:
diff changeset
3
0bbeb1a284e2 fix entry asmcode
tobaru
parents:
diff changeset
4 CC = $(CROSSCOMPILE)/Users/one/src/cbclang-arm/build/bin/clang
0bbeb1a284e2 fix entry asmcode
tobaru
parents:
diff changeset
5 AS = $(CROSSCOMPILE)as
0bbeb1a284e2 fix entry asmcode
tobaru
parents:
diff changeset
6 LD = $(CROSSCOMPILE)ld
0bbeb1a284e2 fix entry asmcode
tobaru
parents:
diff changeset
7 OBJCOPY = $(CROSSCOMPILE)objcopy
0bbeb1a284e2 fix entry asmcode
tobaru
parents:
diff changeset
8 OBJDUMP = $(CROSSCOMPILE)objdump
0bbeb1a284e2 fix entry asmcode
tobaru
parents:
diff changeset
9
0bbeb1a284e2 fix entry asmcode
tobaru
parents:
diff changeset
10 CFLAGS = -arch arm -fno-pic -static -fno-builtin -fno-strict-aliasing -Wall -Werror -I. -g -O0 \
0bbeb1a284e2 fix entry asmcode
tobaru
parents:
diff changeset
11 -Wno-macro-redefined -Wno-gnu-designator -Wno-sometimes-uninitialized -Wno-tautological-compare \
0bbeb1a284e2 fix entry asmcode
tobaru
parents:
diff changeset
12 -I/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/usr/include
0bbeb1a284e2 fix entry asmcode
tobaru
parents:
diff changeset
13 LDFLAGS = -L. -arch armv7
0bbeb1a284e2 fix entry asmcode
tobaru
parents:
diff changeset
14 ASFLAGS = -arch arm
0bbeb1a284e2 fix entry asmcode
tobaru
parents:
diff changeset
15
0bbeb1a284e2 fix entry asmcode
tobaru
parents:
diff changeset
16 LIBGCC = $(shell $(CC) -print-libgcc-file-name)
0bbeb1a284e2 fix entry asmcode
tobaru
parents:
diff changeset
17
0bbeb1a284e2 fix entry asmcode
tobaru
parents:
diff changeset
18 # host compiler
0bbeb1a284e2 fix entry asmcode
tobaru
parents:
diff changeset
19 HOSTCC_preferred = clang
0bbeb1a284e2 fix entry asmcode
tobaru
parents:
diff changeset
20 define get_hostcc
0bbeb1a284e2 fix entry asmcode
tobaru
parents:
diff changeset
21 $(if $(shell which $(HOSTCC_preferred)),$(HOSTCC_preferred),"cc")
0bbeb1a284e2 fix entry asmcode
tobaru
parents:
diff changeset
22 endef
0bbeb1a284e2 fix entry asmcode
tobaru
parents:
diff changeset
23 HOSTCC := $(call get_hostcc)
0bbeb1a284e2 fix entry asmcode
tobaru
parents:
diff changeset
24
0bbeb1a284e2 fix entry asmcode
tobaru
parents:
diff changeset
25 # general rules
0bbeb1a284e2 fix entry asmcode
tobaru
parents:
diff changeset
26 quiet-command = $(if $(V),$1,$(if $(2),@echo $2 && $1, @$1))
0bbeb1a284e2 fix entry asmcode
tobaru
parents:
diff changeset
27
0bbeb1a284e2 fix entry asmcode
tobaru
parents:
diff changeset
28 LINK_BIN = $(call quiet-command,$(LD) $(LDFLAGS) \
0bbeb1a284e2 fix entry asmcode
tobaru
parents:
diff changeset
29 -T $(1) -o $(2) $(3) $(LIBS) -b binary $(4), " LINK $(TARGET_DIR)$@")
0bbeb1a284e2 fix entry asmcode
tobaru
parents:
diff changeset
30
0bbeb1a284e2 fix entry asmcode
tobaru
parents:
diff changeset
31 LINK_INIT = $(call quiet-command,$(LD) $(LDFLAGS) \
0bbeb1a284e2 fix entry asmcode
tobaru
parents:
diff changeset
32 $(1) -o $@.out $<, " LINK $(TARGET_DIR)$@")
0bbeb1a284e2 fix entry asmcode
tobaru
parents:
diff changeset
33 OBJCOPY_INIT = $(call quiet-command,$(OBJCOPY) \
0bbeb1a284e2 fix entry asmcode
tobaru
parents:
diff changeset
34 -S -O binary --prefix-symbols="_binary_$@" $@.out $@, " OBJCOPY $(TARGET_DIR)$@")
0bbeb1a284e2 fix entry asmcode
tobaru
parents:
diff changeset
35
0bbeb1a284e2 fix entry asmcode
tobaru
parents:
diff changeset
36 build-directory = $(shell mkdir -p build build/device build/lib)
0bbeb1a284e2 fix entry asmcode
tobaru
parents:
diff changeset
37
0bbeb1a284e2 fix entry asmcode
tobaru
parents:
diff changeset
38 build/%.o: %.c
0bbeb1a284e2 fix entry asmcode
tobaru
parents:
diff changeset
39 $(call build-directory)
0bbeb1a284e2 fix entry asmcode
tobaru
parents:
diff changeset
40 $(call quiet-command,$(CC) $(CFLAGS) \
0bbeb1a284e2 fix entry asmcode
tobaru
parents:
diff changeset
41 -c -o $@ $<," CC $(TARGET_DIR)$@")
0bbeb1a284e2 fix entry asmcode
tobaru
parents:
diff changeset
42
0bbeb1a284e2 fix entry asmcode
tobaru
parents:
diff changeset
43 AS_WITH = $(call quiet-command,$(CC) $(ASFLAGS) \
0bbeb1a284e2 fix entry asmcode
tobaru
parents:
diff changeset
44 $(1) -c -o $@ $<," AS $(TARGET_DIR)$@")
0bbeb1a284e2 fix entry asmcode
tobaru
parents:
diff changeset
45
0bbeb1a284e2 fix entry asmcode
tobaru
parents:
diff changeset
46 build/%.o: %.S
0bbeb1a284e2 fix entry asmcode
tobaru
parents:
diff changeset
47 $(call build-directory)
0bbeb1a284e2 fix entry asmcode
tobaru
parents:
diff changeset
48 $(call AS_WITH, )