]> git.saurik.com Git - apple/xnu.git/blob - tools/tests/xnu_quick_test/makefile
xnu-1228.tar.gz
[apple/xnu.git] / tools / tests / xnu_quick_test / makefile
1 ifdef RC_BUILDIT
2 DOING_BUILDIT=yes
3 endif
4
5 ifdef RC_OS
6 DOING_BUILDIT=yes
7 endif
8
9 ifdef DOING_BUILDIT
10 include $(MAKEFILEPATH)/CoreOS/ReleaseControl/Common.make
11 MY_ARCH = $(patsubst %, -arch %, $(RC_ARCHS))
12 install:: xnu_quick_test
13 else
14 ifndef SRCROOT
15 SRCROOT=$(shell /bin/pwd)
16 endif
17 ifndef OBJROOT
18 OBJROOT=$(SRCROOT)/BUILD/obj
19 endif
20 ifndef DSTROOT
21 DSTROOT=$(SRCROOT)/BUILD/dst
22 endif
23
24 ifndef ARCH
25 ARCH=i386 x86_64 ppc ppc64
26 endif
27
28 ifdef ARCH
29 MY_ARCH = $(patsubst %, -arch %, $(ARCH)) # allows building multiple archs.
30 endif
31
32 CFLAGS += $(MY_ARCH)
33 endif
34
35 CFLAGS += -g -I /System/Library/Frameworks/System.framework/Versions/B/PrivateHeaders/ -F/AppleInternal/Library/Frameworks/ $(MORECFLAGS)
36 LIBFLAGS = -I /System/Library/Frameworks/System.framework/Versions/B/PrivateHeaders/ -F/AppleInternal/Library/Frameworks/ -framework XILog
37 #CFLAGS+= $(MY_ARCH) -g -D_POSIX_C_SOURCE=200112L
38
39 MY_OBJECTS = $(OBJROOT)/main.o $(OBJROOT)/memory_tests.o $(OBJROOT)/misc.o \
40 $(OBJROOT)/sema_tests.o $(OBJROOT)/shared_memory_tests.o \
41 $(OBJROOT)/socket_tests.o $(OBJROOT)/tests.o $(OBJROOT)/xattr_tests.o
42
43
44 xnu_quick_test : $(OBJROOT) $(DSTROOT) $(MY_OBJECTS) helpers
45 sudo rm -rf $(DSTROOT)/xnu_quick_test
46 cc $(MY_ARCH) $(LIBFLAGS) -o $(DSTROOT)/xnu_quick_test $(MY_OBJECTS)
47 sudo chown root $(DSTROOT)/xnu_quick_test
48 sudo chmod 4755 $(DSTROOT)/xnu_quick_test
49
50 # The helper binaries are used to test exec()'ing between 64bit and 32bit.
51 # Creates test binaries with page zero sizes = 4KB and 4GB. Also creates 32-bit
52 # helper processes for the 64-bit version of xnu_quick_test to test the conversion
53 # from a 32-bit process to a 64-bit process.
54 helpers : helpers/sleep.c helpers/launch.c helpers/arch.c helperdir $(OBJROOT)/misc.o
55 gcc -arch ppc helpers/sleep.c -o $(DSTROOT)/helpers/sleep-ppc32
56 gcc -arch i386 helpers/sleep.c -o $(DSTROOT)/helpers/sleep-i386
57 gcc -arch x86_64 -pagezero_size 0x100000000 helpers/sleep.c -o $(DSTROOT)/helpers/sleep-x86_64-4G
58 gcc -arch x86_64 -pagezero_size 0x1000 helpers/sleep.c -o $(DSTROOT)/helpers/sleep-x86_64-4K
59 gcc -arch ppc64 -pagezero_size 0x100000000 helpers/sleep.c -o $(DSTROOT)/helpers/sleep-ppc64-4G
60 gcc -arch ppc64 -pagezero_size 0x1000 helpers/sleep.c -o $(DSTROOT)/helpers/sleep-ppc64-4K
61 gcc $(LIBFLAGS) -arch i386 $(OBJROOT)/misc.o helpers/launch.c -o $(DSTROOT)/helpers/launch-i386
62 gcc $(LIBFLAGS) -arch x86_64 $(OBJROOT)/misc.o helpers/launch.c -o $(DSTROOT)/helpers/launch-x86_64
63 gcc $(LIBFLAGS) -arch ppc $(OBJROOT)/misc.o helpers/launch.c -o $(DSTROOT)/helpers/launch-ppc
64 gcc $(LIBFLAGS) -arch ppc64 $(OBJROOT)/misc.o helpers/launch.c -o $(DSTROOT)/helpers/launch-ppc64
65 gcc -arch ppc -arch ppc64 -arch i386 -arch x86_64 helpers/arch.c -o $(DSTROOT)/helpers/arch
66
67 helperdir :
68 mkdir -p $(DSTROOT)/helpers
69
70 $(OBJROOT) :
71 mkdir -p $(OBJROOT);
72
73 $(DSTROOT) :
74 mkdir -p $(DSTROOT);
75
76 INCLUDES = /Developer/SDKs/Purple/System/Library/Frameworks/System.framework/Versions/B/PrivateHeaders/
77
78
79 $(OBJROOT)/main.o : main.c tests.h
80 cc $(CFLAGS) -c main.c -o $@
81
82 $(OBJROOT)/memory_tests.o : memory_tests.c tests.h
83 cc $(CFLAGS) -c memory_tests.c -o $@
84
85 # misc.o has to be built 4-way for the helpers to link
86 $(OBJROOT)/misc.o : misc.c tests.h
87 cc -arch i386 -arch x86_64 -arch ppc -arch ppc64 $(CFLAGS) -c misc.c -o $@
88
89 $(OBJROOT)/sema_tests.o : sema_tests.c tests.h
90 cc $(CFLAGS) -c sema_tests.c -o $@
91
92 $(OBJROOT)/shared_memory_tests.o : shared_memory_tests.c tests.h
93 cc $(CFLAGS) -c shared_memory_tests.c -o $@
94
95 $(OBJROOT)/socket_tests.o : socket_tests.c tests.h
96 cc $(CFLAGS) -c socket_tests.c -o $@
97
98 $(OBJROOT)/tests.o : tests.c tests.h
99 cc $(CFLAGS) -c tests.c -o $@
100
101 $(OBJROOT)/xattr_tests.o : xattr_tests.c tests.h
102 cc $(CFLAGS) -c xattr_tests.c -o $@
103
104
105 ifndef DOING_BUILDIT
106 .PHONY : clean
107 clean :
108 sudo rm -f $(DSTROOT)/xnu_quick_test
109 sudo rm -f $(DSTROOT)/helpers/*
110 rm -f $(OBJROOT)/*.o
111 endif
112