]>
Commit | Line | Data |
---|---|---|
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 | 11 | include $(SRCROOT)/makedefs/MakeInc.color |
39236c6e | 12 | |
1c79356b A |
13 | # |
14 | # Generic Install rules | |
15 | # | |
16 | ||
91447636 A |
17 | ifndef INSTALL_KF_MI_LCL_LIST |
18 | INSTALL_KF_MI_LCL_LIST = $(EXPORT_MI_LIST) | |
19 | endif | |
1c79356b | 20 | |
91447636 A |
21 | ifndef INSTALL_KF_MI_LCL_GEN_LIST |
22 | INSTALL_KF_MI_LCL_GEN_LIST = $(EXPORT_MI_GEN_LIST) | |
23 | endif | |
1c79356b | 24 | |
91447636 A |
25 | ifndef INSTALL_KF_MD_LCL_LIST |
26 | INSTALL_KF_MD_LCL_LIST = $(EXPORT_MD_LIST) | |
27 | endif | |
1c79356b | 28 | |
91447636 A |
29 | ifndef INSTALL_KF_MD_LCL_GEN_LIST |
30 | INSTALL_KF_MD_LCL_GEN_LIST = $(EXPORT_MD_GEN_LIST) | |
31 | endif | |
9bccf70c | 32 | |
91447636 A |
33 | ifndef INSTALL_KF_MI_LIST |
34 | INSTALL_KF_MI_LIST = $(EXPORT_MI_LIST) | |
35 | endif | |
1c79356b | 36 | |
91447636 A |
37 | ifndef INSTALL_KF_MI_GEN_LIST |
38 | INSTALL_KF_MI_GEN_LIST = $(EXPORT_MI_GEN_LIST) | |
39 | endif | |
9bccf70c | 40 | |
91447636 A |
41 | ifndef INSTALL_KF_MD_LIST |
42 | INSTALL_KF_MD_LIST = $(EXPORT_MD_LIST) | |
43 | endif | |
9bccf70c | 44 | |
91447636 A |
45 | ifndef INSTALL_KF_MD_GEN_LIST |
46 | INSTALL_KF_MD_GEN_LIST = $(EXPORT_MD_GEN_LIST) | |
47 | endif | |
48 | ||
2a1bd2d3 | 49 | $(eval $(call _setup_build_log_colors)) |
39037602 | 50 | |
39236c6e | 51 | .PHONY: ALWAYS |
2d21ac55 | 52 | |
39236c6e | 53 | ALWAYS: |
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 | 63 | define 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.$$$$$$$$ |
89 | endef | |
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 | ||
100 | define 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 | |
126 | endef | |
127 | ||
cb323159 A |
128 | # |
129 | # Empty the install lists of non-host headers if building the host headers alias | |
130 | # | |
131 | ||
132 | ifeq ($(INSTALLHDRS_SKIP_HOST),YES) | |
133 | INSTALL_MI_LIST = | |
134 | INSTALL_MI_GEN_LIST = | |
135 | INSTALL_DRIVERKIT_MI_LIST = | |
136 | INSTALL_DRIVERKIT_MI_GEN_LIST = | |
137 | INSTALL_KF_MI_LIST = | |
138 | INSTALL_KF_MI_GEN_LIST = | |
139 | INSTALL_MI_LCL_LIST = | |
140 | INSTALL_MI_LCL_GEN_LIST = | |
141 | INSTALL_DRIVERKIT_MI_LCL_LIST = | |
142 | INSTALL_DRIVERKIT_MI_LCL_GEN_LIST = | |
143 | INSTALL_KF_MI_LCL_LIST = | |
144 | INSTALL_KF_MI_LCL_GEN_LIST = | |
145 | INSTALL_MD_LIST = | |
146 | INSTALL_MD_GEN_LIST = | |
147 | INSTALL_DRIVERKIT_MD_LIST = | |
148 | INSTALL_DRIVERKIT_MD_GEN_LIST = | |
149 | INSTALL_KF_MD_LIST = | |
150 | INSTALL_KF_MD_GEN_LIST = | |
151 | INSTALL_MD_LCL_LIST = | |
152 | INSTALL_MD_LCL_GEN_LIST = | |
153 | INSTALL_DRIVERKIT_MD_LCL_LIST = | |
154 | INSTALL_DRIVERKIT_MD_LCL_GEN_LIST = | |
155 | INSTALL_KF_MD_LCL_LIST = | |
156 | INSTALL_KF_MD_LCL_GEN_LIST = | |
f427ee49 | 157 | INSTALL_MODULEMAP_INCDIR_MI_LIST = |
cb323159 A |
158 | endif |
159 | ||
39236c6e A |
160 | # |
161 | # Machine-independent (public) files | |
162 | # | |
163 | ||
164 | INSTALL_MI_INC_FILES = $(addprefix $(DSTROOT)/$(INCDIR)/$(INSTALL_MI_DIR)/, $(INSTALL_MI_LIST)) | |
165 | INSTALL_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 |
170 | ifeq ($(DRIVERKIT),1) |
171 | INSTALL_DRIVERKIT_MI_INC_FILES = $(addprefix $(DSTROOT)/$(DRIVERKITINCDIR)/$(INSTALL_MI_DIR)/, $(INSTALL_DRIVERKIT_MI_LIST)) | |
172 | INSTALL_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))) | |
176 | endif | |
177 | ||
39236c6e A |
178 | INSTALL_KF_MI_FILES = $(addprefix $(DSTROOT)/$(KINCDIR)/$(EXPORT_MI_DIR)/, $(INSTALL_KF_MI_LIST)) |
179 | INSTALL_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. |
185 | INSTALL_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 | 193 | ifeq ($(LIBKERN_USE_USR_LOCAL_INCLUDE),) |
3e170ce0 A |
194 | INSTALL_MI_LCL_FILES = $(addprefix $(DSTROOT)/$(LCLDIR)/$(INSTALL_MI_DIR)/, $(sort $(INSTALL_MI_LCL_LIST) $(INSTALL_MI_LIST))) |
195 | INSTALL_MI_LCL_GEN_FILES = $(addprefix $(DSTROOT)/$(LCLDIR)/$(INSTALL_MI_DIR)/, $(sort $(INSTALL_MI_LCL_GEN_LIST) $(INSTALL_MI_GEN_LIST))) | |
f427ee49 A |
196 | else |
197 | INSTALL_MI_LCL_FILES = $(addprefix $(DSTROOT)/$(LCLDIR)/$(INSTALL_MI_DIR)/, $(sort $(INSTALL_MI_LCL_LIST))) | |
198 | INSTALL_MI_LCL_GEN_FILES = $(addprefix $(DSTROOT)/$(LCLDIR)/$(INSTALL_MI_DIR)/, $(sort $(INSTALL_MI_LCL_GEN_LIST))) | |
199 | endif | |
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 |
204 | ifeq ($(DRIVERKIT),1) |
205 | INSTALL_DRIVERKIT_MI_LCL_FILES = $(addprefix $(DSTROOT)/$(DRIVERKITLCLDIR)/$(INSTALL_MI_DIR)/, $(INSTALL_DRIVERKIT_MI_LCL_LIST)) | |
206 | INSTALL_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))) | |
210 | endif | |
211 | ||
39236c6e A |
212 | INSTALL_KF_MI_LCL_FILES = $(addprefix $(DSTROOT)/$(KPINCDIR)/$(EXPORT_MI_DIR)/, $(INSTALL_KF_MI_LCL_LIST)) |
213 | INSTALL_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 |
222 | INSTALL_MD_INC_FILES = $(addprefix $(DSTROOT)/$(INCDIR)/$(INSTALL_MD_DIR)/, $(INSTALL_MD_LIST)) |
223 | INSTALL_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 |
228 | ifeq ($(DRIVERKIT),1) |
229 | INSTALL_DRIVERKIT_MD_INC_FILES = $(addprefix $(DSTROOT)/$(DRIVERKITINCDIR)/$(INSTALL_MD_DIR)/, $(INSTALL_DRIVERKIT_MD_LIST)) | |
230 | INSTALL_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))) | |
234 | endif | |
235 | ||
39236c6e A |
236 | INSTALL_KF_MD_FILES = $(addprefix $(DSTROOT)/$(KINCDIR)/$(EXPORT_MD_DIR)/, $(INSTALL_KF_MD_LIST)) |
237 | INSTALL_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 | 246 | ifeq ($(LIBKERN_USE_USR_LOCAL_INCLUDE),) |
3e170ce0 A |
247 | INSTALL_MD_LCL_FILES = $(addprefix $(DSTROOT)/$(LCLDIR)/$(INSTALL_MD_DIR)/, $(sort $(INSTALL_MD_LCL_LIST) $(INSTALL_MD_LIST))) |
248 | INSTALL_MD_LCL_GEN_FILES = $(addprefix $(DSTROOT)/$(LCLDIR)/$(INSTALL_MD_DIR)/, $(sort $(INSTALL_MD_LCL_GEN_LIST) $(INSTALL_MD_GEN_LIST))) | |
f427ee49 A |
249 | else |
250 | INSTALL_MD_LCL_FILES = $(addprefix $(DSTROOT)/$(LCLDIR)/$(INSTALL_MD_DIR)/, $(sort $(INSTALL_MD_LCL_LIST))) | |
251 | INSTALL_MD_LCL_GEN_FILES = $(addprefix $(DSTROOT)/$(LCLDIR)/$(INSTALL_MD_DIR)/, $(sort $(INSTALL_MD_LCL_GEN_LIST))) | |
252 | endif | |
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 |
257 | ifeq ($(DRIVERKIT),1) |
258 | INSTALL_DRIVERKIT_MD_LCL_FILES = $(addprefix $(DSTROOT)/$(DRIVERKITLCLDIR)/$(INSTALL_MD_DIR)/, $(INSTALL_DRIVERKIT_MD_LCL_LIST)) | |
259 | INSTALL_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))) | |
263 | endif | |
264 | ||
39236c6e A |
265 | INSTALL_KF_MD_LCL_FILES = $(addprefix $(DSTROOT)/$(KPINCDIR)/$(EXPORT_MD_DIR)/, $(INSTALL_KF_MD_LCL_LIST)) |
266 | INSTALL_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 |
274 | do_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 |
285 | do_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 | # | |
296 | EXPORT_MI_INC_FILES = $(addprefix $(OBJROOT)/$(EXPDIR)/$(EXPORT_MI_DIR)/, $(EXPORT_MI_LIST)) | |
1c79356b A |
297 | EXPORT_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 |
301 | EXP_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 | |
310 | EXPORT_MD_INC_FILES = $(addprefix $(OBJROOT)/$(EXPDIR)/$(EXPORT_MD_DIR)/, $(EXPORT_MD_LIST)) | |
1c79356b A |
311 | EXPORT_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 |
315 | EXP_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 | ||
326 | do_exporthdrs_mi: $(EXPORT_MI_GEN_INC_FILES) $(EXPORT_MI_INC_FILES) | |
327 | @: | |
328 | ||
329 | .PHONY: do_exporthdrs_md | |
330 | ||
331 | do_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 | 342 | S_RULE_0=@$(LOG_AS) "$@" |
fe8ab488 | 343 | S_RULE_1A=$(_v)${S_KCC} -c ${SFLAGS} -MD -MF $(@:o=d) -MP ${$@_SFLAGS_ADD} ${INCFLAGS} ${$@_INCFLAGS} |
39236c6e A |
344 | S_RULE_1B=$(<F) |
345 | S_RULE_2= | |
1c79356b A |
346 | |
347 | # | |
348 | # Compilation rules to generate .o from .c for normal files | |
39236c6e | 349 | # |
f427ee49 | 350 | C_RULE_0=@$(LOG_CC) "$@" |
39037602 | 351 | C_RULE_1A=$(_v)${KCC} -c ${filter-out ${$@_CFLAGS_RM}, ${CFLAGS} ${CWARNFLAGS}} -MD -MF $(@:o=d) -MP ${$@_CFLAGS_ADD} ${$@_CWARNFLAGS_ADD} ${INCFLAGS} ${$@_INCFLAGS} |
39236c6e | 352 | C_RULE_1B=$(<F) |
39236c6e | 353 | C_RULE_2= |
316670eb | 354 | |
cb323159 A |
355 | C_RULE_3= |
356 | C_RULE_4A= | |
39037602 A |
357 | C_RULE_4B= |
358 | ||
1c79356b A |
359 | # |
360 | # Compilation rules to generate .o from .c for driver files | |
361 | # | |
39236c6e | 362 | C_RULE_0_D=${C_RULE_0} |
1c79356b A |
363 | C_RULE_1A_D=${C_RULE_1A} |
364 | C_RULE_1B_D=${C_RULE_1B} | |
365 | C_RULE_2_D=${C_RULE_2} | |
39037602 A |
366 | C_RULE_3_D=${C_RULE_3} |
367 | C_RULE_4A_D=${C_RULE_4A} | |
368 | C_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 | 374 | P_RULE_0=@$(LOG_CXX) "$@" |
39037602 | 375 | 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 | 376 | P_RULE_1B=$(<F) |
39236c6e | 377 | P_RULE_2= |
1c79356b | 378 | |
cb323159 A |
379 | P_RULE_3= |
380 | P_RULE_4A= | |
39037602 | 381 | P_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 | # | |
398 | ifeq ($(BUILD_JSON_COMPILATION_DATABASE),1) | |
399 | HIB_FILES := | |
400 | LAST_FILES := | |
401 | KLD_FILES := | |
402 | endif | |
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. | |
408 | do_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. | |
415 | do_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. | |
422 | do_build_install_non_primary:: | |
423 | @: | |
1c79356b | 424 | |
39236c6e | 425 | INSTALL_MAN_FILES = $(addprefix $(DSTROOT)/$(MANDIR)/$(INSTALL_MAN_DIR)/, $(INSTALL_MAN_LIST)) |
1c79356b | 426 | |
39236c6e | 427 | .PHONY: INSTALL_MAN_DIR |
1c79356b | 428 | |
39236c6e A |
429 | INSTALL_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 | ||
436 | define 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 $$< $$@ |
440 | endef | |
441 | ||
442 | 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)))) | |
443 | ||
444 | INSTALL_MAN_FILES_LINKS = $(call function_generate_man_links_rules,$(INSTALL_MAN_LINKS)) | |
445 | ||
446 | .PHONY: do_installman | |
447 | ||
448 | do_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. | |
455 | do_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 | 460 | do_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. | |
467 | do_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. | |
474 | do_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. | |
481 | do_config_install:: | |
482 | @: | |
b0d623f7 | 483 | |
2d21ac55 | 484 | # vim: set ft=make: |