]> git.saurik.com Git - apple/xnu.git/blame - tools/tests/execperf/Makefile
xnu-7195.50.7.100.1.tar.gz
[apple/xnu.git] / tools / tests / execperf / Makefile
CommitLineData
3e170ce0 1include ../Makefile.common
fe8ab488 2
fe8ab488
A
3CC = $(shell xcrun -sdk "$(SDKROOT)" -find cc)
4STRIP = $(shell xcrun -sdk "$(SDKROOT)" -find strip)
5CODESIGN = $(shell xcrun -sdk "$(SDKROOT)" -find codesign)
6export CODESIGN_ALLOCATE := $(shell xcrun -sdk "$(SDKROOT)" -find codesign_allocate)
7DSYMUTIL = $(shell xcrun -sdk "$(SDKROOT)" -find dsymutil)
f427ee49
A
8CFLAGS = -O0 -g -isysroot $(SDKROOT) $(ARCH_FLAGS)
9CFLAGS += -Wl,-sectcreate,__INFO_FILTER,__disable,/dev/null
fe8ab488 10LDFLAGS = -dead_strip \
f427ee49 11 -isysroot $(SDKROOT) $(ARCH_FLAGS)
fe8ab488
A
12
13OBJROOT?=$(shell /bin/pwd)/BUILD/obj
14SYMROOT?=$(shell /bin/pwd)/BUILD/sym
15DSTROOT?=$(shell /bin/pwd)/BUILD/dst
6d2010ae
A
16
17EXECUTABLES = exit.nodyld \
18 exit.nopie.dyld-but-no-Libsystem exit.pie.dyld-but-no-Libsystem \
19 exit.nopie.dyld-and-Libsystem exit.pie.dyld-and-Libsystem \
20 exit.nopie exit.pie \
fe8ab488
A
21 printexecinfo run test
22OBJECTS = exit-asm.o exit.o printexecinfo.o run.o
6d2010ae 23
fe8ab488 24default: $(addprefix $(DSTROOT)/,$(EXECUTABLES))
6d2010ae
A
25
26clean:
fe8ab488
A
27 rm -f $(addprefix $(OBJROOT)/,$(OBJECTS))
28 rm -f $(addprefix $(SYMROOT)/,$(EXECUTABLES))
29 rm -rf $(addsuffix .dSYM,$(addprefix $(SYMROOT)/,$(EXECUTABLES)))
30 rm -f $(addprefix $(DSTROOT)/,$(EXECUTABLES))
6d2010ae 31
fe8ab488 32# DEPENDENCIES
490019cf 33$(addprefix $(DSTROOT)/,$(EXECUTABLES)): | DSTROOT SYMROOT
6d2010ae 34
490019cf 35$(addprefix $(OBJROOT)/,$(OBJECTS)): | OBJROOT
fe8ab488
A
36
37DSTROOT SYMROOT OBJROOT:
490019cf 38 $(_v)mkdir -p $($@)
6d2010ae
A
39
40# OBJECTS
41
490019cf 42$(OBJROOT)/exit-asm.o: exit-asm.S | OBJROOT
6d2010ae
A
43 $(CC) -c -o $@ $< $(CFLAGS)
44
490019cf 45$(OBJROOT)/exit.o: exit.c | OBJROOT
6d2010ae
A
46 $(CC) -c -o $@ $< $(CFLAGS)
47
490019cf 48$(OBJROOT)/printexecinfo.o: printexecinfo.c | OBJROOT
fe8ab488
A
49 $(CC) -c -o $@ $< $(CFLAGS)
50
490019cf 51$(OBJROOT)/run.o: run.c | OBJROOT
6d2010ae
A
52 $(CC) -c -o $@ $< $(CFLAGS)
53
54# EXECUTABLES
55
fe8ab488
A
56$(DSTROOT)/exit.nodyld: $(OBJROOT)/exit-asm.o
57 $(CC) -o $@ $< $(LDFLAGS) -e _main -nostartfiles -nodefaultlibs -static -Wl,-segalign,0x4000
6d2010ae
A
58 $(CODESIGN) -s - $@
59
fe8ab488
A
60$(DSTROOT)/exit.nopie.dyld-but-no-Libsystem: $(OBJROOT)/exit-asm.o
61 $(CC) -o $@ $< $(LDFLAGS) -e _main -Wl,-no_pie -nostartfiles -nodefaultlibs -Wl,-no_new_main
6d2010ae
A
62 $(CODESIGN) -s - $@
63
fe8ab488
A
64$(DSTROOT)/exit.pie.dyld-but-no-Libsystem: $(OBJROOT)/exit-asm.o
65 $(CC) -o $@ $< $(LDFLAGS) -e _main -Wl,-pie -nostartfiles -nodefaultlibs -Wl,-no_new_main
6d2010ae
A
66 $(CODESIGN) -s - $@
67
fe8ab488
A
68$(DSTROOT)/exit.nopie.dyld-and-Libsystem: $(OBJROOT)/exit-asm.o
69 $(CC) -o $@ $< $(LDFLAGS) -Wl,-no_pie -nostartfiles -nodefaultlibs -lSystem
6d2010ae
A
70 $(CODESIGN) -s - $@
71
fe8ab488
A
72$(DSTROOT)/exit.pie.dyld-and-Libsystem: $(OBJROOT)/exit-asm.o
73 $(CC) -o $@ $< $(LDFLAGS) -Wl,-pie -nostartfiles -nodefaultlibs -lSystem
6d2010ae
A
74 $(CODESIGN) -s - $@
75
fe8ab488
A
76$(DSTROOT)/exit.nopie: $(OBJROOT)/exit.o
77 $(CC) -o $@ $< $(LDFLAGS) -Wl,-no_pie
6d2010ae
A
78 $(CODESIGN) -s - $@
79
fe8ab488
A
80$(DSTROOT)/exit.pie: $(OBJROOT)/exit.o
81 $(CC) -o $@ $< $(LDFLAGS) -Wl,-pie
6d2010ae
A
82 $(CODESIGN) -s - $@
83
fe8ab488 84$(DSTROOT)/printexecinfo: $(OBJROOT)/printexecinfo.o
6d2010ae
A
85 $(CC) -o $@ $< $(LDFLAGS)
86 $(CODESIGN) -s - $@
87
fe8ab488
A
88$(DSTROOT)/run: $(OBJROOT)/run.o
89 $(CC) -o $(SYMROOT)/run $< $(LDFLAGS)
90 $(DSYMUTIL) $(SYMROOT)/run
91 $(STRIP) -S -o $@ $(SYMROOT)/run
92 $(CODESIGN) -s - $@
6d2010ae 93
fe8ab488
A
94$(DSTROOT)/test: test.sh
95 install -m 755 $< $@