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