]> git.saurik.com Git - apple/ld64.git/blame_incremental - unit-tests/include/common.makefile
ld64-123.2.1.tar.gz
[apple/ld64.git] / unit-tests / include / common.makefile
... / ...
CommitLineData
1# stuff to include in every test Makefile
2
3SHELL = /bin/sh
4
5# set default to be host
6ARCH ?= $(shell arch)
7
8# set default to be all
9VALID_ARCHS ?= "i386 x86_64 armv6"
10
11MYDIR=$(shell cd ../../bin;pwd)
12LD = ld
13OBJECTDUMP = ObjectDump
14MACHOCHECK = machocheck
15OTOOL = otool
16REBASE = rebase
17DYLDINFO = dyldinfo
18
19ifdef BUILT_PRODUCTS_DIR
20 # if run within Xcode, add the just built tools to the command path
21 PATH := ${BUILT_PRODUCTS_DIR}:${MYDIR}:${PATH}
22 COMPILER_PATH := ${BUILT_PRODUCTS_DIR}:${MYDIR}:${COMPILER_PATH}
23 LD = ${BUILT_PRODUCTS_DIR}/ld
24 OBJECTDUMP = ${BUILT_PRODUCTS_DIR}/ObjectDump
25 MACHOCHECK = ${BUILT_PRODUCTS_DIR}/machocheck
26 REBASE = ${BUILT_PRODUCTS_DIR}/rebase
27 UNWINDDUMP = ${BUILT_PRODUCTS_DIR}/unwinddump
28 DYLDINFO = ${BUILT_PRODUCTS_DIR}/dyldinfo
29else
30 ifneq "$(findstring /unit-tests/test-cases/, $(shell pwd))" ""
31 # if run from Terminal inside unit-test directory
32 RELEASEDIR=$(shell cd ../../../build/Release;pwd)
33 RELEASEADIR=$(shell cd ../../../build/Release-assert;pwd)
34 DEBUGDIR=$(shell cd ../../../build/Debug;pwd)
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
43 else
44 PATH := ${MYDIR}:${PATH}:
45 COMPILER_PATH := ${MYDIR}:${COMPILER_PATH}:
46 endif
47endif
48export PATH
49export COMPILER_PATH
50
51ifeq ($(ARCH),ppc)
52 SDKExtra = -isysroot /Developer/SDKs/MacOSX10.6.sdk
53endif
54
55CC = cc -arch ${ARCH} ${SDKExtra}
56CCFLAGS = -Wall -std=c99
57ASMFLAGS =
58
59CXX = c++ -arch ${ARCH} ${SDKExtra}
60CXXFLAGS = -Wall
61
62ifeq ($(ARCH),armv6)
63 SDKExtra = -isysroot /Developer/SDKs/Extra
64 LDFLAGS := -syslibroot /Developer/SDKs/Extra
65 override FILEARCH = arm
66else
67 FILEARCH = $(ARCH)
68endif
69
70ifeq ($(ARCH),armv7)
71 SDKExtra = -isysroot /Developer/SDKs/Extra
72 LDFLAGS := -syslibroot /Developer/SDKs/Extra
73 override FILEARCH = arm
74else
75 FILEARCH = $(ARCH)
76endif
77
78ifeq ($(ARCH),thumb)
79 SDKExtra = -isysroot /Developer/SDKs/Extra
80 LDFLAGS := -syslibroot /Developer/SDKs/Extra
81 CCFLAGS += -mthumb
82 CXXFLAGS += -mthumb
83 override ARCH = armv6
84 override FILEARCH = arm
85else
86 FILEARCH = $(ARCH)
87endif
88
89ifeq ($(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}
97else
98 FILEARCH = $(ARCH)
99endif
100
101
102RM = rm
103RMFLAGS = -rf
104
105# utilites for Makefiles
106PASS_IFF = ${MYDIR}/pass-iff-exit-zero.pl
107PASS_IFF_SUCCESS = ${PASS_IFF}
108PASS_IFF_EMPTY = ${MYDIR}/pass-iff-no-stdin.pl
109PASS_IFF_STDIN = ${MYDIR}/pass-iff-stdin.pl
110FAIL_IFF = ${MYDIR}/fail-iff-exit-zero.pl
111FAIL_IFF_SUCCESS = ${FAIL_IFF}
112PASS_IFF_ERROR = ${MYDIR}/pass-iff-exit-non-zero.pl
113FAIL_IF_ERROR = ${MYDIR}/fail-if-exit-non-zero.pl
114FAIL_IF_SUCCESS = ${MYDIR}/fail-if-exit-zero.pl
115FAIL_IF_EMPTY = ${MYDIR}/fail-if-no-stdin.pl
116FAIL_IF_STDIN = ${MYDIR}/fail-if-stdin.pl
117PASS_IFF_GOOD_MACHO = ${PASS_IFF} ${MACHOCHECK}
118FAIL_IF_BAD_MACHO = ${FAIL_IF_ERROR} ${MACHOCHECK}
119FAIL_IF_BAD_OBJ = ${FAIL_IF_ERROR} ${OBJECTDUMP} >/dev/null