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