]>
Commit | Line | Data |
---|---|---|
d696c285 A |
1 | # stuff to include in every test Makefile |
2 | ||
3 | SHELL = /bin/sh | |
4 | ||
5 | # set default to be host | |
6 | ARCH ?= $(shell arch) | |
7 | ||
8 | # set default to be all | |
a645023d | 9 | VALID_ARCHS ?= "i386 x86_64 armv6" |
a61fdf0a | 10 | |
afe874b1 A |
11 | IOS_SDK = /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.Internal.sdk |
12 | ||
a61fdf0a | 13 | MYDIR=$(shell cd ../../bin;pwd) |
55e3d2f6 A |
14 | LD = ld |
15 | OBJECTDUMP = ObjectDump | |
16 | MACHOCHECK = machocheck | |
17 | OTOOL = otool | |
18 | REBASE = rebase | |
a645023d | 19 | DYLDINFO = dyldinfo |
d696c285 | 20 | |
d696c285 | 21 | ifdef BUILT_PRODUCTS_DIR |
55e3d2f6 | 22 | # if run within Xcode, add the just built tools to the command path |
a61fdf0a | 23 | PATH := ${BUILT_PRODUCTS_DIR}:${MYDIR}:${PATH} |
afe874b1 A |
24 | COMPILER_PATH := ${BUILT_PRODUCTS_DIR}:${COMPILER_PATH} |
25 | LD_PATH = ${BUILT_PRODUCTS_DIR} | |
55e3d2f6 A |
26 | LD = ${BUILT_PRODUCTS_DIR}/ld |
27 | OBJECTDUMP = ${BUILT_PRODUCTS_DIR}/ObjectDump | |
28 | MACHOCHECK = ${BUILT_PRODUCTS_DIR}/machocheck | |
29 | REBASE = ${BUILT_PRODUCTS_DIR}/rebase | |
a645023d A |
30 | UNWINDDUMP = ${BUILT_PRODUCTS_DIR}/unwinddump |
31 | DYLDINFO = ${BUILT_PRODUCTS_DIR}/dyldinfo | |
a61fdf0a | 32 | else |
2f2f92e4 | 33 | ifneq "$(findstring /unit-tests/test-cases/, $(shell pwd))" "" |
55e3d2f6 | 34 | # if run from Terminal inside unit-test directory |
a645023d | 35 | RELEASEADIR=$(shell cd ../../../build/Release-assert;pwd) |
55e3d2f6 | 36 | DEBUGDIR=$(shell cd ../../../build/Debug;pwd) |
a645023d | 37 | PATH := ${RELEASEADIR}:${RELEASEDIR}:${DEBUGDIR}:${MYDIR}:${PATH} |
afe874b1 A |
38 | COMPILER_PATH := ${RELEASEADIR}:${RELEASEDIR}:${DEBUGDIR}:${COMPILER_PATH} |
39 | LD_PATH = ${DEBUGDIR} | |
a645023d A |
40 | LD = ${DEBUGDIR}/ld |
41 | OBJECTDUMP = ${DEBUGDIR}/ObjectDump | |
42 | MACHOCHECK = ${DEBUGDIR}/machocheck | |
43 | REBASE = ${DEBUGDIR}/rebase | |
44 | UNWINDDUMP = ${DEBUGDIR}/unwinddump | |
45 | DYLDINFO = ${DEBUGDIR}/dyldinfo | |
2f2f92e4 A |
46 | else |
47 | PATH := ${MYDIR}:${PATH}: | |
48 | COMPILER_PATH := ${MYDIR}:${COMPILER_PATH}: | |
49 | endif | |
d696c285 | 50 | endif |
a61fdf0a A |
51 | export PATH |
52 | export COMPILER_PATH | |
afe874b1 | 53 | export GCC_EXEC_PREFIX=garbage |
d696c285 | 54 | |
a645023d A |
55 | ifeq ($(ARCH),ppc) |
56 | SDKExtra = -isysroot /Developer/SDKs/MacOSX10.6.sdk | |
57 | endif | |
d696c285 | 58 | |
a645023d | 59 | CC = cc -arch ${ARCH} ${SDKExtra} |
afe874b1 | 60 | CCFLAGS = -Wall |
d696c285 | 61 | ASMFLAGS = |
afe874b1 A |
62 | VERSION_NEW_LINKEDIT = -mmacosx-version-min=10.6 |
63 | VERSION_OLD_LINKEDIT = -mmacosx-version-min=10.4 | |
64 | LD_NEW_LINKEDIT = -macosx_version_min 10.6 | |
d696c285 | 65 | |
a645023d | 66 | CXX = c++ -arch ${ARCH} ${SDKExtra} |
69a49097 | 67 | CXXFLAGS = -Wall |
d696c285 | 68 | |
2f2f92e4 | 69 | ifeq ($(ARCH),armv6) |
afe874b1 | 70 | LDFLAGS := -syslibroot $(IOS_SDK) |
55e3d2f6 | 71 | override FILEARCH = arm |
afe874b1 A |
72 | CC = /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/clang -arch ${ARCH} -ccc-install-dir ${LD_PATH} -miphoneos-version-min=5.0 -isysroot $(IOS_SDK) |
73 | CXX = /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/clang++ -arch ${ARCH} -ccc-install-dir ${LD_PATH} -miphoneos-version-min=5.0 -isysroot $(IOS_SDK) | |
74 | VERSION_NEW_LINKEDIT = -miphoneos-version-min=4.0 | |
75 | VERSION_OLD_LINKEDIT = -miphoneos-version-min=3.0 | |
76 | LD_SYSROOT = -syslibroot $(IOS_SDK) | |
77 | LD_NEW_LINKEDIT = -ios_version_min 4.0 | |
55e3d2f6 A |
78 | else |
79 | FILEARCH = $(ARCH) | |
80 | endif | |
81 | ||
82 | ifeq ($(ARCH),armv7) | |
afe874b1 | 83 | LDFLAGS := -syslibroot $(IOS_SDK) |
2f2f92e4 | 84 | override FILEARCH = arm |
afe874b1 A |
85 | CC = /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/clang -arch ${ARCH} -ccc-install-dir ${LD_PATH} -miphoneos-version-min=5.0 -isysroot $(IOS_SDK) |
86 | CXX = /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/clang++ -arch ${ARCH} -ccc-install-dir ${LD_PATH} -miphoneos-version-min=5.0 -isysroot $(IOS_SDK) | |
87 | VERSION_NEW_LINKEDIT = -miphoneos-version-min=4.0 | |
88 | VERSION_OLD_LINKEDIT = -miphoneos-version-min=3.0 | |
89 | LD_SYSROOT = -syslibroot $(IOS_SDK) | |
90 | LD_NEW_LINKEDIT = -ios_version_min 4.0 | |
2f2f92e4 A |
91 | else |
92 | FILEARCH = $(ARCH) | |
93 | endif | |
94 | ||
95 | ifeq ($(ARCH),thumb) | |
afe874b1 | 96 | LDFLAGS := -syslibroot $(IOS_SDK) |
2f2f92e4 A |
97 | CCFLAGS += -mthumb |
98 | CXXFLAGS += -mthumb | |
99 | override ARCH = armv6 | |
100 | override FILEARCH = arm | |
afe874b1 A |
101 | CC = /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/clang -arch ${ARCH} -ccc-install-dir ${LD_PATH} -miphoneos-version-min=5.0 -isysroot $(IOS_SDK) |
102 | CXX = /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/clang++ -arch ${ARCH} -ccc-install-dir ${LD_PATH} -miphoneos-version-min=5.0 -isysroot $(IOS_SDK) | |
103 | VERSION_NEW_LINKEDIT = -miphoneos-version-min=4.0 | |
104 | VERSION_OLD_LINKEDIT = -miphoneos-version-min=3.0 | |
105 | LD_SYSROOT = -syslibroot $(IOS_SDK) | |
106 | LD_NEW_LINKEDIT = -ios_version_min 4.0 | |
2f2f92e4 A |
107 | else |
108 | FILEARCH = $(ARCH) | |
109 | endif | |
110 | ||
55e3d2f6 | 111 | ifeq ($(ARCH),thumb2) |
afe874b1 | 112 | LDFLAGS := -syslibroot $(IOS_SDK) |
55e3d2f6 A |
113 | CCFLAGS += -mthumb |
114 | CXXFLAGS += -mthumb | |
115 | override ARCH = armv7 | |
116 | override FILEARCH = arm | |
afe874b1 A |
117 | CC = /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/clang -arch ${ARCH} -ccc-install-dir ${LD_PATH} -miphoneos-version-min=5.0 -isysroot $(IOS_SDK) |
118 | CXX = /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/clang++ -arch ${ARCH} -ccc-install-dir ${LD_PATH} -miphoneos-version-min=5.0 -isysroot $(IOS_SDK) | |
119 | VERSION_NEW_LINKEDIT = -miphoneos-version-min=4.0 | |
120 | VERSION_OLD_LINKEDIT = -miphoneos-version-min=3.0 | |
121 | LD_SYSROOT = -syslibroot $(IOS_SDK) | |
122 | LD_NEW_LINKEDIT = -ios_version_min 4.0 | |
55e3d2f6 A |
123 | else |
124 | FILEARCH = $(ARCH) | |
125 | endif | |
126 | ||
a645023d | 127 | |
d696c285 A |
128 | RM = rm |
129 | RMFLAGS = -rf | |
130 | ||
131 | # utilites for Makefiles | |
55e3d2f6 | 132 | PASS_IFF = ${MYDIR}/pass-iff-exit-zero.pl |
a61fdf0a | 133 | PASS_IFF_SUCCESS = ${PASS_IFF} |
55e3d2f6 A |
134 | PASS_IFF_EMPTY = ${MYDIR}/pass-iff-no-stdin.pl |
135 | PASS_IFF_STDIN = ${MYDIR}/pass-iff-stdin.pl | |
136 | FAIL_IFF = ${MYDIR}/fail-iff-exit-zero.pl | |
a61fdf0a | 137 | FAIL_IFF_SUCCESS = ${FAIL_IFF} |
55e3d2f6 A |
138 | PASS_IFF_ERROR = ${MYDIR}/pass-iff-exit-non-zero.pl |
139 | FAIL_IF_ERROR = ${MYDIR}/fail-if-exit-non-zero.pl | |
140 | FAIL_IF_SUCCESS = ${MYDIR}/fail-if-exit-zero.pl | |
141 | FAIL_IF_EMPTY = ${MYDIR}/fail-if-no-stdin.pl | |
142 | FAIL_IF_STDIN = ${MYDIR}/fail-if-stdin.pl | |
a61fdf0a A |
143 | PASS_IFF_GOOD_MACHO = ${PASS_IFF} ${MACHOCHECK} |
144 | FAIL_IF_BAD_MACHO = ${FAIL_IF_ERROR} ${MACHOCHECK} | |
145 | FAIL_IF_BAD_OBJ = ${FAIL_IF_ERROR} ${OBJECTDUMP} >/dev/null |