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