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