1 # -*- mode: makefile;-*-
3 # Copyright (C) 1999-2016 Apple Inc. All rights reserved.
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.
13 # Generic Install rules
16 ifndef INSTALL_KF_MI_LCL_LIST
17 INSTALL_KF_MI_LCL_LIST = $(EXPORT_MI_LIST)
20 ifndef INSTALL_KF_MI_LCL_GEN_LIST
21 INSTALL_KF_MI_LCL_GEN_LIST = $(EXPORT_MI_GEN_LIST)
24 ifndef INSTALL_KF_MD_LCL_LIST
25 INSTALL_KF_MD_LCL_LIST = $(EXPORT_MD_LIST)
28 ifndef INSTALL_KF_MD_LCL_GEN_LIST
29 INSTALL_KF_MD_LCL_GEN_LIST = $(EXPORT_MD_GEN_LIST)
32 ifndef INSTALL_KF_MI_LIST
33 INSTALL_KF_MI_LIST = $(EXPORT_MI_LIST)
36 ifndef INSTALL_KF_MI_GEN_LIST
37 INSTALL_KF_MI_GEN_LIST = $(EXPORT_MI_GEN_LIST)
40 ifndef INSTALL_KF_MD_LIST
41 INSTALL_KF_MD_LIST = $(EXPORT_MD_LIST)
44 ifndef INSTALL_KF_MD_GEN_LIST
45 INSTALL_KF_MD_GEN_LIST = $(EXPORT_MD_GEN_LIST)
48 ifeq (${XNU_LOGCOLORS},y)
53 # Get a nice list of device code names associated with the build platform
55 #ifdef EMBEDDED_DEVICE_MAP
56 # export CDevs := $(shell $(EMBEDDED_DEVICE_MAP) -db $(EDM_DBPATH) -query "SELECT DISTINCT TargetType FROM Targets WHERE KernelPlatform = '$(CURRENT_MACHINE_CONFIG_LC)'" | tr '[\r\n]' ':' | sed 's,:$$,,')
60 export _MACHINE := $(CURRENT_MACHINE_CONFIG_LC)
61 ifeq ($(CURRENT_MACHINE_CONFIG),NONE)
62 export _MACHINE := $(subst OSX,,$(PLATFORM))
64 export MACHINE_PFX := $(shell __A="$(CURRENT_ARCH_CONFIG_LC)"; \
65 __As=$$((6-$${\#__A})); \
66 printf "%-.6s%*.*s %9.9s" \
68 $${__As} $${__As} " " \
71 override LOG_PFX_LEN := 30
72 override LOG_PFX_LEN_ADJ := $(shell __TMP="$(MACHINE_PFX)"; \
73 printf "%d" $$(($(LOG_PFX_LEN) - $${\#__TMP} - 3)))
74 MACHINE_PFX_COL = $(shell printf "\\033[1m%s\\033[m" "$(MACHINE_PFX)")
75 # Turn off colored output
76 Color0:=$(shell printf "\\033[m")
77 # Start a host command: bold text
78 ColorH:=$(shell printf "\\033[1m")
79 # Start a compilation-related command: blue text
80 ColorC:=$(shell printf "[$(MACHINE_PFX_COL)] \\033[1;34m")
81 # Start a MIG command: green text
82 ColorM:=$(shell printf "[$(MACHINE_PFX_COL)] \\033[1;32m")
83 # Start a linking command: purple text
84 ColorL:=$(shell printf "[$(MACHINE_PFX_COL)] \\033[1;35m")
86 ColorF:=$(shell printf "")
87 # Start a linked file name: italic text
88 ColorLF:=$(shell printf "\\033[3m")
89 # Error strings: red text
90 ColorErr:=$(shell printf "\033[31m")
97 # $(1) is the list of install paths
98 # $(2) is "1" if it's a "GEN"-style rule that looks locally, or else $(SOURCE)
99 # $(3) is the local temp directory for processing
100 # $(4) is the unifdef flags
102 # $$$$$$$$ is a double-escaped "$$" to represent the current pid
103 # of the shell process for creating uniquely named temporary files
105 define INSTALLHDRS_RULE_template
110 $$(_v)$$(MKDIR) ./$(3)
111 $$(_v)$$(MKDIR) $(dir $(firstword $(1)))
113 # Rebuild if unifdef flags change
114 $(1): $(3)/.UNIFDEF_FLAGS
115 $(3)/.UNIFDEF_FLAGS: ALWAYS | $(3)_MKDIR
116 $$(_v)$$(REPLACECONTENTS) $$@ $$(UNIFDEF) $(4)
118 $(1): $(dir $(firstword $(1)))% : $(if $(2),%,$$(SOURCE)/%) | $(3)_MKDIR
119 @$$(LOG_INSTALLHDR) "$$*"
120 $$(_v)$$(UNIFDEF) $(4) $$< > ./$(3)/$$*.unifdef.$$$$$$$$; \
121 if [ $$$$? -eq 2 ]; then \
122 $(ERR) Parse failure for $$<; \
125 $$(DECOMMENT) ./$(3)/$$*.unifdef.$$$$$$$$ r > \
126 ./$(3)/$$*.strip.$$$$$$$$ || exit 1; \
127 if [ -s ./$(3)/$$*.strip.$$$$$$$$ ]; then \
128 $$(INSTALL) $$(INSTALL_FLAGS) ./$(3)/$$*.unifdef.$$$$$$$$ $$@ || exit 1; \
130 $$(RM) ./$(3)/$$*.unifdef.$$$$$$$$ ./$(3)/$$*.strip.$$$$$$$$
133 # $(1) is the list of install paths
134 # $(2) is the source path pattern (using % to match with $(5)) or source file
135 # $(3) is the local temp directory for processing
136 # $(4) is the unifdef flags
137 # $(5) is the destination directory (when pattern matching) or empty
139 # $$$$$$$$ is a double-escaped "$$" to represent the current pid
140 # of the shell process for creating uniquely named temporary files
142 define INSTALLPYTHON_RULE_template
147 $$(_v)$$(MKDIR) ./$(3)
149 # Rebuild if unifdef flags change
150 $(1): $(3)/.UNIFDEF_FLAGS
151 $(3)/.UNIFDEF_FLAGS: ALWAYS | $(3)_MKDIR
152 $$(_v)$$(REPLACECONTENTS) $$@ $$(UNIFDEF) -t $(4)
154 $(1): $(5)% : $(2) | $(3)_MKDIR
155 @$$(LOG_INSTALLPY) "$$*"
156 $$(_v)$$(MKDIR) $$(dir $$@) $$(dir ./$(3)/$$*)
157 $$(_v)$$(UNIFDEF) -t $(4) $$< > ./$(3)/$$*.unifdef.$$$$$$$$$$(suffix $$*); \
158 if [ $$$$? -eq 2 ]; then \
159 $(ERR) Parse failure for $$<; \
162 $$(INSTALL) $$(DATA_INSTALL_FLAGS) \
163 ./$(3)/$$*.unifdef.$$$$$$$$$$(suffix $$*) $$@ || exit 1; \
164 $$(PYTHON) $$(LLDBMACROS_SOURCE)/core/syntax_checker.py \
165 ./$(3)/$$*.unifdef.$$$$$$$$$$(suffix $$*) $$(_vstdout) || exit 1; \
166 $$(RM) ./$(3)/$$*.unifdef.$$$$$$$$$$(suffix $$*)
167 $$(_v)if [ -n "$(5)" ]; then $$(TOUCH) "$(5)"; fi
171 # Empty the install lists of non-host headers if building the host headers alias
174 ifeq ($(INSTALLHDRS_SKIP_HOST),YES)
176 INSTALL_MI_GEN_LIST =
177 INSTALL_DRIVERKIT_MI_LIST =
178 INSTALL_DRIVERKIT_MI_GEN_LIST =
180 INSTALL_KF_MI_GEN_LIST =
181 INSTALL_MI_LCL_LIST =
182 INSTALL_MI_LCL_GEN_LIST =
183 INSTALL_DRIVERKIT_MI_LCL_LIST =
184 INSTALL_DRIVERKIT_MI_LCL_GEN_LIST =
185 INSTALL_KF_MI_LCL_LIST =
186 INSTALL_KF_MI_LCL_GEN_LIST =
188 INSTALL_MD_GEN_LIST =
189 INSTALL_DRIVERKIT_MD_LIST =
190 INSTALL_DRIVERKIT_MD_GEN_LIST =
192 INSTALL_KF_MD_GEN_LIST =
193 INSTALL_MD_LCL_LIST =
194 INSTALL_MD_LCL_GEN_LIST =
195 INSTALL_DRIVERKIT_MD_LCL_LIST =
196 INSTALL_DRIVERKIT_MD_LCL_GEN_LIST =
197 INSTALL_KF_MD_LCL_LIST =
198 INSTALL_KF_MD_LCL_GEN_LIST =
199 INSTALL_MODULEMAP_INCDIR_MI_LIST =
203 # Machine-independent (public) files
206 INSTALL_MI_INC_FILES = $(addprefix $(DSTROOT)/$(INCDIR)/$(INSTALL_MI_DIR)/, $(INSTALL_MI_LIST))
207 INSTALL_MI_INC_GEN_FILES = $(addprefix $(DSTROOT)/$(INCDIR)/$(INSTALL_MI_DIR)/, $(INSTALL_MI_GEN_LIST))
209 $(eval $(call INSTALLHDRS_RULE_template,$(INSTALL_MI_INC_FILES),,incmidir,$(SINCFRAME_UNIFDEF)))
210 $(eval $(call INSTALLHDRS_RULE_template,$(INSTALL_MI_INC_GEN_FILES),1,incmigendir,$(SINCFRAME_UNIFDEF)))
212 ifeq ($(DRIVERKIT),1)
213 INSTALL_DRIVERKIT_MI_INC_FILES = $(addprefix $(DSTROOT)/$(DRIVERKITINCDIR)/$(INSTALL_MI_DIR)/, $(INSTALL_DRIVERKIT_MI_LIST))
214 INSTALL_DRIVERKIT_MI_INC_GEN_FILES = $(addprefix $(DSTROOT)/$(DRIVERKITINCDIR)/$(INSTALL_MI_DIR)/, $(INSTALL_DRIVERKIT_MI_GEN_LIST))
216 $(eval $(call INSTALLHDRS_RULE_template,$(INSTALL_DRIVERKIT_MI_INC_FILES),,dkincmidir,$(DKINCFRAME_UNIFDEF)))
217 $(eval $(call INSTALLHDRS_RULE_template,$(INSTALL_DRIVERKIT_MI_INC_GEN_FILES),1,dkincmigendir,$(DKINCFRAME_UNIFDEF)))
220 INSTALL_KF_MI_FILES = $(addprefix $(DSTROOT)/$(KINCDIR)/$(EXPORT_MI_DIR)/, $(INSTALL_KF_MI_LIST))
221 INSTALL_KF_MI_GEN_FILES = $(addprefix $(DSTROOT)/$(KINCDIR)/$(EXPORT_MI_DIR)/, $(INSTALL_KF_MI_GEN_LIST))
223 $(eval $(call INSTALLHDRS_RULE_template,$(INSTALL_KF_MI_FILES),,kincmidir,$(KINCFRAME_UNIFDEF)))
224 $(eval $(call INSTALLHDRS_RULE_template,$(INSTALL_KF_MI_GEN_FILES),1,kincmigendir,$(KINCFRAME_UNIFDEF)))
226 # Skip INSTALL_MI_DIR to install directly to INCDIR.
227 INSTALL_MODULEMAP_INCDIR_MI_INC_FILES = $(addprefix $(DSTROOT)/$(INCDIR)/,$(INSTALL_MODULEMAP_INCDIR_MI_LIST))
229 $(eval $(call INSTALLHDRS_RULE_template,$(INSTALL_MODULEMAP_INCDIR_MI_INC_FILES),,mmrootincmidir,-t $(DATA_UNIFDEF)))
232 # Machine-independent local (private) files
235 ifeq ($(LIBKERN_USE_USR_LOCAL_INCLUDE),)
236 INSTALL_MI_LCL_FILES = $(addprefix $(DSTROOT)/$(LCLDIR)/$(INSTALL_MI_DIR)/, $(sort $(INSTALL_MI_LCL_LIST) $(INSTALL_MI_LIST)))
237 INSTALL_MI_LCL_GEN_FILES = $(addprefix $(DSTROOT)/$(LCLDIR)/$(INSTALL_MI_DIR)/, $(sort $(INSTALL_MI_LCL_GEN_LIST) $(INSTALL_MI_GEN_LIST)))
239 INSTALL_MI_LCL_FILES = $(addprefix $(DSTROOT)/$(LCLDIR)/$(INSTALL_MI_DIR)/, $(sort $(INSTALL_MI_LCL_LIST)))
240 INSTALL_MI_LCL_GEN_FILES = $(addprefix $(DSTROOT)/$(LCLDIR)/$(INSTALL_MI_DIR)/, $(sort $(INSTALL_MI_LCL_GEN_LIST)))
243 $(eval $(call INSTALLHDRS_RULE_template,$(INSTALL_MI_LCL_FILES),,pincmidir,$(SPINCFRAME_UNIFDEF)))
244 $(eval $(call INSTALLHDRS_RULE_template,$(INSTALL_MI_LCL_GEN_FILES),1,pincmigendir,$(SPINCFRAME_UNIFDEF)))
246 ifeq ($(DRIVERKIT),1)
247 INSTALL_DRIVERKIT_MI_LCL_FILES = $(addprefix $(DSTROOT)/$(DRIVERKITLCLDIR)/$(INSTALL_MI_DIR)/, $(INSTALL_DRIVERKIT_MI_LCL_LIST))
248 INSTALL_DRIVERKIT_MI_LCL_GEN_FILES = $(addprefix $(DSTROOT)/$(DRIVERKITLCLDIR)/$(INSTALL_MI_DIR)/, $(INSTALL_DRIVERKIT_MI_LCL_GEN_LIST))
250 $(eval $(call INSTALLHDRS_RULE_template,$(INSTALL_DRIVERKIT_MI_LCL_FILES),,dkpincmidir,$(DKPINCFRAME_UNIFDEF)))
251 $(eval $(call INSTALLHDRS_RULE_template,$(INSTALL_DRIVERKIT_MI_LCL_GEN_FILES),1,dkpincmigendir,$(DKPINCFRAME_UNIFDEF)))
254 INSTALL_KF_MI_LCL_FILES = $(addprefix $(DSTROOT)/$(KPINCDIR)/$(EXPORT_MI_DIR)/, $(INSTALL_KF_MI_LCL_LIST))
255 INSTALL_KF_MI_LCL_GEN_FILES = $(addprefix $(DSTROOT)/$(KPINCDIR)/$(EXPORT_MI_DIR)/, $(INSTALL_KF_MI_LCL_GEN_LIST))
257 $(eval $(call INSTALLHDRS_RULE_template,$(INSTALL_KF_MI_LCL_FILES),,kpincmidir,$(KPINCFRAME_UNIFDEF)))
258 $(eval $(call INSTALLHDRS_RULE_template,$(INSTALL_KF_MI_LCL_GEN_FILES),1,kpincmigendir,$(KPINCFRAME_UNIFDEF)))
261 # Machine-dependent (public) files
264 INSTALL_MD_INC_FILES = $(addprefix $(DSTROOT)/$(INCDIR)/$(INSTALL_MD_DIR)/, $(INSTALL_MD_LIST))
265 INSTALL_MD_INC_GEN_FILES = $(addprefix $(DSTROOT)/$(INCDIR)/$(INSTALL_MD_DIR)/, $(INSTALL_MD_GEN_LIST))
267 $(eval $(call INSTALLHDRS_RULE_template,$(INSTALL_MD_INC_FILES),,incdir,$(SINCFRAME_UNIFDEF)))
268 $(eval $(call INSTALLHDRS_RULE_template,$(INSTALL_MD_INC_GEN_FILES),1,incgendir,$(SINCFRAME_UNIFDEF)))
270 ifeq ($(DRIVERKIT),1)
271 INSTALL_DRIVERKIT_MD_INC_FILES = $(addprefix $(DSTROOT)/$(DRIVERKITINCDIR)/$(INSTALL_MD_DIR)/, $(INSTALL_DRIVERKIT_MD_LIST))
272 INSTALL_DRIVERKIT_MD_INC_GEN_FILES = $(addprefix $(DSTROOT)/$(DRIVERKITINCDIR)/$(INSTALL_MD_DIR)/, $(INSTALL_DRIVERKIT_MD_GEN_LIST))
274 $(eval $(call INSTALLHDRS_RULE_template,$(INSTALL_DRIVERKIT_MD_INC_FILES),,dkincdir,$(DKINCFRAME_UNIFDEF)))
275 $(eval $(call INSTALLHDRS_RULE_template,$(INSTALL_DRIVERKIT_MD_INC_GEN_FILES),1,dkincgendir,$(DKINCFRAME_UNIFDEF)))
278 INSTALL_KF_MD_FILES = $(addprefix $(DSTROOT)/$(KINCDIR)/$(EXPORT_MD_DIR)/, $(INSTALL_KF_MD_LIST))
279 INSTALL_KF_MD_GEN_FILES = $(addprefix $(DSTROOT)/$(KINCDIR)/$(EXPORT_MD_DIR)/, $(INSTALL_KF_MD_GEN_LIST))
281 $(eval $(call INSTALLHDRS_RULE_template,$(INSTALL_KF_MD_FILES),,kincdir,$(KINCFRAME_UNIFDEF)))
282 $(eval $(call INSTALLHDRS_RULE_template,$(INSTALL_KF_MD_GEN_FILES),1,kincgendir,$(KINCFRAME_UNIFDEF)))
285 # Machine-dependent local (private) files
288 ifeq ($(LIBKERN_USE_USR_LOCAL_INCLUDE),)
289 INSTALL_MD_LCL_FILES = $(addprefix $(DSTROOT)/$(LCLDIR)/$(INSTALL_MD_DIR)/, $(sort $(INSTALL_MD_LCL_LIST) $(INSTALL_MD_LIST)))
290 INSTALL_MD_LCL_GEN_FILES = $(addprefix $(DSTROOT)/$(LCLDIR)/$(INSTALL_MD_DIR)/, $(sort $(INSTALL_MD_LCL_GEN_LIST) $(INSTALL_MD_GEN_LIST)))
292 INSTALL_MD_LCL_FILES = $(addprefix $(DSTROOT)/$(LCLDIR)/$(INSTALL_MD_DIR)/, $(sort $(INSTALL_MD_LCL_LIST)))
293 INSTALL_MD_LCL_GEN_FILES = $(addprefix $(DSTROOT)/$(LCLDIR)/$(INSTALL_MD_DIR)/, $(sort $(INSTALL_MD_LCL_GEN_LIST)))
296 $(eval $(call INSTALLHDRS_RULE_template,$(INSTALL_MD_LCL_FILES),,pincdir,$(SPINCFRAME_UNIFDEF)))
297 $(eval $(call INSTALLHDRS_RULE_template,$(INSTALL_MD_LCL_GEN_FILES),1,pincgendir,$(SPINCFRAME_UNIFDEF)))
299 ifeq ($(DRIVERKIT),1)
300 INSTALL_DRIVERKIT_MD_LCL_FILES = $(addprefix $(DSTROOT)/$(DRIVERKITLCLDIR)/$(INSTALL_MD_DIR)/, $(INSTALL_DRIVERKIT_MD_LCL_LIST))
301 INSTALL_DRIVERKIT_MD_LCL_GEN_FILES = $(addprefix $(DSTROOT)/$(DRIVERKITLCLDIR)/$(INSTALL_MD_DIR)/, $(INSTALL_DRIVERKIT_MD_LCL_GEN_LIST))
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)))
307 INSTALL_KF_MD_LCL_FILES = $(addprefix $(DSTROOT)/$(KPINCDIR)/$(EXPORT_MD_DIR)/, $(INSTALL_KF_MD_LCL_LIST))
308 INSTALL_KF_MD_LCL_GEN_FILES = $(addprefix $(DSTROOT)/$(KPINCDIR)/$(EXPORT_MD_DIR)/, $(INSTALL_KF_MD_LCL_GEN_LIST))
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)))
313 .PHONY: do_installhdrs_mi
315 # Double-colon rule so that MakeInc.kernel can add custom behaviors
316 do_installhdrs_mi:: $(INSTALL_MI_INC_FILES) $(INSTALL_MI_INC_GEN_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) \
320 $(INSTALL_DRIVERKIT_MI_LCL_FILES) $(INSTALL_DRIVERKIT_MI_LCL_GEN_FILES) \
321 $(INSTALL_KF_MI_LCL_FILES) $(INSTALL_KF_MI_LCL_GEN_FILES) \
322 $(INSTALL_MODULEMAP_INCDIR_MI_INC_FILES)
325 .PHONY: do_installhdrs_md
327 do_installhdrs_md: $(INSTALL_MD_INC_FILES) $(INSTALL_MD_INC_GEN_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) \
331 $(INSTALL_DRIVERKIT_MD_LCL_FILES) $(INSTALL_DRIVERKIT_MD_LCL_GEN_FILES) \
332 $(INSTALL_KF_MD_LCL_FILES) $(INSTALL_KF_MD_LCL_GEN_FILES)
336 # Generic Export rules
338 EXPORT_MI_INC_FILES = $(addprefix $(OBJROOT)/$(EXPDIR)/$(EXPORT_MI_DIR)/, $(EXPORT_MI_LIST))
339 EXPORT_MI_GEN_INC_FILES = $(addprefix $(OBJROOT)/$(EXPDIR)/$(EXPORT_MI_DIR)/, $(EXPORT_MI_GEN_LIST))
341 .PHONY: EXP_MI_INC_DIR
344 $(_v)$(MKDIR) $(OBJROOT)/$(EXPDIR)/$(EXPORT_MI_DIR)
346 $(EXPORT_MI_GEN_INC_FILES): $(OBJROOT)/$(EXPDIR)/$(EXPORT_MI_DIR)/% : % | EXP_MI_INC_DIR
347 $(_v)$(INSTALL) $(DATA_INSTALL_FLAGS_RO) $< $@
349 $(EXPORT_MI_INC_FILES): $(OBJROOT)/$(EXPDIR)/$(EXPORT_MI_DIR)/% : $(SOURCE)/% | EXP_MI_INC_DIR
350 $(_v)$(INSTALL) $(DATA_INSTALL_FLAGS_RO) $< $@
352 EXPORT_MD_INC_FILES = $(addprefix $(OBJROOT)/$(EXPDIR)/$(EXPORT_MD_DIR)/, $(EXPORT_MD_LIST))
353 EXPORT_MD_GEN_INC_FILES = $(addprefix $(OBJROOT)/$(EXPDIR)/$(EXPORT_MD_DIR)/, $(EXPORT_MD_GEN_LIST))
355 .PHONY: EXP_MD_INC_DIR
358 $(_v)$(MKDIR) $(OBJROOT)/$(EXPDIR)/$(EXPORT_MD_DIR)
360 $(EXPORT_MD_GEN_INC_FILES): $(OBJROOT)/$(EXPDIR)/$(EXPORT_MD_DIR)/% : % | EXP_MD_INC_DIR
361 $(_v)$(INSTALL) $(DATA_INSTALL_FLAGS_RO) $< $@
363 $(EXPORT_MD_INC_FILES): $(OBJROOT)/$(EXPDIR)/$(EXPORT_MD_DIR)/% : $(SOURCE)/% | EXP_MD_INC_DIR
364 $(_v)$(INSTALL) $(DATA_INSTALL_FLAGS_RO) $< $@
366 .PHONY: do_exporthdrs_mi
368 do_exporthdrs_mi: $(EXPORT_MI_GEN_INC_FILES) $(EXPORT_MI_INC_FILES)
371 .PHONY: do_exporthdrs_md
373 do_exporthdrs_md: $(EXPORT_MD_GEN_INC_FILES) $(EXPORT_MD_INC_FILES)
377 # Generic Compilation rules
381 # Compilation rules to generate .o from .s
384 S_RULE_0=@$(LOG_AS) "$@"
385 S_RULE_1A=$(_v)${S_KCC} -c ${SFLAGS} -MD -MF $(@:o=d) -MP ${$@_SFLAGS_ADD} ${INCFLAGS} ${$@_INCFLAGS}
390 # Compilation rules to generate .o from .c for normal files
392 C_RULE_0=@$(LOG_CC) "$@"
393 C_RULE_1A=$(_v)${KCC} -c ${filter-out ${$@_CFLAGS_RM}, ${CFLAGS} ${CWARNFLAGS}} -MD -MF $(@:o=d) -MP ${$@_CFLAGS_ADD} ${$@_CWARNFLAGS_ADD} ${INCFLAGS} ${$@_INCFLAGS}
402 # Compilation rules to generate .o from .c for driver files
404 C_RULE_0_D=${C_RULE_0}
405 C_RULE_1A_D=${C_RULE_1A}
406 C_RULE_1B_D=${C_RULE_1B}
407 C_RULE_2_D=${C_RULE_2}
408 C_RULE_3_D=${C_RULE_3}
409 C_RULE_4A_D=${C_RULE_4A}
410 C_RULE_4B_D=${C_RULE_4B}
413 # Compilation rules to generate .co from .cp or .cpo from .cpp
414 # The config tool slickly changes the last source filename char to 'o'
415 # for the object filename.
416 P_RULE_0=@$(LOG_CXX) "$@"
417 P_RULE_1A=$(_v)${KC++} -o $@ -c ${CXXFLAGS} ${filter-out ${$@_CFLAGS_RM}, ${CFLAGS} ${CXXWARNFLAGS}} -MD -MF $(@:o=d) -MP ${$@_CFLAGS_ADD} ${$@_CXXWARNFLAGS_ADD} ${INCFLAGS} ${$@_INCFLAGS}
426 # Explain how to make the bsd syscall list
428 $(TARGET)/bsd.syscalls.master: $(SRCROOT)/bsd/kern/syscalls.master $(MAKESYSCALLS)
429 @$(LOG_GENERATE) "$(@F)$(Color0) from $(ColorF)$<$(Color0)"
430 $(_v)$(UNIFDEF) $(SEED_DEFINES) $< > $@; \
431 if [ $$? -eq 2 ]; then \
432 $(ERR) Parse failure for $<; \
437 # This isn't the right place to put this, but we need to := override some settings
438 # in Makefiles that include the generic helper fragments (like this file)
440 ifeq ($(BUILD_JSON_COMPILATION_DATABASE),1)
448 # Do-nothing rule, since not all levels of the recursive hierarchy might implement this
449 # in their local Makefiles. Those that do will use a "::" rule to augment this.
453 .PHONY: do_build_install_primary
455 # Do-nothing rule, since not all levels of the recursive hierarchy might implement this
456 # in their local Makefiles. Those that do will use a "::" rule to augment this.
457 do_build_install_primary::
460 .PHONY: do_build_install_non_primary
462 # Do-nothing rule, since not all levels of the recursive hierarchy might implement this
463 # in their local Makefiles. Those that do will use a "::" rule to augment this.
464 do_build_install_non_primary::
467 INSTALL_MAN_FILES = $(addprefix $(DSTROOT)/$(MANDIR)/$(INSTALL_MAN_DIR)/, $(INSTALL_MAN_LIST))
469 .PHONY: INSTALL_MAN_DIR
472 $(_v)$(MKDIR) $(DSTROOT)/$(MANDIR)/$(INSTALL_MAN_DIR)
474 $(INSTALL_MAN_FILES): $(DSTROOT)/$(MANDIR)/$(INSTALL_MAN_DIR)/% : % | INSTALL_MAN_DIR
476 $(_v)$(INSTALL) $(INSTALL_FLAGS) $< $@
478 define MAN_LINKS_RULE_template
479 $$(DSTROOT)/$$(MANDIR)/$$(INSTALL_MAN_DIR)/$(2): $$(DSTROOT)/$$(MANDIR)/$$(INSTALL_MAN_DIR)/$(1)
480 @$$(LOG_MANLINK) "$(2)"
484 function_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 INSTALL_MAN_FILES_LINKS = $(call function_generate_man_links_rules,$(INSTALL_MAN_LINKS))
488 .PHONY: do_installman
490 do_installman: $(INSTALL_MAN_FILES) $(INSTALL_MAN_FILES_LINKS)
493 .PHONY: do_textfiles_install do_textfiles_install_mi do_textfiles_install_md
495 # Do-nothing rule, since not all levels of the recursive hierarchy might implement this
496 # in their local Makefiles. Those that do will use a "::" rule to augment this.
497 do_textfiles_install_mi:: do_installman
500 # Do-nothing rule, since not all levels of the recursive hierarchy might implement this
501 # in their local Makefiles. Those that do will use a "::" rule to augment this.
502 do_textfiles_install_md::
505 .PHONY: do_build_setup
507 # Do-nothing rule, since not all levels of the recursive hierarchy might implement this
508 # in their local Makefiles. Those that do will use a "::" rule to augment this.
512 .PHONY: do_config_all
514 # Do-nothing rule, since not all levels of the recursive hierarchy might implement this
515 # in their local Makefiles. Those that do will use a "::" rule to augment this.
519 .PHONY: do_config_install
521 # Do-nothing rule, since not all levels of the recursive hierarchy might implement this
522 # in their local Makefiles. Those that do will use a "::" rule to augment this.