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