1 Product=$(shell tconf --product)
2 Embedded=$(shell tconf --test TARGET_OS_EMBEDDED)
4 ifeq "$(Embedded)" "YES"
7 XILogFLAG = -framework XILog
21 include $(MAKEFILEPATH)/CoreOS/ReleaseControl/Common.make
22 MY_ARCH = $(patsubst %, -arch %, $(RC_ARCHS))
23 install:: xnu_quick_test
26 SRCROOT=$(shell /bin/pwd)
29 OBJROOT=$(SRCROOT)/BUILD/obj
32 DSTROOT=$(SRCROOT)/BUILD/dst
36 ARCH=i386 x86_64 ppc ppc64
37 # this hack should be removed once tconf gets
38 # <rdar://problem/5667139>
39 ifeq "$(Product)" "iPhone"
42 ifeq "$(Product)" "AppleTV"
48 MY_ARCH = $(patsubst %, -arch %, $(ARCH)) # allows building multiple archs.
54 CFLAGS += -g -I /System/Library/Frameworks/System.framework/Versions/B/PrivateHeaders/ -F/AppleInternal/Library/Frameworks/ $(MORECFLAGS)
55 LIBFLAGS = -I /System/Library/Frameworks/System.framework/Versions/B/PrivateHeaders -F/AppleInternal/Library/Frameworks/ $(XILogFLAG)
57 #CFLAGS+= $(MY_ARCH) -g -D_POSIX_C_SOURCE=200112L
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
64 xnu_quick_test : $(OBJROOT) $(DSTROOT) $(MY_OBJECTS) helpers
65 sudo rm -rf $(DSTROOT)/xnu_quick_test
66 $(CC) $(MY_ARCH) $(LIBFLAGS) -o $(DSTROOT)/xnu_quick_test $(MY_OBJECTS)
67 sudo chown root $(DSTROOT)/xnu_quick_test
68 sudo chmod 4755 $(DSTROOT)/xnu_quick_test
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
75 ifneq "$(Product)" "iPhone"
76 $(CC) -arch i386 helpers/sleep.c -o $(DSTROOT)/helpers/sleep-i386
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
85 ifneq "$(Product)" "iPhone"
86 $(CC) $(LIBFLAGS) -arch i386 $(OBJROOT)/misc.o helpers/launch.c -o $(DSTROOT)/helpers/launch-i386
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
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
101 mkdir -p $(DSTROOT)/helpers
109 INCLUDES = /Developer/SDKs/Purple/System/Library/Frameworks/System.framework/Versions/B/PrivateHeaders/
111 $(OBJROOT)/main.o : main.c tests.h
112 $(CC) $(CFLAGS) -c main.c -o $@
114 $(OBJROOT)/memory_tests.o : memory_tests.c tests.h
115 $(CC) $(CFLAGS) -c memory_tests.c -o $@
117 # misc.o has to be built 4-way for the helpers to link
118 $(OBJROOT)/misc.o : misc.c tests.h
119 ifeq "$(Product)" "iPhone"
120 $(CC) -arch armv6 $(CFLAGS) -c misc.c -o $@
122 $(CC) -arch i386 -arch x86_64 -arch ppc -arch ppc64 $(CFLAGS) -c misc.c -o $@
125 $(OBJROOT)/sema_tests.o : sema_tests.c tests.h
126 $(CC) $(CFLAGS) -c sema_tests.c -o $@
128 $(OBJROOT)/shared_memory_tests.o : shared_memory_tests.c tests.h
129 $(CC) $(CFLAGS) -c shared_memory_tests.c -o $@
131 $(OBJROOT)/socket_tests.o : socket_tests.c tests.h
132 $(CC) $(CFLAGS) -c socket_tests.c -o $@
134 $(OBJROOT)/tests.o : tests.c tests.h
135 $(CC) $(CFLAGS) -c tests.c -o $@
137 $(OBJROOT)/xattr_tests.o : xattr_tests.c tests.h
138 $(CC) $(CFLAGS) -c xattr_tests.c -o $@
144 sudo rm -f $(DSTROOT)/xnu_quick_test
145 sudo rm -f $(DSTROOT)/helpers/*