2 # Copyright (C) 1999-2010 Apple Inc. All rights reserved.
6 export VERSDIR := $(shell /bin/pwd)
10 export SRCROOT := $(shell /bin/pwd)
13 export OBJROOT = $(SRCROOT)/BUILD/obj
16 export DSTROOT = $(SRCROOT)/BUILD/dst
19 export SYMROOT = $(SRCROOT)/BUILD/sym
22 export MakeInc_top=${VERSDIR}/makedefs/MakeInc.top
23 export MakeInc_kernel=${VERSDIR}/makedefs/MakeInc.kernel
24 export MakeInc_cmd=${VERSDIR}/makedefs/MakeInc.cmd
25 export MakeInc_def=${VERSDIR}/makedefs/MakeInc.def
26 export MakeInc_rule=${VERSDIR}/makedefs/MakeInc.rule
27 export MakeInc_dir=${VERSDIR}/makedefs/MakeInc.dir
30 # Dispatch non-xnu build aliases to their own build
31 # systems. All xnu variants start with MakeInc_top.
34 ifeq ($(findstring Libsyscall,$(RC_ProjectName)),Libsyscall)
36 ifeq ($(RC_ProjectName),Libsyscall_headers_Sim)
37 TARGET=-target Libsyscall_headers_Sim
44 xcodebuild $@ $(TARGET) \
45 "SRCROOT=$(SRCROOT)/libsyscall" \
46 "OBJROOT=$(OBJROOT)" \
47 "SYMROOT=$(SYMROOT)" \
48 "DSTROOT=$(DSTROOT)" \
56 else ifeq ($(RC_ProjectName),libkxld)
60 installhdrs install clean:
61 $(MAKE) -C libkern/kxld $@ USE_APPLE_PB_SUPPORT=all
66 else ifeq ($(RC_ProjectName),libkxld_host)
70 installhdrs install clean:
71 $(MAKE) -C libkern/kxld $@ USE_APPLE_PB_SUPPORT=all PRODUCT_TYPE=ARCHIVE
76 else ifeq ($(RC_ProjectName),libkmod)
83 "SRCROOT=$(SRCROOT)/libkern/kmod" \
84 "OBJROOT=$(OBJROOT)" \
85 "SYMROOT=$(SYMROOT)" \
86 "DSTROOT=$(DSTROOT)" \
94 else ifeq ($(RC_ProjectName),xnu_quick_test)
100 install: xnu_quick_test
107 else # all other RC_ProjectName
109 ifndef CURRENT_BUILD_CONFIG
111 # avoid having to include MakeInc.cmd
114 else ifeq ($(VERBOSE),YES)
121 # Setup for parallel sub-makes based on 2 times number of logical CPUs.
122 # If MAKEJOBS or -jN is passed on the make line, that takes precedence.
124 MAKEJOBS := --jobs=$(shell expr `/usr/sbin/sysctl -n hw.physicalcpu` \* 2)
126 TOP_TARGETS = clean installsrc installhdrs installhdrs_embedded installman exporthdrs setup build all all_embedded install install_embedded installopensource cscope tags help print_exports print_exports_first_build_config
128 .PHONY: $(TOP_TARGETS)
132 ifneq ($(REMOTEBUILD),)
134 $(_v)$(VERSDIR)/tools/remote_build.sh _REMOTEBUILD_TARGET=$@ _REMOTEBUILD_MAKE=$(MAKE) $(MAKEFLAGS)
137 $(_v)$(MAKE) -r $(if $(filter -j,$(MAKEFLAGS)),,$(MAKEJOBS)) -f $(MakeInc_top) $@
140 else # CURRENT_BUILD_CONFIG
142 include $(MakeInc_cmd)
143 include $(MakeInc_def)
155 CONFIG_SUBDIRS = config tools
157 INSTINC_SUBDIRS = $(ALL_SUBDIRS) EXTERNAL_HEADERS
158 INSTINC_SUBDIRS_X86_64 = $(INSTINC_SUBDIRS)
159 INSTINC_SUBDIRS_ARM = $(INSTINC_SUBDIRS)
161 EXPINC_SUBDIRS = $(ALL_SUBDIRS)
162 EXPINC_SUBDIRS_X86_64 = $(EXPINC_SUBDIRS)
163 EXPINC_SUBDIRS_ARM = $(EXPINC_SUBDIRS)
165 SETUP_SUBDIRS = SETUP
167 COMP_SUBDIRS_X86_64 = $(ALL_SUBDIRS)
168 COMP_SUBDIRS_ARM = $(ALL_SUBDIRS)
177 include $(MakeInc_kernel)
178 include $(MakeInc_rule)
179 include $(MakeInc_dir)
181 endif # CURRENT_BUILD_CONFIG
183 endif # all other RC_ProjectName
185 # "xnu_quick_test" and "testbots" are targets that can be invoked via a standalone
186 # "make xnu_quick_test" or via buildit/XBS with the RC_ProjectName=xnu_quick_test.
187 # Define the target here in the outermost scope of the initial Makefile
190 $(MAKE) -C $(SRCROOT)/tools/tests \
191 SRCROOT=$(SRCROOT)/tools/tests
193 # This target is defined to compile and run xnu_quick_test under testbots
195 $(MAKE) -C $(SRCROOT)/tools/tests/xnu_quick_test \
196 SRCROOT=$(SRCROOT)/tools/tests/xnu_quick_test \
197 MORECFLAGS="-DRUN_UNDER_TESTBOTS=1" \