]>
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) | |
d696c285 A |
12 | |
13 | # if run within Xcode, add the just built tools to the command path | |
14 | ifdef BUILT_PRODUCTS_DIR | |
a61fdf0a A |
15 | PATH := ${BUILT_PRODUCTS_DIR}:${MYDIR}:${PATH} |
16 | COMPILER_PATH := ${BUILT_PRODUCTS_DIR}:${MYDIR}:${COMPILER_PATH} | |
17 | else | |
2f2f92e4 A |
18 | ifneq "$(findstring /unit-tests/test-cases/, $(shell pwd))" "" |
19 | RELEASEDIR=$(shell cd ../../../build/Release;pwd) | |
20 | PATH := ${RELEASEDIR}:${MYDIR}:${PATH} | |
21 | COMPILER_PATH := ${RELEASEDIR}:${MYDIR}:${COMPILER_PATH} | |
22 | else | |
23 | PATH := ${MYDIR}:${PATH}: | |
24 | COMPILER_PATH := ${MYDIR}:${COMPILER_PATH}: | |
25 | endif | |
d696c285 | 26 | endif |
a61fdf0a A |
27 | export PATH |
28 | export COMPILER_PATH | |
d696c285 A |
29 | |
30 | LD = ld | |
31 | OBJECTDUMP = ObjectDump | |
32 | MACHOCHECK = machocheck | |
d696c285 | 33 | OTOOL = otool |
d696c285 A |
34 | |
35 | CC = gcc-4.0 -arch ${ARCH} | |
69a49097 | 36 | CCFLAGS = -Wall -std=c99 |
d696c285 A |
37 | ASMFLAGS = |
38 | ||
39 | CXX = g++-4.0 -arch ${ARCH} | |
69a49097 | 40 | CXXFLAGS = -Wall |
d696c285 | 41 | |
2f2f92e4 A |
42 | ifeq ($(ARCH),armv6) |
43 | LDFLAGS := -syslibroot /Developer/SDKs/Purple | |
44 | override FILEARCH = arm | |
45 | else | |
46 | FILEARCH = $(ARCH) | |
47 | endif | |
48 | ||
49 | ifeq ($(ARCH),thumb) | |
50 | LDFLAGS := -syslibroot /Developer/SDKs/Purple | |
51 | CCFLAGS += -mthumb | |
52 | CXXFLAGS += -mthumb | |
53 | override ARCH = armv6 | |
54 | override FILEARCH = arm | |
55 | else | |
56 | FILEARCH = $(ARCH) | |
57 | endif | |
58 | ||
d696c285 A |
59 | RM = rm |
60 | RMFLAGS = -rf | |
61 | ||
62 | # utilites for Makefiles | |
a61fdf0a A |
63 | PASS_IFF = pass-iff-exit-zero.pl |
64 | PASS_IFF_SUCCESS = ${PASS_IFF} | |
65 | PASS_IFF_EMPTY = pass-iff-no-stdin.pl | |
66 | PASS_IFF_STDIN = pass-iff-stdin.pl | |
67 | FAIL_IFF = fail-iff-exit-zero.pl | |
68 | FAIL_IFF_SUCCESS = ${FAIL_IFF} | |
69 | PASS_IFF_ERROR = pass-iff-exit-non-zero.pl | |
70 | FAIL_IF_ERROR = fail-if-exit-non-zero.pl | |
71 | FAIL_IF_SUCCESS = fail-if-exit-zero.pl | |
72 | FAIL_IF_EMPTY = fail-if-no-stdin.pl | |
73 | FAIL_IF_STDIN = fail-if-stdin.pl | |
74 | PASS_IFF_GOOD_MACHO = ${PASS_IFF} ${MACHOCHECK} | |
75 | FAIL_IF_BAD_MACHO = ${FAIL_IF_ERROR} ${MACHOCHECK} | |
76 | FAIL_IF_BAD_OBJ = ${FAIL_IF_ERROR} ${OBJECTDUMP} >/dev/null |