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