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