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