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