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