]> git.saurik.com Git - apple/xnu.git/blob - tools/tests/Makefile
xnu-7195.50.7.100.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 DSTSUBPATH_KEXTS = $(DSTROOT)/System/AppleInternal/Library/AuxiliaryExtensions
25
26 COMMON_TARGETS = unit_tests \
27 MPMMTest \
28 packetdrill \
29 affinity \
30 superpages \
31 zero-to-n \
32 jitter \
33 perf_index \
34 personas \
35 unixconf \
36
37 KEXT_TARGETS = pgokext.kext
38
39 IPHONE_TARGETS =
40
41 MAC_TARGETS =
42
43 BATS_TARGET = $(BATS_CONFIG_PATH)/BATS
44
45 ifeq "$(Embedded)" "YES"
46 TARGETS = $(addprefix $(DSTSUBPATH)/, $(COMMON_TARGETS) $(IPHONE_TARGETS)) $(addprefix $(DSTSUBPATH_KEXTS)/, $(KEXT_TARGETS))
47 else
48 TARGETS = $(addprefix $(DSTSUBPATH)/, $(COMMON_TARGETS) $(MAC_TARGETS)) $(addprefix $(DSTSUBPATH_KEXTS)/, $(KEXT_TARGETS))
49 endif
50
51 all: $(BATS_TARGET) $(TARGETS)
52
53 .PHONY: always
54
55 always:
56
57 # NOTE: RC_ARCHES nonsense is here because code signing will fail on kexts if we include a i386 slice
58 # <rdar://problem/29878263> CoreOSLobo: xnu_tests-4026 fails to codesign
59
60 $(DSTSUBPATH_KEXTS)/pgokext.kext: always
61 xcodebuild -configuration Debug -project $(SRCROOT)/testkext/testkext.xcodeproj -target pgokext DSTROOT=$(DSTSUBPATH_KEXTS) SYMROOT=$(SYMROOT)/testkext SRCROOT=$(SRCROOT)/testkext OBJROOT=$(OBJROOT)/testkext SDKROOT=$(SDKROOT) RC_ARCHS="$(subst i386,,$(RC_ARCHS))" install
62
63 $(DSTSUBPATH)/%: always
64 $(_v)echo Building $@
65 $(_v)mkdir -p $@
66 $(_v)mkdir -p $(OBJROOT)/$(notdir $@)
67 $(_v)mkdir -p $(SYMROOT)/$(notdir $@)
68 $(_v)$(MAKE) -C $(SRCROOT)/$(notdir $@) SRCROOT=$(SRCROOT)/$(notdir $@) DSTROOT=$@ OBJROOT=$(OBJROOT)/$(notdir $@) SYMROOT=$(SYMROOT)/$(notdir $@) SDKROOT=$(SDKROOT) BASEDSTROOT=$(DSTROOT)
69 $(_v)find $@ -type d -name "*.dSYM" -exec cp -a {} $(SYMROOT)/ ';'
70
71 $(BATS_TARGET): $(TARGETS)
72 $(_v)mkdir -p $@
73 $(_v)mkdir -p $(OBJROOT)/$(notdir $@)
74 $(_v)mkdir -p $(SYMROOT)
75 $(_v)$(MAKE) -C $(SRCROOT)/$(notdir $@) SRCROOT=$(SRCROOT)/$(notdir $@) DSTROOT=$@ OBJROOT=$(OBJROOT)/$(notdir $@) SDKROOT=$(SDKROOT) BASEDSTROOT=$(DSTROOT) BASEDSTSUBPATH=$(DSTSUBPATH)