xref: /xnu-12377.81.4/Makefile (revision 043036a2b3718f7f0be807e2870f8f47d3fa0796)
1*043036a2SApple OSS Distributions#
2*043036a2SApple OSS Distributions# Copyright (C) 1999-2020 Apple Inc. All rights reserved.
3*043036a2SApple OSS Distributions#
4*043036a2SApple OSS Distributionsifndef VERSDIR
5*043036a2SApple OSS Distributionsexport VERSDIR := $(shell /bin/pwd)
6*043036a2SApple OSS Distributionsendif
7*043036a2SApple OSS Distributions
8*043036a2SApple OSS Distributionsifndef SRCROOT
9*043036a2SApple OSS Distributionsexport SRCROOT := $(shell /bin/pwd)
10*043036a2SApple OSS Distributionsendif
11*043036a2SApple OSS Distributionsifndef OBJROOT
12*043036a2SApple OSS Distributionsexport OBJROOT = $(SRCROOT)/BUILD/obj
13*043036a2SApple OSS Distributionsendif
14*043036a2SApple OSS Distributionsifndef DSTROOT
15*043036a2SApple OSS Distributionsexport DSTROOT = $(SRCROOT)/BUILD/dst
16*043036a2SApple OSS Distributionsendif
17*043036a2SApple OSS Distributionsifndef SYMROOT
18*043036a2SApple OSS Distributionsexport SYMROOT = $(SRCROOT)/BUILD/sym
19*043036a2SApple OSS Distributionsendif
20*043036a2SApple OSS Distributionsifndef MallocNanoZone
21*043036a2SApple OSS Distributionsexport MallocNanoZone := 1
22*043036a2SApple OSS Distributionsendif
23*043036a2SApple OSS Distributions
24*043036a2SApple OSS Distributions# Avoid make default rules, make becomes faster
25*043036a2SApple OSS DistributionsMAKEFLAGS+=r
26*043036a2SApple OSS Distributions
27*043036a2SApple OSS Distributionsexport MakeInc_top=${VERSDIR}/makedefs/MakeInc.top
28*043036a2SApple OSS Distributionsexport MakeInc_kernel=${VERSDIR}/makedefs/MakeInc.kernel
29*043036a2SApple OSS Distributionsexport MakeInc_cmd=${VERSDIR}/makedefs/MakeInc.cmd
30*043036a2SApple OSS Distributionsexport MakeInc_def=${VERSDIR}/makedefs/MakeInc.def
31*043036a2SApple OSS Distributionsexport MakeInc_rule=${VERSDIR}/makedefs/MakeInc.rule
32*043036a2SApple OSS Distributionsexport MakeInc_dir=${VERSDIR}/makedefs/MakeInc.dir
33*043036a2SApple OSS Distributions
34*043036a2SApple OSS Distributions.DEFAULT_GOAL := default
35*043036a2SApple OSS Distributions
36*043036a2SApple OSS Distributionsexport PATCH_PREFIX ?= change-under-test_
37*043036a2SApple OSS Distributionsexport PATCH_GLOB ?= $(PATCH_PREFIX)*.diff
38*043036a2SApple OSS Distributions
39*043036a2SApple OSS Distributions
40*043036a2SApple OSS Distributionsskip:
41*043036a2SApple OSS Distributions	@echo "Skipping $(RC_ProjectName)"
42*043036a2SApple OSS Distributions
43*043036a2SApple OSS Distributions.PHONY: skip
44*043036a2SApple OSS Distributions
45*043036a2SApple OSS Distributions#
46*043036a2SApple OSS Distributions# Dispatch non-xnu build aliases to their own build
47*043036a2SApple OSS Distributions# systems. All xnu variants start with MakeInc_top.
48*043036a2SApple OSS Distributions#
49*043036a2SApple OSS Distributions
50*043036a2SApple OSS Distributionsifneq ($(findstring Libsyscall,$(RC_ProjectName)),)
51*043036a2SApple OSS Distributions
52*043036a2SApple OSS Distributionsinclude $(MakeInc_cmd)
53*043036a2SApple OSS Distributionsinclude $(MakeInc_def)
54*043036a2SApple OSS Distributionsinclude $(MakeInc_rule)
55*043036a2SApple OSS Distributions
56*043036a2SApple OSS Distributionsifeq ($(RC_ProjectName),Libsyscall_headers_Sim)
57*043036a2SApple OSS DistributionsTARGET=-target Libsyscall_headers_Sim
58*043036a2SApple OSS Distributionsendif
59*043036a2SApple OSS Distributions
60*043036a2SApple OSS Distributionsifeq ($(RC_ProjectName),Libsyscall_driverkit)
61*043036a2SApple OSS DistributionsTARGET=-target Libsyscall_driverkit
62*043036a2SApple OSS Distributionsendif
63*043036a2SApple OSS Distributions
64*043036a2SApple OSS Distributions# default to OS X
65*043036a2SApple OSS DistributionsSDKROOT ?= macosx.internal
66*043036a2SApple OSS Distributions
67*043036a2SApple OSS Distributionsdefault: install
68*043036a2SApple OSS Distributions
69*043036a2SApple OSS DistributionsLibsyscall_driverkit: install
70*043036a2SApple OSS Distributions
71*043036a2SApple OSS Distributions.PHONY: Libsyscall_driverkit
72*043036a2SApple OSS Distributions
73*043036a2SApple OSS Distributionsinstallhdrs install::
74*043036a2SApple OSS Distributions	cd libsyscall ; \
75*043036a2SApple OSS Distributions		xcodebuild $@ $(TARGET)	\
76*043036a2SApple OSS Distributions			$(MAKEOVERRIDES)	\
77*043036a2SApple OSS Distributions			"SRCROOT=$(SRCROOT)/libsyscall"					\
78*043036a2SApple OSS Distributions			"OBJROOT=$(OBJROOT)"						\
79*043036a2SApple OSS Distributions			"SYMROOT=$(SYMROOT)"						\
80*043036a2SApple OSS Distributions			"DSTROOT=$(DSTROOT)"						\
81*043036a2SApple OSS Distributions			"SDKROOT=$(SDKROOT)"
82*043036a2SApple OSS Distributions
83*043036a2SApple OSS Distributionsinstallhdrs install:: do_unifdef_headers
84*043036a2SApple OSS Distributions
85*043036a2SApple OSS Distributions$(eval $(call LIBSYSCALL_DO_UNIFDEF_HEADERS_RULE_template,$(DSTROOT)/$(INCDIR),$(SINCFRAME_UNIFDEF)))
86*043036a2SApple OSS Distributions$(eval $(call LIBSYSCALL_DO_UNIFDEF_HEADERS_RULE_template,$(DSTROOT)/$(LCLDIR),$(SPINCFRAME_UNIFDEF)))
87*043036a2SApple OSS Distributionsifeq ($(DRIVERKIT),1)
88*043036a2SApple OSS Distributions$(eval $(call LIBSYSCALL_DO_UNIFDEF_HEADERS_RULE_template,$(DSTROOT)/$(DRIVERKITINCDIR),$(DKINCFRAME_UNIFDEF)))
89*043036a2SApple OSS Distributions$(eval $(call LIBSYSCALL_DO_UNIFDEF_HEADERS_RULE_template,$(DSTROOT)/$(DRIVERKITLCLDIR),$(DKPINCFRAME_UNIFDEF)))
90*043036a2SApple OSS Distributionsendif
91*043036a2SApple OSS Distributions
92*043036a2SApple OSS Distributionsclean:
93*043036a2SApple OSS Distributions
94*043036a2SApple OSS Distributionsinstallsrc:
95*043036a2SApple OSS Distributions	pax -rw . $(SRCROOT)
96*043036a2SApple OSS Distributions
97*043036a2SApple OSS Distributionselse ifneq ($(findstring libkxld_host,$(RC_ProjectName)),)
98*043036a2SApple OSS Distributions
99*043036a2SApple OSS Distributionsinclude $(MakeInc_cmd)
100*043036a2SApple OSS Distributions
101*043036a2SApple OSS Distributionsdefault: install
102*043036a2SApple OSS Distributions
103*043036a2SApple OSS Distributionsinstallhdrs install clean:
104*043036a2SApple OSS Distributions	 $(MAKE) -C libkern/kxld $@ USE_APPLE_PB_SUPPORT=all PRODUCT_TYPE=ARCHIVE
105*043036a2SApple OSS Distributions
106*043036a2SApple OSS Distributionsinstallsrc:
107*043036a2SApple OSS Distributions	$(_v)$(MKDIR) $(SRCROOT)
108*043036a2SApple OSS Distributions	$(_v)$(FIND) -x . \! \( \( -name BUILD -o -name .svn -o -name .git -o -name cscope.\* -o -name compile_commands.json -o -name \*~ \) -prune \) -print0 | $(PAX) -rw -p a -d0 $(SRCROOT)
109*043036a2SApple OSS Distributions	$(_v)$(CHMOD) -R go+rX $(SRCROOT)
110*043036a2SApple OSS Distributions
111*043036a2SApple OSS Distributionselse ifneq ($(findstring libkxld,$(RC_ProjectName)),)
112*043036a2SApple OSS Distributions
113*043036a2SApple OSS Distributionsinclude $(MakeInc_cmd)
114*043036a2SApple OSS Distributions
115*043036a2SApple OSS Distributionsdefault: install
116*043036a2SApple OSS Distributions
117*043036a2SApple OSS Distributionsinstallhdrs install clean:
118*043036a2SApple OSS Distributions	 $(MAKE) -C libkern/kxld $@ USE_APPLE_PB_SUPPORT=all
119*043036a2SApple OSS Distributions
120*043036a2SApple OSS Distributionsinstallsrc:
121*043036a2SApple OSS Distributions	$(_v)$(MKDIR) $(SRCROOT)
122*043036a2SApple OSS Distributions	$(_v)$(FIND) -x . \! \( \( -name BUILD -o -name .svn -o -name .git -o -name cscope.\* -name compile_commands.json -o -name \*~ \) -prune \) -print0 | $(PAX) -rw -p a -d0 $(SRCROOT)
123*043036a2SApple OSS Distributions	$(_v)$(CHMOD) -R go+rX $(SRCROOT)
124*043036a2SApple OSS Distributions
125*043036a2SApple OSS Distributionselse ifneq ($(findstring libkmod,$(RC_ProjectName)),)
126*043036a2SApple OSS Distributions
127*043036a2SApple OSS Distributionsdefault: install
128*043036a2SApple OSS Distributions
129*043036a2SApple OSS Distributionsinstallhdrs install:
130*043036a2SApple OSS Distributions	cd libkern/kmod ; \
131*043036a2SApple OSS Distributions		xcodebuild $@	\
132*043036a2SApple OSS Distributions			$(MAKEOVERRIDES)	\
133*043036a2SApple OSS Distributions			"SRCROOT=$(SRCROOT)/libkern/kmod"				\
134*043036a2SApple OSS Distributions			"OBJROOT=$(OBJROOT)"						\
135*043036a2SApple OSS Distributions			"SYMROOT=$(SYMROOT)"						\
136*043036a2SApple OSS Distributions			"DSTROOT=$(DSTROOT)"						\
137*043036a2SApple OSS Distributions			"SDKROOT=$(SDKROOT)"
138*043036a2SApple OSS Distributions
139*043036a2SApple OSS Distributionsclean:
140*043036a2SApple OSS Distributions
141*043036a2SApple OSS Distributionsinstallsrc:
142*043036a2SApple OSS Distributions	pax -rw . $(SRCROOT)
143*043036a2SApple OSS Distributions
144*043036a2SApple OSS Distributionselse ifneq ($(findstring xnu_tests,$(RC_ProjectName)),)
145*043036a2SApple OSS Distributions
146*043036a2SApple OSS Distributionsexport SYSCTL_HW_PHYSICALCPU := $(shell /usr/sbin/sysctl -n hw.physicalcpu)
147*043036a2SApple OSS Distributionsexport SYSCTL_HW_LOGICALCPU  := $(shell /usr/sbin/sysctl -n hw.logicalcpu)
148*043036a2SApple OSS DistributionsMAKEJOBS := --jobs=$(shell expr $(SYSCTL_HW_LOGICALCPU) + 1)
149*043036a2SApple OSS Distributions
150*043036a2SApple OSS Distributionsdefault: install
151*043036a2SApple OSS Distributions
152*043036a2SApple OSS Distributionsinstallhdrs:
153*043036a2SApple OSS Distributions
154*043036a2SApple OSS Distributionsinstall: xnu_tests
155*043036a2SApple OSS Distributions
156*043036a2SApple OSS Distributionsclean:
157*043036a2SApple OSS Distributions
158*043036a2SApple OSS Distributionsinstallsrc:
159*043036a2SApple OSS Distributions	pax -rw . $(SRCROOT)
160*043036a2SApple OSS Distributions
161*043036a2SApple OSS Distributionselse ifeq ($(RC_ProjectName),xnu_tests_driverkit)
162*043036a2SApple OSS Distributions
163*043036a2SApple OSS Distributionsexport SYSCTL_HW_PHYSICALCPU := $(shell /usr/sbin/sysctl -n hw.physicalcpu)
164*043036a2SApple OSS Distributionsexport SYSCTL_HW_LOGICALCPU  := $(shell /usr/sbin/sysctl -n hw.logicalcpu)
165*043036a2SApple OSS DistributionsMAKEJOBS := --jobs=$(shell expr $(SYSCTL_HW_LOGICALCPU) + 1)
166*043036a2SApple OSS Distributions
167*043036a2SApple OSS Distributionsdefault: install
168*043036a2SApple OSS Distributions
169*043036a2SApple OSS Distributionsinstallhdrs:
170*043036a2SApple OSS Distributions
171*043036a2SApple OSS Distributionsinstall: xnu_tests_driverkit
172*043036a2SApple OSS Distributions
173*043036a2SApple OSS Distributionsclean:
174*043036a2SApple OSS Distributions
175*043036a2SApple OSS Distributionsinstallsrc:
176*043036a2SApple OSS Distributions	pax -rw . $(SRCROOT)
177*043036a2SApple OSS Distributions
178*043036a2SApple OSS Distributionselse # all other RC_ProjectName
179*043036a2SApple OSS Distributions
180*043036a2SApple OSS Distributionsifndef CURRENT_BUILD_CONFIG
181*043036a2SApple OSS Distributions
182*043036a2SApple OSS Distributions# avoid having to include MakeInc.cmd
183*043036a2SApple OSS Distributionsifeq ($(RC_XBS),YES)
184*043036a2SApple OSS Distributions_v =
185*043036a2SApple OSS Distributionselse ifeq ($(VERBOSE),YES)
186*043036a2SApple OSS Distributions_v =
187*043036a2SApple OSS Distributionselse
188*043036a2SApple OSS Distributions_v = @
189*043036a2SApple OSS Distributionsendif
190*043036a2SApple OSS Distributions
191*043036a2SApple OSS Distributions#
192*043036a2SApple OSS Distributions# Setup for parallel sub-makes, taking into account physical and logical
193*043036a2SApple OSS Distributions# CPUs. If the system does not support SMT, use N+1.
194*043036a2SApple OSS Distributions# If MAKEJOBS or -jN is passed on the make line, that takes precedence.
195*043036a2SApple OSS Distributions#
196*043036a2SApple OSS Distributionsexport SYSCTL_HW_PHYSICALCPU := $(shell /usr/sbin/sysctl -n hw.physicalcpu)
197*043036a2SApple OSS Distributionsexport SYSCTL_HW_LOGICALCPU  := $(shell /usr/sbin/sysctl -n hw.logicalcpu)
198*043036a2SApple OSS DistributionsMAKEJOBS := --jobs=$(shell expr $(SYSCTL_HW_LOGICALCPU) + 1)
199*043036a2SApple OSS Distributions
200*043036a2SApple OSS DistributionsTOP_TARGETS = \
201*043036a2SApple OSS Distributions	clean \
202*043036a2SApple OSS Distributions	installsrc \
203*043036a2SApple OSS Distributions	exporthdrs \
204*043036a2SApple OSS Distributions	all all_desktop all_embedded \
205*043036a2SApple OSS Distributions	all_release_embedded all_development_embedded \
206*043036a2SApple OSS Distributions	all_release_desktop all_development_desktop \
207*043036a2SApple OSS Distributions	installhdrs installhdrs_desktop installhdrs_embedded \
208*043036a2SApple OSS Distributions	installhdrs_release_embedded installhdrs_development_embedded \
209*043036a2SApple OSS Distributions	installhdrs_release_desktop installhdrs_development_desktop \
210*043036a2SApple OSS Distributions	install install_desktop install_embedded \
211*043036a2SApple OSS Distributions	install_release_embedded install_development_embedded \
212*043036a2SApple OSS Distributions	install_release_desktop install_development_desktop \
213*043036a2SApple OSS Distributions	install_release_embedded_nohdrs install_release_desktop_nohdrs \
214*043036a2SApple OSS Distributions	install_kernels \
215*043036a2SApple OSS Distributions	cscope tags TAGS \
216*043036a2SApple OSS Distributions	help
217*043036a2SApple OSS Distributions
218*043036a2SApple OSS DistributionsDEFAULT_TARGET = all
219*043036a2SApple OSS Distributions
220*043036a2SApple OSS Distributions# Targets for internal build system debugging
221*043036a2SApple OSS DistributionsTOP_TARGETS += \
222*043036a2SApple OSS Distributions	print_exports print_exports_first_build_config \
223*043036a2SApple OSS Distributions	setup \
224*043036a2SApple OSS Distributions	build \
225*043036a2SApple OSS Distributions	config \
226*043036a2SApple OSS Distributions	install_textfiles \
227*043036a2SApple OSS Distributions	install_config
228*043036a2SApple OSS Distributions
229*043036a2SApple OSS Distributions.PHONY: $(TOP_TARGETS)
230*043036a2SApple OSS Distributions
231*043036a2SApple OSS Distributionsdefault: $(DEFAULT_TARGET)
232*043036a2SApple OSS Distributions
233*043036a2SApple OSS Distributionsifneq ($(REMOTEBUILD),)
234*043036a2SApple OSS Distributions$(TOP_TARGETS):
235*043036a2SApple OSS Distributions	$(_v)$(VERSDIR)/tools/remote_build.sh _REMOTEBUILD_TARGET=$@ _REMOTEBUILD_MAKE=$(MAKE) $(if $(filter --,$(MAKEFLAGS)),-,)$(MAKEFLAGS)
236*043036a2SApple OSS Distributionselse
237*043036a2SApple OSS Distributions$(TOP_TARGETS):
238*043036a2SApple OSS Distributions	$(_v)$(MAKE) $(MAKEARGS) -r $(if $(filter -j,$(MAKEFLAGS)),,$(MAKEJOBS)) -f $(MakeInc_top) $@
239*043036a2SApple OSS Distributionsendif
240*043036a2SApple OSS Distributions
241*043036a2SApple OSS Distributionselse # CURRENT_BUILD_CONFIG
242*043036a2SApple OSS Distributions
243*043036a2SApple OSS Distributionsinclude $(MakeInc_cmd)
244*043036a2SApple OSS Distributionsinclude $(MakeInc_def)
245*043036a2SApple OSS Distributions
246*043036a2SApple OSS DistributionsALL_SUBDIRS = \
247*043036a2SApple OSS Distributions	security \
248*043036a2SApple OSS Distributions	bsd  \
249*043036a2SApple OSS Distributions	iokit \
250*043036a2SApple OSS Distributions	osfmk \
251*043036a2SApple OSS Distributions	pexpert \
252*043036a2SApple OSS Distributions	libkern \
253*043036a2SApple OSS Distributions	libsa \
254*043036a2SApple OSS Distributions	config \
255*043036a2SApple OSS Distributions	san
256*043036a2SApple OSS Distributions
257*043036a2SApple OSS DistributionsCONFIG_SUBDIRS = config tools san
258*043036a2SApple OSS Distributions# Hack to handle san external dependency on config_all allsymbols target
259*043036a2SApple OSS Distributionsconfig_all_recurse_into_san: config_all_recurse_into_config
260*043036a2SApple OSS Distributions
261*043036a2SApple OSS DistributionsINSTINC_SUBDIRS = $(ALL_SUBDIRS) EXTERNAL_HEADERS
262*043036a2SApple OSS DistributionsINSTINC_SUBDIRS_X86_64 = $(INSTINC_SUBDIRS)
263*043036a2SApple OSS DistributionsINSTINC_SUBDIRS_X86_64H = $(INSTINC_SUBDIRS)
264*043036a2SApple OSS DistributionsINSTINC_SUBDIRS_ARM64 = $(INSTINC_SUBDIRS)
265*043036a2SApple OSS Distributions
266*043036a2SApple OSS DistributionsEXPINC_SUBDIRS = $(ALL_SUBDIRS)
267*043036a2SApple OSS DistributionsEXPINC_SUBDIRS_X86_64 = $(EXPINC_SUBDIRS)
268*043036a2SApple OSS DistributionsEXPINC_SUBDIRS_X86_64H = $(EXPINC_SUBDIRS)
269*043036a2SApple OSS DistributionsEXPINC_SUBDIRS_ARM64 = $(EXPINC_SUBDIRS)
270*043036a2SApple OSS Distributions
271*043036a2SApple OSS DistributionsSETUP_SUBDIRS = SETUP san bsd
272*043036a2SApple OSS Distributions
273*043036a2SApple OSS DistributionsCOMP_SUBDIRS_X86_64 = $(ALL_SUBDIRS)
274*043036a2SApple OSS DistributionsCOMP_SUBDIRS_X86_64H = $(ALL_SUBDIRS)
275*043036a2SApple OSS DistributionsCOMP_SUBDIRS_ARM64 = $(ALL_SUBDIRS)
276*043036a2SApple OSS Distributions
277*043036a2SApple OSS DistributionsINSTTEXTFILES_SUBDIRS =	\
278*043036a2SApple OSS Distributions	bsd
279*043036a2SApple OSS DistributionsINSTTEXTFILES_SUBDIRS_X86_64 = $(INSTTEXTFILES_SUBDIRS)
280*043036a2SApple OSS DistributionsINSTTEXTFILES_SUBDIRS_X86_64H = $(INSTTEXTFILES_SUBDIRS)
281*043036a2SApple OSS DistributionsINSTTEXTFILES_SUBDIRS_ARM64 = $(INSTTEXTFILES_SUBDIRS)
282*043036a2SApple OSS Distributions
283*043036a2SApple OSS Distributionsinclude $(MakeInc_kernel)
284*043036a2SApple OSS Distributionsinclude $(MakeInc_rule)
285*043036a2SApple OSS Distributionsinclude $(MakeInc_dir)
286*043036a2SApple OSS Distributions
287*043036a2SApple OSS Distributionsendif # CURRENT_BUILD_CONFIG
288*043036a2SApple OSS Distributions
289*043036a2SApple OSS Distributionsendif # all other RC_ProjectName
290*043036a2SApple OSS Distributions
291*043036a2SApple OSS Distributionsinstallapi_libkdd installhdrs_libkdd install_libkdd:
292*043036a2SApple OSS Distributions	cd libkdd; \
293*043036a2SApple OSS Distributions		xcodebuild -target Default $(subst _libkdd,,$@)	\
294*043036a2SApple OSS Distributions			$(MAKEOVERRIDES)	\
295*043036a2SApple OSS Distributions			"SRCROOT=$(SRCROOT)/libkdd"		\
296*043036a2SApple OSS Distributions			"OBJROOT=$(OBJROOT)"			\
297*043036a2SApple OSS Distributions			"SYMROOT=$(SYMROOT)"			\
298*043036a2SApple OSS Distributions			"DSTROOT=$(DSTROOT)"			\
299*043036a2SApple OSS Distributions			"SDKROOT=$(SDKROOT)"
300*043036a2SApple OSS Distributions
301*043036a2SApple OSS Distributions
302*043036a2SApple OSS Distributionsinstallapi_libkdd_tests installhdrs_libkdd_tests install_libkdd_tests:
303*043036a2SApple OSS Distributions	cd libkdd; \
304*043036a2SApple OSS Distributions		xcodebuild -target tests $(subst _libkdd_tests,,$@)	\
305*043036a2SApple OSS Distributions			$(MAKEOVERRIDES)	\
306*043036a2SApple OSS Distributions			"SRCROOT=$(SRCROOT)/libkdd"		\
307*043036a2SApple OSS Distributions			"OBJROOT=$(OBJROOT)"			\
308*043036a2SApple OSS Distributions			"SYMROOT=$(SYMROOT)"			\
309*043036a2SApple OSS Distributions			"DSTROOT=$(DSTROOT)"			\
310*043036a2SApple OSS Distributions			"SDKROOT=$(SDKROOT)"
311*043036a2SApple OSS Distributions
312*043036a2SApple OSS Distributions
313*043036a2SApple OSS Distributionsinstallapi_libkdd_host installhdrs_libkdd_host install_libkdd_host:
314*043036a2SApple OSS Distributions	cd libkdd; \
315*043036a2SApple OSS Distributions		xcodebuild -configuration ReleaseHost -target kdd.framework $(subst _libkdd_host,,$@)	\
316*043036a2SApple OSS Distributions			$(MAKEOVERRIDES)	\
317*043036a2SApple OSS Distributions			"SRCROOT=$(SRCROOT)/libkdd"		\
318*043036a2SApple OSS Distributions			"OBJROOT=$(OBJROOT)"			\
319*043036a2SApple OSS Distributions			"SYMROOT=$(SYMROOT)"			\
320*043036a2SApple OSS Distributions			"DSTROOT=$(DSTROOT)"			\
321*043036a2SApple OSS Distributions			"SDKROOT=$(SDKROOT)"
322*043036a2SApple OSS Distributions
323*043036a2SApple OSS Distributions
324*043036a2SApple OSS Distributions# "xnu_tests" and "testbots" are targets that can be invoked via a standalone
325*043036a2SApple OSS Distributions# "make xnu_tests" or via buildit/XBS with the RC_ProjectName=xnu_tests.
326*043036a2SApple OSS Distributions# Define the target here in the outermost scope of the initial Makefile
327*043036a2SApple OSS Distributions
328*043036a2SApple OSS Distributionsxnu_tests:
329*043036a2SApple OSS Distributions	$(MAKE) -C $(SRCROOT)/tools/tests	$(if $(filter -j,$(MAKEFLAGS)),,$(MAKEJOBS)) \
330*043036a2SApple OSS Distributions		SRCROOT=$(SRCROOT)/tools/tests
331*043036a2SApple OSS Distributions	$(MAKE) -C $(SRCROOT)/tests	$(if $(filter -j,$(MAKEFLAGS)),,$(MAKEJOBS)) \
332*043036a2SApple OSS Distributions		SRCROOT=$(SRCROOT)/tests
333*043036a2SApple OSS Distributions	$(MAKE) -C $(SRCROOT)/tools/lldbmacros/tests $(if $(filter -j,$(MAKEFLAGS)),,$(MAKEJOBS)) \
334*043036a2SApple OSS Distributions		SRCROOT=$(SRCROOT)/tools/lldbmacros
335*043036a2SApple OSS Distributions
336*043036a2SApple OSS Distributionsxnu_tests_driverkit:
337*043036a2SApple OSS Distributions	$(MAKE) -C $(SRCROOT)/tests/driverkit $(if $(filter -j,$(MAKEFLAGS)),,$(MAKEJOBS)) \
338*043036a2SApple OSS Distributions		SRCROOT=$(SRCROOT)/tests/driverkit
339*043036a2SApple OSS Distributions
340*043036a2SApple OSS Distributionsxnu_unittests:
341*043036a2SApple OSS Distributions	$(MAKE) -C $(SRCROOT)/tests/unit	$(if $(filter -j,$(MAKEFLAGS)),,$(MAKEJOBS)) \
342*043036a2SApple OSS Distributions		SRCROOT=$(SRCROOT)/tests/unit
343*043036a2SApple OSS Distributions	$(MAKE) -C $(SRCROOT)/tests	$(if $(filter -j,$(MAKEFLAGS)),,$(MAKEJOBS)) sched/install_userspace_unit_tests \
344*043036a2SApple OSS Distributions		SRCROOT=$(SRCROOT)/tests
345*043036a2SApple OSS Distributions
346*043036a2SApple OSS Distributions
347*043036a2SApple OSS Distributionsinclude $(MakeInc_cmd)
348*043036a2SApple OSS Distributions
349*043036a2SApple OSS Distributions#
350*043036a2SApple OSS Distributions# The "analyze" target defined below invokes Clang Static Analyzer
351*043036a2SApple OSS Distributions# with a predefined set of checks and options for the project.
352*043036a2SApple OSS Distributions#
353*043036a2SApple OSS Distributions
354*043036a2SApple OSS Distributions# By default, analysis results are available in BUILD/StaticAnalyzer.
355*043036a2SApple OSS Distributions# Set this variable in your make invocation to use a different directory.
356*043036a2SApple OSS Distributions# Note that these results are only deleted when the build directory
357*043036a2SApple OSS Distributions# is cleaned. They aren't deleted every time the analyzer is re-run,
358*043036a2SApple OSS Distributions# but they are deleted after "make clean".
359*043036a2SApple OSS DistributionsSTATIC_ANALYZER_OUTPUT_DIR ?= $(SRCROOT)/BUILD/StaticAnalyzer
360*043036a2SApple OSS Distributions
361*043036a2SApple OSS Distributions# By default, the default make target is analyzed. You can analyze
362*043036a2SApple OSS Distributions# other targets by setting this variable in your make invocation.
363*043036a2SApple OSS DistributionsSTATIC_ANALYZER_TARGET ?=
364*043036a2SApple OSS Distributions
365*043036a2SApple OSS Distributions# You can pass additional flags to scan-build by setting this variable
366*043036a2SApple OSS Distributions# in your make invocation. For example, you can enable additional checks.
367*043036a2SApple OSS DistributionsSTATIC_ANALYZER_EXTRA_FLAGS ?=
368*043036a2SApple OSS Distributions
369*043036a2SApple OSS Distributionsanalyze:
370*043036a2SApple OSS Distributions# This is where the reports are going to be available.
371*043036a2SApple OSS Distributions# Old reports are deleted on make clean only.
372*043036a2SApple OSS Distributions	$(_v)$(MKDIR) $(STATIC_ANALYZER_OUTPUT_DIR)
373*043036a2SApple OSS Distributions
374*043036a2SApple OSS Distributions# Recursively build the requested target under scan-build.
375*043036a2SApple OSS Distributions# Exclude checks that weren't deemed to be security critical,
376*043036a2SApple OSS Distributions# like null pointer dereferences.
377*043036a2SApple OSS Distributions	$(_v)$(XCRUN) $(SCAN_BUILD) -o $(STATIC_ANALYZER_OUTPUT_DIR) \
378*043036a2SApple OSS Distributions		-disable-checker deadcode.DeadStores \
379*043036a2SApple OSS Distributions		-disable-checker core.NullDereference \
380*043036a2SApple OSS Distributions		-disable-checker core.DivideZero \
381*043036a2SApple OSS Distributions		--exclude BUILD \
382*043036a2SApple OSS Distributions		$(STATIC_ANALYZER_EXTRA_FLAGS) \
383*043036a2SApple OSS Distributions		$(MAKE) $(STATIC_ANALYZER_TARGET) QUIET=1 2>&1 | $(GREP) "^scan-build:"
384*043036a2SApple OSS Distributions
385*043036a2SApple OSS Distributions.PHONY: analyze
386*043036a2SApple OSS Distributions
387*043036a2SApple OSS Distributions.PHONY: empty
388*043036a2SApple OSS Distributions
389*043036a2SApple OSS Distributions# Add an empty target which is useful for bringing up new build aliases
390*043036a2SApple OSS Distributions# Aliases can be created with this as their target, then later move to their
391*043036a2SApple OSS Distributions# required target in coordination with other aliases
392*043036a2SApple OSS Distributionsempty:
393*043036a2SApple OSS Distributions	$(_v)$(MKDIR) $(DSTROOT)/AppleInternal
394