]> git.saurik.com Git - apple/xnu.git/blob - makedefs/MakeInc.rule
ad66233b6ff832dbba1b636fd716222cb5a49e8d
[apple/xnu.git] / makedefs / MakeInc.rule
1 # -*- mode: makefile;-*-
2 #
3 # Copyright (C) 1999-2016 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 #
11
12 #
13 # Generic Install rules
14 #
15
16 ifndef INSTALL_KF_MI_LCL_LIST
17 INSTALL_KF_MI_LCL_LIST = $(EXPORT_MI_LIST)
18 endif
19
20 ifndef INSTALL_KF_MI_LCL_GEN_LIST
21 INSTALL_KF_MI_LCL_GEN_LIST = $(EXPORT_MI_GEN_LIST)
22 endif
23
24 ifndef INSTALL_KF_MD_LCL_LIST
25 INSTALL_KF_MD_LCL_LIST = $(EXPORT_MD_LIST)
26 endif
27
28 ifndef INSTALL_KF_MD_LCL_GEN_LIST
29 INSTALL_KF_MD_LCL_GEN_LIST = $(EXPORT_MD_GEN_LIST)
30 endif
31
32 ifndef INSTALL_KF_MI_LIST
33 INSTALL_KF_MI_LIST = $(EXPORT_MI_LIST)
34 endif
35
36 ifndef INSTALL_KF_MI_GEN_LIST
37 INSTALL_KF_MI_GEN_LIST = $(EXPORT_MI_GEN_LIST)
38 endif
39
40 ifndef INSTALL_KF_MD_LIST
41 INSTALL_KF_MD_LIST = $(EXPORT_MD_LIST)
42 endif
43
44 ifndef INSTALL_KF_MD_GEN_LIST
45 INSTALL_KF_MD_GEN_LIST = $(EXPORT_MD_GEN_LIST)
46 endif
47
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 MACHINE_PFX
60 export _MACHINE := $(CURRENT_MACHINE_CONFIG_LC)
61 ifeq ($(CURRENT_MACHINE_CONFIG),NONE)
62 export _MACHINE := $(subst OSX,,$(PLATFORM))
63 endif
64 export MACHINE_PFX := $(shell __A="$(CURRENT_ARCH_CONFIG_LC)"; \
65 __As=$$((6-$${\#__A})); \
66 printf "%-.6s%*.*s %9.9s" \
67 "$${__A}" \
68 $${__As} $${__As} " " \
69 "$(_MACHINE)")
70 endif
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")
85 # Start a filename
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")
91 endif
92
93 .PHONY: ALWAYS
94
95 ALWAYS:
96
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
101 #
102 # $$$$$$$$ is a double-escaped "$$" to represent the current pid
103 # of the shell process for creating uniquely named temporary files
104
105 define INSTALLHDRS_RULE_template
106
107 .PHONY: $(3)_MKDIR
108
109 $(3)_MKDIR:
110 $$(_v)$$(MKDIR) ./$(3)
111 $$(_v)$$(MKDIR) $(dir $(firstword $(1)))
112
113 # Rebuild if unifdef flags change
114 $(1): $(3)/.UNIFDEF_FLAGS
115 $(3)/.UNIFDEF_FLAGS: ALWAYS | $(3)_MKDIR
116 $$(_v)$$(REPLACECONTENTS) $$@ $$(UNIFDEF) $(4)
117
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 $$<; \
123 exit 1; \
124 fi; \
125 $$(DECOMMENT) ./$(3)/$$*.unifdef.$$$$$$$$ r > \
126 ./$(3)/$$*.strip.$$$$$$$$ || exit 1; \
127 if [ -s ./$(3)/$$*.strip.$$$$$$$$ ]; then \
128 $$(INSTALL) $$(INSTALL_FLAGS) ./$(3)/$$*.unifdef.$$$$$$$$ $$@ || exit 1; \
129 fi; \
130 $$(RM) ./$(3)/$$*.unifdef.$$$$$$$$ ./$(3)/$$*.strip.$$$$$$$$
131 endef
132
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
138 #
139 # $$$$$$$$ is a double-escaped "$$" to represent the current pid
140 # of the shell process for creating uniquely named temporary files
141
142 define INSTALLPYTHON_RULE_template
143
144 .PHONY: $(3)_MKDIR
145
146 $(3)_MKDIR:
147 $$(_v)$$(MKDIR) ./$(3)
148
149 # Rebuild if unifdef flags change
150 $(1): $(3)/.UNIFDEF_FLAGS
151 $(3)/.UNIFDEF_FLAGS: ALWAYS | $(3)_MKDIR
152 $$(_v)$$(REPLACECONTENTS) $$@ $$(UNIFDEF) -t $(4)
153
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 $$<; \
160 exit 1; \
161 fi; \
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
168 endef
169
170 #
171 # Empty the install lists of non-host headers if building the host headers alias
172 #
173
174 ifeq ($(INSTALLHDRS_SKIP_HOST),YES)
175 INSTALL_MI_LIST =
176 INSTALL_MI_GEN_LIST =
177 INSTALL_DRIVERKIT_MI_LIST =
178 INSTALL_DRIVERKIT_MI_GEN_LIST =
179 INSTALL_KF_MI_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 =
187 INSTALL_MD_LIST =
188 INSTALL_MD_GEN_LIST =
189 INSTALL_DRIVERKIT_MD_LIST =
190 INSTALL_DRIVERKIT_MD_GEN_LIST =
191 INSTALL_KF_MD_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 =
200 endif
201
202 #
203 # Machine-independent (public) files
204 #
205
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))
208
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)))
211
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))
215
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)))
218 endif
219
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))
222
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)))
225
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))
228
229 $(eval $(call INSTALLHDRS_RULE_template,$(INSTALL_MODULEMAP_INCDIR_MI_INC_FILES),,mmrootincmidir,-t $(DATA_UNIFDEF)))
230
231 #
232 # Machine-independent local (private) files
233 #
234
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)))
238 else
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)))
241 endif
242
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)))
245
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))
249
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)))
252 endif
253
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))
256
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)))
259
260 #
261 # Machine-dependent (public) files
262 #
263
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))
266
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)))
269
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))
273
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)))
276 endif
277
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))
280
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)))
283
284 #
285 # Machine-dependent local (private) files
286 #
287
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)))
291 else
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)))
294 endif
295
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)))
298
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))
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)))
305 endif
306
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))
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
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)
323 @:
324
325 .PHONY: do_installhdrs_md
326
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)
333 @:
334
335 #
336 # Generic Export rules
337 #
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))
340
341 .PHONY: EXP_MI_INC_DIR
342
343 EXP_MI_INC_DIR:
344 $(_v)$(MKDIR) $(OBJROOT)/$(EXPDIR)/$(EXPORT_MI_DIR)
345
346 $(EXPORT_MI_GEN_INC_FILES): $(OBJROOT)/$(EXPDIR)/$(EXPORT_MI_DIR)/% : % | EXP_MI_INC_DIR
347 $(_v)$(INSTALL) $(DATA_INSTALL_FLAGS_RO) $< $@
348
349 $(EXPORT_MI_INC_FILES): $(OBJROOT)/$(EXPDIR)/$(EXPORT_MI_DIR)/% : $(SOURCE)/% | EXP_MI_INC_DIR
350 $(_v)$(INSTALL) $(DATA_INSTALL_FLAGS_RO) $< $@
351
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))
354
355 .PHONY: EXP_MD_INC_DIR
356
357 EXP_MD_INC_DIR:
358 $(_v)$(MKDIR) $(OBJROOT)/$(EXPDIR)/$(EXPORT_MD_DIR)
359
360 $(EXPORT_MD_GEN_INC_FILES): $(OBJROOT)/$(EXPDIR)/$(EXPORT_MD_DIR)/% : % | EXP_MD_INC_DIR
361 $(_v)$(INSTALL) $(DATA_INSTALL_FLAGS_RO) $< $@
362
363 $(EXPORT_MD_INC_FILES): $(OBJROOT)/$(EXPDIR)/$(EXPORT_MD_DIR)/% : $(SOURCE)/% | EXP_MD_INC_DIR
364 $(_v)$(INSTALL) $(DATA_INSTALL_FLAGS_RO) $< $@
365
366 .PHONY: do_exporthdrs_mi
367
368 do_exporthdrs_mi: $(EXPORT_MI_GEN_INC_FILES) $(EXPORT_MI_INC_FILES)
369 @:
370
371 .PHONY: do_exporthdrs_md
372
373 do_exporthdrs_md: $(EXPORT_MD_GEN_INC_FILES) $(EXPORT_MD_INC_FILES)
374 @:
375
376 #
377 # Generic Compilation rules
378 #
379
380 #
381 # Compilation rules to generate .o from .s
382 #
383
384 S_RULE_0=@$(LOG_AS) "$@"
385 S_RULE_1A=$(_v)${S_KCC} -c ${SFLAGS} -MD -MF $(@:o=d) -MP ${$@_SFLAGS_ADD} ${INCFLAGS} ${$@_INCFLAGS}
386 S_RULE_1B=$(<F)
387 S_RULE_2=
388
389 #
390 # Compilation rules to generate .o from .c for normal files
391 #
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}
394 C_RULE_1B=$(<F)
395 C_RULE_2=
396
397 C_RULE_3=
398 C_RULE_4A=
399 C_RULE_4B=
400
401 #
402 # Compilation rules to generate .o from .c for driver files
403 #
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}
411
412 #
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}
418 P_RULE_1B=$(<F)
419 P_RULE_2=
420
421 P_RULE_3=
422 P_RULE_4A=
423 P_RULE_4B=
424
425 #
426 # Explain how to make the bsd syscall list
427 #
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 $<; \
433 exit 1; \
434 fi
435
436 #
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)
439 #
440 ifeq ($(BUILD_JSON_COMPILATION_DATABASE),1)
441 HIB_FILES :=
442 LAST_FILES :=
443 KLD_FILES :=
444 endif
445
446 .PHONY: do_build_all
447
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.
450 do_build_all::
451 @:
452
453 .PHONY: do_build_install_primary
454
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::
458 @:
459
460 .PHONY: do_build_install_non_primary
461
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::
465 @:
466
467 INSTALL_MAN_FILES = $(addprefix $(DSTROOT)/$(MANDIR)/$(INSTALL_MAN_DIR)/, $(INSTALL_MAN_LIST))
468
469 .PHONY: INSTALL_MAN_DIR
470
471 INSTALL_MAN_DIR:
472 $(_v)$(MKDIR) $(DSTROOT)/$(MANDIR)/$(INSTALL_MAN_DIR)
473
474 $(INSTALL_MAN_FILES): $(DSTROOT)/$(MANDIR)/$(INSTALL_MAN_DIR)/% : % | INSTALL_MAN_DIR
475 @$(LOG_MAN) "$*"
476 $(_v)$(INSTALL) $(INSTALL_FLAGS) $< $@
477
478 define MAN_LINKS_RULE_template
479 $$(DSTROOT)/$$(MANDIR)/$$(INSTALL_MAN_DIR)/$(2): $$(DSTROOT)/$$(MANDIR)/$$(INSTALL_MAN_DIR)/$(1)
480 @$$(LOG_MANLINK) "$(2)"
481 $(_v)ln -f $$< $$@
482 endef
483
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))))
485
486 INSTALL_MAN_FILES_LINKS = $(call function_generate_man_links_rules,$(INSTALL_MAN_LINKS))
487
488 .PHONY: do_installman
489
490 do_installman: $(INSTALL_MAN_FILES) $(INSTALL_MAN_FILES_LINKS)
491 @:
492
493 .PHONY: do_textfiles_install do_textfiles_install_mi do_textfiles_install_md
494
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
498 @:
499
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::
503 @:
504
505 .PHONY: do_build_setup
506
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.
509 do_build_setup::
510 @:
511
512 .PHONY: do_config_all
513
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.
516 do_config_all::
517 @:
518
519 .PHONY: do_config_install
520
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.
523 do_config_install::
524 @:
525
526 # vim: set ft=make: