]>
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 | |
cb323159 | 64 | export CMD_MC := $(shell __A="$(CURRENT_ARCH_CONFIG_LC)"; \ |
39037602 | 65 | __As=$$((6-$${\#__A})); \ |
cb323159 | 66 | printf "\\033[1m%-.6s%*.*s %9.9s\\033[m" \ |
39037602 A |
67 | "$${__A}" \ |
68 | $${__As} $${__As} " " \ | |
cb323159 | 69 | "$(_MACHINE)") |
39037602 A |
70 | endif |
71 | # Turn off colored output | |
cb323159 | 72 | Color0:=$(shell printf "\\033[m") |
39037602 | 73 | # Start a host command: bold, underlined pink text |
cb323159 | 74 | ColorH:=$(shell printf "\\033[1;4;35m") |
39037602 | 75 | # Start a compilation-related command: bold, underlined blue text |
cb323159 | 76 | ColorC:=$(shell printf "[$(CMD_MC)] \\033[1;4;34m") |
39037602 | 77 | # Start a MIG command: bold, green text on light grey background |
cb323159 | 78 | ColorM:=$(shell printf "[$(CMD_MC)] \\033[1;32;40m") |
39037602 | 79 | # Start a linking command: bold, white text on blue background |
cb323159 | 80 | ColorL:=$(shell printf "[$(CMD_MC)] \\033[1;37;44m") |
39037602 | 81 | # Start a filename: bold, white text |
cb323159 | 82 | ColorF:=$(shell printf "\\033[1;37m") |
39037602 | 83 | # Start a linked file name: yellow text on light grey background |
cb323159 | 84 | ColorLF:=$(shell printf "\\033[1;33;40m") |
39037602 | 85 | # Error strings: underlined bold white text on red background |
cb323159 | 86 | ColorErr:=$(shell printf "\033[1;4;37;41m") |
39037602 A |
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 |
cb323159 | 115 | $$(call makelog,$$(ColorH)INSTALLHDR$$(Color0) $$(ColorF)$$*$$(Color0)) |
39236c6e A |
116 | $$(_v)$$(UNIFDEF) $(4) $$< > ./$(3)/$$*.unifdef.$$$$$$$$; \ |
117 | if [ $$$$? -eq 2 ]; then \ | |
cb323159 | 118 | $(ERR) Parse failure for $$<; \ |
39236c6e | 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 | ||
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 | ||
138 | define 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 | |
cb323159 | 151 | $$(call makelog,$$(ColorH)INSTALLPY$$(Color0) $$(ColorF)$$*$$(Color0)) |
d9a64523 A |
152 | $$(_v)$$(MKDIR) $$(dir $$@) $$(dir ./$(3)/$$*) |
153 | $$(_v)$$(UNIFDEF) -t $(4) $$< > ./$(3)/$$*.unifdef.$$$$$$$$$$(suffix $$*); \ | |
154 | if [ $$$$? -eq 2 ]; then \ | |
cb323159 | 155 | $(ERR) Parse failure for $$<; \ |
d9a64523 A |
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 | |
164 | endef | |
165 | ||
cb323159 A |
166 | # |
167 | # Empty the install lists of non-host headers if building the host headers alias | |
168 | # | |
169 | ||
170 | ifeq ($(INSTALLHDRS_SKIP_HOST),YES) | |
171 | INSTALL_MI_LIST = | |
172 | INSTALL_MI_GEN_LIST = | |
173 | INSTALL_DRIVERKIT_MI_LIST = | |
174 | INSTALL_DRIVERKIT_MI_GEN_LIST = | |
175 | INSTALL_KF_MI_LIST = | |
176 | INSTALL_KF_MI_GEN_LIST = | |
177 | INSTALL_MI_LCL_LIST = | |
178 | INSTALL_MI_LCL_GEN_LIST = | |
179 | INSTALL_DRIVERKIT_MI_LCL_LIST = | |
180 | INSTALL_DRIVERKIT_MI_LCL_GEN_LIST = | |
181 | INSTALL_KF_MI_LCL_LIST = | |
182 | INSTALL_KF_MI_LCL_GEN_LIST = | |
183 | INSTALL_MD_LIST = | |
184 | INSTALL_MD_GEN_LIST = | |
185 | INSTALL_DRIVERKIT_MD_LIST = | |
186 | INSTALL_DRIVERKIT_MD_GEN_LIST = | |
187 | INSTALL_KF_MD_LIST = | |
188 | INSTALL_KF_MD_GEN_LIST = | |
189 | INSTALL_MD_LCL_LIST = | |
190 | INSTALL_MD_LCL_GEN_LIST = | |
191 | INSTALL_DRIVERKIT_MD_LCL_LIST = | |
192 | INSTALL_DRIVERKIT_MD_LCL_GEN_LIST = | |
193 | INSTALL_KF_MD_LCL_LIST = | |
194 | INSTALL_KF_MD_LCL_GEN_LIST = | |
195 | endif | |
196 | ||
39236c6e A |
197 | # |
198 | # Machine-independent (public) files | |
199 | # | |
200 | ||
201 | INSTALL_MI_INC_FILES = $(addprefix $(DSTROOT)/$(INCDIR)/$(INSTALL_MI_DIR)/, $(INSTALL_MI_LIST)) | |
202 | INSTALL_MI_INC_GEN_FILES = $(addprefix $(DSTROOT)/$(INCDIR)/$(INSTALL_MI_DIR)/, $(INSTALL_MI_GEN_LIST)) | |
203 | ||
204 | $(eval $(call INSTALLHDRS_RULE_template,$(INSTALL_MI_INC_FILES),,incmidir,$(SINCFRAME_UNIFDEF))) | |
205 | $(eval $(call INSTALLHDRS_RULE_template,$(INSTALL_MI_INC_GEN_FILES),1,incmigendir,$(SINCFRAME_UNIFDEF))) | |
1c79356b | 206 | |
cb323159 A |
207 | ifeq ($(DRIVERKIT),1) |
208 | INSTALL_DRIVERKIT_MI_INC_FILES = $(addprefix $(DSTROOT)/$(DRIVERKITINCDIR)/$(INSTALL_MI_DIR)/, $(INSTALL_DRIVERKIT_MI_LIST)) | |
209 | INSTALL_DRIVERKIT_MI_INC_GEN_FILES = $(addprefix $(DSTROOT)/$(DRIVERKITINCDIR)/$(INSTALL_MI_DIR)/, $(INSTALL_DRIVERKIT_MI_GEN_LIST)) | |
210 | ||
211 | $(eval $(call INSTALLHDRS_RULE_template,$(INSTALL_DRIVERKIT_MI_INC_FILES),,dkincmidir,$(DKINCFRAME_UNIFDEF))) | |
212 | $(eval $(call INSTALLHDRS_RULE_template,$(INSTALL_DRIVERKIT_MI_INC_GEN_FILES),1,dkincmigendir,$(DKINCFRAME_UNIFDEF))) | |
213 | endif | |
214 | ||
39236c6e A |
215 | INSTALL_KF_MI_FILES = $(addprefix $(DSTROOT)/$(KINCDIR)/$(EXPORT_MI_DIR)/, $(INSTALL_KF_MI_LIST)) |
216 | INSTALL_KF_MI_GEN_FILES = $(addprefix $(DSTROOT)/$(KINCDIR)/$(EXPORT_MI_DIR)/, $(INSTALL_KF_MI_GEN_LIST)) | |
217 | ||
218 | $(eval $(call INSTALLHDRS_RULE_template,$(INSTALL_KF_MI_FILES),,kincmidir,$(KINCFRAME_UNIFDEF))) | |
219 | $(eval $(call INSTALLHDRS_RULE_template,$(INSTALL_KF_MI_GEN_FILES),1,kincmigendir,$(KINCFRAME_UNIFDEF))) | |
1c79356b A |
220 | |
221 | # | |
39236c6e | 222 | # Machine-independent local (private) files |
1c79356b | 223 | # |
1c79356b | 224 | |
3e170ce0 A |
225 | INSTALL_MI_LCL_FILES = $(addprefix $(DSTROOT)/$(LCLDIR)/$(INSTALL_MI_DIR)/, $(sort $(INSTALL_MI_LCL_LIST) $(INSTALL_MI_LIST))) |
226 | INSTALL_MI_LCL_GEN_FILES = $(addprefix $(DSTROOT)/$(LCLDIR)/$(INSTALL_MI_DIR)/, $(sort $(INSTALL_MI_LCL_GEN_LIST) $(INSTALL_MI_GEN_LIST))) | |
1c79356b | 227 | |
39236c6e A |
228 | $(eval $(call INSTALLHDRS_RULE_template,$(INSTALL_MI_LCL_FILES),,pincmidir,$(SPINCFRAME_UNIFDEF))) |
229 | $(eval $(call INSTALLHDRS_RULE_template,$(INSTALL_MI_LCL_GEN_FILES),1,pincmigendir,$(SPINCFRAME_UNIFDEF))) | |
1c79356b | 230 | |
cb323159 A |
231 | ifeq ($(DRIVERKIT),1) |
232 | INSTALL_DRIVERKIT_MI_LCL_FILES = $(addprefix $(DSTROOT)/$(DRIVERKITLCLDIR)/$(INSTALL_MI_DIR)/, $(INSTALL_DRIVERKIT_MI_LCL_LIST)) | |
233 | INSTALL_DRIVERKIT_MI_LCL_GEN_FILES = $(addprefix $(DSTROOT)/$(DRIVERKITLCLDIR)/$(INSTALL_MI_DIR)/, $(INSTALL_DRIVERKIT_MI_LCL_GEN_LIST)) | |
234 | ||
235 | $(eval $(call INSTALLHDRS_RULE_template,$(INSTALL_DRIVERKIT_MI_LCL_FILES),,dkpincmidir,$(DKPINCFRAME_UNIFDEF))) | |
236 | $(eval $(call INSTALLHDRS_RULE_template,$(INSTALL_DRIVERKIT_MI_LCL_GEN_FILES),1,dkpincmigendir,$(DKPINCFRAME_UNIFDEF))) | |
237 | endif | |
238 | ||
39236c6e A |
239 | INSTALL_KF_MI_LCL_FILES = $(addprefix $(DSTROOT)/$(KPINCDIR)/$(EXPORT_MI_DIR)/, $(INSTALL_KF_MI_LCL_LIST)) |
240 | INSTALL_KF_MI_LCL_GEN_FILES = $(addprefix $(DSTROOT)/$(KPINCDIR)/$(EXPORT_MI_DIR)/, $(INSTALL_KF_MI_LCL_GEN_LIST)) | |
1c79356b | 241 | |
39236c6e A |
242 | $(eval $(call INSTALLHDRS_RULE_template,$(INSTALL_KF_MI_LCL_FILES),,kpincmidir,$(KPINCFRAME_UNIFDEF))) |
243 | $(eval $(call INSTALLHDRS_RULE_template,$(INSTALL_KF_MI_LCL_GEN_FILES),1,kpincmigendir,$(KPINCFRAME_UNIFDEF))) | |
1c79356b | 244 | |
39236c6e A |
245 | # |
246 | # Machine-dependent (public) files | |
247 | # | |
1c79356b | 248 | |
39236c6e A |
249 | INSTALL_MD_INC_FILES = $(addprefix $(DSTROOT)/$(INCDIR)/$(INSTALL_MD_DIR)/, $(INSTALL_MD_LIST)) |
250 | INSTALL_MD_INC_GEN_FILES = $(addprefix $(DSTROOT)/$(INCDIR)/$(INSTALL_MD_DIR)/, $(INSTALL_MD_GEN_LIST)) | |
1c79356b | 251 | |
39236c6e A |
252 | $(eval $(call INSTALLHDRS_RULE_template,$(INSTALL_MD_INC_FILES),,incdir,$(SINCFRAME_UNIFDEF))) |
253 | $(eval $(call INSTALLHDRS_RULE_template,$(INSTALL_MD_INC_GEN_FILES),1,incgendir,$(SINCFRAME_UNIFDEF))) | |
1c79356b | 254 | |
cb323159 A |
255 | ifeq ($(DRIVERKIT),1) |
256 | INSTALL_DRIVERKIT_MD_INC_FILES = $(addprefix $(DSTROOT)/$(DRIVERKITINCDIR)/$(INSTALL_MD_DIR)/, $(INSTALL_DRIVERKIT_MD_LIST)) | |
257 | INSTALL_DRIVERKIT_MD_INC_GEN_FILES = $(addprefix $(DSTROOT)/$(DRIVERKITINCDIR)/$(INSTALL_MD_DIR)/, $(INSTALL_DRIVERKIT_MD_GEN_LIST)) | |
258 | ||
259 | $(eval $(call INSTALLHDRS_RULE_template,$(INSTALL_DRIVERKIT_MD_INC_FILES),,dkincdir,$(DKINCFRAME_UNIFDEF))) | |
260 | $(eval $(call INSTALLHDRS_RULE_template,$(INSTALL_DRIVERKIT_MD_INC_GEN_FILES),1,dkincgendir,$(DKINCFRAME_UNIFDEF))) | |
261 | endif | |
262 | ||
39236c6e A |
263 | INSTALL_KF_MD_FILES = $(addprefix $(DSTROOT)/$(KINCDIR)/$(EXPORT_MD_DIR)/, $(INSTALL_KF_MD_LIST)) |
264 | INSTALL_KF_MD_GEN_FILES = $(addprefix $(DSTROOT)/$(KINCDIR)/$(EXPORT_MD_DIR)/, $(INSTALL_KF_MD_GEN_LIST)) | |
1c79356b | 265 | |
39236c6e A |
266 | $(eval $(call INSTALLHDRS_RULE_template,$(INSTALL_KF_MD_FILES),,kincdir,$(KINCFRAME_UNIFDEF))) |
267 | $(eval $(call INSTALLHDRS_RULE_template,$(INSTALL_KF_MD_GEN_FILES),1,kincgendir,$(KINCFRAME_UNIFDEF))) | |
1c79356b | 268 | |
39236c6e A |
269 | # |
270 | # Machine-dependent local (private) files | |
271 | # | |
272 | ||
3e170ce0 A |
273 | INSTALL_MD_LCL_FILES = $(addprefix $(DSTROOT)/$(LCLDIR)/$(INSTALL_MD_DIR)/, $(sort $(INSTALL_MD_LCL_LIST) $(INSTALL_MD_LIST))) |
274 | INSTALL_MD_LCL_GEN_FILES = $(addprefix $(DSTROOT)/$(LCLDIR)/$(INSTALL_MD_DIR)/, $(sort $(INSTALL_MD_LCL_GEN_LIST) $(INSTALL_MD_GEN_LIST))) | |
39236c6e A |
275 | |
276 | $(eval $(call INSTALLHDRS_RULE_template,$(INSTALL_MD_LCL_FILES),,pincdir,$(SPINCFRAME_UNIFDEF))) | |
277 | $(eval $(call INSTALLHDRS_RULE_template,$(INSTALL_MD_LCL_GEN_FILES),1,pincgendir,$(SPINCFRAME_UNIFDEF))) | |
278 | ||
cb323159 A |
279 | ifeq ($(DRIVERKIT),1) |
280 | INSTALL_DRIVERKIT_MD_LCL_FILES = $(addprefix $(DSTROOT)/$(DRIVERKITLCLDIR)/$(INSTALL_MD_DIR)/, $(INSTALL_DRIVERKIT_MD_LCL_LIST)) | |
281 | INSTALL_DRIVERKIT_MD_LCL_GEN_FILES = $(addprefix $(DSTROOT)/$(DRIVERKITLCLDIR)/$(INSTALL_MD_DIR)/, $(INSTALL_DRIVERKIT_MD_LCL_GEN_LIST)) | |
282 | ||
283 | $(eval $(call INSTALLHDRS_RULE_template,$(INSTALL_DRIVERKIT_MD_LCL_FILES),,dkpincdir,$(DKPINCFRAME_UNIFDEF))) | |
284 | $(eval $(call INSTALLHDRS_RULE_template,$(INSTALL_DRIVERKIT_MD_LCL_GEN_FILES),1,dkpincgendir,$(DKPINCFRAME_UNIFDEF))) | |
285 | endif | |
286 | ||
39236c6e A |
287 | INSTALL_KF_MD_LCL_FILES = $(addprefix $(DSTROOT)/$(KPINCDIR)/$(EXPORT_MD_DIR)/, $(INSTALL_KF_MD_LCL_LIST)) |
288 | INSTALL_KF_MD_LCL_GEN_FILES = $(addprefix $(DSTROOT)/$(KPINCDIR)/$(EXPORT_MD_DIR)/, $(INSTALL_KF_MD_LCL_GEN_LIST)) | |
289 | ||
290 | $(eval $(call INSTALLHDRS_RULE_template,$(INSTALL_KF_MD_LCL_FILES),,kpincdir,$(KPINCFRAME_UNIFDEF))) | |
291 | $(eval $(call INSTALLHDRS_RULE_template,$(INSTALL_KF_MD_LCL_GEN_FILES),1,kpincgendir,$(KPINCFRAME_UNIFDEF))) | |
1c79356b | 292 | |
39236c6e A |
293 | .PHONY: do_installhdrs_mi |
294 | ||
295 | # Double-colon rule so that MakeInc.kernel can add custom behaviors | |
cb323159 A |
296 | do_installhdrs_mi:: $(INSTALL_MI_INC_FILES) $(INSTALL_MI_INC_GEN_FILES) \ |
297 | $(INSTALL_DRIVERKIT_MI_INC_FILES) $(INSTALL_DRIVERKIT_MI_INC_GEN_FILES) \ | |
298 | $(INSTALL_KF_MI_FILES) $(INSTALL_KF_MI_GEN_FILES) \ | |
299 | $(INSTALL_MI_LCL_FILES) $(INSTALL_MI_LCL_GEN_FILES) \ | |
300 | $(INSTALL_DRIVERKIT_MI_LCL_FILES) $(INSTALL_DRIVERKIT_MI_LCL_GEN_FILES) \ | |
301 | $(INSTALL_KF_MI_LCL_FILES) $(INSTALL_KF_MI_LCL_GEN_FILES) | |
39236c6e A |
302 | @: |
303 | ||
304 | .PHONY: do_installhdrs_md | |
305 | ||
cb323159 A |
306 | do_installhdrs_md: $(INSTALL_MD_INC_FILES) $(INSTALL_MD_INC_GEN_FILES) \ |
307 | $(INSTALL_DRIVERKIT_MD_INC_FILES) $(INSTALL_DRIVERKIT_MD_INC_GEN_FILES) \ | |
308 | $(INSTALL_KF_MD_FILES) $(INSTALL_KF_MD_GEN_FILES) \ | |
309 | $(INSTALL_MD_LCL_FILES) $(INSTALL_MD_LCL_GEN_FILES) \ | |
310 | $(INSTALL_DRIVERKIT_MD_LCL_FILES) $(INSTALL_DRIVERKIT_MD_LCL_GEN_FILES) \ | |
311 | $(INSTALL_KF_MD_LCL_FILES) $(INSTALL_KF_MD_LCL_GEN_FILES) | |
39236c6e A |
312 | @: |
313 | ||
314 | # | |
315 | # Generic Export rules | |
316 | # | |
317 | EXPORT_MI_INC_FILES = $(addprefix $(OBJROOT)/$(EXPDIR)/$(EXPORT_MI_DIR)/, $(EXPORT_MI_LIST)) | |
1c79356b A |
318 | EXPORT_MI_GEN_INC_FILES = $(addprefix $(OBJROOT)/$(EXPDIR)/$(EXPORT_MI_DIR)/, $(EXPORT_MI_GEN_LIST)) |
319 | ||
39236c6e | 320 | .PHONY: EXP_MI_INC_DIR |
1c79356b | 321 | |
39236c6e A |
322 | EXP_MI_INC_DIR: |
323 | $(_v)$(MKDIR) $(OBJROOT)/$(EXPDIR)/$(EXPORT_MI_DIR) | |
1c79356b | 324 | |
39236c6e A |
325 | $(EXPORT_MI_GEN_INC_FILES): $(OBJROOT)/$(EXPDIR)/$(EXPORT_MI_DIR)/% : % | EXP_MI_INC_DIR |
326 | $(_v)$(INSTALL) $(DATA_INSTALL_FLAGS) $< $@ | |
327 | ||
328 | $(EXPORT_MI_INC_FILES): $(OBJROOT)/$(EXPDIR)/$(EXPORT_MI_DIR)/% : $(SOURCE)/% | EXP_MI_INC_DIR | |
329 | $(_v)$(INSTALL) $(DATA_INSTALL_FLAGS) $< $@ | |
330 | ||
331 | EXPORT_MD_INC_FILES = $(addprefix $(OBJROOT)/$(EXPDIR)/$(EXPORT_MD_DIR)/, $(EXPORT_MD_LIST)) | |
1c79356b A |
332 | EXPORT_MD_GEN_INC_FILES = $(addprefix $(OBJROOT)/$(EXPDIR)/$(EXPORT_MD_DIR)/, $(EXPORT_MD_GEN_LIST)) |
333 | ||
39236c6e | 334 | .PHONY: EXP_MD_INC_DIR |
1c79356b | 335 | |
39236c6e A |
336 | EXP_MD_INC_DIR: |
337 | $(_v)$(MKDIR) $(OBJROOT)/$(EXPDIR)/$(EXPORT_MD_DIR) | |
338 | ||
339 | $(EXPORT_MD_GEN_INC_FILES): $(OBJROOT)/$(EXPDIR)/$(EXPORT_MD_DIR)/% : % | EXP_MD_INC_DIR | |
340 | $(_v)$(INSTALL) $(DATA_INSTALL_FLAGS) $< $@ | |
341 | ||
342 | $(EXPORT_MD_INC_FILES): $(OBJROOT)/$(EXPDIR)/$(EXPORT_MD_DIR)/% : $(SOURCE)/% | EXP_MD_INC_DIR | |
343 | $(_v)$(INSTALL) $(DATA_INSTALL_FLAGS) $< $@ | |
344 | ||
345 | .PHONY: do_exporthdrs_mi | |
346 | ||
347 | do_exporthdrs_mi: $(EXPORT_MI_GEN_INC_FILES) $(EXPORT_MI_INC_FILES) | |
348 | @: | |
349 | ||
350 | .PHONY: do_exporthdrs_md | |
351 | ||
352 | do_exporthdrs_md: $(EXPORT_MD_GEN_INC_FILES) $(EXPORT_MD_INC_FILES) | |
353 | @: | |
1c79356b | 354 | |
1c79356b A |
355 | # |
356 | # Generic Compilation rules | |
357 | # | |
358 | ||
359 | # | |
360 | # Compilation rules to generate .o from .s | |
361 | # | |
2d21ac55 | 362 | |
cb323159 | 363 | S_RULE_0=$(call makelog,$(ColorC)AS$(Color0) $(ColorF)$@$(Color0)) |
fe8ab488 | 364 | S_RULE_1A=$(_v)${S_KCC} -c ${SFLAGS} -MD -MF $(@:o=d) -MP ${$@_SFLAGS_ADD} ${INCFLAGS} ${$@_INCFLAGS} |
39236c6e A |
365 | S_RULE_1B=$(<F) |
366 | S_RULE_2= | |
1c79356b A |
367 | |
368 | # | |
369 | # Compilation rules to generate .o from .c for normal files | |
39236c6e | 370 | # |
cb323159 | 371 | C_RULE_0=$(call makelog,$(ColorC)CC$(Color0) $(ColorF)$@$(Color0)) |
39037602 | 372 | C_RULE_1A=$(_v)${KCC} -c ${filter-out ${$@_CFLAGS_RM}, ${CFLAGS} ${CWARNFLAGS}} -MD -MF $(@:o=d) -MP ${$@_CFLAGS_ADD} ${$@_CWARNFLAGS_ADD} ${INCFLAGS} ${$@_INCFLAGS} |
39236c6e | 373 | C_RULE_1B=$(<F) |
39236c6e | 374 | C_RULE_2= |
316670eb | 375 | |
cb323159 A |
376 | C_RULE_3= |
377 | C_RULE_4A= | |
39037602 A |
378 | C_RULE_4B= |
379 | ||
1c79356b A |
380 | # |
381 | # Compilation rules to generate .o from .c for driver files | |
382 | # | |
39236c6e | 383 | C_RULE_0_D=${C_RULE_0} |
1c79356b A |
384 | C_RULE_1A_D=${C_RULE_1A} |
385 | C_RULE_1B_D=${C_RULE_1B} | |
386 | C_RULE_2_D=${C_RULE_2} | |
39037602 A |
387 | C_RULE_3_D=${C_RULE_3} |
388 | C_RULE_4A_D=${C_RULE_4A} | |
389 | C_RULE_4B_D=${C_RULE_4B} | |
1c79356b | 390 | |
1c79356b A |
391 | # |
392 | # Compilation rules to generate .co from .cp or .cpo from .cpp | |
393 | # The config tool slickly changes the last source filename char to 'o' | |
394 | # for the object filename. | |
cb323159 | 395 | P_RULE_0=$(call makelog,$(ColorC)C++$(Color0) $(ColorF)$@$(Color0)) |
39037602 | 396 | 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 | 397 | P_RULE_1B=$(<F) |
39236c6e | 398 | P_RULE_2= |
1c79356b | 399 | |
cb323159 A |
400 | P_RULE_3= |
401 | P_RULE_4A= | |
39037602 | 402 | P_RULE_4B= |
1c79356b | 403 | |
3e170ce0 A |
404 | # |
405 | # This isn't the right place to put this, but we need to := override some settings | |
406 | # in Makefiles that include the generic helper fragments (like this file) | |
407 | # | |
408 | ifeq ($(BUILD_JSON_COMPILATION_DATABASE),1) | |
409 | HIB_FILES := | |
410 | LAST_FILES := | |
411 | KLD_FILES := | |
412 | endif | |
413 | ||
39236c6e | 414 | .PHONY: do_build_all |
1c79356b | 415 | |
39236c6e A |
416 | # Do-nothing rule, since not all levels of the recursive hierarchy might implement this |
417 | # in their local Makefiles. Those that do will use a "::" rule to augment this. | |
418 | do_build_all:: | |
419 | @: | |
1c79356b | 420 | |
39236c6e | 421 | .PHONY: do_build_install_primary |
2d21ac55 | 422 | |
39236c6e A |
423 | # Do-nothing rule, since not all levels of the recursive hierarchy might implement this |
424 | # in their local Makefiles. Those that do will use a "::" rule to augment this. | |
425 | do_build_install_primary:: | |
426 | @: | |
2d21ac55 | 427 | |
39236c6e | 428 | .PHONY: do_build_install_non_primary |
2d21ac55 | 429 | |
39236c6e A |
430 | # Do-nothing rule, since not all levels of the recursive hierarchy might implement this |
431 | # in their local Makefiles. Those that do will use a "::" rule to augment this. | |
432 | do_build_install_non_primary:: | |
433 | @: | |
1c79356b | 434 | |
39236c6e | 435 | INSTALL_MAN_FILES = $(addprefix $(DSTROOT)/$(MANDIR)/$(INSTALL_MAN_DIR)/, $(INSTALL_MAN_LIST)) |
1c79356b | 436 | |
39236c6e | 437 | .PHONY: INSTALL_MAN_DIR |
1c79356b | 438 | |
39236c6e A |
439 | INSTALL_MAN_DIR: |
440 | $(_v)$(MKDIR) $(DSTROOT)/$(MANDIR)/$(INSTALL_MAN_DIR) | |
9bccf70c | 441 | |
39236c6e | 442 | $(INSTALL_MAN_FILES): $(DSTROOT)/$(MANDIR)/$(INSTALL_MAN_DIR)/% : % | INSTALL_MAN_DIR |
cb323159 | 443 | $(call makelog,$(ColorH)MAN$(Color0) $(ColorF)$*$(Color0)) |
39236c6e A |
444 | $(_v)$(INSTALL) $(INSTALL_FLAGS) $< $@ |
445 | ||
446 | define MAN_LINKS_RULE_template | |
447 | $$(DSTROOT)/$$(MANDIR)/$$(INSTALL_MAN_DIR)/$(2): $$(DSTROOT)/$$(MANDIR)/$$(INSTALL_MAN_DIR)/$(1) | |
cb323159 | 448 | $$(call makelog,$$(ColorH)MANLINK$$(Color0) $$(ColorF)$(2)$$(Color0)) |
39236c6e A |
449 | $(_v)ln -f $$< $$@ |
450 | endef | |
451 | ||
452 | 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)))) | |
453 | ||
454 | INSTALL_MAN_FILES_LINKS = $(call function_generate_man_links_rules,$(INSTALL_MAN_LINKS)) | |
455 | ||
456 | .PHONY: do_installman | |
457 | ||
458 | do_installman: $(INSTALL_MAN_FILES) $(INSTALL_MAN_FILES_LINKS) | |
459 | @: | |
1c79356b | 460 | |
fe8ab488 A |
461 | .PHONY: do_textfiles_install |
462 | ||
463 | # Do-nothing rule, since not all levels of the recursive hierarchy might implement this | |
464 | # in their local Makefiles. Those that do will use a "::" rule to augment this. | |
465 | do_textfiles_install:: do_installman | |
466 | @: | |
467 | ||
39236c6e A |
468 | .PHONY: do_build_setup |
469 | ||
470 | # Do-nothing rule, since not all levels of the recursive hierarchy might implement this | |
471 | # in their local Makefiles. Those that do will use a "::" rule to augment this. | |
472 | do_build_setup:: | |
473 | @: | |
474 | ||
475 | .PHONY: do_config_all | |
476 | ||
477 | # Do-nothing rule, since not all levels of the recursive hierarchy might implement this | |
478 | # in their local Makefiles. Those that do will use a "::" rule to augment this. | |
479 | do_config_all:: | |
480 | @: | |
481 | ||
fe8ab488 A |
482 | .PHONY: do_config_install |
483 | ||
484 | # Do-nothing rule, since not all levels of the recursive hierarchy might implement this | |
485 | # in their local Makefiles. Those that do will use a "::" rule to augment this. | |
486 | do_config_install:: | |
487 | @: | |
b0d623f7 | 488 | |
2d21ac55 | 489 | # vim: set ft=make: |