+#
+# Dispatch non-xnu build aliases to their own build
+# systems. All xnu variants start with MakeInc_top.
+#
+
+ifneq ($(findstring Libsyscall,$(RC_ProjectName)),)
+
+include $(MakeInc_cmd)
+
+ifeq ($(RC_ProjectName),Libsyscall_headers_Sim)
+TARGET=-target Libsyscall_headers_Sim
+endif
+
+ifeq ($(RC_ProjectName),Libsyscall_driverkit)
+TARGET=-target Libsyscall_driverkit
+endif
+
+default: install
+
+# default to OS X
+SDKROOT ?= macosx.internal
+
+installhdrs install:
+ cd libsyscall ; \
+ xcodebuild $@ $(TARGET) \
+ $(MAKEOVERRIDES) \
+ "SRCROOT=$(SRCROOT)/libsyscall" \
+ "OBJROOT=$(OBJROOT)" \
+ "SYMROOT=$(SYMROOT)" \
+ "DSTROOT=$(DSTROOT)" \
+ "SDKROOT=$(SDKROOT)"
+
+Libsyscall_driverkit: install
+
+.PHONY: Libsyscall_driverkit
+
+clean:
+
+installsrc:
+ pax -rw . $(SRCROOT)
+
+else ifneq ($(findstring libkxld_host,$(RC_ProjectName)),)
+
+include $(MakeInc_cmd)
+
+default: install
+
+installhdrs install clean:
+ $(MAKE) -C libkern/kxld $@ USE_APPLE_PB_SUPPORT=all PRODUCT_TYPE=ARCHIVE
+
+installsrc:
+ $(_v)$(MKDIR) $(SRCROOT)
+ $(_v)$(FIND) -x . \! \( \( -name BUILD -o -name .svn -o -name .git -o -name cscope.\* -o -name \*~ \) -prune \) -print0 | $(PAX) -rw -p a -d0 $(SRCROOT)
+ $(_v)$(CHMOD) -R go+rX $(SRCROOT)
+
+else ifneq ($(findstring libkxld,$(RC_ProjectName)),)
+
+include $(MakeInc_cmd)
+
+default: install
+
+installhdrs install clean:
+ $(MAKE) -C libkern/kxld $@ USE_APPLE_PB_SUPPORT=all
+
+installsrc:
+ $(_v)$(MKDIR) $(SRCROOT)
+ $(_v)$(FIND) -x . \! \( \( -name BUILD -o -name .svn -o -name .git -o -name cscope.\* -o -name \*~ \) -prune \) -print0 | $(PAX) -rw -p a -d0 $(SRCROOT)
+ $(_v)$(CHMOD) -R go+rX $(SRCROOT)
+
+else ifneq ($(findstring libkmod,$(RC_ProjectName)),)
+
+default: install
+
+installhdrs install:
+ cd libkern/kmod ; \
+ xcodebuild $@ \
+ $(MAKEOVERRIDES) \
+ "SRCROOT=$(SRCROOT)/libkern/kmod" \
+ "OBJROOT=$(OBJROOT)" \
+ "SYMROOT=$(SYMROOT)" \
+ "DSTROOT=$(DSTROOT)" \
+ "SDKROOT=$(SDKROOT)"
+
+clean:
+
+installsrc:
+ pax -rw . $(SRCROOT)
+
+else ifneq ($(findstring xnu_tests,$(RC_ProjectName)),)
+
+export SYSCTL_HW_PHYSICALCPU := $(shell /usr/sbin/sysctl -n hw.physicalcpu)
+export SYSCTL_HW_LOGICALCPU := $(shell /usr/sbin/sysctl -n hw.logicalcpu)
+MAKEJOBS := --jobs=$(shell expr $(SYSCTL_HW_LOGICALCPU) + 1)
+
+default: install
+
+installhdrs:
+
+install: xnu_tests
+
+clean:
+
+installsrc:
+ pax -rw . $(SRCROOT)
+
+else ifeq ($(RC_ProjectName),xnu_tests_driverkit)
+
+export SYSCTL_HW_PHYSICALCPU := $(shell /usr/sbin/sysctl -n hw.physicalcpu)
+export SYSCTL_HW_LOGICALCPU := $(shell /usr/sbin/sysctl -n hw.logicalcpu)
+MAKEJOBS := --jobs=$(shell expr $(SYSCTL_HW_LOGICALCPU) + 1)
+
+default: install
+
+installhdrs:
+
+install: xnu_tests_driverkit
+
+clean:
+
+installsrc:
+ pax -rw . $(SRCROOT)
+
+else # all other RC_ProjectName
+
+ifndef CURRENT_BUILD_CONFIG
+
+# avoid having to include MakeInc.cmd
+ifeq ($(RC_XBS),YES)
+_v =
+else ifeq ($(VERBOSE),YES)
+_v =
+else
+_v = @
+endif
+
+#
+# Setup for parallel sub-makes, taking into account physical and logical
+# CPUs. If the system does not support SMT, use N+1.
+# If MAKEJOBS or -jN is passed on the make line, that takes precedence.
+#
+export SYSCTL_HW_PHYSICALCPU := $(shell /usr/sbin/sysctl -n hw.physicalcpu)
+export SYSCTL_HW_LOGICALCPU := $(shell /usr/sbin/sysctl -n hw.logicalcpu)
+MAKEJOBS := --jobs=$(shell expr $(SYSCTL_HW_LOGICALCPU) + 1)
+
+TOP_TARGETS = \
+ clean \
+ installsrc \
+ exporthdrs \
+ all all_desktop all_embedded \
+ all_release_embedded all_development_embedded \
+ installhdrs installhdrs_desktop installhdrs_embedded \
+ installhdrs_release_embedded installhdrs_development_embedded \
+ install install_desktop install_embedded \
+ install_release_embedded install_development_embedded \
+ install_kernels \
+ cscope tags TAGS \
+ help
+
+DEFAULT_TARGET = all
+
+# Targets for internal build system debugging
+TOP_TARGETS += \
+ print_exports print_exports_first_build_config \
+ setup \
+ build \
+ config \
+ install_textfiles \
+ install_config
+
+ifeq ($(BUILD_JSON_COMPILATION_DATABASE),1)
+MAKEARGS += -B
+DEFAULT_TARGET := build
+endif
+
+.PHONY: $(TOP_TARGETS)
+
+default: $(DEFAULT_TARGET)
+
+ifneq ($(REMOTEBUILD),)
+$(TOP_TARGETS):
+ $(_v)$(VERSDIR)/tools/remote_build.sh _REMOTEBUILD_TARGET=$@ _REMOTEBUILD_MAKE=$(MAKE) $(if $(filter --,$(MAKEFLAGS)),-,)$(MAKEFLAGS)
+else
+$(TOP_TARGETS):
+ $(_v)$(MAKE) $(MAKEARGS) -r $(if $(filter -j,$(MAKEFLAGS)),,$(MAKEJOBS)) -f $(MakeInc_top) $@
+endif
+
+else # CURRENT_BUILD_CONFIG
+