1# -*- mode: makefile;-*- 2# 3# Copyright (C) 1999-2020 Apple Inc. All rights reserved. 4# 5# MakeInc.rule defines the targets and rules for 6# leaf directories once MakeInc.dir has recursed 7# into them. "do_XXX" may be double-colon rules 8# to allow the Makefile in the source directory 9# to augment the actions that will be performed. 10# 11include $(SRCROOT)/makedefs/MakeInc.color 12 13# 14# Generic Install rules 15# 16 17ifndef INSTALL_KF_MI_LCL_LIST 18 INSTALL_KF_MI_LCL_LIST = $(EXPORT_MI_LIST) 19endif 20 21ifndef INSTALL_KF_MI_LCL_GEN_LIST 22 INSTALL_KF_MI_LCL_GEN_LIST = $(EXPORT_MI_GEN_LIST) 23endif 24 25ifndef INSTALL_KF_MD_LCL_LIST 26 INSTALL_KF_MD_LCL_LIST = $(EXPORT_MD_LIST) 27endif 28 29ifndef INSTALL_KF_MD_LCL_GEN_LIST 30 INSTALL_KF_MD_LCL_GEN_LIST = $(EXPORT_MD_GEN_LIST) 31endif 32 33ifndef INSTALL_KF_MI_LIST 34 INSTALL_KF_MI_LIST = $(EXPORT_MI_LIST) 35endif 36 37ifndef INSTALL_KF_MI_GEN_LIST 38 INSTALL_KF_MI_GEN_LIST = $(EXPORT_MI_GEN_LIST) 39endif 40 41ifndef INSTALL_KF_MD_LIST 42 INSTALL_KF_MD_LIST = $(EXPORT_MD_LIST) 43endif 44 45ifndef INSTALL_KF_MD_GEN_LIST 46 INSTALL_KF_MD_GEN_LIST = $(EXPORT_MD_GEN_LIST) 47endif 48 49$(eval $(call _setup_build_log_colors)) 50 51.PHONY: ALWAYS 52 53ALWAYS: 54 55# $(1) is the list of install paths 56# $(2) is "1" if it's a "GEN"-style rule that looks locally, or else $(SOURCE) 57# $(3) is the local temp directory for processing 58# $(4) is the unifdef flags 59# 60# $$$$$$$$ is a double-escaped "$$" to represent the current pid 61# of the shell process for creating uniquely named temporary files 62 63define INSTALLHDRS_RULE_template 64 65.PHONY: $(3)_MKDIR 66 67$(3)_MKDIR: 68 $$(_v)$$(MKDIR) ./$(3) 69 $$(_v)$$(MKDIR) $(dir $(firstword $(1))) 70 71# Rebuild if unifdef flags change 72$(1): $(3)/.UNIFDEF_FLAGS 73$(3)/.UNIFDEF_FLAGS: ALWAYS | $(3)_MKDIR 74 $$(_v)$$(REPLACECONTENTS) $$@ $$(UNIFDEF) $(4) 75 76# rebuild if strippers change 77$(1): $(STRIP_BOUND_ATTRIBUTES) 78$(1): $(BOUND_ATTRIBUTES_CHECK) 79 80$(1): $(dir $(firstword $(1)))% : $(if $(2),%,$$(SOURCE)/%) | $(3)_MKDIR 81 @$$(LOG_INSTALLHDR) "$$*" 82 $$(_v)$$(UNIFDEF) $(4) $$< > ./$(3)/$$*.unifdef.$$$$$$$$; \ 83 if [ $$$$? -eq 2 ]; then \ 84 $(ERR) Parse failure for $$<; \ 85 exit 1; \ 86 fi; \ 87 $$(STRIP_BOUND_ATTRIBUTES) -i '' ./$(3)/$$*.unifdef.$$$$$$$$ || exit 1; \ 88 if ! $(BOUND_ATTRIBUTES_CHECK) ./$(3)/$$*.unifdef.$$$$$$$$; then \ 89 $(ERR) bound attribute stripping failure for $$<; \ 90 exit 1; \ 91 fi; \ 92 $$(DECOMMENT) ./$(3)/$$*.unifdef.$$$$$$$$ r > \ 93 ./$(3)/$$*.strip.$$$$$$$$ || exit 1; \ 94 if [ -s ./$(3)/$$*.strip.$$$$$$$$ ]; then \ 95 $$(INSTALL) $$(INSTALL_FLAGS) ./$(3)/$$*.unifdef.$$$$$$$$ $$@ || exit 1; \ 96 fi; \ 97 $$(RM) ./$(3)/$$*.unifdef.$$$$$$$$ ./$(3)/$$*.strip.$$$$$$$$ 98endef 99 100# $(1) is the list of install paths 101# $(2) is the source path pattern (using % to match with $(5)) or source file 102# $(3) is the local temp directory for processing 103# $(4) is the unifdef flags 104# $(5) is the destination directory (when pattern matching) or empty 105# 106# $$$$$$$$ is a double-escaped "$$" to represent the current pid 107# of the shell process for creating uniquely named temporary files 108 109define INSTALLPYTHON_RULE_template 110 111.PHONY: $(3)_MKDIR 112 113$(3)_MKDIR: 114 $$(_v)$$(MKDIR) ./$(3) 115 116# Rebuild if unifdef flags change 117$(1): $(3)/.UNIFDEF_FLAGS 118$(3)/.UNIFDEF_FLAGS: ALWAYS | $(3)_MKDIR 119 $$(_v)$$(REPLACECONTENTS) $$@ $$(UNIFDEF) -t $(4) 120 121$(1): $(5)% : $(2) | $(3)_MKDIR 122 @$$(LOG_INSTALLPY) "$$*" 123 $$(_v)$$(MKDIR) $$(dir $$@) $$(dir ./$(3)/$$*) 124 $$(_v)$$(UNIFDEF) -t $(4) $$< > ./$(3)/$$*.unifdef.$$$$$$$$$$(suffix $$*); \ 125 if [ $$$$? -eq 2 ]; then \ 126 $(ERR) Parse failure for $$<; \ 127 exit 1; \ 128 fi; \ 129 $$(INSTALL) $$(DATA_INSTALL_FLAGS) \ 130 ./$(3)/$$*.unifdef.$$$$$$$$$$(suffix $$*) $$@ || exit 1; \ 131 $$(PYTHON) $$(LLDBMACROS_SOURCE)/core/syntax_checker.py \ 132 ./$(3)/$$*.unifdef.$$$$$$$$$$(suffix $$*) $$(_vstdout) || exit 1; \ 133 $$(RM) ./$(3)/$$*.unifdef.$$$$$$$$$$(suffix $$*) 134 $$(_v)if [ -n "$(5)" ]; then $$(TOUCH) "$(5)"; fi 135endef 136 137# Template for Libsyscall header unifdef postprocessing in DSTROOT 138# $(1) is the install path 139# $(2) is the unifdef flags 140 141define LIBSYSCALL_DO_UNIFDEF_HEADERS_RULE_template 142do_unifdef_headers:: 143 $$(_v)[ \! -d "$(1)" ] || $$(FIND) -x "$(1)" -type f \( -name \*.h -o \ 144 -name \*.defs -o -name \*.iig -o -name \*.modulemap \) \ 145 -execdir $$(UNIFDEF) $(2) -o {} {} \; 146.PHONY: do_unifdef_headers 147endef 148 149 150# 151# Empty the install lists of non-host headers if building the host headers alias 152# 153 154ifeq ($(INSTALLHDRS_SKIP_HOST),YES) 155 156INSTALL_MI_LIST = 157INSTALL_MI_GEN_LIST = 158INSTALL_DRIVERKIT_MI_LIST = 159INSTALL_DRIVERKIT_MI_GEN_LIST = 160INSTALL_KF_MI_LIST = 161INSTALL_KF_MI_GEN_LIST = 162INSTALL_MI_LCL_LIST = 163INSTALL_MI_LCL_GEN_LIST = 164INSTALL_SF_MI_LCL_LIST = 165INSTALL_SF_MI_LCL_GEN_LIST = 166INSTALL_DRIVERKIT_MI_LCL_LIST = 167INSTALL_DRIVERKIT_MI_LCL_GEN_LIST = 168INSTALL_KF_MI_LCL_LIST = 169INSTALL_KF_MI_LCL_GEN_LIST = 170INSTALL_MD_LIST = 171INSTALL_MD_GEN_LIST = 172INSTALL_DRIVERKIT_MD_LIST = 173INSTALL_DRIVERKIT_MD_GEN_LIST = 174INSTALL_KF_MD_LIST = 175INSTALL_KF_MD_GEN_LIST = 176INSTALL_MD_LCL_LIST = 177INSTALL_MD_LCL_GEN_LIST = 178INSTALL_SF_MD_LCL_LIST = 179INSTALL_SF_MD_LCL_GEN_LIST = 180INSTALL_DRIVERKIT_MD_LCL_LIST = 181INSTALL_DRIVERKIT_MD_LCL_GEN_LIST = 182INSTALL_KF_MD_LCL_LIST = 183INSTALL_KF_MD_LCL_GEN_LIST = 184 185# If there are no headers then there can be no module maps. 186INSTALLHDRS_MODULEMAPS_SKIP_HOST = YES 187 188endif 189 190ifeq ($(INSTALLHDRS_MODULEMAPS_SKIP_HOST),YES) 191INSTALL_MODULEMAP_MI_LIST = 192INSTALL_MODULEMAP_MI_LCL_LIST = 193INSTALL_MODULEMAP_MD_LIST = 194INSTALL_MODULEMAP_MD_LCL_LIST = 195endif 196 197# 198# Machine-independent (public) files 199# 200 201INSTALL_MI_INC_FILES = $(addprefix $(DSTROOT)/$(INCDIR)/$(INSTALL_MI_DIR)/, $(INSTALL_MI_LIST)) 202INSTALL_MI_INC_GEN_FILES = $(addprefix $(DSTROOT)/$(INCDIR)/$(INSTALL_MI_DIR)/, $(INSTALL_MI_GEN_LIST)) 203INSTALL_MODULEMAP_MI_INC_FILES = $(addprefix $(DSTROOT)/$(INCDIR)/$(INSTALL_MODULEMAP_MI_DIR)/,$(INSTALL_MODULEMAP_MI_LIST)) 204 205$(eval $(call INSTALLHDRS_RULE_template,$(INSTALL_MI_INC_FILES),,incmidir,$(SINCFRAME_UNIFDEF))) 206$(eval $(call INSTALLHDRS_RULE_template,$(INSTALL_MI_INC_GEN_FILES),1,incmigendir,$(SINCFRAME_UNIFDEF))) 207$(eval $(call INSTALLHDRS_RULE_template,$(INSTALL_MODULEMAP_MI_INC_FILES),,mmincmidir,-t $(DATA_UNIFDEF))) 208 209ifeq ($(DRIVERKIT),1) 210INSTALL_DRIVERKIT_MI_INC_FILES = $(addprefix $(DSTROOT)/$(DRIVERKITINCDIR)/$(INSTALL_MI_DIR)/, $(INSTALL_DRIVERKIT_MI_LIST)) 211INSTALL_DRIVERKIT_MI_INC_GEN_FILES = $(addprefix $(DSTROOT)/$(DRIVERKITINCDIR)/$(INSTALL_MI_DIR)/, $(INSTALL_DRIVERKIT_MI_GEN_LIST)) 212 213$(eval $(call INSTALLHDRS_RULE_template,$(INSTALL_DRIVERKIT_MI_INC_FILES),,dkincmidir,$(DKINCFRAME_UNIFDEF))) 214$(eval $(call INSTALLHDRS_RULE_template,$(INSTALL_DRIVERKIT_MI_INC_GEN_FILES),1,dkincmigendir,$(DKINCFRAME_UNIFDEF))) 215endif 216 217INSTALL_KF_MI_FILES = $(addprefix $(DSTROOT)/$(KINCDIR)/$(EXPORT_MI_DIR)/, $(INSTALL_KF_MI_LIST)) 218INSTALL_KF_MI_GEN_FILES = $(addprefix $(DSTROOT)/$(KINCDIR)/$(EXPORT_MI_DIR)/, $(INSTALL_KF_MI_GEN_LIST)) 219 220$(eval $(call INSTALLHDRS_RULE_template,$(INSTALL_KF_MI_FILES),,kincmidir,$(KINCFRAME_UNIFDEF))) 221$(eval $(call INSTALLHDRS_RULE_template,$(INSTALL_KF_MI_GEN_FILES),1,kincmigendir,$(KINCFRAME_UNIFDEF))) 222 223# 224# Machine-independent local (private) files 225# 226 227INSTALL_MI_LCL_FILES = $(addprefix $(DSTROOT)/$(LCLDIR)/$(INSTALL_MI_DIR)/, $(INSTALL_MI_LCL_LIST)) 228INSTALL_MI_LCL_GEN_FILES = $(addprefix $(DSTROOT)/$(LCLDIR)/$(INSTALL_MI_DIR)/, $(INSTALL_MI_LCL_GEN_LIST)) 229INSTALL_MODULEMAP_MI_LCL_FILES = $(addprefix $(DSTROOT)/$(LCLDIR)/$(INSTALL_MODULEMAP_MI_DIR)/,$(INSTALL_MODULEMAP_MI_LCL_LIST)) 230 231$(eval $(call INSTALLHDRS_RULE_template,$(INSTALL_MI_LCL_FILES),,pincmidir,$(SPINCFRAME_UNIFDEF))) 232$(eval $(call INSTALLHDRS_RULE_template,$(INSTALL_MI_LCL_GEN_FILES),1,pincmigendir,$(SPINCFRAME_UNIFDEF))) 233$(eval $(call INSTALLHDRS_RULE_template,$(INSTALL_MODULEMAP_MI_LCL_FILES),,mmpincmidir,-t $(PDATA_UNIFDEF))) 234 235INSTALL_SF_MI_LCL_FILES = $(addprefix $(DSTROOT)/$(SPINCDIR)/$(INSTALL_MI_DIR)/, $(sort $(INSTALL_SF_MI_LCL_LIST))) 236INSTALL_SF_MI_LCL_GEN_FILES = $(addprefix $(DSTROOT)/$(SPINCDIR)/$(INSTALL_MI_DIR)/, $(sort $(INSTALL_SF_MI_LCL_GEN_LIST))) 237 238$(eval $(call INSTALLHDRS_RULE_template,$(INSTALL_SF_MI_LCL_FILES),,spincmidir,$(SPINCFRAME_UNIFDEF))) 239$(eval $(call INSTALLHDRS_RULE_template,$(INSTALL_SF_MI_LCL_GEN_FILES),1,spincmigendir,$(SPINCFRAME_UNIFDEF))) 240 241ifeq ($(DRIVERKIT),1) 242INSTALL_DRIVERKIT_MI_LCL_FILES = $(addprefix $(DSTROOT)/$(DRIVERKITLCLDIR)/$(INSTALL_MI_DIR)/, $(INSTALL_DRIVERKIT_MI_LCL_LIST)) 243INSTALL_DRIVERKIT_MI_LCL_GEN_FILES = $(addprefix $(DSTROOT)/$(DRIVERKITLCLDIR)/$(INSTALL_MI_DIR)/, $(INSTALL_DRIVERKIT_MI_LCL_GEN_LIST)) 244 245$(eval $(call INSTALLHDRS_RULE_template,$(INSTALL_DRIVERKIT_MI_LCL_FILES),,dkpincmidir,$(DKPINCFRAME_UNIFDEF))) 246$(eval $(call INSTALLHDRS_RULE_template,$(INSTALL_DRIVERKIT_MI_LCL_GEN_FILES),1,dkpincmigendir,$(DKPINCFRAME_UNIFDEF))) 247endif 248 249INSTALL_KF_MI_LCL_FILES = $(addprefix $(DSTROOT)/$(KPINCDIR)/$(EXPORT_MI_DIR)/, $(INSTALL_KF_MI_LCL_LIST)) 250INSTALL_KF_MI_LCL_GEN_FILES = $(addprefix $(DSTROOT)/$(KPINCDIR)/$(EXPORT_MI_DIR)/, $(INSTALL_KF_MI_LCL_GEN_LIST)) 251 252$(eval $(call INSTALLHDRS_RULE_template,$(INSTALL_KF_MI_LCL_FILES),,kpincmidir,$(KPINCFRAME_UNIFDEF))) 253$(eval $(call INSTALLHDRS_RULE_template,$(INSTALL_KF_MI_LCL_GEN_FILES),1,kpincmigendir,$(KPINCFRAME_UNIFDEF))) 254 255# 256# Machine-dependent (public) files 257# 258 259INSTALL_MD_INC_FILES = $(addprefix $(DSTROOT)/$(INCDIR)/$(INSTALL_MD_DIR)/, $(INSTALL_MD_LIST)) 260INSTALL_MD_INC_GEN_FILES = $(addprefix $(DSTROOT)/$(INCDIR)/$(INSTALL_MD_DIR)/, $(INSTALL_MD_GEN_LIST)) 261INSTALL_MODULEMAP_MD_INC_FILES = $(addprefix $(DSTROOT)/$(INCDIR)/$(INSTALL_MODULEMAP_MD_DIR)/,$(INSTALL_MODULEMAP_MD_LIST)) 262 263$(eval $(call INSTALLHDRS_RULE_template,$(INSTALL_MD_INC_FILES),,incdir,$(SINCFRAME_UNIFDEF))) 264$(eval $(call INSTALLHDRS_RULE_template,$(INSTALL_MD_INC_GEN_FILES),1,incgendir,$(SINCFRAME_UNIFDEF))) 265$(eval $(call INSTALLHDRS_RULE_template,$(INSTALL_MODULEMAP_MD_INC_FILES),,mmincdir,-t $(DATA_UNIFDEF))) 266 267ifeq ($(DRIVERKIT),1) 268INSTALL_DRIVERKIT_MD_INC_FILES = $(addprefix $(DSTROOT)/$(DRIVERKITINCDIR)/$(INSTALL_MD_DIR)/, $(INSTALL_DRIVERKIT_MD_LIST)) 269INSTALL_DRIVERKIT_MD_INC_GEN_FILES = $(addprefix $(DSTROOT)/$(DRIVERKITINCDIR)/$(INSTALL_MD_DIR)/, $(INSTALL_DRIVERKIT_MD_GEN_LIST)) 270 271$(eval $(call INSTALLHDRS_RULE_template,$(INSTALL_DRIVERKIT_MD_INC_FILES),,dkincdir,$(DKINCFRAME_UNIFDEF))) 272$(eval $(call INSTALLHDRS_RULE_template,$(INSTALL_DRIVERKIT_MD_INC_GEN_FILES),1,dkincgendir,$(DKINCFRAME_UNIFDEF))) 273endif 274 275INSTALL_KF_MD_FILES = $(addprefix $(DSTROOT)/$(KINCDIR)/$(EXPORT_MD_DIR)/, $(INSTALL_KF_MD_LIST)) 276INSTALL_KF_MD_GEN_FILES = $(addprefix $(DSTROOT)/$(KINCDIR)/$(EXPORT_MD_DIR)/, $(INSTALL_KF_MD_GEN_LIST)) 277 278$(eval $(call INSTALLHDRS_RULE_template,$(INSTALL_KF_MD_FILES),,kincdir,$(KINCFRAME_UNIFDEF))) 279$(eval $(call INSTALLHDRS_RULE_template,$(INSTALL_KF_MD_GEN_FILES),1,kincgendir,$(KINCFRAME_UNIFDEF))) 280 281# 282# Machine-dependent local (private) files 283# 284 285INSTALL_MD_LCL_FILES = $(addprefix $(DSTROOT)/$(LCLDIR)/$(INSTALL_MD_DIR)/, $(sort $(INSTALL_MD_LCL_LIST))) 286INSTALL_MD_LCL_GEN_FILES = $(addprefix $(DSTROOT)/$(LCLDIR)/$(INSTALL_MD_DIR)/, $(sort $(INSTALL_MD_LCL_GEN_LIST))) 287INSTALL_MODULEMAP_MD_LCL_FILES = $(addprefix $(DSTROOT)/$(LCLDIR)/$(INSTALL_MODULEMAP_MD_DIR)/,$(INSTALL_MODULEMAP_MD_LCL_LIST)) 288 289$(eval $(call INSTALLHDRS_RULE_template,$(INSTALL_MD_LCL_FILES),,pincdir,$(SPINCFRAME_UNIFDEF))) 290$(eval $(call INSTALLHDRS_RULE_template,$(INSTALL_MD_LCL_GEN_FILES),1,pincgendir,$(SPINCFRAME_UNIFDEF))) 291$(eval $(call INSTALLHDRS_RULE_template,$(INSTALL_MODULEMAP_MD_LCL_FILES),,mmpincdir,-t $(PDATA_UNIFDEF))) 292 293INSTALL_SF_MD_LCL_FILES = $(addprefix $(DSTROOT)/$(SPINCDIR)/$(INSTALL_MD_DIR)/, $(sort $(INSTALL_SF_MD_LCL_LIST))) 294INSTALL_SF_MD_LCL_GEN_FILES = $(addprefix $(DSTROOT)/$(SPINCDIR)/$(INSTALL_MD_DIR)/, $(sort $(INSTALL_SF_MD_LCL_GEN_LIST))) 295 296$(eval $(call INSTALLHDRS_RULE_template,$(INSTALL_SF_MD_LCL_FILES),,spincdir,$(SPINCFRAME_UNIFDEF))) 297$(eval $(call INSTALLHDRS_RULE_template,$(INSTALL_SF_MD_LCL_GEN_FILES),1,spincgendir,$(SPINCFRAME_UNIFDEF))) 298 299ifeq ($(DRIVERKIT),1) 300INSTALL_DRIVERKIT_MD_LCL_FILES = $(addprefix $(DSTROOT)/$(DRIVERKITLCLDIR)/$(INSTALL_MD_DIR)/, $(INSTALL_DRIVERKIT_MD_LCL_LIST)) 301INSTALL_DRIVERKIT_MD_LCL_GEN_FILES = $(addprefix $(DSTROOT)/$(DRIVERKITLCLDIR)/$(INSTALL_MD_DIR)/, $(INSTALL_DRIVERKIT_MD_LCL_GEN_LIST)) 302 303$(eval $(call INSTALLHDRS_RULE_template,$(INSTALL_DRIVERKIT_MD_LCL_FILES),,dkpincdir,$(DKPINCFRAME_UNIFDEF))) 304$(eval $(call INSTALLHDRS_RULE_template,$(INSTALL_DRIVERKIT_MD_LCL_GEN_FILES),1,dkpincgendir,$(DKPINCFRAME_UNIFDEF))) 305endif 306 307INSTALL_KF_MD_LCL_FILES = $(addprefix $(DSTROOT)/$(KPINCDIR)/$(EXPORT_MD_DIR)/, $(INSTALL_KF_MD_LCL_LIST)) 308INSTALL_KF_MD_LCL_GEN_FILES = $(addprefix $(DSTROOT)/$(KPINCDIR)/$(EXPORT_MD_DIR)/, $(INSTALL_KF_MD_LCL_GEN_LIST)) 309 310$(eval $(call INSTALLHDRS_RULE_template,$(INSTALL_KF_MD_LCL_FILES),,kpincdir,$(KPINCFRAME_UNIFDEF))) 311$(eval $(call INSTALLHDRS_RULE_template,$(INSTALL_KF_MD_LCL_GEN_FILES),1,kpincgendir,$(KPINCFRAME_UNIFDEF))) 312 313.PHONY: do_installhdrs_mi 314 315# Double-colon rule so that MakeInc.kernel can add custom behaviors 316do_installhdrs_mi:: $(INSTALL_MI_INC_FILES) $(INSTALL_MI_INC_GEN_FILES) $(INSTALL_MODULEMAP_MI_INC_FILES) \ 317 $(INSTALL_DRIVERKIT_MI_INC_FILES) $(INSTALL_DRIVERKIT_MI_INC_GEN_FILES) \ 318 $(INSTALL_KF_MI_FILES) $(INSTALL_KF_MI_GEN_FILES) \ 319 $(INSTALL_MI_LCL_FILES) $(INSTALL_MI_LCL_GEN_FILES) $(INSTALL_MODULEMAP_MI_LCL_FILES) \ 320 $(INSTALL_SF_MI_LCL_FILES) $(INSTALL_SF_MI_LCL_GEN_FILES) \ 321 $(INSTALL_DRIVERKIT_MI_LCL_FILES) $(INSTALL_DRIVERKIT_MI_LCL_GEN_FILES) \ 322 $(INSTALL_KF_MI_LCL_FILES) $(INSTALL_KF_MI_LCL_GEN_FILES) 323 @: 324 325.PHONY: do_installhdrs_md 326 327do_installhdrs_md: $(INSTALL_MD_INC_FILES) $(INSTALL_MD_INC_GEN_FILES) $(INSTALL_MODULEMAP_MD_INC_FILES) \ 328 $(INSTALL_DRIVERKIT_MD_INC_FILES) $(INSTALL_DRIVERKIT_MD_INC_GEN_FILES) \ 329 $(INSTALL_KF_MD_FILES) $(INSTALL_KF_MD_GEN_FILES) \ 330 $(INSTALL_MD_LCL_FILES) $(INSTALL_MD_LCL_GEN_FILES) $(INSTALL_MODULEMAP_MD_LCL_FILES) \ 331 $(INSTALL_SF_MD_LCL_FILES) $(INSTALL_SF_MD_LCL_GEN_FILES) \ 332 $(INSTALL_DRIVERKIT_MD_LCL_FILES) $(INSTALL_DRIVERKIT_MD_LCL_GEN_FILES) \ 333 $(INSTALL_KF_MD_LCL_FILES) $(INSTALL_KF_MD_LCL_GEN_FILES) 334 @: 335 336# 337# Generic Export rules 338# 339EXPORT_MI_INC_FILES = $(addprefix $(OBJROOT)/$(EXPDIR)/$(EXPORT_MI_DIR)/, $(EXPORT_MI_LIST)) 340EXPORT_MI_GEN_INC_FILES = $(addprefix $(OBJROOT)/$(EXPDIR)/$(EXPORT_MI_DIR)/, $(EXPORT_MI_GEN_LIST)) 341 342.PHONY: EXP_MI_INC_DIR 343 344EXP_MI_INC_DIR: 345 $(_v)$(MKDIR) $(OBJROOT)/$(EXPDIR)/$(EXPORT_MI_DIR) 346 347$(EXPORT_MI_GEN_INC_FILES): $(OBJROOT)/$(EXPDIR)/$(EXPORT_MI_DIR)/% : % | EXP_MI_INC_DIR 348 $(_v)$(INSTALL) $(DATA_INSTALL_FLAGS_RO) $< $@ 349 350$(EXPORT_MI_INC_FILES): $(OBJROOT)/$(EXPDIR)/$(EXPORT_MI_DIR)/% : $(SOURCE)/% | EXP_MI_INC_DIR 351 $(_v)$(INSTALL) $(DATA_INSTALL_FLAGS_RO) $< $@ 352 353EXPORT_MD_INC_FILES = $(addprefix $(OBJROOT)/$(EXPDIR)/$(EXPORT_MD_DIR)/, $(EXPORT_MD_LIST)) 354EXPORT_MD_GEN_INC_FILES = $(addprefix $(OBJROOT)/$(EXPDIR)/$(EXPORT_MD_DIR)/, $(EXPORT_MD_GEN_LIST)) 355 356.PHONY: EXP_MD_INC_DIR 357 358EXP_MD_INC_DIR: 359 $(_v)$(MKDIR) $(OBJROOT)/$(EXPDIR)/$(EXPORT_MD_DIR) 360 361$(EXPORT_MD_GEN_INC_FILES): $(OBJROOT)/$(EXPDIR)/$(EXPORT_MD_DIR)/% : % | EXP_MD_INC_DIR 362 $(_v)$(INSTALL) $(DATA_INSTALL_FLAGS_RO) $< $@ 363 364$(EXPORT_MD_INC_FILES): $(OBJROOT)/$(EXPDIR)/$(EXPORT_MD_DIR)/% : $(SOURCE)/% | EXP_MD_INC_DIR 365 $(_v)$(INSTALL) $(DATA_INSTALL_FLAGS_RO) $< $@ 366 367.PHONY: do_exporthdrs_mi 368 369do_exporthdrs_mi: $(EXPORT_MI_GEN_INC_FILES) $(EXPORT_MI_INC_FILES) 370 @: 371 372.PHONY: do_exporthdrs_md 373 374do_exporthdrs_md: $(EXPORT_MD_GEN_INC_FILES) $(EXPORT_MD_INC_FILES) 375 @: 376 377# 378# Generic Compilation rules 379# 380 381# 382# Compilation rules to generate .o from .s 383# 384 385S_RULE_0=@$(LOG_AS) "$@" 386S_RULE_1A=$(_v)${S_KCC} -c ${SFLAGS} -MD -MF $(@:o=d) -MP ${$@_SFLAGS_ADD} ${INCFLAGS} ${$@_INCFLAGS} 387S_RULE_1B=$(<F) 388S_RULE_2= 389 390# 391# Compilation rules to generate .o from .c for normal files 392# 393C_RULE_0=@$(LOG_CC) "$@" 394C_RULE_1A=$(_v)${KCC} -c ${filter-out ${$@_CFLAGS_RM}, ${CFLAGS} ${CWARNFLAGS}} -MD -MF $(@:o=d) -MP ${$@_CFLAGS_ADD} ${$@_CWARNFLAGS_ADD} ${INCFLAGS} ${$@_INCFLAGS} 395C_RULE_1B=$(<F) 396C_RULE_2= 397 398C_RULE_3= 399C_RULE_4A= 400C_RULE_4B= 401 402# 403# Compilation rules to generate .o from .c for driver files 404# 405C_RULE_0_D=${C_RULE_0} 406C_RULE_1A_D=${C_RULE_1A} 407C_RULE_1B_D=${C_RULE_1B} 408C_RULE_2_D=${C_RULE_2} 409C_RULE_3_D=${C_RULE_3} 410C_RULE_4A_D=${C_RULE_4A} 411C_RULE_4B_D=${C_RULE_4B} 412 413# 414# Compilation rules to generate .co from .cp or .cpo from .cpp 415# The config tool slickly changes the last source filename char to 'o' 416# for the object filename. 417P_RULE_0=@$(LOG_CXX) "$@" 418P_RULE_1A=$(_v)${KC++} -o $@ -c ${CXXFLAGS} ${filter-out ${$@_CFLAGS_RM}, ${CFLAGS} ${CXXWARNFLAGS}} -MD -MF $(@:o=d) -MP ${$@_CFLAGS_ADD} ${$@_CXXWARNFLAGS_ADD} ${INCFLAGS} ${$@_INCFLAGS} 419P_RULE_1B=$(<F) 420P_RULE_2= 421 422P_RULE_3= 423P_RULE_4A= 424P_RULE_4B= 425 426# 427# Explain how to make the bsd syscall list 428# 429$(TARGET)/bsd.syscalls.master: $(SRCROOT)/bsd/kern/syscalls.master $(MAKESYSCALLS) 430 @$(LOG_GENERATE) "$(@F)$(Color0) from $(ColorF)$<$(Color0)" 431 $(_v)$(UNIFDEF) $(SEED_DEFINES) $< > $@; \ 432 if [ $$? -eq 2 ]; then \ 433 $(ERR) Parse failure for $<; \ 434 exit 1; \ 435 fi 436 437# 438# This isn't the right place to put this, but we need to := override some settings 439# in Makefiles that include the generic helper fragments (like this file) 440# 441ifeq ($(BUILD_JSON_COMPILATION_DATABASE),1) 442HIB_FILES := 443LAST_FILES := 444KLD_FILES := 445endif 446 447.PHONY: do_build_all 448 449# Do-nothing rule, since not all levels of the recursive hierarchy might implement this 450# in their local Makefiles. Those that do will use a "::" rule to augment this. 451do_build_all:: 452 @: 453 454.PHONY: do_build_install_primary 455 456# Do-nothing rule, since not all levels of the recursive hierarchy might implement this 457# in their local Makefiles. Those that do will use a "::" rule to augment this. 458do_build_install_primary:: 459 @: 460 461.PHONY: do_build_install_non_primary 462 463# Do-nothing rule, since not all levels of the recursive hierarchy might implement this 464# in their local Makefiles. Those that do will use a "::" rule to augment this. 465do_build_install_non_primary:: 466 @: 467 468INSTALL_MAN_FILES = $(addprefix $(DSTROOT)/$(MANDIR)/$(INSTALL_MAN_DIR)/, $(INSTALL_MAN_LIST)) 469 470.PHONY: INSTALL_MAN_DIR 471 472INSTALL_MAN_DIR: 473 $(_v)$(MKDIR) $(DSTROOT)/$(MANDIR)/$(INSTALL_MAN_DIR) 474 475$(INSTALL_MAN_FILES): $(DSTROOT)/$(MANDIR)/$(INSTALL_MAN_DIR)/% : % | INSTALL_MAN_DIR 476 @$(LOG_MAN) "$*" 477 $(_v)$(INSTALL) $(INSTALL_FLAGS) $< $@ 478 479define MAN_LINKS_RULE_template 480$$(DSTROOT)/$$(MANDIR)/$$(INSTALL_MAN_DIR)/$(2): $$(DSTROOT)/$$(MANDIR)/$$(INSTALL_MAN_DIR)/$(1) 481 @$$(LOG_MANLINK) "$(2)" 482 $(_v)ln -f $$< $$@ 483endef 484 485function_generate_man_links_rules = $(if $(word 1,$(1)),$(eval $(call MAN_LINKS_RULE_template,$(word 1,$(1)),$(word 2,$(1)))) $(DSTROOT)/$(MANDIR)/$(INSTALL_MAN_DIR)/$(word 2,$(1)) $(call function_generate_man_links_rules,$(wordlist 3,$(words $(1)),$(1)))) 486 487INSTALL_MAN_FILES_LINKS = $(call function_generate_man_links_rules,$(INSTALL_MAN_LINKS)) 488 489.PHONY: do_installman 490 491do_installman: $(INSTALL_MAN_FILES) $(INSTALL_MAN_FILES_LINKS) 492 @: 493 494.PHONY: do_textfiles_install do_textfiles_install_mi do_textfiles_install_md 495 496# Do-nothing rule, since not all levels of the recursive hierarchy might implement this 497# in their local Makefiles. Those that do will use a "::" rule to augment this. 498do_textfiles_install_mi:: do_installman 499 @: 500 501# Do-nothing rule, since not all levels of the recursive hierarchy might implement this 502# in their local Makefiles. Those that do will use a "::" rule to augment this. 503do_textfiles_install_md:: 504 @: 505 506.PHONY: do_build_setup 507 508# Do-nothing rule, since not all levels of the recursive hierarchy might implement this 509# in their local Makefiles. Those that do will use a "::" rule to augment this. 510do_build_setup:: 511 @: 512 513.PHONY: do_config_all 514 515# Do-nothing rule, since not all levels of the recursive hierarchy might implement this 516# in their local Makefiles. Those that do will use a "::" rule to augment this. 517do_config_all:: 518 @: 519 520.PHONY: do_config_install_primary 521 522# Do-nothing rule, since not all levels of the recursive hierarchy might implement this 523# in their local Makefiles. Those that do will use a "::" rule to augment this. 524do_config_install_primary:: 525 @: 526 527.PHONY: do_config_install_variant 528 529# Do-nothing rule, since not all levels of the recursive hierarchy might implement this 530# in their local Makefiles. Those that do will use a "::" rule to augment this. 531do_config_install_variant:: 532 @: 533 534.PHONY: do_config_install 535 536# Do-nothing rule, since not all levels of the recursive hierarchy might implement this 537# in their local Makefiles. Those that do will use a "::" rule to augment this. 538do_config_install:: 539 @: 540 541# vim: set ft=make: 542