]> git.saurik.com Git - apple/xnu.git/blame - makedefs/MakeInc.rule
xnu-7195.101.1.tar.gz
[apple/xnu.git] / makedefs / MakeInc.rule
CommitLineData
39236c6e
A
1# -*- mode: makefile;-*-
2#
2a1bd2d3 3# Copyright (C) 1999-2020 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#
2a1bd2d3 11include $(SRCROOT)/makedefs/MakeInc.color
39236c6e 12
1c79356b
A
13#
14# Generic Install rules
15#
16
91447636
A
17ifndef INSTALL_KF_MI_LCL_LIST
18 INSTALL_KF_MI_LCL_LIST = $(EXPORT_MI_LIST)
19endif
1c79356b 20
91447636
A
21ifndef INSTALL_KF_MI_LCL_GEN_LIST
22 INSTALL_KF_MI_LCL_GEN_LIST = $(EXPORT_MI_GEN_LIST)
23endif
1c79356b 24
91447636
A
25ifndef INSTALL_KF_MD_LCL_LIST
26 INSTALL_KF_MD_LCL_LIST = $(EXPORT_MD_LIST)
27endif
1c79356b 28
91447636
A
29ifndef INSTALL_KF_MD_LCL_GEN_LIST
30 INSTALL_KF_MD_LCL_GEN_LIST = $(EXPORT_MD_GEN_LIST)
31endif
9bccf70c 32
91447636
A
33ifndef INSTALL_KF_MI_LIST
34 INSTALL_KF_MI_LIST = $(EXPORT_MI_LIST)
35endif
1c79356b 36
91447636
A
37ifndef INSTALL_KF_MI_GEN_LIST
38 INSTALL_KF_MI_GEN_LIST = $(EXPORT_MI_GEN_LIST)
39endif
9bccf70c 40
91447636
A
41ifndef INSTALL_KF_MD_LIST
42 INSTALL_KF_MD_LIST = $(EXPORT_MD_LIST)
43endif
9bccf70c 44
91447636
A
45ifndef INSTALL_KF_MD_GEN_LIST
46 INSTALL_KF_MD_GEN_LIST = $(EXPORT_MD_GEN_LIST)
47endif
48
2a1bd2d3 49$(eval $(call _setup_build_log_colors))
39037602 50
39236c6e 51.PHONY: ALWAYS
2d21ac55 52
39236c6e 53ALWAYS:
91447636 54
39236c6e
A
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
91447636 62
39236c6e 63define INSTALLHDRS_RULE_template
9bccf70c 64
39236c6e
A
65.PHONY: $(3)_MKDIR
66
67$(3)_MKDIR:
68 $$(_v)$$(MKDIR) ./$(3)
69 $$(_v)$$(MKDIR) $(dir $(firstword $(1)))
70
fe8ab488
A
71# Rebuild if unifdef flags change
72$(1): $(3)/.UNIFDEF_FLAGS
73$(3)/.UNIFDEF_FLAGS: ALWAYS | $(3)_MKDIR
74 $$(_v)$$(REPLACECONTENTS) $$@ $$(UNIFDEF) $(4)
75
39236c6e 76$(1): $(dir $(firstword $(1)))% : $(if $(2),%,$$(SOURCE)/%) | $(3)_MKDIR
f427ee49 77 @$$(LOG_INSTALLHDR) "$$*"
39236c6e
A
78 $$(_v)$$(UNIFDEF) $(4) $$< > ./$(3)/$$*.unifdef.$$$$$$$$; \
79 if [ $$$$? -eq 2 ]; then \
cb323159 80 $(ERR) Parse failure for $$<; \
39236c6e 81 exit 1; \
91447636 82 fi; \
39236c6e
A
83 $$(DECOMMENT) ./$(3)/$$*.unifdef.$$$$$$$$ r > \
84 ./$(3)/$$*.strip.$$$$$$$$ || exit 1; \
85 if [ -s ./$(3)/$$*.strip.$$$$$$$$ ]; then \
86 $$(INSTALL) $$(INSTALL_FLAGS) ./$(3)/$$*.unifdef.$$$$$$$$ $$@ || exit 1; \
91447636 87 fi; \
39236c6e
A
88 $$(RM) ./$(3)/$$*.unifdef.$$$$$$$$ ./$(3)/$$*.strip.$$$$$$$$
89endef
90
d9a64523
A
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
f427ee49 113 @$$(LOG_INSTALLPY) "$$*"
d9a64523
A
114 $$(_v)$$(MKDIR) $$(dir $$@) $$(dir ./$(3)/$$*)
115 $$(_v)$$(UNIFDEF) -t $(4) $$< > ./$(3)/$$*.unifdef.$$$$$$$$$$(suffix $$*); \
116 if [ $$$$? -eq 2 ]; then \
cb323159 117 $(ERR) Parse failure for $$<; \
d9a64523
A
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
cb323159
A
128#
129# Empty the install lists of non-host headers if building the host headers alias
130#
131
132ifeq ($(INSTALLHDRS_SKIP_HOST),YES)
133INSTALL_MI_LIST =
134INSTALL_MI_GEN_LIST =
135INSTALL_DRIVERKIT_MI_LIST =
136INSTALL_DRIVERKIT_MI_GEN_LIST =
137INSTALL_KF_MI_LIST =
138INSTALL_KF_MI_GEN_LIST =
139INSTALL_MI_LCL_LIST =
140INSTALL_MI_LCL_GEN_LIST =
141INSTALL_DRIVERKIT_MI_LCL_LIST =
142INSTALL_DRIVERKIT_MI_LCL_GEN_LIST =
143INSTALL_KF_MI_LCL_LIST =
144INSTALL_KF_MI_LCL_GEN_LIST =
145INSTALL_MD_LIST =
146INSTALL_MD_GEN_LIST =
147INSTALL_DRIVERKIT_MD_LIST =
148INSTALL_DRIVERKIT_MD_GEN_LIST =
149INSTALL_KF_MD_LIST =
150INSTALL_KF_MD_GEN_LIST =
151INSTALL_MD_LCL_LIST =
152INSTALL_MD_LCL_GEN_LIST =
153INSTALL_DRIVERKIT_MD_LCL_LIST =
154INSTALL_DRIVERKIT_MD_LCL_GEN_LIST =
155INSTALL_KF_MD_LCL_LIST =
156INSTALL_KF_MD_LCL_GEN_LIST =
f427ee49 157INSTALL_MODULEMAP_INCDIR_MI_LIST =
cb323159
A
158endif
159
39236c6e
A
160#
161# Machine-independent (public) files
162#
163
164INSTALL_MI_INC_FILES = $(addprefix $(DSTROOT)/$(INCDIR)/$(INSTALL_MI_DIR)/, $(INSTALL_MI_LIST))
165INSTALL_MI_INC_GEN_FILES = $(addprefix $(DSTROOT)/$(INCDIR)/$(INSTALL_MI_DIR)/, $(INSTALL_MI_GEN_LIST))
166
167$(eval $(call INSTALLHDRS_RULE_template,$(INSTALL_MI_INC_FILES),,incmidir,$(SINCFRAME_UNIFDEF)))
168$(eval $(call INSTALLHDRS_RULE_template,$(INSTALL_MI_INC_GEN_FILES),1,incmigendir,$(SINCFRAME_UNIFDEF)))
1c79356b 169
cb323159
A
170ifeq ($(DRIVERKIT),1)
171INSTALL_DRIVERKIT_MI_INC_FILES = $(addprefix $(DSTROOT)/$(DRIVERKITINCDIR)/$(INSTALL_MI_DIR)/, $(INSTALL_DRIVERKIT_MI_LIST))
172INSTALL_DRIVERKIT_MI_INC_GEN_FILES = $(addprefix $(DSTROOT)/$(DRIVERKITINCDIR)/$(INSTALL_MI_DIR)/, $(INSTALL_DRIVERKIT_MI_GEN_LIST))
173
174$(eval $(call INSTALLHDRS_RULE_template,$(INSTALL_DRIVERKIT_MI_INC_FILES),,dkincmidir,$(DKINCFRAME_UNIFDEF)))
175$(eval $(call INSTALLHDRS_RULE_template,$(INSTALL_DRIVERKIT_MI_INC_GEN_FILES),1,dkincmigendir,$(DKINCFRAME_UNIFDEF)))
176endif
177
39236c6e
A
178INSTALL_KF_MI_FILES = $(addprefix $(DSTROOT)/$(KINCDIR)/$(EXPORT_MI_DIR)/, $(INSTALL_KF_MI_LIST))
179INSTALL_KF_MI_GEN_FILES = $(addprefix $(DSTROOT)/$(KINCDIR)/$(EXPORT_MI_DIR)/, $(INSTALL_KF_MI_GEN_LIST))
180
181$(eval $(call INSTALLHDRS_RULE_template,$(INSTALL_KF_MI_FILES),,kincmidir,$(KINCFRAME_UNIFDEF)))
182$(eval $(call INSTALLHDRS_RULE_template,$(INSTALL_KF_MI_GEN_FILES),1,kincmigendir,$(KINCFRAME_UNIFDEF)))
1c79356b 183
f427ee49
A
184# Skip INSTALL_MI_DIR to install directly to INCDIR.
185INSTALL_MODULEMAP_INCDIR_MI_INC_FILES = $(addprefix $(DSTROOT)/$(INCDIR)/,$(INSTALL_MODULEMAP_INCDIR_MI_LIST))
186
187$(eval $(call INSTALLHDRS_RULE_template,$(INSTALL_MODULEMAP_INCDIR_MI_INC_FILES),,mmrootincmidir,-t $(DATA_UNIFDEF)))
188
1c79356b 189#
39236c6e 190# Machine-independent local (private) files
1c79356b 191#
1c79356b 192
f427ee49 193ifeq ($(LIBKERN_USE_USR_LOCAL_INCLUDE),)
3e170ce0
A
194INSTALL_MI_LCL_FILES = $(addprefix $(DSTROOT)/$(LCLDIR)/$(INSTALL_MI_DIR)/, $(sort $(INSTALL_MI_LCL_LIST) $(INSTALL_MI_LIST)))
195INSTALL_MI_LCL_GEN_FILES = $(addprefix $(DSTROOT)/$(LCLDIR)/$(INSTALL_MI_DIR)/, $(sort $(INSTALL_MI_LCL_GEN_LIST) $(INSTALL_MI_GEN_LIST)))
f427ee49
A
196else
197INSTALL_MI_LCL_FILES = $(addprefix $(DSTROOT)/$(LCLDIR)/$(INSTALL_MI_DIR)/, $(sort $(INSTALL_MI_LCL_LIST)))
198INSTALL_MI_LCL_GEN_FILES = $(addprefix $(DSTROOT)/$(LCLDIR)/$(INSTALL_MI_DIR)/, $(sort $(INSTALL_MI_LCL_GEN_LIST)))
199endif
1c79356b 200
39236c6e
A
201$(eval $(call INSTALLHDRS_RULE_template,$(INSTALL_MI_LCL_FILES),,pincmidir,$(SPINCFRAME_UNIFDEF)))
202$(eval $(call INSTALLHDRS_RULE_template,$(INSTALL_MI_LCL_GEN_FILES),1,pincmigendir,$(SPINCFRAME_UNIFDEF)))
1c79356b 203
cb323159
A
204ifeq ($(DRIVERKIT),1)
205INSTALL_DRIVERKIT_MI_LCL_FILES = $(addprefix $(DSTROOT)/$(DRIVERKITLCLDIR)/$(INSTALL_MI_DIR)/, $(INSTALL_DRIVERKIT_MI_LCL_LIST))
206INSTALL_DRIVERKIT_MI_LCL_GEN_FILES = $(addprefix $(DSTROOT)/$(DRIVERKITLCLDIR)/$(INSTALL_MI_DIR)/, $(INSTALL_DRIVERKIT_MI_LCL_GEN_LIST))
207
208$(eval $(call INSTALLHDRS_RULE_template,$(INSTALL_DRIVERKIT_MI_LCL_FILES),,dkpincmidir,$(DKPINCFRAME_UNIFDEF)))
209$(eval $(call INSTALLHDRS_RULE_template,$(INSTALL_DRIVERKIT_MI_LCL_GEN_FILES),1,dkpincmigendir,$(DKPINCFRAME_UNIFDEF)))
210endif
211
39236c6e
A
212INSTALL_KF_MI_LCL_FILES = $(addprefix $(DSTROOT)/$(KPINCDIR)/$(EXPORT_MI_DIR)/, $(INSTALL_KF_MI_LCL_LIST))
213INSTALL_KF_MI_LCL_GEN_FILES = $(addprefix $(DSTROOT)/$(KPINCDIR)/$(EXPORT_MI_DIR)/, $(INSTALL_KF_MI_LCL_GEN_LIST))
1c79356b 214
39236c6e
A
215$(eval $(call INSTALLHDRS_RULE_template,$(INSTALL_KF_MI_LCL_FILES),,kpincmidir,$(KPINCFRAME_UNIFDEF)))
216$(eval $(call INSTALLHDRS_RULE_template,$(INSTALL_KF_MI_LCL_GEN_FILES),1,kpincmigendir,$(KPINCFRAME_UNIFDEF)))
1c79356b 217
39236c6e
A
218#
219# Machine-dependent (public) files
220#
1c79356b 221
39236c6e
A
222INSTALL_MD_INC_FILES = $(addprefix $(DSTROOT)/$(INCDIR)/$(INSTALL_MD_DIR)/, $(INSTALL_MD_LIST))
223INSTALL_MD_INC_GEN_FILES = $(addprefix $(DSTROOT)/$(INCDIR)/$(INSTALL_MD_DIR)/, $(INSTALL_MD_GEN_LIST))
1c79356b 224
39236c6e
A
225$(eval $(call INSTALLHDRS_RULE_template,$(INSTALL_MD_INC_FILES),,incdir,$(SINCFRAME_UNIFDEF)))
226$(eval $(call INSTALLHDRS_RULE_template,$(INSTALL_MD_INC_GEN_FILES),1,incgendir,$(SINCFRAME_UNIFDEF)))
1c79356b 227
cb323159
A
228ifeq ($(DRIVERKIT),1)
229INSTALL_DRIVERKIT_MD_INC_FILES = $(addprefix $(DSTROOT)/$(DRIVERKITINCDIR)/$(INSTALL_MD_DIR)/, $(INSTALL_DRIVERKIT_MD_LIST))
230INSTALL_DRIVERKIT_MD_INC_GEN_FILES = $(addprefix $(DSTROOT)/$(DRIVERKITINCDIR)/$(INSTALL_MD_DIR)/, $(INSTALL_DRIVERKIT_MD_GEN_LIST))
231
232$(eval $(call INSTALLHDRS_RULE_template,$(INSTALL_DRIVERKIT_MD_INC_FILES),,dkincdir,$(DKINCFRAME_UNIFDEF)))
233$(eval $(call INSTALLHDRS_RULE_template,$(INSTALL_DRIVERKIT_MD_INC_GEN_FILES),1,dkincgendir,$(DKINCFRAME_UNIFDEF)))
234endif
235
39236c6e
A
236INSTALL_KF_MD_FILES = $(addprefix $(DSTROOT)/$(KINCDIR)/$(EXPORT_MD_DIR)/, $(INSTALL_KF_MD_LIST))
237INSTALL_KF_MD_GEN_FILES = $(addprefix $(DSTROOT)/$(KINCDIR)/$(EXPORT_MD_DIR)/, $(INSTALL_KF_MD_GEN_LIST))
1c79356b 238
39236c6e
A
239$(eval $(call INSTALLHDRS_RULE_template,$(INSTALL_KF_MD_FILES),,kincdir,$(KINCFRAME_UNIFDEF)))
240$(eval $(call INSTALLHDRS_RULE_template,$(INSTALL_KF_MD_GEN_FILES),1,kincgendir,$(KINCFRAME_UNIFDEF)))
1c79356b 241
39236c6e
A
242#
243# Machine-dependent local (private) files
244#
245
f427ee49 246ifeq ($(LIBKERN_USE_USR_LOCAL_INCLUDE),)
3e170ce0
A
247INSTALL_MD_LCL_FILES = $(addprefix $(DSTROOT)/$(LCLDIR)/$(INSTALL_MD_DIR)/, $(sort $(INSTALL_MD_LCL_LIST) $(INSTALL_MD_LIST)))
248INSTALL_MD_LCL_GEN_FILES = $(addprefix $(DSTROOT)/$(LCLDIR)/$(INSTALL_MD_DIR)/, $(sort $(INSTALL_MD_LCL_GEN_LIST) $(INSTALL_MD_GEN_LIST)))
f427ee49
A
249else
250INSTALL_MD_LCL_FILES = $(addprefix $(DSTROOT)/$(LCLDIR)/$(INSTALL_MD_DIR)/, $(sort $(INSTALL_MD_LCL_LIST)))
251INSTALL_MD_LCL_GEN_FILES = $(addprefix $(DSTROOT)/$(LCLDIR)/$(INSTALL_MD_DIR)/, $(sort $(INSTALL_MD_LCL_GEN_LIST)))
252endif
39236c6e
A
253
254$(eval $(call INSTALLHDRS_RULE_template,$(INSTALL_MD_LCL_FILES),,pincdir,$(SPINCFRAME_UNIFDEF)))
255$(eval $(call INSTALLHDRS_RULE_template,$(INSTALL_MD_LCL_GEN_FILES),1,pincgendir,$(SPINCFRAME_UNIFDEF)))
256
cb323159
A
257ifeq ($(DRIVERKIT),1)
258INSTALL_DRIVERKIT_MD_LCL_FILES = $(addprefix $(DSTROOT)/$(DRIVERKITLCLDIR)/$(INSTALL_MD_DIR)/, $(INSTALL_DRIVERKIT_MD_LCL_LIST))
259INSTALL_DRIVERKIT_MD_LCL_GEN_FILES = $(addprefix $(DSTROOT)/$(DRIVERKITLCLDIR)/$(INSTALL_MD_DIR)/, $(INSTALL_DRIVERKIT_MD_LCL_GEN_LIST))
260
261$(eval $(call INSTALLHDRS_RULE_template,$(INSTALL_DRIVERKIT_MD_LCL_FILES),,dkpincdir,$(DKPINCFRAME_UNIFDEF)))
262$(eval $(call INSTALLHDRS_RULE_template,$(INSTALL_DRIVERKIT_MD_LCL_GEN_FILES),1,dkpincgendir,$(DKPINCFRAME_UNIFDEF)))
263endif
264
39236c6e
A
265INSTALL_KF_MD_LCL_FILES = $(addprefix $(DSTROOT)/$(KPINCDIR)/$(EXPORT_MD_DIR)/, $(INSTALL_KF_MD_LCL_LIST))
266INSTALL_KF_MD_LCL_GEN_FILES = $(addprefix $(DSTROOT)/$(KPINCDIR)/$(EXPORT_MD_DIR)/, $(INSTALL_KF_MD_LCL_GEN_LIST))
267
268$(eval $(call INSTALLHDRS_RULE_template,$(INSTALL_KF_MD_LCL_FILES),,kpincdir,$(KPINCFRAME_UNIFDEF)))
269$(eval $(call INSTALLHDRS_RULE_template,$(INSTALL_KF_MD_LCL_GEN_FILES),1,kpincgendir,$(KPINCFRAME_UNIFDEF)))
1c79356b 270
39236c6e
A
271.PHONY: do_installhdrs_mi
272
273# Double-colon rule so that MakeInc.kernel can add custom behaviors
cb323159
A
274do_installhdrs_mi:: $(INSTALL_MI_INC_FILES) $(INSTALL_MI_INC_GEN_FILES) \
275 $(INSTALL_DRIVERKIT_MI_INC_FILES) $(INSTALL_DRIVERKIT_MI_INC_GEN_FILES) \
276 $(INSTALL_KF_MI_FILES) $(INSTALL_KF_MI_GEN_FILES) \
277 $(INSTALL_MI_LCL_FILES) $(INSTALL_MI_LCL_GEN_FILES) \
278 $(INSTALL_DRIVERKIT_MI_LCL_FILES) $(INSTALL_DRIVERKIT_MI_LCL_GEN_FILES) \
f427ee49
A
279 $(INSTALL_KF_MI_LCL_FILES) $(INSTALL_KF_MI_LCL_GEN_FILES) \
280 $(INSTALL_MODULEMAP_INCDIR_MI_INC_FILES)
39236c6e
A
281 @:
282
283.PHONY: do_installhdrs_md
284
cb323159
A
285do_installhdrs_md: $(INSTALL_MD_INC_FILES) $(INSTALL_MD_INC_GEN_FILES) \
286 $(INSTALL_DRIVERKIT_MD_INC_FILES) $(INSTALL_DRIVERKIT_MD_INC_GEN_FILES) \
287 $(INSTALL_KF_MD_FILES) $(INSTALL_KF_MD_GEN_FILES) \
288 $(INSTALL_MD_LCL_FILES) $(INSTALL_MD_LCL_GEN_FILES) \
289 $(INSTALL_DRIVERKIT_MD_LCL_FILES) $(INSTALL_DRIVERKIT_MD_LCL_GEN_FILES) \
290 $(INSTALL_KF_MD_LCL_FILES) $(INSTALL_KF_MD_LCL_GEN_FILES)
39236c6e
A
291 @:
292
293#
294# Generic Export rules
295#
296EXPORT_MI_INC_FILES = $(addprefix $(OBJROOT)/$(EXPDIR)/$(EXPORT_MI_DIR)/, $(EXPORT_MI_LIST))
1c79356b
A
297EXPORT_MI_GEN_INC_FILES = $(addprefix $(OBJROOT)/$(EXPDIR)/$(EXPORT_MI_DIR)/, $(EXPORT_MI_GEN_LIST))
298
39236c6e 299.PHONY: EXP_MI_INC_DIR
1c79356b 300
39236c6e
A
301EXP_MI_INC_DIR:
302 $(_v)$(MKDIR) $(OBJROOT)/$(EXPDIR)/$(EXPORT_MI_DIR)
1c79356b 303
39236c6e 304$(EXPORT_MI_GEN_INC_FILES): $(OBJROOT)/$(EXPDIR)/$(EXPORT_MI_DIR)/% : % | EXP_MI_INC_DIR
f427ee49 305 $(_v)$(INSTALL) $(DATA_INSTALL_FLAGS_RO) $< $@
39236c6e
A
306
307$(EXPORT_MI_INC_FILES): $(OBJROOT)/$(EXPDIR)/$(EXPORT_MI_DIR)/% : $(SOURCE)/% | EXP_MI_INC_DIR
f427ee49 308 $(_v)$(INSTALL) $(DATA_INSTALL_FLAGS_RO) $< $@
39236c6e
A
309
310EXPORT_MD_INC_FILES = $(addprefix $(OBJROOT)/$(EXPDIR)/$(EXPORT_MD_DIR)/, $(EXPORT_MD_LIST))
1c79356b
A
311EXPORT_MD_GEN_INC_FILES = $(addprefix $(OBJROOT)/$(EXPDIR)/$(EXPORT_MD_DIR)/, $(EXPORT_MD_GEN_LIST))
312
39236c6e 313.PHONY: EXP_MD_INC_DIR
1c79356b 314
39236c6e
A
315EXP_MD_INC_DIR:
316 $(_v)$(MKDIR) $(OBJROOT)/$(EXPDIR)/$(EXPORT_MD_DIR)
317
318$(EXPORT_MD_GEN_INC_FILES): $(OBJROOT)/$(EXPDIR)/$(EXPORT_MD_DIR)/% : % | EXP_MD_INC_DIR
f427ee49 319 $(_v)$(INSTALL) $(DATA_INSTALL_FLAGS_RO) $< $@
39236c6e
A
320
321$(EXPORT_MD_INC_FILES): $(OBJROOT)/$(EXPDIR)/$(EXPORT_MD_DIR)/% : $(SOURCE)/% | EXP_MD_INC_DIR
f427ee49 322 $(_v)$(INSTALL) $(DATA_INSTALL_FLAGS_RO) $< $@
39236c6e
A
323
324.PHONY: do_exporthdrs_mi
325
326do_exporthdrs_mi: $(EXPORT_MI_GEN_INC_FILES) $(EXPORT_MI_INC_FILES)
327 @:
328
329.PHONY: do_exporthdrs_md
330
331do_exporthdrs_md: $(EXPORT_MD_GEN_INC_FILES) $(EXPORT_MD_INC_FILES)
332 @:
1c79356b 333
1c79356b
A
334#
335# Generic Compilation rules
336#
337
338#
339# Compilation rules to generate .o from .s
340#
2d21ac55 341
f427ee49 342S_RULE_0=@$(LOG_AS) "$@"
fe8ab488 343S_RULE_1A=$(_v)${S_KCC} -c ${SFLAGS} -MD -MF $(@:o=d) -MP ${$@_SFLAGS_ADD} ${INCFLAGS} ${$@_INCFLAGS}
39236c6e
A
344S_RULE_1B=$(<F)
345S_RULE_2=
1c79356b
A
346
347#
348# Compilation rules to generate .o from .c for normal files
39236c6e 349#
f427ee49 350C_RULE_0=@$(LOG_CC) "$@"
39037602 351C_RULE_1A=$(_v)${KCC} -c ${filter-out ${$@_CFLAGS_RM}, ${CFLAGS} ${CWARNFLAGS}} -MD -MF $(@:o=d) -MP ${$@_CFLAGS_ADD} ${$@_CWARNFLAGS_ADD} ${INCFLAGS} ${$@_INCFLAGS}
39236c6e 352C_RULE_1B=$(<F)
39236c6e 353C_RULE_2=
316670eb 354
cb323159
A
355C_RULE_3=
356C_RULE_4A=
39037602
A
357C_RULE_4B=
358
1c79356b
A
359#
360# Compilation rules to generate .o from .c for driver files
361#
39236c6e 362C_RULE_0_D=${C_RULE_0}
1c79356b
A
363C_RULE_1A_D=${C_RULE_1A}
364C_RULE_1B_D=${C_RULE_1B}
365C_RULE_2_D=${C_RULE_2}
39037602
A
366C_RULE_3_D=${C_RULE_3}
367C_RULE_4A_D=${C_RULE_4A}
368C_RULE_4B_D=${C_RULE_4B}
1c79356b 369
1c79356b
A
370#
371# Compilation rules to generate .co from .cp or .cpo from .cpp
372# The config tool slickly changes the last source filename char to 'o'
373# for the object filename.
f427ee49 374P_RULE_0=@$(LOG_CXX) "$@"
39037602 375P_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 376P_RULE_1B=$(<F)
39236c6e 377P_RULE_2=
1c79356b 378
cb323159
A
379P_RULE_3=
380P_RULE_4A=
39037602 381P_RULE_4B=
1c79356b 382
f427ee49
A
383#
384# Explain how to make the bsd syscall list
385#
386$(TARGET)/bsd.syscalls.master: $(SRCROOT)/bsd/kern/syscalls.master $(MAKESYSCALLS)
387 @$(LOG_GENERATE) "$(@F)$(Color0) from $(ColorF)$<$(Color0)"
388 $(_v)$(UNIFDEF) $(SEED_DEFINES) $< > $@; \
389 if [ $$? -eq 2 ]; then \
390 $(ERR) Parse failure for $<; \
391 exit 1; \
392 fi
393
3e170ce0
A
394#
395# This isn't the right place to put this, but we need to := override some settings
396# in Makefiles that include the generic helper fragments (like this file)
397#
398ifeq ($(BUILD_JSON_COMPILATION_DATABASE),1)
399HIB_FILES :=
400LAST_FILES :=
401KLD_FILES :=
402endif
403
39236c6e 404.PHONY: do_build_all
1c79356b 405
39236c6e
A
406# Do-nothing rule, since not all levels of the recursive hierarchy might implement this
407# in their local Makefiles. Those that do will use a "::" rule to augment this.
408do_build_all::
409 @:
1c79356b 410
39236c6e 411.PHONY: do_build_install_primary
2d21ac55 412
39236c6e
A
413# Do-nothing rule, since not all levels of the recursive hierarchy might implement this
414# in their local Makefiles. Those that do will use a "::" rule to augment this.
415do_build_install_primary::
416 @:
2d21ac55 417
39236c6e 418.PHONY: do_build_install_non_primary
2d21ac55 419
39236c6e
A
420# Do-nothing rule, since not all levels of the recursive hierarchy might implement this
421# in their local Makefiles. Those that do will use a "::" rule to augment this.
422do_build_install_non_primary::
423 @:
1c79356b 424
39236c6e 425INSTALL_MAN_FILES = $(addprefix $(DSTROOT)/$(MANDIR)/$(INSTALL_MAN_DIR)/, $(INSTALL_MAN_LIST))
1c79356b 426
39236c6e 427.PHONY: INSTALL_MAN_DIR
1c79356b 428
39236c6e
A
429INSTALL_MAN_DIR:
430 $(_v)$(MKDIR) $(DSTROOT)/$(MANDIR)/$(INSTALL_MAN_DIR)
9bccf70c 431
39236c6e 432$(INSTALL_MAN_FILES): $(DSTROOT)/$(MANDIR)/$(INSTALL_MAN_DIR)/% : % | INSTALL_MAN_DIR
f427ee49 433 @$(LOG_MAN) "$*"
39236c6e
A
434 $(_v)$(INSTALL) $(INSTALL_FLAGS) $< $@
435
436define MAN_LINKS_RULE_template
437$$(DSTROOT)/$$(MANDIR)/$$(INSTALL_MAN_DIR)/$(2): $$(DSTROOT)/$$(MANDIR)/$$(INSTALL_MAN_DIR)/$(1)
f427ee49 438 @$$(LOG_MANLINK) "$(2)"
39236c6e
A
439 $(_v)ln -f $$< $$@
440endef
441
442function_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))))
443
444INSTALL_MAN_FILES_LINKS = $(call function_generate_man_links_rules,$(INSTALL_MAN_LINKS))
445
446.PHONY: do_installman
447
448do_installman: $(INSTALL_MAN_FILES) $(INSTALL_MAN_FILES_LINKS)
449 @:
1c79356b 450
f427ee49
A
451.PHONY: do_textfiles_install do_textfiles_install_mi do_textfiles_install_md
452
453# Do-nothing rule, since not all levels of the recursive hierarchy might implement this
454# in their local Makefiles. Those that do will use a "::" rule to augment this.
455do_textfiles_install_mi:: do_installman
456 @:
fe8ab488
A
457
458# Do-nothing rule, since not all levels of the recursive hierarchy might implement this
459# in their local Makefiles. Those that do will use a "::" rule to augment this.
f427ee49 460do_textfiles_install_md::
fe8ab488
A
461 @:
462
39236c6e
A
463.PHONY: do_build_setup
464
465# Do-nothing rule, since not all levels of the recursive hierarchy might implement this
466# in their local Makefiles. Those that do will use a "::" rule to augment this.
467do_build_setup::
468 @:
469
470.PHONY: do_config_all
471
472# Do-nothing rule, since not all levels of the recursive hierarchy might implement this
473# in their local Makefiles. Those that do will use a "::" rule to augment this.
474do_config_all::
475 @:
476
fe8ab488
A
477.PHONY: do_config_install
478
479# Do-nothing rule, since not all levels of the recursive hierarchy might implement this
480# in their local Makefiles. Those that do will use a "::" rule to augment this.
481do_config_install::
482 @:
b0d623f7 483
2d21ac55 484# vim: set ft=make: