-ifdef RC_ProjectName
-DSTSUBPATH = $(DSTROOT)/AppleInternal/CoreOS
-else
-DSTSUBPATH = $(DSTROOT)
-endif
+include Makefile.common
-OBJROOT?=$(shell /bin/pwd)
+ifndef SRCROOT
+export SRCROOT := $(shell /bin/pwd)
+endif
+ifndef OBJROOT
+export OBJROOT = $(SRCROOT)/BUILD/obj
+endif
+ifndef DSTROOT
+export DSTROOT = $(SRCROOT)/BUILD/dst
+endif
+ifndef SYMROOT
+export SYMROOT = $(SRCROOT)/BUILD/sym
+endif
-ifeq "$(RC_TARGET_CONFIG)" "iPhone"
-Embedded?=YES
+ifdef RC_ProjectName
+DSTSUBPATH = $(DSTROOT)/AppleInternal/CoreOS/tests/xnu
+BATS_CONFIG_PATH = $(DSTROOT)/AppleInternal/CoreOS
else
-Embedded?=$(shell echo $(SDKROOT) | grep -iq iphoneos && echo YES || echo NO)
+DSTSUBPATH = $(DSTROOT)
+BATS_CONFIG_PATH = $(DSTROOT)
endif
-COMMON_TARGETS = xnu_quick_test \
+COMMON_TARGETS = unit_tests \
MPMMTest \
+ packetdrill \
affinity \
+ execperf \
kqueue_tests \
superpages \
zero-to-n \
jitter \
perf_index \
- unit_tests
+ darwintests \
+ unixconf
+
+IPHONE_TARGETS =
-IPHONE_TARGETS = memorystatus
+MAC_TARGETS =
-MAC_TARGETS =
+BATS_TARGET = $(BATS_CONFIG_PATH)/BATS
ifeq "$(Embedded)" "YES"
-TARGETS = $(addprefix $(DSTSUBPATH)/, $(COMMON_TARGETS) $(IPHONE_TARGETS))
+TARGETS = $(addprefix $(DSTSUBPATH)/, $(COMMON_TARGETS) $(IPHONE_TARGETS))
else
-TARGETS = $(addprefix $(DSTSUBPATH)/, $(COMMON_TARGETS) $(MAC_TARGETS))
+TARGETS = $(addprefix $(DSTSUBPATH)/, $(COMMON_TARGETS) $(MAC_TARGETS))
endif
-all: $(TARGETS)
+all: $(BATS_TARGET) $(TARGETS)
+
+.PHONY: always
+
+always:
+
+$(DSTSUBPATH)/%: always
+ $(_v)echo Building $@
+ $(_v)mkdir -p $@
+ $(_v)mkdir -p $(OBJROOT)/$(notdir $@)
+ $(_v)mkdir -p $(SYMROOT)/$(notdir $@)
+ $(_v)$(MAKE) -C $(SRCROOT)/$(notdir $@) SRCROOT=$(SRCROOT)/$(notdir $@) DSTROOT=$@ OBJROOT=$(OBJROOT)/$(notdir $@) SYMROOT=$(SYMROOT)/$(notdir $@) SDKROOT=$(SDKROOT) BASEDSTROOT=$(DSTROOT)
-$(DSTSUBPATH)/%:
- mkdir -p $@
- mkdir -p $(OBJROOT)/$(notdir $@)
- $(MAKE) -C $(SRCROOT)/$(notdir $@) SRCROOT=$(SRCROOT)/$(notdir $@) DSTROOT=$@ OBJROOT=$(OBJROOT)/$(notdir $@)
+$(BATS_TARGET): $(TARGETS)
+ $(_v)mkdir -p $@
+ $(_v)mkdir -p $(OBJROOT)/$(notdir $@)
+ $(_v)mkdir -p $(SYMROOT)
+ $(_v)$(MAKE) -C $(SRCROOT)/$(notdir $@) SRCROOT=$(SRCROOT)/$(notdir $@) DSTROOT=$@ OBJROOT=$(OBJROOT)/$(notdir $@) SDKROOT=$(SDKROOT) BASEDSTROOT=$(DSTROOT)