]> git.saurik.com Git - apple/xnu.git/blame - makedefs/MakeInc.rule
xnu-4903.241.1.tar.gz
[apple/xnu.git] / makedefs / MakeInc.rule
CommitLineData
39236c6e
A
1# -*- mode: makefile;-*-
2#
39037602 3# Copyright (C) 1999-2016 Apple Inc. All rights reserved.
39236c6e
A
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#
11
1c79356b
A
12#
13# Generic Install rules
14#
15
91447636
A
16ifndef INSTALL_KF_MI_LCL_LIST
17 INSTALL_KF_MI_LCL_LIST = $(EXPORT_MI_LIST)
18endif
1c79356b 19
91447636
A
20ifndef INSTALL_KF_MI_LCL_GEN_LIST
21 INSTALL_KF_MI_LCL_GEN_LIST = $(EXPORT_MI_GEN_LIST)
22endif
1c79356b 23
91447636
A
24ifndef INSTALL_KF_MD_LCL_LIST
25 INSTALL_KF_MD_LCL_LIST = $(EXPORT_MD_LIST)
26endif
1c79356b 27
91447636
A
28ifndef INSTALL_KF_MD_LCL_GEN_LIST
29 INSTALL_KF_MD_LCL_GEN_LIST = $(EXPORT_MD_GEN_LIST)
30endif
9bccf70c 31
91447636
A
32ifndef INSTALL_KF_MI_LIST
33 INSTALL_KF_MI_LIST = $(EXPORT_MI_LIST)
34endif
1c79356b 35
91447636
A
36ifndef INSTALL_KF_MI_GEN_LIST
37 INSTALL_KF_MI_GEN_LIST = $(EXPORT_MI_GEN_LIST)
38endif
9bccf70c 39
91447636
A
40ifndef INSTALL_KF_MD_LIST
41 INSTALL_KF_MD_LIST = $(EXPORT_MD_LIST)
42endif
9bccf70c 43
91447636
A
44ifndef INSTALL_KF_MD_GEN_LIST
45 INSTALL_KF_MD_GEN_LIST = $(EXPORT_MD_GEN_LIST)
46endif
47
39037602
A
48ifeq (${XNU_LOGCOLORS},y)
49 LOGCOLORS ?= y
50endif
51
52ifeq ($(LOGCOLORS),y)
53 # Get a nice list of device code names associated with the build platform
54 ifndef CDevs
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,:$$,,')
57 #endif
58 endif
59 ifndef CMD_MC
60 export _MACHINE := $(CURRENT_MACHINE_CONFIG_LC)
61 ifeq ($(CURRENT_MACHINE_CONFIG),NONE)
62 export _MACHINE := $(subst Mac,,$(PLATFORM))
63 endif
64 export CMD_MC := \\033[1m$(shell __A="$(CURRENT_ARCH_CONFIG_LC)"; \
65 __As=$$((6-$${\#__A})); \
66 printf "%-.6s%*.*s %9.9s" \
67 "$${__A}" \
68 $${__As} $${__As} " " \
69 "$(_MACHINE)")\\033[m
70 endif
71 # Turn off colored output
72 Color0=\\033[m
73 # Start a host command: bold, underlined pink text
74 ColorH=\\033[1;4;35m
75 # Start a compilation-related command: bold, underlined blue text
76 ColorC=[$(CMD_MC)] \\033[1;4;34m
77 # Start a MIG command: bold, green text on light grey background
78 ColorM=[$(CMD_MC)] \\033[1;32;40m
79 # Start a linking command: bold, white text on blue background
80 ColorL=[$(CMD_MC)] \\033[1;37;44m
81 # Start a filename: bold, white text
82 ColorF=\\033[1;37m
83 # Start a linked file name: yellow text on light grey background
84 ColorLF=\\033[1;33;40m
85 # Error strings: underlined bold white text on red background
86 ColorErr=\033[1;4;37;41m
87endif
88
39236c6e 89.PHONY: ALWAYS
2d21ac55 90
39236c6e 91ALWAYS:
91447636 92
39236c6e
A
93# $(1) is the list of install paths
94# $(2) is "1" if it's a "GEN"-style rule that looks locally, or else $(SOURCE)
95# $(3) is the local temp directory for processing
96# $(4) is the unifdef flags
97#
98# $$$$$$$$ is a double-escaped "$$" to represent the current pid
99# of the shell process for creating uniquely named temporary files
91447636 100
39236c6e 101define INSTALLHDRS_RULE_template
9bccf70c 102
39236c6e
A
103.PHONY: $(3)_MKDIR
104
105$(3)_MKDIR:
106 $$(_v)$$(MKDIR) ./$(3)
107 $$(_v)$$(MKDIR) $(dir $(firstword $(1)))
108
fe8ab488
A
109# Rebuild if unifdef flags change
110$(1): $(3)/.UNIFDEF_FLAGS
111$(3)/.UNIFDEF_FLAGS: ALWAYS | $(3)_MKDIR
112 $$(_v)$$(REPLACECONTENTS) $$@ $$(UNIFDEF) $(4)
113
39236c6e 114$(1): $(dir $(firstword $(1)))% : $(if $(2),%,$$(SOURCE)/%) | $(3)_MKDIR
d9a64523 115 @echo "$$(ColorH)INSTALLHDR$$(Color0) $$(ColorF)$$*$$(Color0)"
39236c6e
A
116 $$(_v)$$(UNIFDEF) $(4) $$< > ./$(3)/$$*.unifdef.$$$$$$$$; \
117 if [ $$$$? -eq 2 ]; then \
118 echo Parse failure for $$<; \
119 exit 1; \
91447636 120 fi; \
39236c6e
A
121 $$(DECOMMENT) ./$(3)/$$*.unifdef.$$$$$$$$ r > \
122 ./$(3)/$$*.strip.$$$$$$$$ || exit 1; \
123 if [ -s ./$(3)/$$*.strip.$$$$$$$$ ]; then \
124 $$(INSTALL) $$(INSTALL_FLAGS) ./$(3)/$$*.unifdef.$$$$$$$$ $$@ || exit 1; \
91447636 125 fi; \
39236c6e
A
126 $$(RM) ./$(3)/$$*.unifdef.$$$$$$$$ ./$(3)/$$*.strip.$$$$$$$$
127endef
128
d9a64523
A
129# $(1) is the list of install paths
130# $(2) is the source path pattern (using % to match with $(5)) or source file
131# $(3) is the local temp directory for processing
132# $(4) is the unifdef flags
133# $(5) is the destination directory (when pattern matching) or empty
134#
135# $$$$$$$$ is a double-escaped "$$" to represent the current pid
136# of the shell process for creating uniquely named temporary files
137
138define INSTALLPYTHON_RULE_template
139
140.PHONY: $(3)_MKDIR
141
142$(3)_MKDIR:
143 $$(_v)$$(MKDIR) ./$(3)
144
145# Rebuild if unifdef flags change
146$(1): $(3)/.UNIFDEF_FLAGS
147$(3)/.UNIFDEF_FLAGS: ALWAYS | $(3)_MKDIR
148 $$(_v)$$(REPLACECONTENTS) $$@ $$(UNIFDEF) -t $(4)
149
150$(1): $(5)% : $(2) | $(3)_MKDIR
151 @echo "$$(ColorH)INSTALLPY$$(Color0) $$(ColorF)$$*$$(Color0)"
152 $$(_v)$$(MKDIR) $$(dir $$@) $$(dir ./$(3)/$$*)
153 $$(_v)$$(UNIFDEF) -t $(4) $$< > ./$(3)/$$*.unifdef.$$$$$$$$$$(suffix $$*); \
154 if [ $$$$? -eq 2 ]; then \
155 echo Parse failure for $$<; \
156 exit 1; \
157 fi; \
158 $$(INSTALL) $$(DATA_INSTALL_FLAGS) \
159 ./$(3)/$$*.unifdef.$$$$$$$$$$(suffix $$*) $$@ || exit 1; \
160 $$(PYTHON) $$(LLDBMACROS_SOURCE)/core/syntax_checker.py \
161 ./$(3)/$$*.unifdef.$$$$$$$$$$(suffix $$*) $$(_vstdout) || exit 1; \
162 $$(RM) ./$(3)/$$*.unifdef.$$$$$$$$$$(suffix $$*)
163 $$(_v)if [ -n "$(5)" ]; then $$(TOUCH) "$(5)"; fi
164endef
165
39236c6e
A
166#
167# Machine-independent (public) files
168#
169
170INSTALL_MI_INC_FILES = $(addprefix $(DSTROOT)/$(INCDIR)/$(INSTALL_MI_DIR)/, $(INSTALL_MI_LIST))
171INSTALL_MI_INC_GEN_FILES = $(addprefix $(DSTROOT)/$(INCDIR)/$(INSTALL_MI_DIR)/, $(INSTALL_MI_GEN_LIST))
172
173$(eval $(call INSTALLHDRS_RULE_template,$(INSTALL_MI_INC_FILES),,incmidir,$(SINCFRAME_UNIFDEF)))
174$(eval $(call INSTALLHDRS_RULE_template,$(INSTALL_MI_INC_GEN_FILES),1,incmigendir,$(SINCFRAME_UNIFDEF)))
1c79356b 175
39236c6e
A
176INSTALL_KF_MI_FILES = $(addprefix $(DSTROOT)/$(KINCDIR)/$(EXPORT_MI_DIR)/, $(INSTALL_KF_MI_LIST))
177INSTALL_KF_MI_GEN_FILES = $(addprefix $(DSTROOT)/$(KINCDIR)/$(EXPORT_MI_DIR)/, $(INSTALL_KF_MI_GEN_LIST))
178
179$(eval $(call INSTALLHDRS_RULE_template,$(INSTALL_KF_MI_FILES),,kincmidir,$(KINCFRAME_UNIFDEF)))
180$(eval $(call INSTALLHDRS_RULE_template,$(INSTALL_KF_MI_GEN_FILES),1,kincmigendir,$(KINCFRAME_UNIFDEF)))
1c79356b
A
181
182#
39236c6e 183# Machine-independent local (private) files
1c79356b 184#
1c79356b 185
3e170ce0
A
186INSTALL_MI_LCL_FILES = $(addprefix $(DSTROOT)/$(LCLDIR)/$(INSTALL_MI_DIR)/, $(sort $(INSTALL_MI_LCL_LIST) $(INSTALL_MI_LIST)))
187INSTALL_MI_LCL_GEN_FILES = $(addprefix $(DSTROOT)/$(LCLDIR)/$(INSTALL_MI_DIR)/, $(sort $(INSTALL_MI_LCL_GEN_LIST) $(INSTALL_MI_GEN_LIST)))
1c79356b 188
39236c6e
A
189$(eval $(call INSTALLHDRS_RULE_template,$(INSTALL_MI_LCL_FILES),,pincmidir,$(SPINCFRAME_UNIFDEF)))
190$(eval $(call INSTALLHDRS_RULE_template,$(INSTALL_MI_LCL_GEN_FILES),1,pincmigendir,$(SPINCFRAME_UNIFDEF)))
1c79356b 191
39236c6e
A
192INSTALL_KF_MI_LCL_FILES = $(addprefix $(DSTROOT)/$(KPINCDIR)/$(EXPORT_MI_DIR)/, $(INSTALL_KF_MI_LCL_LIST))
193INSTALL_KF_MI_LCL_GEN_FILES = $(addprefix $(DSTROOT)/$(KPINCDIR)/$(EXPORT_MI_DIR)/, $(INSTALL_KF_MI_LCL_GEN_LIST))
1c79356b 194
39236c6e
A
195$(eval $(call INSTALLHDRS_RULE_template,$(INSTALL_KF_MI_LCL_FILES),,kpincmidir,$(KPINCFRAME_UNIFDEF)))
196$(eval $(call INSTALLHDRS_RULE_template,$(INSTALL_KF_MI_LCL_GEN_FILES),1,kpincmigendir,$(KPINCFRAME_UNIFDEF)))
1c79356b 197
39236c6e
A
198#
199# Machine-dependent (public) files
200#
1c79356b 201
39236c6e
A
202INSTALL_MD_INC_FILES = $(addprefix $(DSTROOT)/$(INCDIR)/$(INSTALL_MD_DIR)/, $(INSTALL_MD_LIST))
203INSTALL_MD_INC_GEN_FILES = $(addprefix $(DSTROOT)/$(INCDIR)/$(INSTALL_MD_DIR)/, $(INSTALL_MD_GEN_LIST))
1c79356b 204
39236c6e
A
205$(eval $(call INSTALLHDRS_RULE_template,$(INSTALL_MD_INC_FILES),,incdir,$(SINCFRAME_UNIFDEF)))
206$(eval $(call INSTALLHDRS_RULE_template,$(INSTALL_MD_INC_GEN_FILES),1,incgendir,$(SINCFRAME_UNIFDEF)))
1c79356b 207
39236c6e
A
208INSTALL_KF_MD_FILES = $(addprefix $(DSTROOT)/$(KINCDIR)/$(EXPORT_MD_DIR)/, $(INSTALL_KF_MD_LIST))
209INSTALL_KF_MD_GEN_FILES = $(addprefix $(DSTROOT)/$(KINCDIR)/$(EXPORT_MD_DIR)/, $(INSTALL_KF_MD_GEN_LIST))
1c79356b 210
39236c6e
A
211$(eval $(call INSTALLHDRS_RULE_template,$(INSTALL_KF_MD_FILES),,kincdir,$(KINCFRAME_UNIFDEF)))
212$(eval $(call INSTALLHDRS_RULE_template,$(INSTALL_KF_MD_GEN_FILES),1,kincgendir,$(KINCFRAME_UNIFDEF)))
1c79356b 213
39236c6e
A
214#
215# Machine-dependent local (private) files
216#
217
3e170ce0
A
218INSTALL_MD_LCL_FILES = $(addprefix $(DSTROOT)/$(LCLDIR)/$(INSTALL_MD_DIR)/, $(sort $(INSTALL_MD_LCL_LIST) $(INSTALL_MD_LIST)))
219INSTALL_MD_LCL_GEN_FILES = $(addprefix $(DSTROOT)/$(LCLDIR)/$(INSTALL_MD_DIR)/, $(sort $(INSTALL_MD_LCL_GEN_LIST) $(INSTALL_MD_GEN_LIST)))
39236c6e
A
220
221$(eval $(call INSTALLHDRS_RULE_template,$(INSTALL_MD_LCL_FILES),,pincdir,$(SPINCFRAME_UNIFDEF)))
222$(eval $(call INSTALLHDRS_RULE_template,$(INSTALL_MD_LCL_GEN_FILES),1,pincgendir,$(SPINCFRAME_UNIFDEF)))
223
224INSTALL_KF_MD_LCL_FILES = $(addprefix $(DSTROOT)/$(KPINCDIR)/$(EXPORT_MD_DIR)/, $(INSTALL_KF_MD_LCL_LIST))
225INSTALL_KF_MD_LCL_GEN_FILES = $(addprefix $(DSTROOT)/$(KPINCDIR)/$(EXPORT_MD_DIR)/, $(INSTALL_KF_MD_LCL_GEN_LIST))
226
227$(eval $(call INSTALLHDRS_RULE_template,$(INSTALL_KF_MD_LCL_FILES),,kpincdir,$(KPINCFRAME_UNIFDEF)))
228$(eval $(call INSTALLHDRS_RULE_template,$(INSTALL_KF_MD_LCL_GEN_FILES),1,kpincgendir,$(KPINCFRAME_UNIFDEF)))
1c79356b 229
39236c6e
A
230.PHONY: do_installhdrs_mi
231
232# Double-colon rule so that MakeInc.kernel can add custom behaviors
233do_installhdrs_mi:: $(INSTALL_MI_INC_FILES) $(INSTALL_MI_INC_GEN_FILES) $(INSTALL_KF_MI_FILES) $(INSTALL_KF_MI_GEN_FILES) \
234 $(INSTALL_MI_LCL_FILES) $(INSTALL_MI_LCL_GEN_FILES) $(INSTALL_KF_MI_LCL_FILES) $(INSTALL_KF_MI_LCL_GEN_FILES)
235 @:
236
237.PHONY: do_installhdrs_md
238
239do_installhdrs_md: $(INSTALL_MD_INC_FILES) $(INSTALL_MD_INC_GEN_FILES) $(INSTALL_KF_MD_FILES) $(INSTALL_KF_MD_GEN_FILES) \
240 $(INSTALL_MD_LCL_FILES) $(INSTALL_MD_LCL_GEN_FILES) $(INSTALL_KF_MD_LCL_FILES) $(INSTALL_KF_MD_LCL_GEN_FILES)
241 @:
242
243#
244# Generic Export rules
245#
246EXPORT_MI_INC_FILES = $(addprefix $(OBJROOT)/$(EXPDIR)/$(EXPORT_MI_DIR)/, $(EXPORT_MI_LIST))
1c79356b
A
247EXPORT_MI_GEN_INC_FILES = $(addprefix $(OBJROOT)/$(EXPDIR)/$(EXPORT_MI_DIR)/, $(EXPORT_MI_GEN_LIST))
248
39236c6e 249.PHONY: EXP_MI_INC_DIR
1c79356b 250
39236c6e
A
251EXP_MI_INC_DIR:
252 $(_v)$(MKDIR) $(OBJROOT)/$(EXPDIR)/$(EXPORT_MI_DIR)
1c79356b 253
39236c6e
A
254$(EXPORT_MI_GEN_INC_FILES): $(OBJROOT)/$(EXPDIR)/$(EXPORT_MI_DIR)/% : % | EXP_MI_INC_DIR
255 $(_v)$(INSTALL) $(DATA_INSTALL_FLAGS) $< $@
256
257$(EXPORT_MI_INC_FILES): $(OBJROOT)/$(EXPDIR)/$(EXPORT_MI_DIR)/% : $(SOURCE)/% | EXP_MI_INC_DIR
258 $(_v)$(INSTALL) $(DATA_INSTALL_FLAGS) $< $@
259
260EXPORT_MD_INC_FILES = $(addprefix $(OBJROOT)/$(EXPDIR)/$(EXPORT_MD_DIR)/, $(EXPORT_MD_LIST))
1c79356b
A
261EXPORT_MD_GEN_INC_FILES = $(addprefix $(OBJROOT)/$(EXPDIR)/$(EXPORT_MD_DIR)/, $(EXPORT_MD_GEN_LIST))
262
39236c6e 263.PHONY: EXP_MD_INC_DIR
1c79356b 264
39236c6e
A
265EXP_MD_INC_DIR:
266 $(_v)$(MKDIR) $(OBJROOT)/$(EXPDIR)/$(EXPORT_MD_DIR)
267
268$(EXPORT_MD_GEN_INC_FILES): $(OBJROOT)/$(EXPDIR)/$(EXPORT_MD_DIR)/% : % | EXP_MD_INC_DIR
269 $(_v)$(INSTALL) $(DATA_INSTALL_FLAGS) $< $@
270
271$(EXPORT_MD_INC_FILES): $(OBJROOT)/$(EXPDIR)/$(EXPORT_MD_DIR)/% : $(SOURCE)/% | EXP_MD_INC_DIR
272 $(_v)$(INSTALL) $(DATA_INSTALL_FLAGS) $< $@
273
274.PHONY: do_exporthdrs_mi
275
276do_exporthdrs_mi: $(EXPORT_MI_GEN_INC_FILES) $(EXPORT_MI_INC_FILES)
277 @:
278
279.PHONY: do_exporthdrs_md
280
281do_exporthdrs_md: $(EXPORT_MD_GEN_INC_FILES) $(EXPORT_MD_INC_FILES)
282 @:
1c79356b 283
1c79356b
A
284#
285# Generic Compilation rules
286#
287
288#
289# Compilation rules to generate .o from .s
290#
2d21ac55 291
39037602 292S_RULE_0=@echo "$(ColorC)AS$(Color0) $(ColorF)$@$(Color0)"
fe8ab488 293S_RULE_1A=$(_v)${S_KCC} -c ${SFLAGS} -MD -MF $(@:o=d) -MP ${$@_SFLAGS_ADD} ${INCFLAGS} ${$@_INCFLAGS}
39236c6e
A
294S_RULE_1B=$(<F)
295S_RULE_2=
1c79356b
A
296
297#
298# Compilation rules to generate .o from .c for normal files
39236c6e 299#
39037602
A
300C_RULE_0=@echo "$(ColorC)CC$(Color0) $(ColorF)$@$(Color0)"
301C_RULE_1A=$(_v)${KCC} -c ${filter-out ${$@_CFLAGS_RM}, ${CFLAGS} ${CWARNFLAGS}} -MD -MF $(@:o=d) -MP ${$@_CFLAGS_ADD} ${$@_CWARNFLAGS_ADD} ${INCFLAGS} ${$@_INCFLAGS}
39236c6e 302C_RULE_1B=$(<F)
6d2010ae 303ifeq ($(BUILD_MACHO_OBJ),0)
39236c6e
A
304C_RULE_2=
305else ifeq ($(DO_CTFCONVERT),1)
39037602
A
306C_RULE_2=$(_v)if [ -z "${$@_SKIP_CTFCONVERT}" ]; then \
307 ctferr=`${CTFCONVERT} -l xnu -v -o $@.ctf $@ 2>&1 > /dev/null || true`; \
308 if [ ! -z "$${ctferr}" ]; then \
309 echo "[$(CMD_MC)] $(ColorErr)$@$(Color0) $(ColorErr)$${ctferr}$(Color0)"; \
310 fi; \
311 fi
2d21ac55 312else
39236c6e 313C_RULE_2=
316670eb 314endif
39236c6e 315ifeq ($(DO_CTFMACHO), 1)
39037602 316C_CTFRULE_1A=$(_v)${KCC} -o $@.non_lto -c ${filter-out ${$@_CFLAGS_RM}, ${CFLAGS} ${CWARNFLAGS}} ${$@_CFLAGS_ADD} ${$@_CWARNFLAGS_ADD} ${INCFLAGS} $(CFLAGS_NOLTO_FLAG) ${$@_INCFLAGS}
39236c6e 317C_CTFRULE_1B=$(<F)
39037602
A
318C_CTFRULE_2=$(_v)if [ -z "${$@_SKIP_CTFCONVERT}" ]; then \
319 ctferr=`${CTFCONVERT} -l xnu -v -o $@.non_lto.ctf $@.non_lto 2>&1 > /dev/null || true`; \
320 if [ ! -z "$${ctferr}" ]; then \
321 echo "[$(CMD_MC)] $(ColorErr)$@$(Color0) $(ColorErr)$${ctferr}$(Color0)"; \
322 fi; \
323 fi
39236c6e
A
324else
325C_CTFRULE_1A=@true
326C_CTFRULE_1B=
327C_CTFRULE_2=@true
316670eb
A
328endif
329
39037602
A
330C_RULE_3=@true
331C_RULE_4A=@true
332C_RULE_4B=
333
1c79356b
A
334#
335# Compilation rules to generate .o from .c for driver files
336#
39236c6e 337C_RULE_0_D=${C_RULE_0}
1c79356b
A
338C_RULE_1A_D=${C_RULE_1A}
339C_RULE_1B_D=${C_RULE_1B}
340C_RULE_2_D=${C_RULE_2}
39037602
A
341C_RULE_3_D=${C_RULE_3}
342C_RULE_4A_D=${C_RULE_4A}
343C_RULE_4B_D=${C_RULE_4B}
39236c6e
A
344C_CTFRULE_1A_D=${C_CTFRULE_1A}
345C_CTFRULE_1B_D=${C_CTFRULE_1B}
346C_CTFRULE_2_D=${C_CTFRULE_2}
39037602 347C_CTFRULE_3_D=${C_CTFRULE_3}
1c79356b 348
1c79356b
A
349#
350# Compilation rules to generate .co from .cp or .cpo from .cpp
351# The config tool slickly changes the last source filename char to 'o'
352# for the object filename.
39037602
A
353P_RULE_0=@echo "$(ColorC)C++$(Color0) $(ColorF)$@$(Color0)"
354P_RULE_1A=$(_v)${KC++} -o $@ -c ${CXXFLAGS} ${filter-out ${$@_CFLAGS_RM}, ${CFLAGS} ${CXXWARNFLAGS}} -MD -MF $(@:o=d) -MP ${$@_CFLAGS_ADD} ${$@_CXXWARNFLAGS_ADD} ${INCFLAGS} ${$@_INCFLAGS}
1c79356b 355P_RULE_1B=$(<F)
39236c6e
A
356P_RULE_2=
357P_CTFRULE_1A=@true
358P_CTFRULE_1B=
359P_CTFRULE_2=@true
1c79356b 360
39037602
A
361P_RULE_3=@true
362P_RULE_4A=@true
363P_RULE_4B=
1c79356b 364
3e170ce0
A
365#
366# This isn't the right place to put this, but we need to := override some settings
367# in Makefiles that include the generic helper fragments (like this file)
368#
369ifeq ($(BUILD_JSON_COMPILATION_DATABASE),1)
370HIB_FILES :=
371LAST_FILES :=
372KLD_FILES :=
373endif
374
39236c6e 375.PHONY: do_build_all
1c79356b 376
39236c6e
A
377# Do-nothing rule, since not all levels of the recursive hierarchy might implement this
378# in their local Makefiles. Those that do will use a "::" rule to augment this.
379do_build_all::
380 @:
1c79356b 381
39236c6e 382.PHONY: do_build_install_primary
2d21ac55 383
39236c6e
A
384# Do-nothing rule, since not all levels of the recursive hierarchy might implement this
385# in their local Makefiles. Those that do will use a "::" rule to augment this.
386do_build_install_primary::
387 @:
2d21ac55 388
39236c6e 389.PHONY: do_build_install_non_primary
2d21ac55 390
39236c6e
A
391# Do-nothing rule, since not all levels of the recursive hierarchy might implement this
392# in their local Makefiles. Those that do will use a "::" rule to augment this.
393do_build_install_non_primary::
394 @:
1c79356b 395
39236c6e 396INSTALL_MAN_FILES = $(addprefix $(DSTROOT)/$(MANDIR)/$(INSTALL_MAN_DIR)/, $(INSTALL_MAN_LIST))
1c79356b 397
39236c6e 398.PHONY: INSTALL_MAN_DIR
1c79356b 399
39236c6e
A
400INSTALL_MAN_DIR:
401 $(_v)$(MKDIR) $(DSTROOT)/$(MANDIR)/$(INSTALL_MAN_DIR)
9bccf70c 402
39236c6e 403$(INSTALL_MAN_FILES): $(DSTROOT)/$(MANDIR)/$(INSTALL_MAN_DIR)/% : % | INSTALL_MAN_DIR
39037602 404 @echo "$(ColorH)MAN$(Color0) $(ColorF)$*$(Color0)"
39236c6e
A
405 $(_v)$(INSTALL) $(INSTALL_FLAGS) $< $@
406
407define MAN_LINKS_RULE_template
408$$(DSTROOT)/$$(MANDIR)/$$(INSTALL_MAN_DIR)/$(2): $$(DSTROOT)/$$(MANDIR)/$$(INSTALL_MAN_DIR)/$(1)
39037602 409 @echo "$$(ColorH)MANLINK$$(Color0) $$(ColorF)$(2)$$(Color0)"
39236c6e
A
410 $(_v)ln -f $$< $$@
411endef
412
413function_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))))
414
415INSTALL_MAN_FILES_LINKS = $(call function_generate_man_links_rules,$(INSTALL_MAN_LINKS))
416
417.PHONY: do_installman
418
419do_installman: $(INSTALL_MAN_FILES) $(INSTALL_MAN_FILES_LINKS)
420 @:
1c79356b 421
fe8ab488
A
422.PHONY: do_textfiles_install
423
424# Do-nothing rule, since not all levels of the recursive hierarchy might implement this
425# in their local Makefiles. Those that do will use a "::" rule to augment this.
426do_textfiles_install:: do_installman
427 @:
428
39236c6e
A
429.PHONY: do_build_setup
430
431# Do-nothing rule, since not all levels of the recursive hierarchy might implement this
432# in their local Makefiles. Those that do will use a "::" rule to augment this.
433do_build_setup::
434 @:
435
436.PHONY: do_config_all
437
438# Do-nothing rule, since not all levels of the recursive hierarchy might implement this
439# in their local Makefiles. Those that do will use a "::" rule to augment this.
440do_config_all::
441 @:
442
fe8ab488
A
443.PHONY: do_config_install
444
445# Do-nothing rule, since not all levels of the recursive hierarchy might implement this
446# in their local Makefiles. Those that do will use a "::" rule to augment this.
447do_config_install::
448 @:
b0d623f7 449
2d21ac55 450# vim: set ft=make: