10f3703acSApple OSS Distributionsinclude ../Makefile.common 2a3bb9fccSApple OSS Distributions 3*bb611c8fSApple OSS DistributionsCFLAGS = -O0 -g -isysroot $(SDKROOT) $(ARCH_FLAGS) 4a3bb9fccSApple OSS DistributionsLDFLAGS = -dead_strip \ 5*bb611c8fSApple OSS Distributions -isysroot $(SDKROOT) $(ARCH_FLAGS) 6a3bb9fccSApple OSS Distributions 7a3bb9fccSApple OSS DistributionsOBJROOT?=$(shell /bin/pwd)/BUILD/obj 8a3bb9fccSApple OSS DistributionsSYMROOT?=$(shell /bin/pwd)/BUILD/sym 9a3bb9fccSApple OSS DistributionsDSTROOT?=$(shell /bin/pwd)/BUILD/dst 10855239e5SApple OSS Distributions 11855239e5SApple OSS DistributionsEXECUTABLES = exit.nodyld \ 12855239e5SApple OSS Distributions exit.nopie.dyld-but-no-Libsystem exit.pie.dyld-but-no-Libsystem \ 13855239e5SApple OSS Distributions exit.nopie.dyld-and-Libsystem exit.pie.dyld-and-Libsystem \ 14855239e5SApple OSS Distributions exit.nopie exit.pie \ 15a3bb9fccSApple OSS Distributions printexecinfo run test 16a3bb9fccSApple OSS DistributionsOBJECTS = exit-asm.o exit.o printexecinfo.o run.o 17855239e5SApple OSS Distributions 18a3bb9fccSApple OSS Distributionsdefault: $(addprefix $(DSTROOT)/,$(EXECUTABLES)) 19855239e5SApple OSS Distributions 20855239e5SApple OSS Distributionsclean: 21a3bb9fccSApple OSS Distributions rm -f $(addprefix $(OBJROOT)/,$(OBJECTS)) 22a3bb9fccSApple OSS Distributions rm -f $(addprefix $(SYMROOT)/,$(EXECUTABLES)) 23a3bb9fccSApple OSS Distributions rm -rf $(addsuffix .dSYM,$(addprefix $(SYMROOT)/,$(EXECUTABLES))) 24a3bb9fccSApple OSS Distributions rm -f $(addprefix $(DSTROOT)/,$(EXECUTABLES)) 25855239e5SApple OSS Distributions 26a3bb9fccSApple OSS Distributions# DEPENDENCIES 2788cc0b97SApple OSS Distributions$(addprefix $(DSTROOT)/,$(EXECUTABLES)): | DSTROOT SYMROOT 28855239e5SApple OSS Distributions 2988cc0b97SApple OSS Distributions$(addprefix $(OBJROOT)/,$(OBJECTS)): | OBJROOT 30a3bb9fccSApple OSS Distributions 31a3bb9fccSApple OSS DistributionsDSTROOT SYMROOT OBJROOT: 3288cc0b97SApple OSS Distributions $(_v)mkdir -p $($@) 33855239e5SApple OSS Distributions 34855239e5SApple OSS Distributions# OBJECTS 35855239e5SApple OSS Distributions 3688cc0b97SApple OSS Distributions$(OBJROOT)/exit-asm.o: exit-asm.S | OBJROOT 37855239e5SApple OSS Distributions $(CC) -c -o $@ $< $(CFLAGS) 38855239e5SApple OSS Distributions 3988cc0b97SApple OSS Distributions$(OBJROOT)/exit.o: exit.c | OBJROOT 40855239e5SApple OSS Distributions $(CC) -c -o $@ $< $(CFLAGS) 41855239e5SApple OSS Distributions 4288cc0b97SApple OSS Distributions$(OBJROOT)/printexecinfo.o: printexecinfo.c | OBJROOT 43a3bb9fccSApple OSS Distributions $(CC) -c -o $@ $< $(CFLAGS) 44a3bb9fccSApple OSS Distributions 4588cc0b97SApple OSS Distributions$(OBJROOT)/run.o: run.c | OBJROOT 46855239e5SApple OSS Distributions $(CC) -c -o $@ $< $(CFLAGS) 47855239e5SApple OSS Distributions 48855239e5SApple OSS Distributions# EXECUTABLES 49855239e5SApple OSS Distributions 50a3bb9fccSApple OSS Distributions$(DSTROOT)/exit.nodyld: $(OBJROOT)/exit-asm.o 51a3bb9fccSApple OSS Distributions $(CC) -o $@ $< $(LDFLAGS) -e _main -nostartfiles -nodefaultlibs -static -Wl,-segalign,0x4000 52855239e5SApple OSS Distributions $(CODESIGN) -s - $@ 53855239e5SApple OSS Distributions 54a3bb9fccSApple OSS Distributions$(DSTROOT)/exit.nopie.dyld-but-no-Libsystem: $(OBJROOT)/exit-asm.o 55a3bb9fccSApple OSS Distributions $(CC) -o $@ $< $(LDFLAGS) -e _main -Wl,-no_pie -nostartfiles -nodefaultlibs -Wl,-no_new_main 56855239e5SApple OSS Distributions $(CODESIGN) -s - $@ 57855239e5SApple OSS Distributions 58a3bb9fccSApple OSS Distributions$(DSTROOT)/exit.pie.dyld-but-no-Libsystem: $(OBJROOT)/exit-asm.o 59a3bb9fccSApple OSS Distributions $(CC) -o $@ $< $(LDFLAGS) -e _main -Wl,-pie -nostartfiles -nodefaultlibs -Wl,-no_new_main 60855239e5SApple OSS Distributions $(CODESIGN) -s - $@ 61855239e5SApple OSS Distributions 62a3bb9fccSApple OSS Distributions$(DSTROOT)/exit.nopie.dyld-and-Libsystem: $(OBJROOT)/exit-asm.o 63a3bb9fccSApple OSS Distributions $(CC) -o $@ $< $(LDFLAGS) -Wl,-no_pie -nostartfiles -nodefaultlibs -lSystem 64855239e5SApple OSS Distributions $(CODESIGN) -s - $@ 65855239e5SApple OSS Distributions 66a3bb9fccSApple OSS Distributions$(DSTROOT)/exit.pie.dyld-and-Libsystem: $(OBJROOT)/exit-asm.o 67a3bb9fccSApple OSS Distributions $(CC) -o $@ $< $(LDFLAGS) -Wl,-pie -nostartfiles -nodefaultlibs -lSystem 68855239e5SApple OSS Distributions $(CODESIGN) -s - $@ 69855239e5SApple OSS Distributions 70a3bb9fccSApple OSS Distributions$(DSTROOT)/exit.nopie: $(OBJROOT)/exit.o 71a3bb9fccSApple OSS Distributions $(CC) -o $@ $< $(LDFLAGS) -Wl,-no_pie 72855239e5SApple OSS Distributions $(CODESIGN) -s - $@ 73855239e5SApple OSS Distributions 74a3bb9fccSApple OSS Distributions$(DSTROOT)/exit.pie: $(OBJROOT)/exit.o 75a3bb9fccSApple OSS Distributions $(CC) -o $@ $< $(LDFLAGS) -Wl,-pie 76855239e5SApple OSS Distributions $(CODESIGN) -s - $@ 77855239e5SApple OSS Distributions 78a3bb9fccSApple OSS Distributions$(DSTROOT)/printexecinfo: $(OBJROOT)/printexecinfo.o 79855239e5SApple OSS Distributions $(CC) -o $@ $< $(LDFLAGS) 80855239e5SApple OSS Distributions $(CODESIGN) -s - $@ 81855239e5SApple OSS Distributions 82a3bb9fccSApple OSS Distributions$(DSTROOT)/run: $(OBJROOT)/run.o 83a3bb9fccSApple OSS Distributions $(CC) -o $(SYMROOT)/run $< $(LDFLAGS) 84a3bb9fccSApple OSS Distributions $(DSYMUTIL) $(SYMROOT)/run 85a3bb9fccSApple OSS Distributions $(STRIP) -S -o $@ $(SYMROOT)/run 86a3bb9fccSApple OSS Distributions $(CODESIGN) -s - $@ 87855239e5SApple OSS Distributions 88a3bb9fccSApple OSS Distributions$(DSTROOT)/test: test.sh 89a3bb9fccSApple OSS Distributions install -m 755 $< $@ 90