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
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 \
15 OBJECTS = exit-asm.o exit.o printexecinfo.o
17 default: $(EXECUTABLES) run
20 rm -f run $(EXECUTABLES)
21 rm -f run.o $(OBJECTS)
24 $(CC) -c -o $@ $< $(CFLAGS)
27 $(CC) -o $@ $< $(LDFLAGS)
32 exit-asm.o: exit-asm.S
33 $(CC) -c -o $@ $< $(CFLAGS)
36 $(CC) -c -o $@ $< $(CFLAGS)
38 printexecinfo.o: printexecinfo.c
39 $(CC) -c -o $@ $< $(CFLAGS)
43 exit.nodyld: exit-asm.o
44 $(CC) -o $@ $< $(LDFLAGS) -e mystart -nostartfiles -nodefaultlibs -static
48 exit.nopie.dyld-but-no-Libsystem: exit-asm.o
49 $(CC) -o $@ $< $(LDFLAGS) -e mystart $(NOPIE_OPTION) -nostartfiles -nodefaultlibs
52 exit.pie.dyld-but-no-Libsystem: exit-asm.o
53 $(CC) -o $@ $< $(LDFLAGS) -e mystart -Wl,-pie -nostartfiles -nodefaultlibs
56 exit.nopie.dyld-and-Libsystem: exit-asm.o
57 $(CC) -o $@ $< $(LDFLAGS) -e mystart $(NOPIE_OPTION) -nostartfiles -nodefaultlibs -lSystem
60 exit.pie.dyld-and-Libsystem: exit-asm.o
61 $(CC) -o $@ $< $(LDFLAGS) -e mystart -Wl,-pie -nostartfiles -nodefaultlibs -lSystem
65 $(CC) -o $@ $< $(LDFLAGS) -e mystart $(NOPIE_OPTION)
69 $(CC) -o $@ $< $(LDFLAGS) -e mystart -Wl,-pie
72 printexecinfo: printexecinfo.o
73 $(CC) -o $@ $< $(LDFLAGS)
78 quick-test: $(EXECUTABLES) run