]> git.saurik.com Git - apple/xnu.git/blob - tools/tests/execperf/Makefile
xnu-1699.22.73.tar.gz
[apple/xnu.git] / tools / tests / execperf / Makefile
1 SDKROOT ?= /
2 ARCHS = x86_64
3 CC = xcrun -sdk $(SDKROOT) cc
4 CODESIGN = xcrun -sdk $(SDKROOT) codesign
5 CFLAGS = -O0 -g -isysroot $(SDKROOT) $(patsubst %, -arch %,$(ARCHS))
6 LDFLAGS = -Wl,-new_linker -dead_strip \
7 -isysroot $(SDKROOT) $(patsubst %, -arch %,$(ARCHS))
8 NOPIE_OPTION = -Wl,-no_pie
9
10 EXECUTABLES = exit.nodyld \
11 exit.nopie.dyld-but-no-Libsystem exit.pie.dyld-but-no-Libsystem \
12 exit.nopie.dyld-and-Libsystem exit.pie.dyld-and-Libsystem \
13 exit.nopie exit.pie \
14 printexecinfo
15 OBJECTS = exit-asm.o exit.o printexecinfo.o
16
17 default: $(EXECUTABLES) run
18
19 clean:
20 rm -f run $(EXECUTABLES)
21 rm -f run.o $(OBJECTS)
22
23 run.o: run.c
24 $(CC) -c -o $@ $< $(CFLAGS)
25
26 run: run.o
27 $(CC) -o $@ $< $(LDFLAGS)
28 $(CODESIGN) -s - $@
29
30 # OBJECTS
31
32 exit-asm.o: exit-asm.S
33 $(CC) -c -o $@ $< $(CFLAGS)
34
35 exit.o: exit.c
36 $(CC) -c -o $@ $< $(CFLAGS)
37
38 printexecinfo.o: printexecinfo.c
39 $(CC) -c -o $@ $< $(CFLAGS)
40
41 # EXECUTABLES
42
43 exit.nodyld: exit-asm.o
44 $(CC) -o $@ $< $(LDFLAGS) -e mystart -nostartfiles -nodefaultlibs -static
45 $(CODESIGN) -s - $@
46
47
48 exit.nopie.dyld-but-no-Libsystem: exit-asm.o
49 $(CC) -o $@ $< $(LDFLAGS) -e mystart $(NOPIE_OPTION) -nostartfiles -nodefaultlibs
50 $(CODESIGN) -s - $@
51
52 exit.pie.dyld-but-no-Libsystem: exit-asm.o
53 $(CC) -o $@ $< $(LDFLAGS) -e mystart -Wl,-pie -nostartfiles -nodefaultlibs
54 $(CODESIGN) -s - $@
55
56 exit.nopie.dyld-and-Libsystem: exit-asm.o
57 $(CC) -o $@ $< $(LDFLAGS) -e mystart $(NOPIE_OPTION) -nostartfiles -nodefaultlibs -lSystem
58 $(CODESIGN) -s - $@
59
60 exit.pie.dyld-and-Libsystem: exit-asm.o
61 $(CC) -o $@ $< $(LDFLAGS) -e mystart -Wl,-pie -nostartfiles -nodefaultlibs -lSystem
62 $(CODESIGN) -s - $@
63
64 exit.nopie: exit.o
65 $(CC) -o $@ $< $(LDFLAGS) -e mystart $(NOPIE_OPTION)
66 $(CODESIGN) -s - $@
67
68 exit.pie: exit.o
69 $(CC) -o $@ $< $(LDFLAGS) -e mystart -Wl,-pie
70 $(CODESIGN) -s - $@
71
72 printexecinfo: printexecinfo.o
73 $(CC) -o $@ $< $(LDFLAGS)
74 $(CODESIGN) -s - $@
75
76 # ACTIONS
77
78 quick-test: $(EXECUTABLES) run
79 ./test.sh