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