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