1 # stuff to include in every test Makefile
5 # set default to be host
8 # set default to be all
9 VALID_ARCHS ?= "i386 x86_64 armv6"
12 MYDIR=$(shell cd ../../bin;pwd)
14 OBJECTDUMP = ObjectDump
15 MACHOCHECK = machocheck
20 ifdef BUILT_PRODUCTS_DIR
21 # if run within Xcode, add the just built tools to the command path
22 PATH := ${BUILT_PRODUCTS_DIR}:${MYDIR}:${PATH}
23 COMPILER_PATH := ${BUILT_PRODUCTS_DIR}:${COMPILER_PATH}
24 LD_PATH = ${BUILT_PRODUCTS_DIR}
25 LD = ${BUILT_PRODUCTS_DIR}/ld
26 OBJECTDUMP = ${BUILT_PRODUCTS_DIR}/ObjectDump
27 MACHOCHECK = ${BUILT_PRODUCTS_DIR}/machocheck
28 REBASE = ${BUILT_PRODUCTS_DIR}/rebase
29 UNWINDDUMP = ${BUILT_PRODUCTS_DIR}/unwinddump
30 DYLDINFO = ${BUILT_PRODUCTS_DIR}/dyldinfo
32 ifneq "$(findstring /unit-tests/test-cases/, $(shell pwd))" ""
33 # if run from Terminal inside unit-test directory
34 RELEASEADIR=$(shell cd ../../../build/Release-assert;pwd)
35 DEBUGDIR=$(shell cd ../../../build/Debug;pwd)
36 PATH := ${RELEASEADIR}:${RELEASEDIR}:${DEBUGDIR}:${MYDIR}:${PATH}
37 COMPILER_PATH := ${RELEASEADIR}:${RELEASEDIR}:${DEBUGDIR}:${COMPILER_PATH}
40 OBJECTDUMP = ${DEBUGDIR}/ObjectDump
41 MACHOCHECK = ${DEBUGDIR}/machocheck
42 REBASE = ${DEBUGDIR}/rebase
43 UNWINDDUMP = ${DEBUGDIR}/unwinddump
44 DYLDINFO = ${DEBUGDIR}/dyldinfo
46 PATH := ${MYDIR}:${PATH}:
47 COMPILER_PATH := ${MYDIR}:${COMPILER_PATH}:
52 export GCC_EXEC_PREFIX=garbage
55 SDKExtra = -isysroot /Developer/SDKs/MacOSX10.6.sdk
58 CC = $(shell xcrun -find clang) -arch ${ARCH} ${SDKExtra}
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
65 CXX = $(shell xcrun -find clang++) -arch ${ARCH} ${SDKExtra}
66 CXXFLAGS = -Wall -stdlib=libc++
68 IOS_SDK = $(shell xcodebuild -sdk iphoneos7.0.internal -version Path)
71 LDFLAGS := -syslibroot $(IOS_SDK)
72 override FILEARCH = arm
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)
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
84 LDFLAGS := -syslibroot $(IOS_SDK)
85 override FILEARCH = arm
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)
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
97 LDFLAGS := -syslibroot $(IOS_SDK)
100 override ARCH = armv6
101 override FILEARCH = arm
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)
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
112 ifeq ($(ARCH),thumb2)
113 LDFLAGS := -syslibroot $(IOS_SDK)
116 override ARCH = armv7
117 override FILEARCH = arm
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)
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
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
143 # utilites for Makefiles
144 PASS_IFF = ${MYDIR}/pass-iff-exit-zero.pl
145 PASS_IFF_SUCCESS = ${PASS_IFF}
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
149 FAIL_IFF_SUCCESS = ${FAIL_IFF}
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
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