]>
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 A |
10 | |
11 | MYDIR=$(shell cd ../../bin;pwd) | |
55e3d2f6 A |
12 | LD = ld |
13 | OBJECTDUMP = ObjectDump | |
14 | MACHOCHECK = machocheck | |
15 | OTOOL = otool | |
16 | REBASE = rebase | |
a645023d | 17 | DYLDINFO = dyldinfo |
d696c285 | 18 | |
d696c285 | 19 | ifdef BUILT_PRODUCTS_DIR |
55e3d2f6 | 20 | # if run within Xcode, add the just built tools to the command path |
a61fdf0a A |
21 | PATH := ${BUILT_PRODUCTS_DIR}:${MYDIR}:${PATH} |
22 | COMPILER_PATH := ${BUILT_PRODUCTS_DIR}:${MYDIR}:${COMPILER_PATH} | |
55e3d2f6 A |
23 | LD = ${BUILT_PRODUCTS_DIR}/ld |
24 | OBJECTDUMP = ${BUILT_PRODUCTS_DIR}/ObjectDump | |
25 | MACHOCHECK = ${BUILT_PRODUCTS_DIR}/machocheck | |
26 | REBASE = ${BUILT_PRODUCTS_DIR}/rebase | |
a645023d A |
27 | UNWINDDUMP = ${BUILT_PRODUCTS_DIR}/unwinddump |
28 | DYLDINFO = ${BUILT_PRODUCTS_DIR}/dyldinfo | |
a61fdf0a | 29 | else |
2f2f92e4 | 30 | ifneq "$(findstring /unit-tests/test-cases/, $(shell pwd))" "" |
55e3d2f6 | 31 | # if run from Terminal inside unit-test directory |
2f2f92e4 | 32 | RELEASEDIR=$(shell cd ../../../build/Release;pwd) |
a645023d | 33 | RELEASEADIR=$(shell cd ../../../build/Release-assert;pwd) |
55e3d2f6 | 34 | DEBUGDIR=$(shell cd ../../../build/Debug;pwd) |
a645023d A |
35 | PATH := ${RELEASEADIR}:${RELEASEDIR}:${DEBUGDIR}:${MYDIR}:${PATH} |
36 | COMPILER_PATH := ${RELEASEADIR}:${RELEASEDIR}:${DEBUGDIR}:${MYDIR}:${COMPILER_PATH} | |
37 | LD = ${DEBUGDIR}/ld | |
38 | OBJECTDUMP = ${DEBUGDIR}/ObjectDump | |
39 | MACHOCHECK = ${DEBUGDIR}/machocheck | |
40 | REBASE = ${DEBUGDIR}/rebase | |
41 | UNWINDDUMP = ${DEBUGDIR}/unwinddump | |
42 | DYLDINFO = ${DEBUGDIR}/dyldinfo | |
2f2f92e4 A |
43 | else |
44 | PATH := ${MYDIR}:${PATH}: | |
45 | COMPILER_PATH := ${MYDIR}:${COMPILER_PATH}: | |
46 | endif | |
d696c285 | 47 | endif |
a61fdf0a A |
48 | export PATH |
49 | export COMPILER_PATH | |
d696c285 | 50 | |
a645023d A |
51 | ifeq ($(ARCH),ppc) |
52 | SDKExtra = -isysroot /Developer/SDKs/MacOSX10.6.sdk | |
53 | endif | |
d696c285 | 54 | |
a645023d | 55 | CC = cc -arch ${ARCH} ${SDKExtra} |
69a49097 | 56 | CCFLAGS = -Wall -std=c99 |
d696c285 A |
57 | ASMFLAGS = |
58 | ||
a645023d | 59 | CXX = c++ -arch ${ARCH} ${SDKExtra} |
69a49097 | 60 | CXXFLAGS = -Wall |
d696c285 | 61 | |
2f2f92e4 | 62 | ifeq ($(ARCH),armv6) |
55e3d2f6 A |
63 | SDKExtra = -isysroot /Developer/SDKs/Extra |
64 | LDFLAGS := -syslibroot /Developer/SDKs/Extra | |
65 | override FILEARCH = arm | |
66 | else | |
67 | FILEARCH = $(ARCH) | |
68 | endif | |
69 | ||
70 | ifeq ($(ARCH),armv7) | |
71 | SDKExtra = -isysroot /Developer/SDKs/Extra | |
72 | LDFLAGS := -syslibroot /Developer/SDKs/Extra | |
2f2f92e4 A |
73 | override FILEARCH = arm |
74 | else | |
75 | FILEARCH = $(ARCH) | |
76 | endif | |
77 | ||
78 | ifeq ($(ARCH),thumb) | |
55e3d2f6 A |
79 | SDKExtra = -isysroot /Developer/SDKs/Extra |
80 | LDFLAGS := -syslibroot /Developer/SDKs/Extra | |
2f2f92e4 A |
81 | CCFLAGS += -mthumb |
82 | CXXFLAGS += -mthumb | |
83 | override ARCH = armv6 | |
84 | override FILEARCH = arm | |
85 | else | |
86 | FILEARCH = $(ARCH) | |
87 | endif | |
88 | ||
55e3d2f6 A |
89 | ifeq ($(ARCH),thumb2) |
90 | SDKExtra = -isysroot /Developer/SDKs/Extra | |
91 | LDFLAGS := -syslibroot /Developer/SDKs/Extra | |
92 | CCFLAGS += -mthumb | |
93 | CXXFLAGS += -mthumb | |
94 | override ARCH = armv7 | |
95 | override FILEARCH = arm | |
96 | CC = /Volumes/Leopard/Developer/Platforms/iPhoneOS.platform/usr/bin/gcc-4.2 -arch ${ARCH} | |
97 | else | |
98 | FILEARCH = $(ARCH) | |
99 | endif | |
100 | ||
a645023d | 101 | |
d696c285 A |
102 | RM = rm |
103 | RMFLAGS = -rf | |
104 | ||
105 | # utilites for Makefiles | |
55e3d2f6 | 106 | PASS_IFF = ${MYDIR}/pass-iff-exit-zero.pl |
a61fdf0a | 107 | PASS_IFF_SUCCESS = ${PASS_IFF} |
55e3d2f6 A |
108 | PASS_IFF_EMPTY = ${MYDIR}/pass-iff-no-stdin.pl |
109 | PASS_IFF_STDIN = ${MYDIR}/pass-iff-stdin.pl | |
110 | FAIL_IFF = ${MYDIR}/fail-iff-exit-zero.pl | |
a61fdf0a | 111 | FAIL_IFF_SUCCESS = ${FAIL_IFF} |
55e3d2f6 A |
112 | PASS_IFF_ERROR = ${MYDIR}/pass-iff-exit-non-zero.pl |
113 | FAIL_IF_ERROR = ${MYDIR}/fail-if-exit-non-zero.pl | |
114 | FAIL_IF_SUCCESS = ${MYDIR}/fail-if-exit-zero.pl | |
115 | FAIL_IF_EMPTY = ${MYDIR}/fail-if-no-stdin.pl | |
116 | FAIL_IF_STDIN = ${MYDIR}/fail-if-stdin.pl | |
a61fdf0a A |
117 | PASS_IFF_GOOD_MACHO = ${PASS_IFF} ${MACHOCHECK} |
118 | FAIL_IF_BAD_MACHO = ${FAIL_IF_ERROR} ${MACHOCHECK} | |
119 | FAIL_IF_BAD_OBJ = ${FAIL_IF_ERROR} ${OBJECTDUMP} >/dev/null |