]> git.saurik.com Git - apple/xnu.git/blob - tools/tests/Makefile
xnu-6153.141.1.tar.gz
[apple/xnu.git] / tools / tests / Makefile
1 include Makefile.common
2
3 ifndef SRCROOT
4 export SRCROOT := $(shell /bin/pwd)
5 endif
6 ifndef OBJROOT
7 export OBJROOT = $(SRCROOT)/BUILD/obj
8 endif
9 ifndef DSTROOT
10 export DSTROOT = $(SRCROOT)/BUILD/dst
11 endif
12 ifndef SYMROOT
13 export SYMROOT = $(SRCROOT)/BUILD/sym
14 endif
15
16 ifdef RC_ProjectName
17 DSTSUBPATH = $(DSTROOT)/AppleInternal/CoreOS/tests/xnu
18 BATS_CONFIG_PATH = $(DSTROOT)/AppleInternal/CoreOS
19 else
20 DSTSUBPATH = $(DSTROOT)
21 BATS_CONFIG_PATH = $(DSTROOT)
22 endif
23
24 COMMON_TARGETS = unit_tests \
25 MPMMTest \
26 packetdrill \
27 affinity \
28 superpages \
29 zero-to-n \
30 jitter \
31 perf_index \
32 personas \
33 unixconf \
34 testkext/pgokext.kext
35
36 IPHONE_TARGETS =
37
38 MAC_TARGETS =
39
40 BATS_TARGET = $(BATS_CONFIG_PATH)/BATS
41
42 ifeq "$(Embedded)" "YES"
43 TARGETS = $(addprefix $(DSTSUBPATH)/, $(COMMON_TARGETS) $(IPHONE_TARGETS))
44 else
45 TARGETS = $(addprefix $(DSTSUBPATH)/, $(COMMON_TARGETS) $(MAC_TARGETS))
46 endif
47
48 all: $(BATS_TARGET) $(TARGETS)
49
50 .PHONY: always
51
52 always:
53
54 # NOTE: RC_ARCHES nonsense is here because code signing will fail on kexts if we include a i386 slice
55 # <rdar://problem/29878263> CoreOSLobo: xnu_tests-4026 fails to codesign
56
57 $(DSTSUBPATH)/testkext/pgokext.kext: always
58 xcodebuild -configuration Debug -project $(SRCROOT)/testkext/testkext.xcodeproj -target pgokext DSTROOT=$(DSTSUBPATH)/testkext SYMROOT=$(SYMROOT)/testkext SRCROOT=$(SRCROOT)/testkext OBJROOT=$(OBJROOT)/testkext SDKROOT=$(SDKROOT) RC_ARCHS="$(subst i386,,$(RC_ARCHS))" install
59
60 $(DSTSUBPATH)/%: always
61 $(_v)echo Building $@
62 $(_v)mkdir -p $@
63 $(_v)mkdir -p $(OBJROOT)/$(notdir $@)
64 $(_v)mkdir -p $(SYMROOT)/$(notdir $@)
65 $(_v)$(MAKE) -C $(SRCROOT)/$(notdir $@) SRCROOT=$(SRCROOT)/$(notdir $@) DSTROOT=$@ OBJROOT=$(OBJROOT)/$(notdir $@) SYMROOT=$(SYMROOT)/$(notdir $@) SDKROOT=$(SDKROOT) BASEDSTROOT=$(DSTROOT)
66 $(_v)find $@ -type d -name "*.dSYM" -exec cp -a {} $(SYMROOT)/ ';'
67
68 $(BATS_TARGET): $(TARGETS)
69 $(_v)mkdir -p $@
70 $(_v)mkdir -p $(OBJROOT)/$(notdir $@)
71 $(_v)mkdir -p $(SYMROOT)
72 $(_v)$(MAKE) -C $(SRCROOT)/$(notdir $@) SRCROOT=$(SRCROOT)/$(notdir $@) DSTROOT=$@ OBJROOT=$(OBJROOT)/$(notdir $@) SDKROOT=$(SDKROOT) BASEDSTROOT=$(DSTROOT) BASEDSTSUBPATH=$(DSTSUBPATH)