]>
Commit | Line | Data |
---|---|---|
cf7d32b8 A |
1 | Product=$(shell tconf --product) |
2 | Embedded=$(shell tconf --test TARGET_OS_EMBEDDED) | |
3 | ||
4 | ifeq "$(Embedded)" "YES" | |
5 | XILogFLAG = | |
6 | else | |
7 | XILogFLAG = -framework XILog | |
8 | endif | |
9 | ||
10 | CC=gcc $(SYSROOT) | |
11 | ||
2d21ac55 A |
12 | ifdef RC_BUILDIT |
13 | DOING_BUILDIT=yes | |
14 | endif | |
15 | ||
16 | ifdef RC_OS | |
17 | DOING_BUILDIT=yes | |
18 | endif | |
19 | ||
20 | ifdef DOING_BUILDIT | |
21 | include $(MAKEFILEPATH)/CoreOS/ReleaseControl/Common.make | |
22 | MY_ARCH = $(patsubst %, -arch %, $(RC_ARCHS)) | |
23 | install:: xnu_quick_test | |
24 | else | |
25 | ifndef SRCROOT | |
26 | SRCROOT=$(shell /bin/pwd) | |
27 | endif | |
28 | ifndef OBJROOT | |
29 | OBJROOT=$(SRCROOT)/BUILD/obj | |
30 | endif | |
31 | ifndef DSTROOT | |
32 | DSTROOT=$(SRCROOT)/BUILD/dst | |
33 | endif | |
34 | ||
35 | ifndef ARCH | |
36 | ARCH=i386 x86_64 ppc ppc64 | |
cf7d32b8 A |
37 | # this hack should be removed once tconf gets |
38 | # <rdar://problem/5667139> | |
39 | ifeq "$(Product)" "iPhone" | |
40 | ARCH=armv6 | |
41 | endif | |
42 | ifeq "$(Product)" "AppleTV" | |
43 | ARCH=i386 | |
44 | endif | |
2d21ac55 A |
45 | endif |
46 | ||
47 | ifdef ARCH | |
48 | MY_ARCH = $(patsubst %, -arch %, $(ARCH)) # allows building multiple archs. | |
49 | endif | |
50 | ||
51 | CFLAGS += $(MY_ARCH) | |
52 | endif | |
53 | ||
54 | CFLAGS += -g -I /System/Library/Frameworks/System.framework/Versions/B/PrivateHeaders/ -F/AppleInternal/Library/Frameworks/ $(MORECFLAGS) | |
cf7d32b8 A |
55 | LIBFLAGS = -I /System/Library/Frameworks/System.framework/Versions/B/PrivateHeaders -F/AppleInternal/Library/Frameworks/ $(XILogFLAG) |
56 | ||
2d21ac55 A |
57 | #CFLAGS+= $(MY_ARCH) -g -D_POSIX_C_SOURCE=200112L |
58 | ||
59 | MY_OBJECTS = $(OBJROOT)/main.o $(OBJROOT)/memory_tests.o $(OBJROOT)/misc.o \ | |
60 | $(OBJROOT)/sema_tests.o $(OBJROOT)/shared_memory_tests.o \ | |
61 | $(OBJROOT)/socket_tests.o $(OBJROOT)/tests.o $(OBJROOT)/xattr_tests.o | |
62 | ||
63 | ||
64 | xnu_quick_test : $(OBJROOT) $(DSTROOT) $(MY_OBJECTS) helpers | |
65 | sudo rm -rf $(DSTROOT)/xnu_quick_test | |
cf7d32b8 | 66 | $(CC) $(MY_ARCH) $(LIBFLAGS) -o $(DSTROOT)/xnu_quick_test $(MY_OBJECTS) |
2d21ac55 A |
67 | sudo chown root $(DSTROOT)/xnu_quick_test |
68 | sudo chmod 4755 $(DSTROOT)/xnu_quick_test | |
69 | ||
70 | # The helper binaries are used to test exec()'ing between 64bit and 32bit. | |
71 | # Creates test binaries with page zero sizes = 4KB and 4GB. Also creates 32-bit | |
72 | # helper processes for the 64-bit version of xnu_quick_test to test the conversion | |
73 | # from a 32-bit process to a 64-bit process. | |
74 | helpers : helpers/sleep.c helpers/launch.c helpers/arch.c helperdir $(OBJROOT)/misc.o | |
cf7d32b8 A |
75 | ifneq "$(Product)" "iPhone" |
76 | $(CC) -arch i386 helpers/sleep.c -o $(DSTROOT)/helpers/sleep-i386 | |
77 | endif | |
78 | ifeq "$(Product)" "MacOSX" | |
79 | $(CC) -arch x86_64 -pagezero_size 0x100000000 helpers/sleep.c -o $(DSTROOT)/helpers/sleep-x86_64-4G | |
80 | $(CC) -arch x86_64 -pagezero_size 0x1000 helpers/sleep.c -o $(DSTROOT)/helpers/sleep-x86_64-4K | |
81 | $(CC) -arch ppc helpers/sleep.c -o $(DSTROOT)/helpers/sleep-ppc32 | |
82 | $(CC) -arch ppc64 -pagezero_size 0x100000000 helpers/sleep.c -o $(DSTROOT)/helpers/sleep-ppc64-4G | |
83 | $(CC) -arch ppc64 -pagezero_size 0x1000 helpers/sleep.c -o $(DSTROOT)/helpers/sleep-ppc64-4K | |
84 | endif | |
85 | ifneq "$(Product)" "iPhone" | |
86 | $(CC) $(LIBFLAGS) -arch i386 $(OBJROOT)/misc.o helpers/launch.c -o $(DSTROOT)/helpers/launch-i386 | |
87 | endif | |
88 | ifeq "$(Product)" "MacOS" | |
89 | $(CC) $(LIBFLAGS) -arch x86_64 $(OBJROOT)/misc.o helpers/launch.c -o $(DSTROOT)/helpers/launch-x86_64 | |
90 | $(CC) $(LIBFLAGS) -arch ppc $(OBJROOT)/misc.o helpers/launch.c -o $(DSTROOT)/helpers/launch-ppc | |
91 | $(CC) $(LIBFLAGS) -arch ppc64 $(OBJROOT)/misc.o helpers/launch.c -o $(DSTROOT)/helpers/launch-ppc64 | |
92 | $(CC) $(MY_ARCH) helpers/arch.c -o $(DSTROOT)/helpers/arch | |
93 | endif | |
94 | ifeq "$(Product)" "iPhone" | |
95 | $(CC) -arch armv6 helpers/sleep.c -o $(DSTROOT)/helpers/sleep-arm | |
96 | $(CC) $(LIBFLAGS) -arch armv6 $(OBJROOT)/misc.o helpers/launch.c -o $(DSTROOT)/helpers/launch-arm | |
97 | endif | |
98 | ||
2d21ac55 A |
99 | |
100 | helperdir : | |
101 | mkdir -p $(DSTROOT)/helpers | |
102 | ||
103 | $(OBJROOT) : | |
104 | mkdir -p $(OBJROOT); | |
105 | ||
106 | $(DSTROOT) : | |
107 | mkdir -p $(DSTROOT); | |
108 | ||
109 | INCLUDES = /Developer/SDKs/Purple/System/Library/Frameworks/System.framework/Versions/B/PrivateHeaders/ | |
2d21ac55 A |
110 | |
111 | $(OBJROOT)/main.o : main.c tests.h | |
cf7d32b8 | 112 | $(CC) $(CFLAGS) -c main.c -o $@ |
2d21ac55 A |
113 | |
114 | $(OBJROOT)/memory_tests.o : memory_tests.c tests.h | |
cf7d32b8 | 115 | $(CC) $(CFLAGS) -c memory_tests.c -o $@ |
2d21ac55 A |
116 | |
117 | # misc.o has to be built 4-way for the helpers to link | |
118 | $(OBJROOT)/misc.o : misc.c tests.h | |
cf7d32b8 A |
119 | ifeq "$(Product)" "iPhone" |
120 | $(CC) -arch armv6 $(CFLAGS) -c misc.c -o $@ | |
121 | else | |
122 | $(CC) -arch i386 -arch x86_64 -arch ppc -arch ppc64 $(CFLAGS) -c misc.c -o $@ | |
123 | endif | |
2d21ac55 A |
124 | |
125 | $(OBJROOT)/sema_tests.o : sema_tests.c tests.h | |
cf7d32b8 | 126 | $(CC) $(CFLAGS) -c sema_tests.c -o $@ |
2d21ac55 A |
127 | |
128 | $(OBJROOT)/shared_memory_tests.o : shared_memory_tests.c tests.h | |
cf7d32b8 | 129 | $(CC) $(CFLAGS) -c shared_memory_tests.c -o $@ |
2d21ac55 A |
130 | |
131 | $(OBJROOT)/socket_tests.o : socket_tests.c tests.h | |
cf7d32b8 | 132 | $(CC) $(CFLAGS) -c socket_tests.c -o $@ |
2d21ac55 A |
133 | |
134 | $(OBJROOT)/tests.o : tests.c tests.h | |
cf7d32b8 | 135 | $(CC) $(CFLAGS) -c tests.c -o $@ |
2d21ac55 A |
136 | |
137 | $(OBJROOT)/xattr_tests.o : xattr_tests.c tests.h | |
cf7d32b8 | 138 | $(CC) $(CFLAGS) -c xattr_tests.c -o $@ |
2d21ac55 A |
139 | |
140 | ||
141 | ifndef DOING_BUILDIT | |
142 | .PHONY : clean | |
143 | clean : | |
144 | sudo rm -f $(DSTROOT)/xnu_quick_test | |
145 | sudo rm -f $(DSTROOT)/helpers/* | |
146 | rm -f $(OBJROOT)/*.o | |
147 | endif |