]>
Commit | Line | Data |
---|---|---|
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 |
16 | ifndef INSTALL_KF_MI_LCL_LIST |
17 | INSTALL_KF_MI_LCL_LIST = $(EXPORT_MI_LIST) | |
18 | endif | |
1c79356b | 19 | |
91447636 A |
20 | ifndef INSTALL_KF_MI_LCL_GEN_LIST |
21 | INSTALL_KF_MI_LCL_GEN_LIST = $(EXPORT_MI_GEN_LIST) | |
22 | endif | |
1c79356b | 23 | |
91447636 A |
24 | ifndef INSTALL_KF_MD_LCL_LIST |
25 | INSTALL_KF_MD_LCL_LIST = $(EXPORT_MD_LIST) | |
26 | endif | |
1c79356b | 27 | |
91447636 A |
28 | ifndef INSTALL_KF_MD_LCL_GEN_LIST |
29 | INSTALL_KF_MD_LCL_GEN_LIST = $(EXPORT_MD_GEN_LIST) | |
30 | endif | |
9bccf70c | 31 | |
91447636 A |
32 | ifndef INSTALL_KF_MI_LIST |
33 | INSTALL_KF_MI_LIST = $(EXPORT_MI_LIST) | |
34 | endif | |
1c79356b | 35 | |
91447636 A |
36 | ifndef INSTALL_KF_MI_GEN_LIST |
37 | INSTALL_KF_MI_GEN_LIST = $(EXPORT_MI_GEN_LIST) | |
38 | endif | |
9bccf70c | 39 | |
91447636 A |
40 | ifndef INSTALL_KF_MD_LIST |
41 | INSTALL_KF_MD_LIST = $(EXPORT_MD_LIST) | |
42 | endif | |
9bccf70c | 43 | |
91447636 A |
44 | ifndef INSTALL_KF_MD_GEN_LIST |
45 | INSTALL_KF_MD_GEN_LIST = $(EXPORT_MD_GEN_LIST) | |
46 | endif | |
47 | ||
39037602 A |
48 | ifeq (${XNU_LOGCOLORS},y) |
49 | LOGCOLORS ?= y | |
50 | endif | |
51 | ||
52 | ifeq ($(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 | |
87 | endif | |
88 | ||
39236c6e | 89 | .PHONY: ALWAYS |
2d21ac55 | 90 | |
39236c6e | 91 | ALWAYS: |
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 | 101 | define 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 |
39037602 | 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.$$$$$$$$ |
127 | endef | |
128 | ||
129 | # | |
130 | # Machine-independent (public) files | |
131 | # | |
132 | ||
133 | INSTALL_MI_INC_FILES = $(addprefix $(DSTROOT)/$(INCDIR)/$(INSTALL_MI_DIR)/, $(INSTALL_MI_LIST)) | |
134 | INSTALL_MI_INC_GEN_FILES = $(addprefix $(DSTROOT)/$(INCDIR)/$(INSTALL_MI_DIR)/, $(INSTALL_MI_GEN_LIST)) | |
135 | ||
136 | $(eval $(call INSTALLHDRS_RULE_template,$(INSTALL_MI_INC_FILES),,incmidir,$(SINCFRAME_UNIFDEF))) | |
137 | $(eval $(call INSTALLHDRS_RULE_template,$(INSTALL_MI_INC_GEN_FILES),1,incmigendir,$(SINCFRAME_UNIFDEF))) | |
1c79356b | 138 | |
39236c6e A |
139 | INSTALL_KF_MI_FILES = $(addprefix $(DSTROOT)/$(KINCDIR)/$(EXPORT_MI_DIR)/, $(INSTALL_KF_MI_LIST)) |
140 | INSTALL_KF_MI_GEN_FILES = $(addprefix $(DSTROOT)/$(KINCDIR)/$(EXPORT_MI_DIR)/, $(INSTALL_KF_MI_GEN_LIST)) | |
141 | ||
142 | $(eval $(call INSTALLHDRS_RULE_template,$(INSTALL_KF_MI_FILES),,kincmidir,$(KINCFRAME_UNIFDEF))) | |
143 | $(eval $(call INSTALLHDRS_RULE_template,$(INSTALL_KF_MI_GEN_FILES),1,kincmigendir,$(KINCFRAME_UNIFDEF))) | |
1c79356b A |
144 | |
145 | # | |
39236c6e | 146 | # Machine-independent local (private) files |
1c79356b | 147 | # |
1c79356b | 148 | |
3e170ce0 A |
149 | INSTALL_MI_LCL_FILES = $(addprefix $(DSTROOT)/$(LCLDIR)/$(INSTALL_MI_DIR)/, $(sort $(INSTALL_MI_LCL_LIST) $(INSTALL_MI_LIST))) |
150 | INSTALL_MI_LCL_GEN_FILES = $(addprefix $(DSTROOT)/$(LCLDIR)/$(INSTALL_MI_DIR)/, $(sort $(INSTALL_MI_LCL_GEN_LIST) $(INSTALL_MI_GEN_LIST))) | |
1c79356b | 151 | |
39236c6e A |
152 | $(eval $(call INSTALLHDRS_RULE_template,$(INSTALL_MI_LCL_FILES),,pincmidir,$(SPINCFRAME_UNIFDEF))) |
153 | $(eval $(call INSTALLHDRS_RULE_template,$(INSTALL_MI_LCL_GEN_FILES),1,pincmigendir,$(SPINCFRAME_UNIFDEF))) | |
1c79356b | 154 | |
39236c6e A |
155 | INSTALL_KF_MI_LCL_FILES = $(addprefix $(DSTROOT)/$(KPINCDIR)/$(EXPORT_MI_DIR)/, $(INSTALL_KF_MI_LCL_LIST)) |
156 | INSTALL_KF_MI_LCL_GEN_FILES = $(addprefix $(DSTROOT)/$(KPINCDIR)/$(EXPORT_MI_DIR)/, $(INSTALL_KF_MI_LCL_GEN_LIST)) | |
1c79356b | 157 | |
39236c6e A |
158 | $(eval $(call INSTALLHDRS_RULE_template,$(INSTALL_KF_MI_LCL_FILES),,kpincmidir,$(KPINCFRAME_UNIFDEF))) |
159 | $(eval $(call INSTALLHDRS_RULE_template,$(INSTALL_KF_MI_LCL_GEN_FILES),1,kpincmigendir,$(KPINCFRAME_UNIFDEF))) | |
1c79356b | 160 | |
39236c6e A |
161 | # |
162 | # Machine-dependent (public) files | |
163 | # | |
1c79356b | 164 | |
39236c6e A |
165 | INSTALL_MD_INC_FILES = $(addprefix $(DSTROOT)/$(INCDIR)/$(INSTALL_MD_DIR)/, $(INSTALL_MD_LIST)) |
166 | INSTALL_MD_INC_GEN_FILES = $(addprefix $(DSTROOT)/$(INCDIR)/$(INSTALL_MD_DIR)/, $(INSTALL_MD_GEN_LIST)) | |
1c79356b | 167 | |
39236c6e A |
168 | $(eval $(call INSTALLHDRS_RULE_template,$(INSTALL_MD_INC_FILES),,incdir,$(SINCFRAME_UNIFDEF))) |
169 | $(eval $(call INSTALLHDRS_RULE_template,$(INSTALL_MD_INC_GEN_FILES),1,incgendir,$(SINCFRAME_UNIFDEF))) | |
1c79356b | 170 | |
39236c6e A |
171 | INSTALL_KF_MD_FILES = $(addprefix $(DSTROOT)/$(KINCDIR)/$(EXPORT_MD_DIR)/, $(INSTALL_KF_MD_LIST)) |
172 | INSTALL_KF_MD_GEN_FILES = $(addprefix $(DSTROOT)/$(KINCDIR)/$(EXPORT_MD_DIR)/, $(INSTALL_KF_MD_GEN_LIST)) | |
1c79356b | 173 | |
39236c6e A |
174 | $(eval $(call INSTALLHDRS_RULE_template,$(INSTALL_KF_MD_FILES),,kincdir,$(KINCFRAME_UNIFDEF))) |
175 | $(eval $(call INSTALLHDRS_RULE_template,$(INSTALL_KF_MD_GEN_FILES),1,kincgendir,$(KINCFRAME_UNIFDEF))) | |
1c79356b | 176 | |
39236c6e A |
177 | # |
178 | # Machine-dependent local (private) files | |
179 | # | |
180 | ||
3e170ce0 A |
181 | INSTALL_MD_LCL_FILES = $(addprefix $(DSTROOT)/$(LCLDIR)/$(INSTALL_MD_DIR)/, $(sort $(INSTALL_MD_LCL_LIST) $(INSTALL_MD_LIST))) |
182 | INSTALL_MD_LCL_GEN_FILES = $(addprefix $(DSTROOT)/$(LCLDIR)/$(INSTALL_MD_DIR)/, $(sort $(INSTALL_MD_LCL_GEN_LIST) $(INSTALL_MD_GEN_LIST))) | |
39236c6e A |
183 | |
184 | $(eval $(call INSTALLHDRS_RULE_template,$(INSTALL_MD_LCL_FILES),,pincdir,$(SPINCFRAME_UNIFDEF))) | |
185 | $(eval $(call INSTALLHDRS_RULE_template,$(INSTALL_MD_LCL_GEN_FILES),1,pincgendir,$(SPINCFRAME_UNIFDEF))) | |
186 | ||
187 | INSTALL_KF_MD_LCL_FILES = $(addprefix $(DSTROOT)/$(KPINCDIR)/$(EXPORT_MD_DIR)/, $(INSTALL_KF_MD_LCL_LIST)) | |
188 | INSTALL_KF_MD_LCL_GEN_FILES = $(addprefix $(DSTROOT)/$(KPINCDIR)/$(EXPORT_MD_DIR)/, $(INSTALL_KF_MD_LCL_GEN_LIST)) | |
189 | ||
190 | $(eval $(call INSTALLHDRS_RULE_template,$(INSTALL_KF_MD_LCL_FILES),,kpincdir,$(KPINCFRAME_UNIFDEF))) | |
191 | $(eval $(call INSTALLHDRS_RULE_template,$(INSTALL_KF_MD_LCL_GEN_FILES),1,kpincgendir,$(KPINCFRAME_UNIFDEF))) | |
1c79356b | 192 | |
39236c6e A |
193 | .PHONY: do_installhdrs_mi |
194 | ||
195 | # Double-colon rule so that MakeInc.kernel can add custom behaviors | |
196 | do_installhdrs_mi:: $(INSTALL_MI_INC_FILES) $(INSTALL_MI_INC_GEN_FILES) $(INSTALL_KF_MI_FILES) $(INSTALL_KF_MI_GEN_FILES) \ | |
197 | $(INSTALL_MI_LCL_FILES) $(INSTALL_MI_LCL_GEN_FILES) $(INSTALL_KF_MI_LCL_FILES) $(INSTALL_KF_MI_LCL_GEN_FILES) | |
198 | @: | |
199 | ||
200 | .PHONY: do_installhdrs_md | |
201 | ||
202 | do_installhdrs_md: $(INSTALL_MD_INC_FILES) $(INSTALL_MD_INC_GEN_FILES) $(INSTALL_KF_MD_FILES) $(INSTALL_KF_MD_GEN_FILES) \ | |
203 | $(INSTALL_MD_LCL_FILES) $(INSTALL_MD_LCL_GEN_FILES) $(INSTALL_KF_MD_LCL_FILES) $(INSTALL_KF_MD_LCL_GEN_FILES) | |
204 | @: | |
205 | ||
206 | # | |
207 | # Generic Export rules | |
208 | # | |
209 | EXPORT_MI_INC_FILES = $(addprefix $(OBJROOT)/$(EXPDIR)/$(EXPORT_MI_DIR)/, $(EXPORT_MI_LIST)) | |
1c79356b A |
210 | EXPORT_MI_GEN_INC_FILES = $(addprefix $(OBJROOT)/$(EXPDIR)/$(EXPORT_MI_DIR)/, $(EXPORT_MI_GEN_LIST)) |
211 | ||
39236c6e | 212 | .PHONY: EXP_MI_INC_DIR |
1c79356b | 213 | |
39236c6e A |
214 | EXP_MI_INC_DIR: |
215 | $(_v)$(MKDIR) $(OBJROOT)/$(EXPDIR)/$(EXPORT_MI_DIR) | |
1c79356b | 216 | |
39236c6e A |
217 | $(EXPORT_MI_GEN_INC_FILES): $(OBJROOT)/$(EXPDIR)/$(EXPORT_MI_DIR)/% : % | EXP_MI_INC_DIR |
218 | $(_v)$(INSTALL) $(DATA_INSTALL_FLAGS) $< $@ | |
219 | ||
220 | $(EXPORT_MI_INC_FILES): $(OBJROOT)/$(EXPDIR)/$(EXPORT_MI_DIR)/% : $(SOURCE)/% | EXP_MI_INC_DIR | |
221 | $(_v)$(INSTALL) $(DATA_INSTALL_FLAGS) $< $@ | |
222 | ||
223 | EXPORT_MD_INC_FILES = $(addprefix $(OBJROOT)/$(EXPDIR)/$(EXPORT_MD_DIR)/, $(EXPORT_MD_LIST)) | |
1c79356b A |
224 | EXPORT_MD_GEN_INC_FILES = $(addprefix $(OBJROOT)/$(EXPDIR)/$(EXPORT_MD_DIR)/, $(EXPORT_MD_GEN_LIST)) |
225 | ||
39236c6e | 226 | .PHONY: EXP_MD_INC_DIR |
1c79356b | 227 | |
39236c6e A |
228 | EXP_MD_INC_DIR: |
229 | $(_v)$(MKDIR) $(OBJROOT)/$(EXPDIR)/$(EXPORT_MD_DIR) | |
230 | ||
231 | $(EXPORT_MD_GEN_INC_FILES): $(OBJROOT)/$(EXPDIR)/$(EXPORT_MD_DIR)/% : % | EXP_MD_INC_DIR | |
232 | $(_v)$(INSTALL) $(DATA_INSTALL_FLAGS) $< $@ | |
233 | ||
234 | $(EXPORT_MD_INC_FILES): $(OBJROOT)/$(EXPDIR)/$(EXPORT_MD_DIR)/% : $(SOURCE)/% | EXP_MD_INC_DIR | |
235 | $(_v)$(INSTALL) $(DATA_INSTALL_FLAGS) $< $@ | |
236 | ||
237 | .PHONY: do_exporthdrs_mi | |
238 | ||
239 | do_exporthdrs_mi: $(EXPORT_MI_GEN_INC_FILES) $(EXPORT_MI_INC_FILES) | |
240 | @: | |
241 | ||
242 | .PHONY: do_exporthdrs_md | |
243 | ||
244 | do_exporthdrs_md: $(EXPORT_MD_GEN_INC_FILES) $(EXPORT_MD_INC_FILES) | |
245 | @: | |
1c79356b | 246 | |
1c79356b A |
247 | # |
248 | # Generic Compilation rules | |
249 | # | |
250 | ||
251 | # | |
252 | # Compilation rules to generate .o from .s | |
253 | # | |
2d21ac55 | 254 | |
39037602 | 255 | S_RULE_0=@echo "$(ColorC)AS$(Color0) $(ColorF)$@$(Color0)" |
fe8ab488 | 256 | S_RULE_1A=$(_v)${S_KCC} -c ${SFLAGS} -MD -MF $(@:o=d) -MP ${$@_SFLAGS_ADD} ${INCFLAGS} ${$@_INCFLAGS} |
39236c6e A |
257 | S_RULE_1B=$(<F) |
258 | S_RULE_2= | |
1c79356b A |
259 | |
260 | # | |
261 | # Compilation rules to generate .o from .c for normal files | |
39236c6e | 262 | # |
39037602 A |
263 | C_RULE_0=@echo "$(ColorC)CC$(Color0) $(ColorF)$@$(Color0)" |
264 | C_RULE_1A=$(_v)${KCC} -c ${filter-out ${$@_CFLAGS_RM}, ${CFLAGS} ${CWARNFLAGS}} -MD -MF $(@:o=d) -MP ${$@_CFLAGS_ADD} ${$@_CWARNFLAGS_ADD} ${INCFLAGS} ${$@_INCFLAGS} | |
39236c6e | 265 | C_RULE_1B=$(<F) |
6d2010ae | 266 | ifeq ($(BUILD_MACHO_OBJ),0) |
39236c6e A |
267 | C_RULE_2= |
268 | else ifeq ($(DO_CTFCONVERT),1) | |
39037602 A |
269 | C_RULE_2=$(_v)if [ -z "${$@_SKIP_CTFCONVERT}" ]; then \ |
270 | ctferr=`${CTFCONVERT} -l xnu -v -o $@.ctf $@ 2>&1 > /dev/null || true`; \ | |
271 | if [ ! -z "$${ctferr}" ]; then \ | |
272 | echo "[$(CMD_MC)] $(ColorErr)$@$(Color0) $(ColorErr)$${ctferr}$(Color0)"; \ | |
273 | fi; \ | |
274 | fi | |
2d21ac55 | 275 | else |
39236c6e | 276 | C_RULE_2= |
316670eb | 277 | endif |
39236c6e | 278 | ifeq ($(DO_CTFMACHO), 1) |
39037602 | 279 | C_CTFRULE_1A=$(_v)${KCC} -o $@.non_lto -c ${filter-out ${$@_CFLAGS_RM}, ${CFLAGS} ${CWARNFLAGS}} ${$@_CFLAGS_ADD} ${$@_CWARNFLAGS_ADD} ${INCFLAGS} $(CFLAGS_NOLTO_FLAG) ${$@_INCFLAGS} |
39236c6e | 280 | C_CTFRULE_1B=$(<F) |
39037602 A |
281 | C_CTFRULE_2=$(_v)if [ -z "${$@_SKIP_CTFCONVERT}" ]; then \ |
282 | ctferr=`${CTFCONVERT} -l xnu -v -o $@.non_lto.ctf $@.non_lto 2>&1 > /dev/null || true`; \ | |
283 | if [ ! -z "$${ctferr}" ]; then \ | |
284 | echo "[$(CMD_MC)] $(ColorErr)$@$(Color0) $(ColorErr)$${ctferr}$(Color0)"; \ | |
285 | fi; \ | |
286 | fi | |
39236c6e A |
287 | else |
288 | C_CTFRULE_1A=@true | |
289 | C_CTFRULE_1B= | |
290 | C_CTFRULE_2=@true | |
316670eb A |
291 | endif |
292 | ||
39037602 A |
293 | C_RULE_3=@true |
294 | C_RULE_4A=@true | |
295 | C_RULE_4B= | |
296 | ||
1c79356b A |
297 | # |
298 | # Compilation rules to generate .o from .c for driver files | |
299 | # | |
39236c6e | 300 | C_RULE_0_D=${C_RULE_0} |
1c79356b A |
301 | C_RULE_1A_D=${C_RULE_1A} |
302 | C_RULE_1B_D=${C_RULE_1B} | |
303 | C_RULE_2_D=${C_RULE_2} | |
39037602 A |
304 | C_RULE_3_D=${C_RULE_3} |
305 | C_RULE_4A_D=${C_RULE_4A} | |
306 | C_RULE_4B_D=${C_RULE_4B} | |
39236c6e A |
307 | C_CTFRULE_1A_D=${C_CTFRULE_1A} |
308 | C_CTFRULE_1B_D=${C_CTFRULE_1B} | |
309 | C_CTFRULE_2_D=${C_CTFRULE_2} | |
39037602 | 310 | C_CTFRULE_3_D=${C_CTFRULE_3} |
1c79356b | 311 | |
1c79356b A |
312 | # |
313 | # Compilation rules to generate .co from .cp or .cpo from .cpp | |
314 | # The config tool slickly changes the last source filename char to 'o' | |
315 | # for the object filename. | |
39037602 A |
316 | P_RULE_0=@echo "$(ColorC)C++$(Color0) $(ColorF)$@$(Color0)" |
317 | 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} | |
1c79356b | 318 | P_RULE_1B=$(<F) |
39236c6e A |
319 | P_RULE_2= |
320 | P_CTFRULE_1A=@true | |
321 | P_CTFRULE_1B= | |
322 | P_CTFRULE_2=@true | |
1c79356b | 323 | |
39037602 A |
324 | P_RULE_3=@true |
325 | P_RULE_4A=@true | |
326 | P_RULE_4B= | |
1c79356b | 327 | |
3e170ce0 A |
328 | # |
329 | # This isn't the right place to put this, but we need to := override some settings | |
330 | # in Makefiles that include the generic helper fragments (like this file) | |
331 | # | |
332 | ifeq ($(BUILD_JSON_COMPILATION_DATABASE),1) | |
333 | HIB_FILES := | |
334 | LAST_FILES := | |
335 | KLD_FILES := | |
336 | endif | |
337 | ||
39236c6e | 338 | .PHONY: do_build_all |
1c79356b | 339 | |
39236c6e A |
340 | # Do-nothing rule, since not all levels of the recursive hierarchy might implement this |
341 | # in their local Makefiles. Those that do will use a "::" rule to augment this. | |
342 | do_build_all:: | |
343 | @: | |
1c79356b | 344 | |
39236c6e | 345 | .PHONY: do_build_install_primary |
2d21ac55 | 346 | |
39236c6e A |
347 | # Do-nothing rule, since not all levels of the recursive hierarchy might implement this |
348 | # in their local Makefiles. Those that do will use a "::" rule to augment this. | |
349 | do_build_install_primary:: | |
350 | @: | |
2d21ac55 | 351 | |
39236c6e | 352 | .PHONY: do_build_install_non_primary |
2d21ac55 | 353 | |
39236c6e A |
354 | # Do-nothing rule, since not all levels of the recursive hierarchy might implement this |
355 | # in their local Makefiles. Those that do will use a "::" rule to augment this. | |
356 | do_build_install_non_primary:: | |
357 | @: | |
1c79356b | 358 | |
39236c6e | 359 | INSTALL_MAN_FILES = $(addprefix $(DSTROOT)/$(MANDIR)/$(INSTALL_MAN_DIR)/, $(INSTALL_MAN_LIST)) |
1c79356b | 360 | |
39236c6e | 361 | .PHONY: INSTALL_MAN_DIR |
1c79356b | 362 | |
39236c6e A |
363 | INSTALL_MAN_DIR: |
364 | $(_v)$(MKDIR) $(DSTROOT)/$(MANDIR)/$(INSTALL_MAN_DIR) | |
9bccf70c | 365 | |
39236c6e | 366 | $(INSTALL_MAN_FILES): $(DSTROOT)/$(MANDIR)/$(INSTALL_MAN_DIR)/% : % | INSTALL_MAN_DIR |
39037602 | 367 | @echo "$(ColorH)MAN$(Color0) $(ColorF)$*$(Color0)" |
39236c6e A |
368 | $(_v)$(INSTALL) $(INSTALL_FLAGS) $< $@ |
369 | ||
370 | define MAN_LINKS_RULE_template | |
371 | $$(DSTROOT)/$$(MANDIR)/$$(INSTALL_MAN_DIR)/$(2): $$(DSTROOT)/$$(MANDIR)/$$(INSTALL_MAN_DIR)/$(1) | |
39037602 | 372 | @echo "$$(ColorH)MANLINK$$(Color0) $$(ColorF)$(2)$$(Color0)" |
39236c6e A |
373 | $(_v)ln -f $$< $$@ |
374 | endef | |
375 | ||
376 | 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)))) | |
377 | ||
378 | INSTALL_MAN_FILES_LINKS = $(call function_generate_man_links_rules,$(INSTALL_MAN_LINKS)) | |
379 | ||
380 | .PHONY: do_installman | |
381 | ||
382 | do_installman: $(INSTALL_MAN_FILES) $(INSTALL_MAN_FILES_LINKS) | |
383 | @: | |
1c79356b | 384 | |
fe8ab488 A |
385 | .PHONY: do_textfiles_install |
386 | ||
387 | # Do-nothing rule, since not all levels of the recursive hierarchy might implement this | |
388 | # in their local Makefiles. Those that do will use a "::" rule to augment this. | |
389 | do_textfiles_install:: do_installman | |
390 | @: | |
391 | ||
39236c6e A |
392 | .PHONY: do_build_setup |
393 | ||
394 | # Do-nothing rule, since not all levels of the recursive hierarchy might implement this | |
395 | # in their local Makefiles. Those that do will use a "::" rule to augment this. | |
396 | do_build_setup:: | |
397 | @: | |
398 | ||
399 | .PHONY: do_config_all | |
400 | ||
401 | # Do-nothing rule, since not all levels of the recursive hierarchy might implement this | |
402 | # in their local Makefiles. Those that do will use a "::" rule to augment this. | |
403 | do_config_all:: | |
404 | @: | |
405 | ||
fe8ab488 A |
406 | .PHONY: do_config_install |
407 | ||
408 | # Do-nothing rule, since not all levels of the recursive hierarchy might implement this | |
409 | # in their local Makefiles. Those that do will use a "::" rule to augment this. | |
410 | do_config_install:: | |
411 | @: | |
b0d623f7 | 412 | |
2d21ac55 | 413 | # vim: set ft=make: |