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