]> git.saurik.com Git - apple/ld64.git/blame - unit-tests/include/common.makefile
ld64-97.17.tar.gz
[apple/ld64.git] / unit-tests / include / common.makefile
CommitLineData
d696c285
A
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
2f2f92e4 9VALID_ARCHS ?= "ppc ppc64 i386 x86_64 armv6"
a61fdf0a
A
10
11MYDIR=$(shell cd ../../bin;pwd)
55e3d2f6
A
12LD = ld
13OBJECTDUMP = ObjectDump
14MACHOCHECK = machocheck
15OTOOL = otool
16REBASE = rebase
d696c285 17
d696c285 18ifdef 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 26else
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 41endif
a61fdf0a
A
42export PATH
43export COMPILER_PATH
d696c285 44
d696c285 45
55e3d2f6 46CC = gcc-4.2 -arch ${ARCH} ${SDKExtra}
69a49097 47CCFLAGS = -Wall -std=c99
d696c285
A
48ASMFLAGS =
49
55e3d2f6 50CXX = g++-4.2 -arch ${ARCH} ${SDKExtra}
69a49097 51CXXFLAGS = -Wall
d696c285 52
2f2f92e4 53ifeq ($(ARCH),armv6)
55e3d2f6
A
54 SDKExtra = -isysroot /Developer/SDKs/Extra
55 LDFLAGS := -syslibroot /Developer/SDKs/Extra
56 override FILEARCH = arm
57else
58 FILEARCH = $(ARCH)
59endif
60
61ifeq ($(ARCH),armv7)
62 SDKExtra = -isysroot /Developer/SDKs/Extra
63 LDFLAGS := -syslibroot /Developer/SDKs/Extra
2f2f92e4
A
64 override FILEARCH = arm
65else
66 FILEARCH = $(ARCH)
67endif
68
69ifeq ($(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
76else
77 FILEARCH = $(ARCH)
78endif
79
55e3d2f6
A
80ifeq ($(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}
88else
89 FILEARCH = $(ARCH)
90endif
91
d696c285
A
92RM = rm
93RMFLAGS = -rf
94
95# utilites for Makefiles
55e3d2f6 96PASS_IFF = ${MYDIR}/pass-iff-exit-zero.pl
a61fdf0a 97PASS_IFF_SUCCESS = ${PASS_IFF}
55e3d2f6
A
98PASS_IFF_EMPTY = ${MYDIR}/pass-iff-no-stdin.pl
99PASS_IFF_STDIN = ${MYDIR}/pass-iff-stdin.pl
100FAIL_IFF = ${MYDIR}/fail-iff-exit-zero.pl
a61fdf0a 101FAIL_IFF_SUCCESS = ${FAIL_IFF}
55e3d2f6
A
102PASS_IFF_ERROR = ${MYDIR}/pass-iff-exit-non-zero.pl
103FAIL_IF_ERROR = ${MYDIR}/fail-if-exit-non-zero.pl
104FAIL_IF_SUCCESS = ${MYDIR}/fail-if-exit-zero.pl
105FAIL_IF_EMPTY = ${MYDIR}/fail-if-no-stdin.pl
106FAIL_IF_STDIN = ${MYDIR}/fail-if-stdin.pl
a61fdf0a
A
107PASS_IFF_GOOD_MACHO = ${PASS_IFF} ${MACHOCHECK}
108FAIL_IF_BAD_MACHO = ${FAIL_IF_ERROR} ${MACHOCHECK}
109FAIL_IF_BAD_OBJ = ${FAIL_IF_ERROR} ${OBJECTDUMP} >/dev/null