]> git.saurik.com Git - apple/ld64.git/blame_incremental - unit-tests/include/common.makefile
ld64-85.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 ?= "ppc ppc64 i386 x86_64 armv6"
10
11MYDIR=$(shell cd ../../bin;pwd)
12
13# if run within Xcode, add the just built tools to the command path
14ifdef BUILT_PRODUCTS_DIR
15 PATH := ${BUILT_PRODUCTS_DIR}:${MYDIR}:${PATH}
16 COMPILER_PATH := ${BUILT_PRODUCTS_DIR}:${MYDIR}:${COMPILER_PATH}
17else
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
26endif
27export PATH
28export COMPILER_PATH
29
30LD = ld
31OBJECTDUMP = ObjectDump
32MACHOCHECK = machocheck
33OTOOL = otool
34
35CC = gcc-4.0 -arch ${ARCH}
36CCFLAGS = -Wall -std=c99
37ASMFLAGS =
38
39CXX = g++-4.0 -arch ${ARCH}
40CXXFLAGS = -Wall
41
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
59RM = rm
60RMFLAGS = -rf
61
62# utilites for Makefiles
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