1 | # $Id: footer.kmk 1410 2008-03-18 16:00:56Z bird $
|
---|
2 | ## @file
|
---|
3 | #
|
---|
4 | # kBuild - File included at top of makefile.
|
---|
5 | #
|
---|
6 | # Copyright (c) 2004-2007 knut st. osmundsen <bird-kBuild-spam@anduin.net>
|
---|
7 | #
|
---|
8 | #
|
---|
9 | # This file is part of kBuild.
|
---|
10 | #
|
---|
11 | # kBuild is free software; you can redistribute it and/or modify
|
---|
12 | # it under the terms of the GNU General Public License as published by
|
---|
13 | # the Free Software Foundation; either version source of the License, or
|
---|
14 | # (at your option) any later version.
|
---|
15 | #
|
---|
16 | # kBuild is distributed in the hope that it will be useful,
|
---|
17 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
18 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
19 | # GNU General Public License for more details.
|
---|
20 | #
|
---|
21 | # You should have received a copy of the GNU General Public License
|
---|
22 | # along with kBuild; if not, write to the Free Software
|
---|
23 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
---|
24 | #
|
---|
25 | #
|
---|
26 |
|
---|
27 | ifndef __footer_kmk__
|
---|
28 | # start-of-file-content
|
---|
29 | ifdef KBUILD_PROFILE_SELF
|
---|
30 | _KBUILD_TS_FOOTER_START := $(nanots )
|
---|
31 | $(info prof: $(int-sub $(_KBUILD_TS_FOOTER_START), $(_KBUILD_TS_HEADER_START)) - $(int-sub $(_KBUILD_TS_FOOTER_START), $(_KBUILD_TS_PREV)) - start of footer.kmk)
|
---|
32 | _KBUILD_TS_PREV := $(_KBUILD_TS_FOOTER_START)
|
---|
33 | endif
|
---|
34 |
|
---|
35 | #
|
---|
36 | # Variables.
|
---|
37 | # (Some of these need initialization before including definitions using them.)
|
---|
38 | #
|
---|
39 |
|
---|
40 | # All targets of each types.
|
---|
41 | _ALL_BLDPROGS := $(BLDPROGS) $(BLDPROGS.$(BUILD_PLATFORM)) $(BLDPROGS.$(BUILD_PLATFORM).$(BUILD_PLATFORM_ARCH)) $(BLDPROGS.$(BUILD_PLATFORM_ARCH)) $(BLDPROGS.$(BUILD_PLATFORM_CPU)) $(BLDPROGS.$(BUILD_TYPE))
|
---|
42 | _ALL_LIBRARIES := $(LIBRARIES) $(LIBRARIES.$(BUILD_TARGET)) $(LIBRARIES.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)) $(LIBRARIES.$(BUILD_TARGET_ARCH)) $(LIBRARIES.$(BUILD_TARGET_CPU)) $(LIBRARIES.$(BUILD_TYPE))
|
---|
43 | _ALL_IMPORT_LIBS := $(IMPORT_LIBS) $(IMPORT_LIBS.$(BUILD_TARGET)) $(IMPORT_LIBS.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)) $(IMPORT_LIBS.$(BUILD_TARGET_ARCH)) $(IMPORT_LIBS.$(BUILD_TARGET_CPU)) $(IMPORT_LIBS.$(BUILD_TYPE))
|
---|
44 | _ALL_DLLS := $(DLLS) $(DLLS.$(BUILD_TARGET)) $(DLLS.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)) $(DLLS.$(BUILD_TARGET_ARCH)) $(DLLS.$(BUILD_TARGET_CPU)) $(DLLS.$(BUILD_TYPE))
|
---|
45 | _ALL_PROGRAMS := $(PROGRAMS) $(PROGRAMS.$(BUILD_TARGET)) $(PROGRAMS.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)) $(PROGRAMS.$(BUILD_TARGET_ARCH)) $(PROGRAMS.$(BUILD_TARGET_CPU)) $(PROGRAMS.$(BUILD_TYPE))
|
---|
46 | _ALL_SYSMODS := $(SYSMODS) $(SYSMODS.$(BUILD_TARGET)) $(SYSMODS.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)) $(SYSMODS.$(BUILD_TARGET_ARCH)) $(SYSMODS.$(BUILD_TARGET_CPU)) $(SYSMODS.$(BUILD_TYPE))
|
---|
47 | _ALL_OTHERS := $(OTHERS) $(OTHERS.$(BUILD_TARGET)) $(OTHERS.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)) $(OTHERS.$(BUILD_TARGET_ARCH)) $(OTHERS.$(BUILD_TARGET_CPU)) $(OTHERS.$(BUILD_TYPE))
|
---|
48 | _ALL_INSTALLS := $(INSTALLS) $(INSTALLS.$(BUILD_TARGET)) $(INSTALLS.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)) $(INSTALLS.$(BUILD_TARGET_ARCH)) $(INSTALLS.$(BUILD_TARGET_CPU)) $(INSTALLS.$(BUILD_TYPE))
|
---|
49 | _ALL_FETCHES := $(FETCHES) $(FETCHES.$(BUILD_TARGET)) $(FETCHES.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)) $(FETCHES.$(BUILD_TARGET_ARCH)) $(FETCHES.$(BUILD_TARGET_CPU)) $(FETCHES.$(BUILD_TYPE))
|
---|
50 | _ALL_PATCHES := $(PATCHES) $(PATCHES.$(BUILD_TARGET)) $(PATCHES.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)) $(PATCHES.$(BUILD_TARGET_ARCH)) $(PATCHES.$(BUILD_TARGET_CPU)) $(PATCHES.$(BUILD_TYPE))
|
---|
51 |
|
---|
52 | # all targets.
|
---|
53 | _ALL_TARGETS = \
|
---|
54 | $(_ALL_FETCHES) \
|
---|
55 | $(_ALL_PATCHES) \
|
---|
56 | $(_ALL_BLDPROGS) \
|
---|
57 | $(_ALL_LIBRARIES) \
|
---|
58 | $(_ALL_IMPORT_LIBS) \
|
---|
59 | $(_ALL_DLLS) \
|
---|
60 | $(_ALL_PROGRAMS) \
|
---|
61 | $(_ALL_SYSMODS) \
|
---|
62 | $(_ALL_INSTALLS) \
|
---|
63 | $(_ALL_OTHERS)
|
---|
64 |
|
---|
65 | # all $(BUILD_TARGET) targets.
|
---|
66 | _ALL_BUILD_TARGET_TARGETS = \
|
---|
67 | $(_ALL_FETCHES) \
|
---|
68 | $(_ALL_PATCHES) \
|
---|
69 | $(_ALL_LIBRARIES) \
|
---|
70 | $(_ALL_IMPORT_LIBS) \
|
---|
71 | $(_ALL_DLLS) \
|
---|
72 | $(_ALL_PROGRAMS) \
|
---|
73 | $(_ALL_SYSMODS) \
|
---|
74 | $(_ALL_INSTALLS) \
|
---|
75 | $(_ALL_OTHERS)
|
---|
76 |
|
---|
77 | # all $(BUILD_PLATFORM) targets.
|
---|
78 | _ALL_BUILD_PLATFORM_TARGETS = \
|
---|
79 | $(_ALL_BLDPROGS)
|
---|
80 |
|
---|
81 | # all targets making use of srcname.
|
---|
82 | _ALL_SRCNAME_TARGETS = \
|
---|
83 | $(_ALL_FETCHES) \
|
---|
84 | $(_ALL_PATCHES)
|
---|
85 |
|
---|
86 | # dependency files.
|
---|
87 | _DEPFILES :=
|
---|
88 |
|
---|
89 | # included dependency files.
|
---|
90 | _DEPFILES_INCLUDED :=
|
---|
91 |
|
---|
92 |
|
---|
93 | # All kind of output files except for _OBJS and _DEPFILES.
|
---|
94 | # Compiling or linking definition outputting other things that $@ and any
|
---|
95 | # required dependency file must add those output files to this variable.
|
---|
96 | _OUT_FILES :=
|
---|
97 |
|
---|
98 | # Files which only requires cleaning up.
|
---|
99 | _CLEAN_FILES :=
|
---|
100 |
|
---|
101 | # all of a type
|
---|
102 | _OBJS :=
|
---|
103 | _FETCHES :=
|
---|
104 | _DOWNLOADS:=
|
---|
105 | _UNPACKS :=
|
---|
106 | _PATCHES :=
|
---|
107 | _UNFETCHES:=
|
---|
108 | _BLDPROGS :=
|
---|
109 | _LIBS :=
|
---|
110 | _DLLS :=
|
---|
111 | _PROGRAMS :=
|
---|
112 | _SYSMODS :=
|
---|
113 | _INSTALLS :=
|
---|
114 | _INSTALLS_FILES :=
|
---|
115 | _INSTALLS_DIRS :=
|
---|
116 | _OTHERS :=
|
---|
117 | _PACKING :=
|
---|
118 | _DIRS := $(PATH_TARGET)/ $(PATH_TARGET) $(BLDDIRS)
|
---|
119 | _IMPORT_LIBS :=
|
---|
120 |
|
---|
121 | # misc
|
---|
122 | pass_prev :=
|
---|
123 |
|
---|
124 |
|
---|
125 |
|
---|
126 | #
|
---|
127 | # Footer macros
|
---|
128 | #
|
---|
129 |
|
---|
130 | ## Figure out the tool for a target.
|
---|
131 | # @param $1 normalized target.
|
---|
132 | # @param $2 tooltype.
|
---|
133 | # @param bld_trg build target.
|
---|
134 | # @param bld_trg_arch build target architecture.
|
---|
135 | _TARGET_TOOL = $(strip $(firstword \
|
---|
136 | $($(1)_$(2)TOOL.$(bld_trg).$(bld_trg_arch)) \
|
---|
137 | $($(1)_$(2)TOOL.$(bld_trg)) \
|
---|
138 | $($(1)_$(2)TOOL) \
|
---|
139 | $($(1)_TOOL.$(bld_trg).$(bld_trg_arch)) \
|
---|
140 | $($(1)_TOOL.$(bld_trg)) \
|
---|
141 | $($(1)_TOOL) \
|
---|
142 | $($(2)TOOL.$(bld_trg).$(bld_trg_arch)) \
|
---|
143 | $($(2)TOOL.$(bld_trg)) \
|
---|
144 | $($(2)TOOL) \
|
---|
145 | $(TOOL.$(bld_trg).$(bld_trg_arch)) \
|
---|
146 | $(TOOL.$(bld_trg)) \
|
---|
147 | $(TOOL) \
|
---|
148 | ))
|
---|
149 |
|
---|
150 | ## Figure out the actual name of an installed file.
|
---|
151 | # @param $1 The file to install.
|
---|
152 | # @param $2 The target name.
|
---|
153 | # @param $3 The _INST value (can be empty).
|
---|
154 | # @param $4 The default directory to use when $3 is empty.
|
---|
155 | _INSTALL_FILE = $(patsubst %/,%/$(notdir $(1)),$(if $(3),$(PATH_INS)/$(3),$(4)/))
|
---|
156 |
|
---|
157 |
|
---|
158 | ## Inherit one template property in a non-accumulative manner.
|
---|
159 | # @param $(prop) Property name
|
---|
160 | # @param $(src) Source (parent) object.
|
---|
161 | # @param $(trg) Target (child) object.
|
---|
162 | define def_inherit_one
|
---|
163 | ifdef $(src)_$(prop)
|
---|
164 | ifndef $(trg)_$(prop)
|
---|
165 | $(trg)_$(prop) = $($(src)_$(prop))
|
---|
166 | #$ (warning def_inherit_one: $(trg)_$(prop) = $($(src)_$(prop)) )
|
---|
167 | endif
|
---|
168 | endif
|
---|
169 | endef # def_inherit_one
|
---|
170 |
|
---|
171 |
|
---|
172 | # EXPAND_BY = overriding
|
---|
173 |
|
---|
174 | ## Inherit one template property in a non-accumulative manner.
|
---|
175 | # @param $(prop) Property name
|
---|
176 | # @param $(src) Source (parent) object.
|
---|
177 | # @param $(trg) Target (child) object.
|
---|
178 | define def_inherit_one_overriding_now_l
|
---|
179 | ifdef $(src)_$(prop)
|
---|
180 | ifndef $(trg)_$(prop)
|
---|
181 | $(trg)_$(prop) := $($(src)_$(prop))
|
---|
182 | #$ (warning def_inherit_one_overriding_now_l: $(trg)_$(prop) = $($(src)_$(prop)) )
|
---|
183 | endif
|
---|
184 | endif
|
---|
185 | endef # def_inherit_one_overriding_now_l
|
---|
186 |
|
---|
187 | ## @copydoc def_inherit_one_overriding_now_l
|
---|
188 | define def_inherit_one_overriding_now_r
|
---|
189 | ifdef $(src)_$(prop)
|
---|
190 | ifndef $(trg)_$(prop)
|
---|
191 | $(trg)_$(prop) := $($(src)_$(prop))
|
---|
192 | #$ (warning def_inherit_one_overriding_now_r: $(trg)_$(prop) = $($(src)_$(prop)) )
|
---|
193 | endif
|
---|
194 | endif
|
---|
195 | endef # def_inherit_one_overriding_now_r
|
---|
196 |
|
---|
197 | ## Inherit one template property in a non-accumulative manner, deferred expansion.
|
---|
198 | # @param $(prop) Property name
|
---|
199 | # @param $(src) Source
|
---|
200 | # @param $(trg) Target
|
---|
201 | # @remark This define relies on double evaluation
|
---|
202 | define def_inherit_one_overriding_deferred
|
---|
203 | ifdef $(src)_$(prop)
|
---|
204 | ifndef $(trg)_$(prop)
|
---|
205 | $(trg)_$(prop) = $$($(src)_$(prop))
|
---|
206 | #$ (warning def_inherit_one_overriding_deferred: $(trg)_$(prop) = $($(src)_$(prop)) )
|
---|
207 | endif
|
---|
208 | endif
|
---|
209 | endef # def_inherit_one_overriding_deferred
|
---|
210 |
|
---|
211 | ## @copydoc def_inherit_one_overriding_deferred
|
---|
212 | define def_inherit_one_overriding_deferred_l
|
---|
213 | ifdef $(src)_$(prop)
|
---|
214 | ifndef $(trg)_$(prop)
|
---|
215 | $(trg)_$(prop) = $$($(src)_$(prop))
|
---|
216 | #$ (warning def_inherit_one_overriding_deferred_l: $(trg)_$(prop) = $($(src)_$(prop)) )
|
---|
217 | endif
|
---|
218 | endif
|
---|
219 | endef # def_inherit_one_overriding_deferred_l
|
---|
220 |
|
---|
221 | ## @copydoc def_inherit_one_overriding_deferred
|
---|
222 | define def_inherit_one_overriding_deferred_r
|
---|
223 | ifdef $(src)_$(prop)
|
---|
224 | ifndef $(trg)_$(prop)
|
---|
225 | $(trg)_$(prop) = $$($(src)_$(prop))
|
---|
226 | #$ (warning def_inherit_one_overriding_deferred_r: $(trg)_$(prop) = $($(src)_$(prop)) )
|
---|
227 | endif
|
---|
228 | endif
|
---|
229 | endef # def_inherit_one_overriding_deferred_r
|
---|
230 |
|
---|
231 |
|
---|
232 | # EXPAND_BY = prepending
|
---|
233 |
|
---|
234 | ## Inherit one template property in a prepending manner.
|
---|
235 | # @param $(prop) Property name
|
---|
236 | # @param $(src) Source (parent) object.
|
---|
237 | # @param $(trg) Target (child) object.
|
---|
238 | define def_inherit_one_prepending_now_l
|
---|
239 | ifdef $(src)_$(prop)
|
---|
240 | $(trg)_$(prop) := $(trg)_$(prop) $($(src)_$(prop))
|
---|
241 | #$ (warning def_inherit_one_prepending_now_l: $(trg)_$(prop) = $($(trg)_$(prop)) )
|
---|
242 | endif
|
---|
243 | endef # def_inherit_one_prepending_now_l
|
---|
244 |
|
---|
245 | ## @copydoc def_inherit_one_prepending_now_l
|
---|
246 | define def_inherit_one_prepending_now_r
|
---|
247 | ifdef $(src)_$(prop)
|
---|
248 | $(trg)_$(prop) := $($(src)_$(prop)) $(trg)_$(prop)
|
---|
249 | #$ (warning def_inherit_one_prepending_now_r: $(trg)_$(prop) = $($(trg)_$(prop)) )
|
---|
250 | endif
|
---|
251 | endef # def_inherit_one_prepending_now_r
|
---|
252 |
|
---|
253 | ## Inherit one template property in a non-accumulative manner, deferred expansion.
|
---|
254 | # @param $(prop) Property name
|
---|
255 | # @param $(src) Source
|
---|
256 | # @param $(trg) Target
|
---|
257 | # @remark This define relies on double evaluation
|
---|
258 | define def_inherit_one_prepending_deferred
|
---|
259 | ifdef $(src)_$(prop)
|
---|
260 | ifndef $(trg)_$(prop)
|
---|
261 | $(trg)_$(prop) = $$($(src)_$(prop))
|
---|
262 | #$ (warning def_inherit_one_prepending_deferred: $(trg)_$(prop) = $($(src)_$(prop)) )
|
---|
263 | endif
|
---|
264 | endif
|
---|
265 | endef # def_inherit_one_prepending_deferred
|
---|
266 |
|
---|
267 | ## Inherit one template property in a prepending manner, deferred expansion.
|
---|
268 | # @param $(prop) Property name
|
---|
269 | # @param $(src) Source (parent) object.
|
---|
270 | # @param $(trg) Target (child) object.
|
---|
271 | define def_inherit_one_prepending_deferred_l
|
---|
272 | ifdef $(src)_$(prop)
|
---|
273 | $(trg)_$(prop) <= $$($(src)_$(prop))
|
---|
274 | #$ (warning def_inherit_one_prepending_deferred_l: $(trg)_$(prop) = $($(trg)_$(prop)) )
|
---|
275 | endif
|
---|
276 | endef # def_inherit_one_prepending_deferred_l
|
---|
277 |
|
---|
278 | ## @copydoc def_inherit_one_prepending_deferred_l
|
---|
279 | define def_inherit_one_prepending_deferred_r
|
---|
280 | ifdef $(src)_$(prop)
|
---|
281 | $(trg)_$(prop) += $$($(src)_$(prop))
|
---|
282 | #$ (warning def_inherit_one_prepending_deferred_r: $(trg)_$(prop) = $($(trg)_$(prop)) )
|
---|
283 | endif
|
---|
284 | endef # def_inherit_one_prepending_deferred_r
|
---|
285 |
|
---|
286 |
|
---|
287 | # EXPAND_BY = appending
|
---|
288 |
|
---|
289 | ## Inherit one template property in a appending manner.
|
---|
290 | # @param $(prop) Property name
|
---|
291 | # @param $(src) Source (parent) object.
|
---|
292 | # @param $(trg) Target (child) object.
|
---|
293 | define def_inherit_one_appending_now_l
|
---|
294 | ifdef $(src)_$(prop)
|
---|
295 | $(trg)_$(prop) := $($(src)_$(prop)) $(trg)_$(prop)
|
---|
296 | #$ (warning def_inherit_one_appending_now_l: $(trg)_$(prop) = $($(trg)_$(prop)) )
|
---|
297 | endif
|
---|
298 | endef # def_inherit_one_appending_now_l
|
---|
299 |
|
---|
300 | ## @copydoc def_inherit_one_appending_now_l
|
---|
301 | define def_inherit_one_appending_now_r
|
---|
302 | ifdef $(src)_$(prop)
|
---|
303 | $(trg)_$(prop) := $(trg)_$(prop) $($(src)_$(prop))
|
---|
304 | #$ (warning def_inherit_one_appending_now_r: $(trg)_$(prop) = $($(trg)_$(prop)) )
|
---|
305 | endif
|
---|
306 | endef # def_inherit_one_appending_now_r
|
---|
307 |
|
---|
308 | ## Inherit one template property in a non-accumulative manner, deferred expansion.
|
---|
309 | # @param $(prop) Property name
|
---|
310 | # @param $(src) Source
|
---|
311 | # @param $(trg) Target
|
---|
312 | # @remark This define relies on double evaluation
|
---|
313 | define def_inherit_one_appending_deferred
|
---|
314 | ifdef $(src)_$(prop)
|
---|
315 | ifndef $(trg)_$(prop)
|
---|
316 | $(trg)_$(prop) = $$($(src)_$(prop))
|
---|
317 | #$ (warning def_inherit_one_appending_deferred: $(trg)_$(prop) = $($(src)_$(prop)) )
|
---|
318 | endif
|
---|
319 | endif
|
---|
320 | endef # def_inherit_one_appending_deferred
|
---|
321 |
|
---|
322 | ## Inherit one template property in a appending manner, deferred expansion.
|
---|
323 | # @param $(prop) Property name
|
---|
324 | # @param $(src) Source (parent) object.
|
---|
325 | # @param $(trg) Target (child) object.
|
---|
326 | define def_inherit_one_appending_deferred_l
|
---|
327 | ifdef $(src)_$(prop)
|
---|
328 | $(trg)_$(prop) += $$($(src)_$(prop))
|
---|
329 | #$ (warning def_inherit_one_appending_deferred_l: $(trg)_$(prop) = $($(trg)_$(prop)) )
|
---|
330 | endif
|
---|
331 | endef # def_inherit_one_appending_deferred_l
|
---|
332 |
|
---|
333 | ## @copydoc def_inherit_one_appending_deferred_l
|
---|
334 | define def_inherit_one_appending_deferred_r
|
---|
335 | ifdef $(src)_$(prop)
|
---|
336 | $(trg)_$(prop) <= $$($(src)_$(prop))
|
---|
337 | #$ (warning def_inherit_one_appending_deferred_r: $(trg)_$(prop) = $($(trg)_$(prop)) )
|
---|
338 | endif
|
---|
339 | endef # def_inherit_one_appending_deferred_r
|
---|
340 |
|
---|
341 |
|
---|
342 |
|
---|
343 | ## Generic inheritance for use with targets templates and tools.
|
---|
344 | # @param trg Object to consider for inheriting.
|
---|
345 | # @param src_prefix What to prefix the value found in EXTENDS with to get the object.
|
---|
346 | # @param properties List of the properties with straight expansion.
|
---|
347 | # @param properties_now_l List of the properties with immediate expansion, accumulating on the left side.
|
---|
348 | # @param properties_now_r List of the properties with immediate expansion, accumulating on the right side.
|
---|
349 | # @param properties_deferred List of the properties with deferred expansion (e.g. function), non-accumulative .
|
---|
350 | # @param properties_deferred_l List of the properties with deferred expansion (e.g. function), accumulating on the left side.
|
---|
351 | # @param properties_deferred_r List of the properties with deferred expansion (e.g. function), accumulating on the right side.
|
---|
352 | define def_inherit
|
---|
353 | src := $(strip $($(trg)_EXTENDS))
|
---|
354 | ifneq ($(src),)
|
---|
355 | ifndef $(trg)_EXTENDS_STATUS_
|
---|
356 | $(trg)_EXTENDS_STATUS_ := 0
|
---|
357 | src := $(src_prefix)$(src)
|
---|
358 |
|
---|
359 | # Recursivly process the parent (src) if it's inherting from somebody too.
|
---|
360 | ifdef $(src)_EXTENDS
|
---|
361 | ifneq ($($(src)_EXTENDS_STATUS_),42)
|
---|
362 | # 'foreach' will create 'trg' in a new variable context hiding
|
---|
363 | # out current variable. 'src' OTOH will be overwritten.
|
---|
364 | #$ (warning def_inherit: recursing into $(src) from $(trg))
|
---|
365 | $(foreach trg, $(src), $(eval $(value def_inherit)))
|
---|
366 | src := $(src_prefix)$(strip $($(trg)_EXTENDS))
|
---|
367 | endif
|
---|
368 | endif
|
---|
369 |
|
---|
370 | # Get & check EXTENDS_BY.
|
---|
371 | by = $(strip $($(trg)_EXTENDS_BY))
|
---|
372 | ifeq ($(by),)
|
---|
373 | by = overriding
|
---|
374 | else ifn1of ($(by), overriding appending prepending)
|
---|
375 | $(error kBuild: Invalid EXTENDS_BY value '$(by)' on '$(trg)'!)
|
---|
376 | endif
|
---|
377 |
|
---|
378 | # Inherit the properties.
|
---|
379 | #$ (warning def_inherit: trg=$(trg) src=$(src))
|
---|
380 | $(foreach prop, $(properties), $(eval $(def_inherit_one)))
|
---|
381 | $(foreach prop, $(properties_now_l), $(eval $(def_inherit_one_$(by)_now_l)))
|
---|
382 | $(foreach prop, $(properties_now_r), $(eval $(def_inherit_one_$(by)_now_r)))
|
---|
383 | $(foreach prop, $(properties_deferred), $(eval $(def_inherit_one_$(by)_deferred)))
|
---|
384 | $(foreach prop, $(properties_deferred_l), $(eval $(def_inherit_one_$(by)_deferred_l)))
|
---|
385 | $(foreach prop, $(properties_deferred_r), $(eval $(def_inherit_one_$(by)_deferred_r)))
|
---|
386 |
|
---|
387 | # Mark the target as done.
|
---|
388 | $(trg)_EXTENDS_STATUS_ := 42
|
---|
389 | else
|
---|
390 | # Check for inheritance loops.
|
---|
391 | ifneq ($($(trg)_EXTENDS_STATUS_),42)
|
---|
392 | $(error kBuild: Target inheritance loop! target=$(trg) $(trg)_EXTENDS_STATUS_=$($(trg)_EXTENDS_STATUS_))
|
---|
393 | endif
|
---|
394 | endif
|
---|
395 | endif
|
---|
396 | endef # def_inherit
|
---|
397 |
|
---|
398 |
|
---|
399 | ##
|
---|
400 | # Function for $(call)'ing.
|
---|
401 | # @param 1 trg Object to consider for inheriting.
|
---|
402 | # @param 2 src_prefix What to prefix the value found in EXTENDS with to get the object.
|
---|
403 | # @param 3 properties List of the properties with straight expansion.
|
---|
404 | # @param 4 properties_now_l List of the properties with immediate expansion, accumulating on the left side.
|
---|
405 | # @param 5 properties_now_r List of the properties with immediate expansion, accumulating on the right side.
|
---|
406 | # @param 6 properties_deferred List of the properties with deferred expansion (e.g. function), non-accumulative .
|
---|
407 | # @param 7 properties_deferred_l List of the properties with deferred expansion (e.g. function), accumulating on the left side.
|
---|
408 | # @param 8 properties_deferred_r List of the properties with deferred expansion (e.g. function), accumulating on the right side.
|
---|
409 | define fn_inherit
|
---|
410 | src_prefix := $(2)
|
---|
411 | properties := $(3)
|
---|
412 | properties_now_l := $(4)
|
---|
413 | properties_now_r := $(5)
|
---|
414 | properties_deferred := $(6)
|
---|
415 | properties_deferred_l := $(7)
|
---|
416 | properties_deferred_r := $(8)
|
---|
417 | $(foreach trg, $(1),$(eval $(value def_inherit)))
|
---|
418 | endef
|
---|
419 |
|
---|
420 |
|
---|
421 |
|
---|
422 | #
|
---|
423 | # Determin all the templates that is being used and make
|
---|
424 | # sure they are present.
|
---|
425 | #
|
---|
426 | _TEMPLATES := $(TEMPLATE)
|
---|
427 | define def_templates
|
---|
428 | ifdef $(target)_TEMPLATE
|
---|
429 | ifneq ("$($(target)_TEMPLATE)","$(strip $($(target)_TEMPLATE))")
|
---|
430 | $$(error kBuild: The template name of target '$(target)' contains tabs ($($(target)_TEMPLATE))). Please remove them)
|
---|
431 | endif
|
---|
432 | _TEMPLATES += $($(target)_TEMPLATE)
|
---|
433 | endif
|
---|
434 | endef # def_templates
|
---|
435 | $(foreach target, $(_ALL_TARGETS), $(eval $(def_templates)))
|
---|
436 | _TEMPLATES := $(sort $(_TEMPLATES))
|
---|
437 |
|
---|
438 | define def_templates_include
|
---|
439 | ifndef TEMPLATE_$(template)
|
---|
440 | TEMPLATE_$(template)_INCLUDE_FILE_ := $(firstword $(foreach path, $(TEMPLATE_PATHS) $(PATH_KBUILD)/templates/, $(wildcard $(path)/$(template).kmk)))
|
---|
441 | ifneq ($(TEMPLATE_$(template)_INCLUDE_FILE_),)
|
---|
442 | include $(TEMPLATE_$(template)_INCLUDE_FILE_)
|
---|
443 | else
|
---|
444 | $$(error kBuild: Cannot find template '$(template)')
|
---|
445 | endif
|
---|
446 | endif
|
---|
447 | endef # def_templates_include
|
---|
448 | $(foreach template, $(_TEMPLATES), $(eval $(def_templates_include)))
|
---|
449 |
|
---|
450 | #$ (warning dbg _TEMPLATES := $(_TEMPLATES))
|
---|
451 |
|
---|
452 |
|
---|
453 | #
|
---|
454 | # Determin the BLD_TRG_* and BLD_TYPE keywords required for correct
|
---|
455 | # inherting, and then check for inheritance.
|
---|
456 | #
|
---|
457 | # This means walking all the template and target lists in order to
|
---|
458 | # pick up all BLD_TRG_* attributes.
|
---|
459 | #
|
---|
460 | _BLD_TYPES := $(BUILD_TYPE)
|
---|
461 | _BLD_TARGETS := $(BUILD_TARGET) $(BUILD_PLATFORMS)
|
---|
462 | _BLD_ARCHES := $(BUILD_TARGET_ARCH) $(BUILD_PLATFORM_ARCH)
|
---|
463 | _BLD_CPUS := $(BUILD_TARGET_CPU) $(BUILD_PLATFORM_CPU)
|
---|
464 |
|
---|
465 | define def_collect_bld_xyz
|
---|
466 | ifdef $(src)_BLD_TYPE
|
---|
467 | ifn1of ($($(src)_BLD_TYPE), $(KBUILD_BLD_TYPES))
|
---|
468 | $(error kBuild: $(src)_BLD_TYPE=$($(src)_BLD_TYPE) not in KBUILD_BLD_TYPES={$(KBUILD_BLD_TYPES)}!)
|
---|
469 | endif
|
---|
470 | _BLD_TYPES += $($(src)_BLD_TYPE)
|
---|
471 | endif
|
---|
472 | ifdef $(src)_BLD_TRG
|
---|
473 | ifn1of ($($(src)_BLD_TRG), $(KBUILD_OSES))
|
---|
474 | $(error kBuild: $(src)_BLD_TRG=$($(src)_BLD_TRG) not in KBUILD_OSES={$(KBUILD_OSES)}!)
|
---|
475 | endif
|
---|
476 | _BLD_TARGETS += $($(src)_BLD_TRG)
|
---|
477 | endif
|
---|
478 | ifdef $(src)_BLD_TRG_ARCH
|
---|
479 | ifn1of ($($(src)_BLD_TRG_ARCH), $(KBUILD_ARCHES))
|
---|
480 | $(error kBuild: $(src)_BLD_TRG_ARCH=$($(src)_BLD_TRG_ARCH) not in KBUILD_ARCHES={$(KBUILD_ARCHES)}!)
|
---|
481 | endif
|
---|
482 | _BLD_ARCHES += $($(src)_BLD_TRG_ARCH)
|
---|
483 | endif
|
---|
484 | ifdef $(src)_BLD_TRG_CPU
|
---|
485 | if1of ($($(src)_BLD_CPU), $(KBUILD_ARCHES) $(KBUILD_OSES) $(KBUILD_BLD_TYPES))
|
---|
486 | $(error kBuild: $(src)_BLD_TRG_CPU=$($(src)_BLD_TRG_CPU) found in KBUILD_ARCHES, KBUILD_OSES or KBUILD_BLD_TYPES!)
|
---|
487 | endif
|
---|
488 | _BLD_CPUS += $($(src)_BLD_TRG_CPU)
|
---|
489 | endif
|
---|
490 | endef # def_collect_bld_xyz
|
---|
491 | $(foreach src, $(addprefix TEMPLATE_, $(_TEMPLATES)) $(_ALL_TARGETS) \
|
---|
492 | ,$(eval $(value def_collect_bld_xyz)))
|
---|
493 |
|
---|
494 | # Drop duplicate values.
|
---|
495 | _BLD_TYPES := $(sort $(_BLD_TYPES))
|
---|
496 | _BLD_TARGETS := $(sort $(_BLD_TARGETS))
|
---|
497 | _BLD_ARCHES := $(sort $(_BLD_ARCHES))
|
---|
498 | _BLD_CPUS := $(sort $(_BLD_CPUS))
|
---|
499 |
|
---|
500 | # Construct all the possible keywords.
|
---|
501 | _KEYWORDS := $(_BLD_TYPES) $(_BLD_TARGETS) $(_BLD_ARCHES) $(_BLD_CPUS) \
|
---|
502 | $(foreach bld_trg,$(_BLD_TARGETS),$(addprefix $(bld_trg).,$(_BLD_ARCHES)))
|
---|
503 |
|
---|
504 | # Look for keywords which extends others and order them.
|
---|
505 | _KEYWORDS_ORDERED :=
|
---|
506 | define def_keyword_ordering
|
---|
507 | src := $(strip $($(prefix)_$(keyword)_EXTENDS))
|
---|
508 | ifneq ($(src),)
|
---|
509 | ifndef $(prefix)_$(keyword)_EXTENDS_STATUS_
|
---|
510 | $(prefix)_$(keyword)_EXTENDS_STATUS_ := 0
|
---|
511 |
|
---|
512 | # Validate src.
|
---|
513 | ifn1of ($(src), $(valid))
|
---|
514 | $(error kBuild: $(keyword) tries to extend unknown keyword '$(src)'! (known = $(valid)))
|
---|
515 | endif
|
---|
516 |
|
---|
517 | # Recursivly process the parent (src) if it's inherting from somebody too.
|
---|
518 | # If it isn't, then we'll have to add it to the ordered keyword list here.
|
---|
519 | ifneq ($($(prefix)_$(src)_EXTENDS_STATUS_),42)
|
---|
520 | ifneq ($($(prefix)_$(src)_EXTENDS_STATUS_),)
|
---|
521 | $(error kBuild: Keyword inheritance loop! keyword=$(src) $(prefix)_$(src)_EXTENDS_STATUS_=$($(prefix)_$(src)_EXTENDS_STATUS_))
|
---|
522 | endif
|
---|
523 | ifdef $(prefix)_$(src)_EXTENDS
|
---|
524 | # 'foreach' will create 'keyword' in a new variable context hiding
|
---|
525 | # out current variable. 'src' OTOH will be overwritten.
|
---|
526 | $(foreach keyword, $(src), $(eval $(value def_keyword_ordering)))
|
---|
527 | src := $(strip $($(keyword)_EXTENDS))
|
---|
528 | else
|
---|
529 | # Add it to the list and mark it as done.
|
---|
530 | _KEYWORDS_ORDERED += $(src)
|
---|
531 | $(prefix)_$(src)_EXTENDS_STATUS_ := 42
|
---|
532 | endif
|
---|
533 | endif
|
---|
534 |
|
---|
535 | # Check EXTENDS_BY.
|
---|
536 | by = $(strip $($(trg)_EXTENDS_BY))
|
---|
537 | ifeq ($(by),)
|
---|
538 | by = overriding
|
---|
539 | else ifn1of ($(by), overriding appending prepending)
|
---|
540 | $(error kBuild: Invalid EXTENDS_BY value '$(by)' on '$(keyword)'!)
|
---|
541 | endif
|
---|
542 |
|
---|
543 | # Add it to the list and mark it as done.
|
---|
544 | _KEYWORDS_ORDERED += $(keyword)
|
---|
545 | $(prefix)_$(keyword)_EXTENDS_STATUS_ := 42
|
---|
546 | else
|
---|
547 | # Check for inheritance loops.
|
---|
548 | ifneq ($($(trg)_EXTENDS_STATUS_),42)
|
---|
549 | $(error kBuild: Keyword inheritance loop! keyword=$(keyword) $(prefix)_$(keyword)_EXTENDS_STATUS_=$($(prefix)_$(keyword)_EXTENDS_STATUS_))
|
---|
550 | endif
|
---|
551 | endif
|
---|
552 | endif
|
---|
553 |
|
---|
554 | endef
|
---|
555 |
|
---|
556 | prefix := BLD_TYPE
|
---|
557 | valid := $(KBUILD_BLD_TYPES)
|
---|
558 | $(foreach keyword, $(_BLD_TYPES) , $(eval $(value def_keyword_ordering)))
|
---|
559 |
|
---|
560 | prefix := BLD_ARCH
|
---|
561 | valid := $(KBUILD_ARCHES)
|
---|
562 | $(foreach keyword, $(_BLD_ARCHES), $(eval $(value def_keyword_ordering)))
|
---|
563 |
|
---|
564 | prefix := BLD_CPU
|
---|
565 | valid := $(KBUILD_CPUS)
|
---|
566 | $(foreach keyword, $(_BLD_CPUS) , $(eval $(value def_keyword_ordering)))
|
---|
567 |
|
---|
568 | # Update _KEYWORDS to the ordered list making sure parent keywords are included too.
|
---|
569 | _KEYWORDS := $(_KEYWORDS_ORDERED) $(filter-out $(_KEYWORDS_ORDERED), $(_KEYWORDS))
|
---|
570 |
|
---|
571 | ifdef KBUILD_PROFILE_SELF
|
---|
572 | _KBUILD_TS_NOW := $(nanots )
|
---|
573 | $(info prof: $(int-sub $(_KBUILD_TS_NOW), $(_KBUILD_TS_HEADER_START)) - $(int-sub $(_KBUILD_TS_NOW), $(_KBUILD_TS_PREV)) - done keywords)
|
---|
574 | _KBUILD_TS_PREV := $(_KBUILD_TS_NOW)
|
---|
575 | endif
|
---|
576 |
|
---|
577 |
|
---|
578 | #
|
---|
579 | # Target inheritance.
|
---|
580 | #
|
---|
581 | # This has to be done on a per target list basis as to avoid adding
|
---|
582 | # incorrect properties that will wast memory, time, and may confuse
|
---|
583 | # later strictness checks. This also has to be done *before* templates
|
---|
584 | # are applied to the targets. Since we're doing that part rather
|
---|
585 | # early on, the target inheritance feature is a bit restricted at
|
---|
586 | # the moment. However, this will be addressed in a little(?) while.
|
---|
587 | #
|
---|
588 |
|
---|
589 | src_prefix :=
|
---|
590 | properties_deferred_l :=
|
---|
591 | properties_deferred_r :=
|
---|
592 |
|
---|
593 | ## combines the specified properties $(1) with the $(_KEYWORDS).
|
---|
594 | _COMB_KEY_PROP = $(1) $(foreach keyword,$(_KEYWORDS), $(addsuffix .$(keyword), $(1)))
|
---|
595 |
|
---|
596 | # Fetches.
|
---|
597 | properties := $(call _COMB_KEY_PROP,$(PROPS_FETCHES_SINGLE))
|
---|
598 | properties_now_l := $(call _COMB_KEY_PROP,$(PROPS_FETCHES_ACCUMULATE_L))
|
---|
599 | properties_now_r := $(call _COMB_KEY_PROP,$(PROPS_FETCHES_ACCUMULATE_R))
|
---|
600 | properties_deferred := $(call _COMB_KEY_PROP,$(PROPS_FETCHES_DEFERRED))
|
---|
601 | $(foreach trg, $(_ALL_FETCHES),$(eval $(value def_inherit)))
|
---|
602 |
|
---|
603 | ## Patches. - not implemented yet.
|
---|
604 | #properties := $(call _COMB_KEY_PROP,$(PROPS_PATCHES_SINGLE))
|
---|
605 | #properties_now_l := $(call _COMB_KEY_PROP,$(PROPS_PATCHES_ACCUMULATE_L))
|
---|
606 | #properties_now_r := $(call _COMB_KEY_PROP,$(PROPS_PATCHES_ACCUMULATE_R))
|
---|
607 | #properties_deferred := $(call _COMB_KEY_PROP,$(PROPS_PATCHES_DEFERRED))
|
---|
608 | #$(foreach trg, $(_ALL_PATCHES),$(eval $(value def_inherit)))
|
---|
609 |
|
---|
610 | # Programs and build programs.
|
---|
611 | properties := $(call _COMB_KEY_PROP,$(PROPS_PROGRAMS_SINGLE))
|
---|
612 | properties_now_l := $(call _COMB_KEY_PROP,$(PROPS_PROGRAMS_ACCUMULATE_L))
|
---|
613 | properties_now_r := $(call _COMB_KEY_PROP,$(PROPS_PROGRAMS_ACCUMULATE_R))
|
---|
614 | properties_deferred := $(call _COMB_KEY_PROP,$(PROPS_PROGRAMS_DEFERRED))
|
---|
615 | $(foreach trg, $(_ALL_BLDPROGS) $(_ALL_PROGRAMS),$(eval $(value def_inherit)))
|
---|
616 |
|
---|
617 | # Libraries and import libraries.
|
---|
618 | properties := $(call _COMB_KEY_PROP,$(PROPS_LIBRARIES_SINGLE))
|
---|
619 | properties_now_l := $(call _COMB_KEY_PROP,$(PROPS_LIBRARIES_ACCUMULATE_L))
|
---|
620 | properties_now_r := $(call _COMB_KEY_PROP,$(PROPS_LIBRARIES_ACCUMULATE_R))
|
---|
621 | properties_deferred := $(call _COMB_KEY_PROP,$(PROPS_LIBRARIES_DEFERRED))
|
---|
622 | if1of ($(BUILD_TARGET), nt os2 win)
|
---|
623 | $(foreach trg, $(_ALL_LIBRARIES) $(_ALL_IMPORT_LIBS),$(eval $(value def_inherit)))
|
---|
624 | else
|
---|
625 | $(foreach trg, $(_ALL_LIBRARIES),$(eval $(value def_inherit)))
|
---|
626 | endif
|
---|
627 |
|
---|
628 | # DLLs.
|
---|
629 | properties := $(call _COMB_KEY_PROP,$(PROPS_DLLS_SINGLE))
|
---|
630 | properties_now_l := $(call _COMB_KEY_PROP,$(PROPS_DLLS_ACCUMULATE_L))
|
---|
631 | properties_now_r := $(call _COMB_KEY_PROP,$(PROPS_DLLS_ACCUMULATE_R))
|
---|
632 | properties_deferred := $(call _COMB_KEY_PROP,$(PROPS_DLLS_DEFERRED))
|
---|
633 | if1of ($(BUILD_TARGET), nt os2 win)
|
---|
634 | $(foreach trg, $(_ALL_DLLS),$(eval $(value def_inherit)))
|
---|
635 | else
|
---|
636 | $(foreach trg, $(_ALL_DLLS) $(_ALL_IMPORT_LIBS),$(eval $(value def_inherit)))
|
---|
637 | endif
|
---|
638 |
|
---|
639 | # System modules.
|
---|
640 | properties := $(call _COMB_KEY_PROP,$(PROPS_SYSMODS_SINGLE))
|
---|
641 | properties_now_l := $(call _COMB_KEY_PROP,$(PROPS_SYSMODS_ACCUMULATE_L))
|
---|
642 | properties_now_r := $(call _COMB_KEY_PROP,$(PROPS_SYSMODS_ACCUMULATE_R))
|
---|
643 | properties_deferred := $(call _COMB_KEY_PROP,$(PROPS_SYSMODS_DEFERRED))
|
---|
644 | $(foreach trg, $(_ALL_SYSMODS),$(eval $(value def_inherit)))
|
---|
645 |
|
---|
646 | # Installs.
|
---|
647 | properties := $(call _COMB_KEY_PROP,$(PROPS_INSTALLS_SINGLE))
|
---|
648 | properties_now_l := $(call _COMB_KEY_PROP,$(PROPS_INSTALLS_ACCUMULATE_L))
|
---|
649 | properties_now_r := $(call _COMB_KEY_PROP,$(PROPS_INSTALLS_ACCUMULATE_R))
|
---|
650 | properties_deferred := $(call _COMB_KEY_PROP,$(PROPS_INSTALLS_DEFERRED))
|
---|
651 | $(foreach trg, $(_ALL_INSTALLS),$(eval $(value def_inherit)))
|
---|
652 |
|
---|
653 | ifdef KBUILD_PROFILE_SELF
|
---|
654 | _KBUILD_TS_NOW := $(nanots )
|
---|
655 | $(info prof: $(int-sub $(_KBUILD_TS_NOW), $(_KBUILD_TS_HEADER_START)) - $(int-sub $(_KBUILD_TS_NOW), $(_KBUILD_TS_PREV)) - done target inheritance)
|
---|
656 | _KBUILD_TS_PREV := $(_KBUILD_TS_NOW)
|
---|
657 | endif
|
---|
658 |
|
---|
659 |
|
---|
660 | #
|
---|
661 | # Template Inheritance.
|
---|
662 | #
|
---|
663 | # This is much the same as with target inheritance, except we cannot
|
---|
664 | # restrict the properties involved since we haven't got a clue which
|
---|
665 | # target platforms/archs are using them. But, we can drop the instance
|
---|
666 | # expansion we're doing for targets since there won't be any more
|
---|
667 | # changes to either the source nor the target templates beyond this
|
---|
668 | # exercise.
|
---|
669 | #
|
---|
670 |
|
---|
671 | src_prefix := TEMPLATE_
|
---|
672 | properties :=
|
---|
673 | properties_now_l :=
|
---|
674 | properties_now_r :=
|
---|
675 | properties_deferred := $(call _COMB_KEY_PROP,$(PROPS_SINGLE) $(PROPS_DEFERRED))
|
---|
676 | properties_deferred_l := $(call _COMB_KEY_PROP,$(PROPS_ACCUMULATE_L))
|
---|
677 | properties_deferred_r := $(call _COMB_KEY_PROP,$(PROPS_ACCUMULATE_R))
|
---|
678 | $(foreach trg, $(addprefix TEMPLATE_,$(_TEMPLATES)),$(eval $(value def_inherit)))
|
---|
679 |
|
---|
680 | ifdef KBUILD_PROFILE_SELF
|
---|
681 | _KBUILD_TS_NOW := $(nanots )
|
---|
682 | $(info prof: $(int-sub $(_KBUILD_TS_NOW), $(_KBUILD_TS_HEADER_START)) - $(int-sub $(_KBUILD_TS_NOW), $(_KBUILD_TS_PREV)) - done template inheritance)
|
---|
683 | _KBUILD_TS_PREV := $(_KBUILD_TS_NOW)
|
---|
684 | endif
|
---|
685 |
|
---|
686 |
|
---|
687 | # done inheriting.
|
---|
688 | src_prefix :=
|
---|
689 | properties :=
|
---|
690 | properties_now_l :=
|
---|
691 | properties_now_r :=
|
---|
692 | properties_deferred :=
|
---|
693 | properties_deferred_l :=
|
---|
694 | properties_deferred_r :=
|
---|
695 |
|
---|
696 |
|
---|
697 | #
|
---|
698 | # Template/Target Expansion.
|
---|
699 | #
|
---|
700 | # Extend all targets with the values from the template. Doing this up front
|
---|
701 | # allows more generic code and less mess down in the pass 2 target handling.
|
---|
702 | # However it does eat a good deal of memory.
|
---|
703 | #
|
---|
704 |
|
---|
705 | ## Inherit one template property in a non-accumulative manner.
|
---|
706 | # @param $(prop) Property name
|
---|
707 | # @param $(target) Target name
|
---|
708 | # @todo fix the precedence order for some properties.
|
---|
709 | define def_inherit_template_one
|
---|
710 | ifdef TEMPLATE_$($(target)_TEMPLATE)_$(prop)
|
---|
711 | ifndef $(target)_$(prop)
|
---|
712 | $(target)_$(prop) := $(TEMPLATE_$($(target)_TEMPLATE)_$(prop))
|
---|
713 | #$ (warning dbgtarget: $(target)_$(prop):='$(value $(target)_$(prop))' TEMPLATE_$($(target)_TEMPLATE)_$(prop))
|
---|
714 | endif
|
---|
715 | endif
|
---|
716 | ifdef TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg)
|
---|
717 | ifndef $(target)_$(prop).$(bld_trg)
|
---|
718 | #$ (warning dbgsource: $(target)_$(prop).$(bld_trg)="TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg)" TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg))
|
---|
719 | $(target)_$(prop).$(bld_trg) := $(TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg))
|
---|
720 | endif
|
---|
721 | endif
|
---|
722 | ifdef TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg).$(bld_trg_arch)
|
---|
723 | ifndef $(target)_$(prop).$(bld_trg).$(bld_trg_arch)
|
---|
724 | #$ (warning dbgsource: $(target)_$(prop).$(bld_trg).$(bld_trg_arch)="TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg).$(bld_trg_arch)" TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg).$(bld_trg_arch))
|
---|
725 | $(target)_$(prop).$(bld_trg).$(bld_trg_arch) := $(TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg).$(bld_trg_arch))
|
---|
726 | endif
|
---|
727 | endif
|
---|
728 | ifdef TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg_arch)
|
---|
729 | ifndef $(target)_$(prop).$(bld_trg_arch)
|
---|
730 | #$ (warning dbgsource: $(target)_$(prop).$(bld_trg_arch)="TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg_arch)" TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg_arch))
|
---|
731 | $(target)_$(prop).$(bld_trg_arch) := $(TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg_arch))
|
---|
732 | endif
|
---|
733 | endif
|
---|
734 | ifdef TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg_cpu)
|
---|
735 | ifndef $(target)_$(prop).$(bld_trg_cpu)
|
---|
736 | #$ (warning dbgsource: $(target)_$(prop).$(bld_trg_cpu)="TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg_cpu)" TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg_cpu))
|
---|
737 | $(target)_$(prop).$(bld_trg_cpu) := $(TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg_cpu))
|
---|
738 | endif
|
---|
739 | endif
|
---|
740 | endef
|
---|
741 |
|
---|
742 | ## Inherit one template property in a non-accumulative manner, deferred expansion.
|
---|
743 | # @param 1: $(prop) Property name
|
---|
744 | # @param 2: $(target) Target name
|
---|
745 | # @todo fix the precedence order for some properties.
|
---|
746 | # @remark this define relies on double evaluation
|
---|
747 | define def_inherit_template_one_deferred
|
---|
748 | ifdef TEMPLATE_$($(target)_TEMPLATE)_$(prop)
|
---|
749 | ifndef $(target)_$(prop)
|
---|
750 | $(target)_$(prop) = $$(TEMPLATE_$($(target)_TEMPLATE)_$(prop))
|
---|
751 | #$ (warning dbgtarget: $(target)_$(prop):='$(value $(target)_$(prop))' TEMPLATE_$($(target)_TEMPLATE)_$(prop))
|
---|
752 | endif
|
---|
753 | endif
|
---|
754 | ifdef TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg)
|
---|
755 | ifndef $(target)_$(prop).$(bld_trg)
|
---|
756 | #$ (warning dbgsource: $(target)_$(prop).$(bld_trg)="TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg)" TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg))
|
---|
757 | $(target)_$(prop).$(bld_trg) = $$(TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg))
|
---|
758 | endif
|
---|
759 | endif
|
---|
760 | ifdef TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg).$(bld_trg_arch)
|
---|
761 | ifndef $(target)_$(prop).$(bld_trg).$(bld_trg_arch)
|
---|
762 | #$ (warning dbgsource: $(target)_$(prop).$(bld_trg).$(bld_trg_arch)="TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg).$(bld_trg_arch)" TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg).$(bld_trg_arch))
|
---|
763 | $(target)_$(prop).$(bld_trg).$(bld_trg_arch) = $$(TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg).$(bld_trg_arch))
|
---|
764 | endif
|
---|
765 | endif
|
---|
766 | ifdef TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg_arch)
|
---|
767 | ifndef $(target)_$(prop).$(bld_trg_arch)
|
---|
768 | #$ (warning dbgsource: $(target)_$(prop).$(bld_trg_arch)="TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg_arch)" TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg_arch))
|
---|
769 | $(target)_$(prop).$(bld_trg_arch) = $$(TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg_arch))
|
---|
770 | endif
|
---|
771 | endif
|
---|
772 | ifdef TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg_cpu)
|
---|
773 | ifndef $(target)_$(prop).$(bld_trg_cpu)
|
---|
774 | #$ (warning dbgsource: $(target)_$(prop).$(bld_trg_cpu)="TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg_cpu)" TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg_cpu))
|
---|
775 | $(target)_$(prop).$(bld_trg_cpu) = $$(TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg_cpu))
|
---|
776 | endif
|
---|
777 | endif
|
---|
778 | endef
|
---|
779 |
|
---|
780 | ## Inherit one acculumlative template property where the 'most significant' items are at the left end.
|
---|
781 | # @param $(prop) Property name
|
---|
782 | # @param $(target) Target name
|
---|
783 | define def_inherit_template_one_accumulate_l
|
---|
784 | ifdef TEMPLATE_$($(target)_TEMPLATE)_$(prop)
|
---|
785 | #$ (warning dbgtype: TEMPLATE_$($(target)_TEMPLATE)_$(prop) $(target)_$(prop)=$($(target)_$(prop)) $(TEMPLATE_$($(target)_TEMPLATE)_$(prop)))
|
---|
786 | $(target)_$(prop) += $$(TEMPLATE_$($(target)_TEMPLATE)_$(prop))
|
---|
787 | #$ (warning dbgtype: $(target)_$(prop)=$($(target)_$(prop)))
|
---|
788 | endif
|
---|
789 | ifdef TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(BUILD_TYPE)
|
---|
790 | #$ (warning dbg4: TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(BUILD_TYPE))
|
---|
791 | $(target)_$(prop).$(BUILD_TYPE) += $$(TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(BUILD_TYPE))
|
---|
792 | endif
|
---|
793 | ifdef TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg)
|
---|
794 | #$ (warning dbg5: TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg))
|
---|
795 | $(target)_$(prop).$(bld_trg) += $$(TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg))
|
---|
796 | endif
|
---|
797 | ifdef TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg).$(bld_trg_arch)
|
---|
798 | #$ (warning dbg4: TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg).$(bld_trg_arch))
|
---|
799 | $(target)_$(prop).$(bld_trg).$(bld_trg_arch) += $$(TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg).$(bld_trg_arch))
|
---|
800 | endif
|
---|
801 | ifdef TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg_cpu)
|
---|
802 | #$ (warning dbg5: TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg_cpu))
|
---|
803 | $(target)_$(prop).$(bld_trg_cpu) += $$(TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg_cpu))
|
---|
804 | endif
|
---|
805 | ifdef TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg_arch)
|
---|
806 | #$ (warning dbg6: TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg_arch))
|
---|
807 | $(target)_$(prop).$(bld_trg_arch) += $$(TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg_arch))
|
---|
808 | endif
|
---|
809 | endef
|
---|
810 |
|
---|
811 | ## Inherit one acculumlative template property where the 'most significant' items are at the right end.
|
---|
812 | # @param $(prop) Property name
|
---|
813 | # @param $(target) Target name
|
---|
814 | define def_inherit_template_one_accumulate_r
|
---|
815 | ifdef TEMPLATE_$($(target)_TEMPLATE)_$(prop)
|
---|
816 | #$ (warning dbgtype: TEMPLATE_$($(target)_TEMPLATE)_$(prop) $(target)_$(prop)=$($(target)_$(prop)) $(TEMPLATE_$($(target)_TEMPLATE)_$(prop)))
|
---|
817 | $(target)_$(prop) <=$$(TEMPLATE_$($(target)_TEMPLATE)_$(prop))
|
---|
818 | #$ (warning dbgtype: $(target)_$(prop)=$($(target)_$(prop)))
|
---|
819 | endif
|
---|
820 | ifdef TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(BUILD_TYPE)
|
---|
821 | #$ (warning dbg4: TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(BUILD_TYPE))
|
---|
822 | $(target)_$(prop).$(BUILD_TYPE) <=$$(TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(BUILD_TYPE))
|
---|
823 | endif
|
---|
824 | ifdef TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg)
|
---|
825 | #$ (warning dbg5: TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg))
|
---|
826 | $(target)_$(prop).$(bld_trg) <=$$(TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg))
|
---|
827 | endif
|
---|
828 | ifdef TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg).$(bld_trg_arch)
|
---|
829 | #$ (warning dbg4: TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg).$(bld_trg_arch))
|
---|
830 | $(target)_$(prop).$(bld_trg).$(bld_trg_arch) <=$$(TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg).$(bld_trg_arch))
|
---|
831 | endif
|
---|
832 | ifdef TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg_cpu)
|
---|
833 | #$ (warning dbg5: TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg_cpu))
|
---|
834 | $(target)_$(prop).$(bld_trg_cpu) <=$$(TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg_cpu))
|
---|
835 | endif
|
---|
836 | ifdef TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg_arch)
|
---|
837 | #$ (warning dbg6: TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg_arch))
|
---|
838 | $(target)_$(prop).$(bld_trg_arch) <=$$(TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg_arch))
|
---|
839 | endif
|
---|
840 | endef
|
---|
841 |
|
---|
842 |
|
---|
843 | ## Inherit template properties for on target.
|
---|
844 | # @param $(target) Target name.
|
---|
845 | define def_inherit_template
|
---|
846 | # sanity check.
|
---|
847 | ifdef _$(target)_ALREADY_PROCESSED
|
---|
848 | $(error kBuild: The target $(target) appears more than once in the target lists! Please correct the makefile(s))
|
---|
849 | endif
|
---|
850 | _$(target)_ALREADY_PROCESSED := 1
|
---|
851 |
|
---|
852 | # Inherit any default template.
|
---|
853 | ifdef TEMPLATE
|
---|
854 | ifeq ($($(target)_TEMPLATE),)
|
---|
855 | $(eval $(target)_TEMPLATE:=$(TEMPLATE))
|
---|
856 | endif
|
---|
857 | endif
|
---|
858 | # Expand the template if specified.
|
---|
859 | ifneq ($($(target)_TEMPLATE),)
|
---|
860 | $(foreach prop,$(PROPS_SINGLE),$(eval $(value def_inherit_template_one)))
|
---|
861 | $(foreach prop,$(PROPS_DEFERRED),$(eval $(def_inherit_template_one_deferred))) # exploits the 2 evaluation, so no value!
|
---|
862 | $(foreach prop,$(PROPS_ACCUMULATE_L),$(eval $(def_inherit_template_one_accumulate_l))) # += works fine without value
|
---|
863 | $(foreach prop,$(PROPS_ACCUMULATE_R),$(eval $(def_inherit_template_one_accumulate_r))) # use <= (kmk addition)
|
---|
864 | endif
|
---|
865 | endef
|
---|
866 |
|
---|
867 | # Inherit template properties
|
---|
868 | bld_trg := $(BUILD_TARGET)
|
---|
869 | bld_trg_arch := $(BUILD_TARGET_ARCH)
|
---|
870 | bld_trg_cpu := $(BUILD_TARGET_CPU)
|
---|
871 | $(foreach target, $(_ALL_BUILD_TARGET_TARGETS),$(eval $(value def_inherit_template)))
|
---|
872 |
|
---|
873 | bld_trg := $(BUILD_PLATFORM)
|
---|
874 | bld_trg_arch := $(BUILD_PLATFORM_ARCH)
|
---|
875 | bld_trg_cpu := $(BUILD_PLATFORM_CPU)
|
---|
876 | $(foreach target, $(_ALL_BUILD_PLATFORM_TARGETS),$(eval $(value def_inherit_template)))
|
---|
877 |
|
---|
878 | ifdef KBUILD_PROFILE_SELF
|
---|
879 | _KBUILD_TS_NOW := $(nanots )
|
---|
880 | $(info prof: $(int-sub $(_KBUILD_TS_NOW), $(_KBUILD_TS_HEADER_START)) - $(int-sub $(_KBUILD_TS_NOW), $(_KBUILD_TS_PREV)) - done common inheritance)
|
---|
881 | _KBUILD_TS_PREV := $(_KBUILD_TS_NOW)
|
---|
882 | endif
|
---|
883 |
|
---|
884 |
|
---|
885 | #
|
---|
886 | # Include tools & sdks
|
---|
887 | #
|
---|
888 | # The first part of this exercise is to figure out which TOOLS and SDKS
|
---|
889 | # that should be included.
|
---|
890 | #
|
---|
891 | _TOOLS := $(TOOL.$(BUILD_TARGET)) $(TOOL.$(BUILD_TARGET_ARCH)) $(TOOL.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)) \
|
---|
892 | $(TOOL.$(BUILD_PLATFORM)) $(TOOL.$(BUILD_PLATFORM_ARCH)) $(TOOL.$(BUILD_PLATFORM).$(BUILD_PLATFORM_ARCH)) \
|
---|
893 | $(TOOL)
|
---|
894 | _SDKS := $(SDKS.$(BUILD_TARGET)) $(SDKS.$(BUILD_TARGET_ARCH)) $(SDKS.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)) \
|
---|
895 | $(SDKS.$(BUILD_PLATFORM)) $(SDKS.$(BUILD_PLATFORM_ARCH)) $(SDKS.$(BUILD_PLATFORM).$(BUILD_PLATFORM_ARCH)) \
|
---|
896 | $(SDKS.$(BUILD_TYPE)) \
|
---|
897 | $(SDKS)
|
---|
898 | define def_tools_sdks_target_source
|
---|
899 | $(eval _TOOLS += $(foreach prop, $(PROPS_TOOLS), \
|
---|
900 | $($(source)_$(prop).$(_bld_trg)) \
|
---|
901 | $($(target)_$(source)_$(prop).$(_bld_trg)) \
|
---|
902 | $($(source)_$(prop).$(_bld_trg).$(_bld_trg_arch)) \
|
---|
903 | $($(target)_$(source)_$(prop).$(_bld_trg).$(_bld_trg_arch)) \
|
---|
904 | $($(source)_$(prop).$(_bld_trg_arch)) \
|
---|
905 | $($(target)_$(source)_$(prop).$(_bld_trg_arch)) \
|
---|
906 | $($(source)_$(prop)) \
|
---|
907 | $($(target)_$(source)_$(prop))))
|
---|
908 | $(eval _SDKS += \
|
---|
909 | $($(source)_SDKS.$(_bld_trg)) \
|
---|
910 | $($(target)_$(source)_SDKS.$(_bld_trg)) \
|
---|
911 | $($(source)_SDKS.$(_bld_trg).$(_bld_trg_arch)) \
|
---|
912 | $($(target)_$(source)_SDKS.$(_bld_trg).$(_bld_trg_arch)) \
|
---|
913 | $($(source)_SDKS.$(_bld_trg_arch)) \
|
---|
914 | $($(target)_$(source)_SDKS.$(_bld_trg_arch)) \
|
---|
915 | $($(source)_SDKS.$(BUILD_TYPE)) \
|
---|
916 | $($(target)_$(source)_SDKS.$(BUILD_TYPE)) \
|
---|
917 | $($(source)_SDKS) \
|
---|
918 | $($(target)_$(source)_SDKS))
|
---|
919 | endef # def_tools_sdks_target_source
|
---|
920 |
|
---|
921 | define def_tools_sdks_target
|
---|
922 | _bld_type := $(firstword $($(target)_BLD_TYPE) $(BUILD_TYPE))
|
---|
923 | _bld_trg := $(firstword $($(target)_BLD_TRG) $(bld_trg))
|
---|
924 | _bld_trg_arch := $(firstword $($(target)_BLD_TRG_ARCH) $(bld_trg_arch))
|
---|
925 | _bld_trg_cpu := $(firstword $($(target)_BLD_TRG_CPU) $(bld_trg_cpu))
|
---|
926 |
|
---|
927 | $(eval _TOOLS += $(foreach prop, $(PROPS_TOOLS), \
|
---|
928 | $($(target)_$(prop).$(_bld_trg)) \
|
---|
929 | $($(target)_$(prop).$(_bld_trg_arch)) \
|
---|
930 | $($(target)_$(prop).$(_bld_trg).$(_bld_trg_arch)) \
|
---|
931 | $($(target)_$(prop))))
|
---|
932 | $(eval _SDKS += \
|
---|
933 | $($(target)_SDKS.$(_bld_trg)) \
|
---|
934 | $($(target)_SDKS.$(_bld_trg_arch)) \
|
---|
935 | $($(target)_SDKS.$(_bld_trg).$(_bld_trg_arch)) \
|
---|
936 | $($(target)_SDKS))
|
---|
937 | $(foreach source, \
|
---|
938 | $($(target)_SOURCES.$(_bld_trg)) \
|
---|
939 | $($(target)_SOURCES.$(_bld_trg_arch)) \
|
---|
940 | $($(target)_SOURCES.$(_bld_trg).$(_bld_trg_arch)) \
|
---|
941 | $($(target)_SOURCES.$(_bld_trg_cpu)) \
|
---|
942 | $($(target)_SOURCES.$(_bld_type)) \
|
---|
943 | $($(target)_SOURCES) \
|
---|
944 | , $(eval $(value def_tools_sdks_target_source)))
|
---|
945 | endef # def_tools_sdks_target
|
---|
946 |
|
---|
947 | define def_tools_srcname_target
|
---|
948 | _bld_type := $(firstword $($(target)_BLD_TYPE) $(BUILD_TYPE))
|
---|
949 | _bld_trg := $(firstword $($(target)_BLD_TRG) $(bld_trg))
|
---|
950 | _bld_trg_arch := $(firstword $($(target)_BLD_TRG_ARCH) $(bld_trg_arch))
|
---|
951 | _bld_trg_cpu := $(firstword $($(target)_BLD_TRG_CPU) $(bld_trg_cpu))
|
---|
952 |
|
---|
953 | $(foreach source, $(notdir\
|
---|
954 | $($(target)_SOURCES.$(_bld_trg)) \
|
---|
955 | $($(target)_SOURCES.$(_bld_trg_arch)) \
|
---|
956 | $($(target)_SOURCES.$(_bld_trg).$(_bld_trg_arch)) \
|
---|
957 | $($(target)_SOURCES.$(_bld_trg_cpu)) \
|
---|
958 | $($(target)_SOURCES.$(_bld_type)) \
|
---|
959 | $($(target)_SOURCES) \
|
---|
960 | ), $(eval $(value def_tools_sdks_target_source)))
|
---|
961 | endef # def_tools_srcname_target
|
---|
962 |
|
---|
963 | bld_trg := $(BUILD_TARGET)
|
---|
964 | bld_trg_arch := $(BUILD_TARGET_ARCH)
|
---|
965 | bld_trg_cpu := $(BUILD_TARGET_CPU)
|
---|
966 | $(foreach target, $(_ALL_BUILD_TARGET_TARGETS), $(eval $(value def_tools_sdks_target)))
|
---|
967 | $(foreach target, $(_ALL_SRCNAME_TARGETS), $(eval $(value def_tools_srcname_target)))
|
---|
968 |
|
---|
969 | bld_trg := $(BUILD_PLATFORM)
|
---|
970 | bld_trg_arch := $(BUILD_PLATFORM_ARCH)
|
---|
971 | bld_trg_cpu := $(BUILD_PLATFORM_CPU)
|
---|
972 | $(foreach target, $(_ALL_BUILD_PLATFORM_TARGETS), $(eval $(value def_tools_sdks_target)))
|
---|
973 |
|
---|
974 |
|
---|
975 | # include TOOLS
|
---|
976 | define def_tools_include
|
---|
977 | ifndef TOOL_$(tool)
|
---|
978 | TOOL_$(tool)_KMK_FILE := $(firstword $(foreach path, $(TOOL_PATHS) $(PATH_KBUILD)/tools, $(wildcard $(path)/$(tool).kmk)))
|
---|
979 | ifeq ($(TOOL_$(tool)_KMK_FILE),)
|
---|
980 | $(error kBuild: Cannot find include file for the tool '$(tool)'! Searched: $(TOOL_PATHS) $(PATH_KBUILD)/tools)
|
---|
981 | endif
|
---|
982 | include $(TOOL_$(tool)_KMK_FILE)
|
---|
983 | ifndef TOOL_$(tool)
|
---|
984 | $(warning kBuild: TOOL_$(tool) was not by $(TOOL_$(tool)_KMK_FILE)!)
|
---|
985 | endif
|
---|
986 | endif
|
---|
987 | endef # def_tools_include
|
---|
988 |
|
---|
989 | _TOOLS := $(sort $(_TOOLS))
|
---|
990 | $(foreach tool, $(_TOOLS), $(eval $(value def_tools_include)))
|
---|
991 |
|
---|
992 | ## @todo TOOL_X_EXTENDS
|
---|
993 |
|
---|
994 |
|
---|
995 | # include SDKS
|
---|
996 | define def_sdks_include_one
|
---|
997 | ifndef SDK_$(sdk)
|
---|
998 | SDK_$(sdk)_KMK_FILE := $(firstword $(foreach path, $(SDK_PATHS) $(PATH_KBUILD)/sdks, $(wildcard $(path)/$(sdk).kmk)))
|
---|
999 | ifeq ($(SDK_$(sdk)_KMK_FILE),)
|
---|
1000 | $(error kBuild: Cannot find include file for the SDK '$(sdk)'! Searched: $(SDK_PATHS) $(PATH_KBUILD)/sdks)
|
---|
1001 | endif
|
---|
1002 | include $(SDK_$(sdk)_KMK_FILE)
|
---|
1003 | ifndef SDK_$(sdk)
|
---|
1004 | $(warning kBuild: SDK_$(sdk) was not defined by $(SDK_$(sdk)_KMK_FILE)!)
|
---|
1005 | endif
|
---|
1006 | endif
|
---|
1007 | endef # def_sdks_include_one
|
---|
1008 |
|
---|
1009 | _SDKS := $(sort $(_SDKS))
|
---|
1010 | $(foreach sdk, $(_SDKS), $(eval $(value def_sdks_include_one)))
|
---|
1011 |
|
---|
1012 | ## @todo Execute SDKS and TOOL inhertiance.
|
---|
1013 |
|
---|
1014 | ifdef KBUILD_PROFILE_SELF
|
---|
1015 | _KBUILD_TS_NOW := $(nanots )
|
---|
1016 | $(info prof: $(int-sub $(_KBUILD_TS_NOW), $(_KBUILD_TS_HEADER_START)) - $(int-sub $(_KBUILD_TS_NOW), $(_KBUILD_TS_PREV)) - done tools and sdks)
|
---|
1017 | _KBUILD_TS_PREV := $(_KBUILD_TS_NOW)
|
---|
1018 | endif
|
---|
1019 |
|
---|
1020 | ## @todo SDK_X_EXTENDS
|
---|
1021 |
|
---|
1022 | #
|
---|
1023 | #
|
---|
1024 | # Target lists - Pass 1
|
---|
1025 | #
|
---|
1026 | # This pass is for defining variables that might be referenced in
|
---|
1027 | # properties of other targets.
|
---|
1028 | #
|
---|
1029 | #
|
---|
1030 |
|
---|
1031 | # Don't do anything for fetch targets (yet).
|
---|
1032 |
|
---|
1033 | ##
|
---|
1034 | # Link prolog for Pass 1.
|
---|
1035 | #
|
---|
1036 | # @param $(target) Normalized target name.
|
---|
1037 | # @param $(EXT) EXE,DLL,SYS,LIB.
|
---|
1038 | # @param $(EXTPRE) HOST or nothing.
|
---|
1039 | # @param $(definst) The default _INST value.
|
---|
1040 | # @param $(tool_prefix) LD or AR.
|
---|
1041 | # @param $(bld_trg_base_var) TARGET or PLATFORM.
|
---|
1042 | define def_pass1_link_common
|
---|
1043 |
|
---|
1044 | bld_type := $(firstword $($(target)_BLD_TYPE) $(BUILD_TYPE))
|
---|
1045 | bld_trg := $(firstword $($(target)_BLD_TRG) $(BUILD_$(bld_trg_base_var)))
|
---|
1046 | bld_trg_arch:= $(firstword $($(target)_BLD_TRG_ARCH) $(BUILD_$(bld_trg_base_var)_ARCH))
|
---|
1047 | bld_trg_cpu := $(firstword $($(target)_BLD_TRG_CPU) $(BUILD_$(bld_trg_base_var)_CPU))
|
---|
1048 |
|
---|
1049 | tool := $(call _TARGET_TOOL,$(target),$(tool_prefix))
|
---|
1050 | name := $(firstword\
|
---|
1051 | $($(target)_NAME.$(bld_trg).$(bld_trg_arch))\
|
---|
1052 | $($(target)_NAME.$(bld_trg_arch))\
|
---|
1053 | $($(target)_NAME.$(bld_trg))\
|
---|
1054 | $($(target)_NAME.$(bld_type))\
|
---|
1055 | $($(target)_NAME)\
|
---|
1056 | $(target))
|
---|
1057 | outbase := $(call TARGET_BASE,$(name),$(target))
|
---|
1058 | ifndef PATH_$(target)
|
---|
1059 | PATH_$(target) := $(patsubst %/,%,$(dir $(outbase)))
|
---|
1060 | else ifneq ($(PATH_$(target)),$(patsubst %/,%,$(dir $(outbase))))
|
---|
1061 | $(error kBuild internal error: PATH_$(target)=$(PATH_$(target)) expected $(patsubst %/,%,$(dir $(outbase))))
|
---|
1062 | endif
|
---|
1063 | ifeq ($(tool_prefix),AR) ## @todo fix this mess!
|
---|
1064 | suff := $(firstword\
|
---|
1065 | $($(target)_$(EXT)SUFF.$(bld_trg).$(bld_trg_arch))\
|
---|
1066 | $($(target)_$(EXT)SUFF.$(bld_trg))\
|
---|
1067 | $($(target)_$(EXT)SUFF)\
|
---|
1068 | $(TOOL_$(tool)_$(tool_prefix)$(EXT)SUFF.$(bld_trg).$(bld_trg_arch))\
|
---|
1069 | $(TOOL_$(tool)_$(tool_prefix)$(EXT)SUFF.$(bld_trg))\
|
---|
1070 | $(TOOL_$(tool)_$(tool_prefix)$(EXT)SUFF)\
|
---|
1071 | $(SUFF_LIB))
|
---|
1072 | else
|
---|
1073 | suff := $(firstword \
|
---|
1074 | $($(target)_$(EXT)SUFF) \
|
---|
1075 | $($(target)_$(EXT)SUFF) \
|
---|
1076 | $(TOOL_$(tool)_$(tool_prefix)$(EXT)SUFF) \
|
---|
1077 | $($(EXTPRE)SUFF_$(EXT)))
|
---|
1078 | endif
|
---|
1079 | out := $(outbase)$(suff)
|
---|
1080 |
|
---|
1081 | # TARGET_*
|
---|
1082 | TARGET_$(target) := $(out)
|
---|
1083 |
|
---|
1084 | # INSTARGET_*
|
---|
1085 | ifndef $(target)_NOINST
|
---|
1086 | INSTARGET_$(target) := $(patsubst %/,%/$(notdir $(out)), \
|
---|
1087 | $(if $($(target)_INST), $(addprefix $(PATH_INS)/,$($(target)_INST)), $(definst)/))
|
---|
1088 |
|
---|
1089 | else # NOINST
|
---|
1090 | INSTARGET_$(target) :=
|
---|
1091 | endif # NOINST
|
---|
1092 |
|
---|
1093 | endef
|
---|
1094 |
|
---|
1095 |
|
---|
1096 | #
|
---|
1097 | # BLDPROGS (Pass 1)
|
---|
1098 | #
|
---|
1099 | define def_pass1_bldprog
|
---|
1100 | # set NOINST if not forced installation before doing the usual stuff.
|
---|
1101 | ifndef $(target)_INST
|
---|
1102 | $(target)_NOINST := 1
|
---|
1103 | endif
|
---|
1104 | $(eval $(value def_pass1_link_common))
|
---|
1105 | endef
|
---|
1106 |
|
---|
1107 | EXT := EXE
|
---|
1108 | EXTPRE := HOST
|
---|
1109 | definst := $(PATH_BIN)
|
---|
1110 | tool_prefix := LD
|
---|
1111 | bld_trg_base_var := PLATFORM
|
---|
1112 | $(foreach target, $(BLDPROGS) $(BLDPROGS.$(BUILD_PLATFORM)) $(BLDPROGS.$(BUILD_PLATFORM).$(BUILD_PLATFORM_ARCH)), \
|
---|
1113 | $(eval $(value def_pass1_bldprog)))
|
---|
1114 |
|
---|
1115 |
|
---|
1116 | #
|
---|
1117 | # LIBRARIES (Pass 1)
|
---|
1118 | #
|
---|
1119 | EXT := LIB
|
---|
1120 | EXTPRE :=
|
---|
1121 | definst := $(PATH_LIB)
|
---|
1122 | tool_prefix := AR
|
---|
1123 | bld_trg_base_var := TARGET
|
---|
1124 | $(foreach target, $(LIBRARIES) $(LIBRARIES.$(BUILD_TARGET)) $(LIBRARIES.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)), \
|
---|
1125 | $(eval $(value def_pass1_link_common)))
|
---|
1126 |
|
---|
1127 |
|
---|
1128 | #
|
---|
1129 | # DLLS (Pass 1)
|
---|
1130 | #
|
---|
1131 | EXT := DLL
|
---|
1132 | EXTPRE :=
|
---|
1133 | definst := $(PATH_DLL)
|
---|
1134 | tool_prefix := LD
|
---|
1135 | bld_trg_base_var := TARGET
|
---|
1136 | $(foreach target, $(DLLS) $(DLLS.$(BUILD_TARGET)) $(DLLS.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)), \
|
---|
1137 | $(eval $(value def_pass1_link_common)))
|
---|
1138 |
|
---|
1139 |
|
---|
1140 | #
|
---|
1141 | # IMPORT LIBRARIES (Pass 1)
|
---|
1142 | #
|
---|
1143 | # - On OS/2 and windows these are libraries.
|
---|
1144 | # - On other platforms they are fake DLLs.
|
---|
1145 | #
|
---|
1146 | if1of ($(BUILD_TARGET), nt os2 win win64 win32)
|
---|
1147 | EXT := LIB
|
---|
1148 | EXTPRE :=
|
---|
1149 | definst := $(PATH_LIB)
|
---|
1150 | tool_prefix := AR
|
---|
1151 | bld_trg_base_var := TARGET
|
---|
1152 | $(foreach target, $(IMPORT_LIBS) $(IMPORT_LIBS.$(BUILD_TARGET)) $(IMPORT_LIBS.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)), \
|
---|
1153 | $(eval $(value def_pass1_link_common)))
|
---|
1154 | else
|
---|
1155 | EXT := DLL
|
---|
1156 | EXTPRE :=
|
---|
1157 | definst := $(PATH_DLL)
|
---|
1158 | tool_prefix := LD
|
---|
1159 | bld_trg_base_var := TARGET
|
---|
1160 | $(foreach target, $(IMPORT_LIBS) $(IMPORT_LIBS.$(BUILD_TARGET)) $(IMPORT_LIBS.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)), \
|
---|
1161 | $(eval $(value def_pass1_link_common)))
|
---|
1162 | endif
|
---|
1163 |
|
---|
1164 |
|
---|
1165 | #
|
---|
1166 | # PROGRAMS (Pass 1)
|
---|
1167 | #
|
---|
1168 | EXT := EXE
|
---|
1169 | EXTPRE :=
|
---|
1170 | definst := $(PATH_BIN)
|
---|
1171 | tool_prefix := LD
|
---|
1172 | bld_trg_base_var := TARGET
|
---|
1173 | $(foreach target, $(PROGRAMS) $(PROGRAMS.$(BUILD_TARGET)) $(PROGRAMS.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)), \
|
---|
1174 | $(eval $(value def_pass1_link_common)))
|
---|
1175 |
|
---|
1176 |
|
---|
1177 | #
|
---|
1178 | # SYSMODS (Pass 1)
|
---|
1179 | #
|
---|
1180 | EXT := SYS
|
---|
1181 | EXTPRE :=
|
---|
1182 | definst := $(PATH_SYS)
|
---|
1183 | tool_prefix := LD
|
---|
1184 | bld_trg_base_var := TARGET
|
---|
1185 | $(foreach target, $(SYSMODS) $(SYSMODS.$(BUILD_TARGET)) $(SYSMODS.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)), \
|
---|
1186 | $(eval $(value def_pass1_link_common)))
|
---|
1187 |
|
---|
1188 |
|
---|
1189 | #
|
---|
1190 | # INSTALLS (Pass 1)
|
---|
1191 | # Note! INSTARGET_* for INSTALLS aren't available until later.
|
---|
1192 | #
|
---|
1193 | define def_pass1_install
|
---|
1194 | bld_type := $(firstword $($(target)_BLD_TYPE) $(BUILD_TYPE))
|
---|
1195 | bld_trg := $(firstword $($(target)_BLD_TRG) $(BUILD_TARGET))
|
---|
1196 | bld_trg_arch:= $(firstword $($(target)_BLD_TRG_ARCH) $(BUILD_TARGET_ARCH))
|
---|
1197 | bld_trg_cpu := $(firstword $($(target)_BLD_TRG_CPU) $(BUILD_TARGET_CPU))
|
---|
1198 | # TARGET_*
|
---|
1199 | TARGET_$(target) := $(PATH_TARGET)/$(target).ins
|
---|
1200 | # INSTARGET_ later.
|
---|
1201 | endef
|
---|
1202 | $(foreach target, $(INSTALLS) $(INSTALLS.$(BUILD_TARGET)) $(INSTALLS.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)), \
|
---|
1203 | $(eval $(value def_pass1_install)))
|
---|
1204 |
|
---|
1205 | ifdef KBUILD_PROFILE_SELF
|
---|
1206 | _KBUILD_TS_NOW := $(nanots )
|
---|
1207 | $(info prof: $(int-sub $(_KBUILD_TS_NOW), $(_KBUILD_TS_HEADER_START)) - $(int-sub $(_KBUILD_TS_NOW), $(_KBUILD_TS_PREV)) - done pass 1)
|
---|
1208 | _KBUILD_TS_PREV := $(_KBUILD_TS_NOW)
|
---|
1209 | endif
|
---|
1210 |
|
---|
1211 |
|
---|
1212 |
|
---|
1213 |
|
---|
1214 | #
|
---|
1215 | #
|
---|
1216 | # Target lists - Pass 2
|
---|
1217 | #
|
---|
1218 | #
|
---|
1219 |
|
---|
1220 |
|
---|
1221 | ## @page pg_fetches Fetching Tools, Sources and Similar.
|
---|
1222 | #
|
---|
1223 | # The targets listed in the the FETCHES target list have the following attributes:
|
---|
1224 | # SOURCES
|
---|
1225 | # INST
|
---|
1226 | # FETCHTOOL
|
---|
1227 | # FETCHFLAGS
|
---|
1228 | # FETCHDIR
|
---|
1229 | # UNPACKTOOL
|
---|
1230 | # UNPACKFLAGS
|
---|
1231 | #
|
---|
1232 | # As usual the target name is an alias for 'creating' the target. Other
|
---|
1233 | # aliases are:
|
---|
1234 | # pass_fetches
|
---|
1235 | # fetch
|
---|
1236 | # unfetch
|
---|
1237 | # download
|
---|
1238 | # unpack
|
---|
1239 | #
|
---|
1240 | # @remark
|
---|
1241 | #
|
---|
1242 | # This is a little bit complex because we must guarantee that if a source file
|
---|
1243 | # changes only sligtly we must refetch it and to a proper unpacking of it. It
|
---|
1244 | # is also a desire that fetched archives and unpacked files can be deleted to
|
---|
1245 | # save space.
|
---|
1246 | #
|
---|
1247 | # Thus, we must be able to cleanup what we've unpacked should any of the
|
---|
1248 | # sources be removed. We do this by maintaining a file listing the files
|
---|
1249 | # and directories that was unpacked. This operation is named 'unfetch'.
|
---|
1250 | #
|
---|
1251 | # We make use of the SIZE and MD5 attributes for each of the sources to
|
---|
1252 | # create a digest that is stored in the primary target file. Subsequent
|
---|
1253 | # runswill compare their digest with it to decide if a refetch is required.
|
---|
1254 | # When a refetch is found necessary, an 'unfetch' is performed first to
|
---|
1255 | # clean out old files and directores. Note even changes in source order
|
---|
1256 | # will cause a refetch due to the way the digest is constructed and
|
---|
1257 | # evaluated.
|
---|
1258 | #
|
---|
1259 | # By not depending directly on the archives (nor on any unpacked files)
|
---|
1260 | # but on a goal made up from the archive name, size and md5, we allow
|
---|
1261 | # the user to delete the archives. Naturally, this means we'll have to
|
---|
1262 | # check and fetch missing archives before attempting to unpack them.
|
---|
1263 | #
|
---|
1264 | # @remark
|
---|
1265 | #
|
---|
1266 | # This feature will *NOT* work correctly with vanilla GNU make becuase
|
---|
1267 | # it makes use of includedep to avoid too many unnecessary files.
|
---|
1268 | #
|
---|
1269 | # @todo
|
---|
1270 | # 1. Download corruption / continuation.
|
---|
1271 | # 2. It's quite possible that there is one too many indirect dependency now...
|
---|
1272 | #
|
---|
1273 |
|
---|
1274 | ## generates the fetch rule
|
---|
1275 | define def_fetch_src_fetch_rule
|
---|
1276 | # Indirect goal for downloading something.
|
---|
1277 | .PRECIOUS: $(out)
|
---|
1278 | $(out) + $($(target)_$(srcname)_FETCH_OUTPUT_) +| $($(target)_$(srcname)_FETCH_OUTPUT_MAYBE_) : \
|
---|
1279 | | $($(target)_$(srcname)_FETCH_DEPORD_)
|
---|
1280 | $$(call MSG_FETCH_DL,$(target),$(source),$(out))
|
---|
1281 | @## @todo do fancy stuff like download continuation.
|
---|
1282 | $$(QUIET)$$(RM) -f $(out)
|
---|
1283 | $($(target)_$(srcname)_FETCH_CMDS_)
|
---|
1284 | $$(QUIET)$(if $(md5),$$(MD5SUM_EXT) -b -C $(md5) $(out))
|
---|
1285 |
|
---|
1286 |
|
---|
1287 |
|
---|
1288 | # Intermediate goal for making sure the md5 and size matches. it will (re) fetch the archive if necessary.
|
---|
1289 | $(out).checked_$(md5)_$(size): $($(target)_$(srcname)_FETCH_DEPEND_) | $($(target)_$(srcname)_FETCH_DEPORD_)
|
---|
1290 | $$(call MSG_FETCH_CHK,$(target),$(source),$(out))
|
---|
1291 | $$(QUIET)$$(RM) -f $$@
|
---|
1292 | @# (re)fetch the file if it doesn't exist or if it doesn't matches the md5.
|
---|
1293 | @## @todo do fancy stuff like download continuation.
|
---|
1294 | $$(QUIET)( test -f $(out) && $(if $(md5),$$(MD5SUM_EXT) -b -C $(md5) $(out), true) ) \
|
---|
1295 | || ( $$(RM_EXT) -f $(out) \
|
---|
1296 | && $$(MAKE) $(out) -f $(MAKEFILE) --no-print-directory )
|
---|
1297 | $$(QUIET2)$$(APPEND) $$@
|
---|
1298 |
|
---|
1299 | _TARGET_$(target)_FETCHED += $(out) $(out).checked_$(md5)_$(size)
|
---|
1300 |
|
---|
1301 | # Just a little precaution.
|
---|
1302 | .NOTPARALLEL: $(out) $(out).checked_$(md5)_$(size)
|
---|
1303 |
|
---|
1304 | endef
|
---|
1305 |
|
---|
1306 | ## generates the unpack rule
|
---|
1307 | define def_fetch_src_unpack_rule
|
---|
1308 | # This is the unpack rule. it has an order-only dependency on the download check.
|
---|
1309 | $(out) + $($(target)_$(srcname)_UNPACK_OUTPUT_) +| $($(target)_$(srcname)_UNPACK_OUTPUT_MAYBE_) : \
|
---|
1310 | $($(target)_$(srcname)_UNPACK_DEPEND_) \
|
---|
1311 | | $($(target)_$(srcname)_UNPACK_DEPORD_) $(archive).checked_$(md5)_$(size)
|
---|
1312 | $$(call MSG_FETCH_UP,$(target),$(archive),$(inst))
|
---|
1313 | $$(QUIET)$$(RM) -f $(out)
|
---|
1314 | @# if the source archive doesn't exist fetch it (can have been deleted to save space).
|
---|
1315 | $$(QUIET)test -f $(archive) \
|
---|
1316 | || ( $$(RM_EXT) -f $(archive).checked_$(md5)_$(size) \
|
---|
1317 | && $$(MAKE) $(archive).checked_$(md5)_$(size) -f $(MAKEFILE) --no-print-directory )
|
---|
1318 | $($(target)_$(srcname)_UNPACK_CMDS_)
|
---|
1319 | $$(QUIET2)$$(APPEND) $(out) $(notdir $(archive).checked_$(md5)_$(size))
|
---|
1320 | $$(QUIET2)$$(APPEND) $(out) $(notdir $(out))
|
---|
1321 |
|
---|
1322 | $(eval _TARGET_$(target)_UNPACKED += $(out))
|
---|
1323 | _TARGET_$(target)_DIGEST := $(_TARGET_$(target)_DIGEST)-$(srcname)_$(md5)_$(size)
|
---|
1324 |
|
---|
1325 | .NOTPARALLEL: $(out)
|
---|
1326 |
|
---|
1327 | endef
|
---|
1328 |
|
---|
1329 | ## Processes a fetch source
|
---|
1330 | #
|
---|
1331 | define def_fetch_src
|
---|
1332 | #$ (warning dbg: def_fetch_src: source='$(source)' target='$(target)')
|
---|
1333 |
|
---|
1334 | # common
|
---|
1335 | srcname := $(notdir $(source))
|
---|
1336 | inst := $(firstword \
|
---|
1337 | $($(target)_$(source)_INST)\
|
---|
1338 | $($(target)_$(srcname)_INST)\
|
---|
1339 | $($(source)_INST)\
|
---|
1340 | $($(srcname)_INST)\
|
---|
1341 | $($(target)_INST)\
|
---|
1342 | )
|
---|
1343 | ifneq ($(patsubst %/,ok,$(inst)),ok)
|
---|
1344 | $(error kBuild: Bad or missing INST property for source '$(source)' in target '$(target)': $(inst))
|
---|
1345 | endif
|
---|
1346 | INSTARGET_$(target)_$(srcname) := $(inst)
|
---|
1347 | fetchdir := $(firstword \
|
---|
1348 | $($(target)_$(source)_FETCHDIR)\
|
---|
1349 | $($(target)_$(srcname)_FETCHDIR)\
|
---|
1350 | $($(source)_FETCHDIR)\
|
---|
1351 | $($(srcname)_FETCHDIR)\
|
---|
1352 | $($(target)_FETCHDIR)\
|
---|
1353 | $(FETCHDIR)\
|
---|
1354 | $(PATH_TARGET)\
|
---|
1355 | )
|
---|
1356 | deps := \
|
---|
1357 | $($(target)_$(source)_DEPS)\
|
---|
1358 | $($(target)_$(srcname)_DEPS)\
|
---|
1359 | $($(source)_DEPS)\
|
---|
1360 | $($(srcname)_DEPS)\
|
---|
1361 | $($(target)_DEPS)
|
---|
1362 | orderdeps := \
|
---|
1363 | $($(target)_$(source)_ORDERDEPS)\
|
---|
1364 | $($(target)_$(srcname)_ORDERDEPS)\
|
---|
1365 | $($(source)_ORDERDEPS)\
|
---|
1366 | $($(srcname)_ORDERDEPS)\
|
---|
1367 | $($(target)_ORDERDEPS)
|
---|
1368 | md5 := $(firstword \
|
---|
1369 | $($(target)_$(source)_MD5)\
|
---|
1370 | $($(target)_$(srcname)_MD5)\
|
---|
1371 | $($(source)_MD5)\
|
---|
1372 | $($(srcname)_MD5)\
|
---|
1373 | $($(target)_MD5)\
|
---|
1374 | )
|
---|
1375 | size := $(firstword \
|
---|
1376 | $($(target)_$(source)_SIZE)\
|
---|
1377 | $($(target)_$(srcname)_SIZE)\
|
---|
1378 | $($(source)_SIZE)\
|
---|
1379 | $($(srcname)_SIZE)\
|
---|
1380 | $($(target)_SIZE)\
|
---|
1381 | )
|
---|
1382 | dep := # not legal for fetch and unpack tools
|
---|
1383 |
|
---|
1384 |
|
---|
1385 | #
|
---|
1386 | # The fetching.
|
---|
1387 | #
|
---|
1388 | out := $(fetchdir)/$(srcname)
|
---|
1389 | archive := $(out)
|
---|
1390 | TARGET_$(target)_$(srcname) := $(out)
|
---|
1391 | dirdep := $(call DIRDEP,$(fetchdir))
|
---|
1392 | tool := $(firstword \
|
---|
1393 | $($(target)_$(source)_FETCHTOOL)\
|
---|
1394 | $($(target)_$(srcname)_FETCHTOOL)\
|
---|
1395 | $($(target)_$(source)_TOOL)\
|
---|
1396 | $($(target)_$(srcname)_TOOL)\
|
---|
1397 | $($(source)_FETCHTOOL)\
|
---|
1398 | $($(srcname)_FETCHTOOL)\
|
---|
1399 | $($(source)_TOOL)\
|
---|
1400 | $($(srcname)_TOOL)\
|
---|
1401 | $($(target)_FETCHTOOL)\
|
---|
1402 | $($(target)_TOOL)\
|
---|
1403 | )
|
---|
1404 | flags :=\
|
---|
1405 | $(TOOL_$(tool)_FETCHFLAGS)\
|
---|
1406 | $(FETCHFLAGS)\
|
---|
1407 | $($(target)_FETCHFLAGS)\
|
---|
1408 | $($(srcname)_FETCHFLAGS)\
|
---|
1409 | $($(source)_FETCHFLAGS)\
|
---|
1410 | $($(target)_$(srcname)_FETCHFLAGS)\
|
---|
1411 | $($(target)_$(source)_FETCHFLAGS)
|
---|
1412 |
|
---|
1413 | #$ (warning dbg: target=$(target) source=$(source) $(srcname)=$(srcname) tool=$(tool) out=$(out) flags=$(flags) dirdep=$(dirdep) fetchdir=$(fetchdir) md5=$(md5) size=$(size))
|
---|
1414 |
|
---|
1415 | ifndef TOOL_$(tool)_FETCH_CMDS
|
---|
1416 | $(warning kBuild: tools: \
|
---|
1417 | 1 $($(target)_$(source)_FETCHTOOL)\
|
---|
1418 | 2 $($(target)_$(srcname)_FETCHTOOL)\
|
---|
1419 | 3 $($(target)_$(source)_TOOL)\
|
---|
1420 | 4 $($(target)_$(srcname)_TOOL)\
|
---|
1421 | 5 $($(source)_FETCHTOOL)\
|
---|
1422 | 6 $($(srcname)_FETCHTOOL)\
|
---|
1423 | 7 $($(source)_TOOL)\
|
---|
1424 | 8 $($(srcname)_TOOL)\
|
---|
1425 | 9 $($(target)_FETCHTOOL)\
|
---|
1426 | 10 $($(target)_TOOL) )
|
---|
1427 | $(error kBuild: TOOL_$(tool)_FETCH_CMDS is not defined. source=$(source) target=$(target) )
|
---|
1428 | endif
|
---|
1429 |
|
---|
1430 | # call the tool
|
---|
1431 | $(target)_$(srcname)_FETCH_CMDS_ := $(TOOL_$(tool)_FETCH_CMDS)
|
---|
1432 | $(target)_$(srcname)_FETCH_OUTPUT_ := $(TOOL_$(tool)_FETCH_OUTPUT)
|
---|
1433 | $(target)_$(srcname)_FETCH_OUTPUT_MAYBE_ := $(TOOL_$(tool)_FETCH_OUTPUT_MAYBE)
|
---|
1434 | $(target)_$(srcname)_FETCH_DEPEND_ := $(TOOL_$(tool)_FETCH_DEPEND) $(deps)
|
---|
1435 | $(target)_$(srcname)_FETCH_DEPORD_ := $(TOOL_$(tool)_FETCH_DEPORD) $(dirdep) $(orderdeps)
|
---|
1436 |
|
---|
1437 | # generate the fetch rule.
|
---|
1438 | $(eval $(def_fetch_src_fetch_rule))
|
---|
1439 |
|
---|
1440 |
|
---|
1441 | #
|
---|
1442 | # The unpacking / installing.
|
---|
1443 | #
|
---|
1444 | out := $(inst)_kBuild_$(target)_$(srcname)_unpacked.lst
|
---|
1445 | dirdep := $(call DIRDEP,$(inst))
|
---|
1446 | tool := $(firstword \
|
---|
1447 | $($(target)_$(source)_UNPACKTOOL)\
|
---|
1448 | $($(target)_$(srcname)_UNPACKTOOL)\
|
---|
1449 | $($(target)_$(source)_TOOL)\
|
---|
1450 | $($(target)_$(srcname)_TOOL)\
|
---|
1451 | $($(source)_UNPACKTOOL)\
|
---|
1452 | $($(srcname)_UNPACKTOOL)\
|
---|
1453 | $($(source)_TOOL)\
|
---|
1454 | $($(srcname)_TOOL)\
|
---|
1455 | $($(target)_UNPACKTOOL)\
|
---|
1456 | $($(target)_TOOL) \
|
---|
1457 | )
|
---|
1458 | ifeq ($(tool),)
|
---|
1459 | tool := $(toupper $(subst .,,$(suffix $(subst tar.,TAR,$(srcname)))))
|
---|
1460 | $(eval $(value def_tools_include))
|
---|
1461 | endif
|
---|
1462 | flags :=\
|
---|
1463 | $(TOOL_$(tool)_UNPACKFLAGS)\
|
---|
1464 | $(UNPACKFLAGS)\
|
---|
1465 | $($(target)_UNPACKFLAGS)\
|
---|
1466 | $($(srcname)_UNPACKFLAGS)\
|
---|
1467 | $($(source)_UNPACKFLAGS)\
|
---|
1468 | $($(target)_$(srcname)_UNPACKFLAGS)\
|
---|
1469 | $($(target)_$(source)_UNPACKFLAGS)
|
---|
1470 |
|
---|
1471 | #$ (warning dbg: target=$(target) source=$(source) $(srcname)=$(srcname) tool=$(tool) out=$(out) flags=$(flags) dirdep=$(dirdep) inst=$(inst) md5=$(md5) size=$(size))
|
---|
1472 | ifndef TOOL_$(tool)_UNPACK_CMDS
|
---|
1473 | $(warning kBuild: tools: \
|
---|
1474 | 1 $($(target)_$(source)_UNPACKTOOL)\
|
---|
1475 | 2 $($(target)_$(srcname)_UNPACKTOOL)\
|
---|
1476 | 3 $($(target)_$(source)_TOOL)\
|
---|
1477 | 4 $($(target)_$(srcname)_TOOL)\
|
---|
1478 | 5 $($(source)_UNPACKTOOL)\
|
---|
1479 | 6 $($(srcname)_UNPACKTOOL)\
|
---|
1480 | 7 $($(source)_TOOL)\
|
---|
1481 | 8 $($(srcname)_TOOL)\
|
---|
1482 | 9 $($(target)_UNPACKTOOL)\
|
---|
1483 | 10 $($(target)_TOOL) \
|
---|
1484 | 11 $(toupper $(subst tar.,TAR,$(ext $(srcname)))) \
|
---|
1485 | )
|
---|
1486 | $(error kBuild: TOOL_$(tool)_UNPACK_CMDS is not defined. source=$(source) target=$(target) )
|
---|
1487 | endif
|
---|
1488 |
|
---|
1489 | # call the tool
|
---|
1490 | $(target)_$(srcname)_UNPACK_CMDS_ := $(TOOL_$(tool)_UNPACK_CMDS)
|
---|
1491 | $(target)_$(srcname)_UNPACK_OUTPUT_ := $(TOOL_$(tool)_UNPACK_OUTPUT)
|
---|
1492 | $(target)_$(srcname)_UNPACK_OUTPUT_MAYBE_ := $(TOOL_$(tool)_UNPACK_OUTPUT_MAYBE)
|
---|
1493 | $(target)_$(srcname)_UNPACK_DEPEND_ := $(TOOL_$(tool)_UNPACK_DEPEND) $(deps)
|
---|
1494 | $(target)_$(srcname)_UNPACK_DEPORD_ := $(TOOL_$(tool)_UNPACK_DEPORD) $(dirdep) $(orderdeps)
|
---|
1495 |
|
---|
1496 | # generate the fetch rule.
|
---|
1497 | $(eval $(def_fetch_src_unpack_rule))
|
---|
1498 |
|
---|
1499 | _DIRS += $(inst) $(fetchdir)
|
---|
1500 |
|
---|
1501 | endef
|
---|
1502 |
|
---|
1503 |
|
---|
1504 | ##
|
---|
1505 | # Define the target level rules for a fetch.
|
---|
1506 | # @param target
|
---|
1507 | # @param out
|
---|
1508 | # @param inst
|
---|
1509 | # @param _TARGET_$(target)_UNPACKED
|
---|
1510 | # @param _TARGET_$(target)_DIGEST
|
---|
1511 | # @param bld_trg
|
---|
1512 | # @param bld_trg_arch
|
---|
1513 | define def_fetch_rules
|
---|
1514 |
|
---|
1515 | $(out).lst: $(_TARGET_$(target)_UNPACKED) | $(call DIRDEP,$(inst))
|
---|
1516 | $$(call MSG_FETCH_OK,$(target))
|
---|
1517 | $$(QUIET)$$(RM) -f $$@ $$@.tmp
|
---|
1518 | $$(QUIET2)$$(APPEND) $$@.tmp '$(notdir $(out))'
|
---|
1519 | $$(QUIET)$(if $(_TARGET_$(target)_UNPACKED),$$(CAT_EXT) $(_TARGET_$(target)_UNPACKED) >> $$@.tmp)
|
---|
1520 | $$(QUIET)$$(MV) -f $$@.tmp $$@
|
---|
1521 |
|
---|
1522 | $(out)_unfetched:
|
---|
1523 | $$(call MSG_UNFETCH,$(target))
|
---|
1524 | $$(QUIET)$$(RM) -f $$(addprefix $(inst),$$(shell $$(CAT_EXT) $(out).lst 2> /dev/null | $$(SED) -e '/\/$$$$/d'))
|
---|
1525 | $$(QUIET)$$(RMDIR) -p --ignore-fail-on-non-empty --ignore-fail-on-not-exist $$(dir $$@) \
|
---|
1526 | $$(addprefix $(inst),$$(sort $$(dir $$(shell $$(CAT_EXT) $(out).lst 2> /dev/null))))
|
---|
1527 | $$(QUIET)$$(RM) -f $(out).lst $(out)
|
---|
1528 | $$(QUIET)$$(RMDIR) -p --ignore-fail-on-non-empty --ignore-fail-on-not-exist $$(dir $$@)
|
---|
1529 |
|
---|
1530 | $(out): $(comp-vars _TARGET_$(target)_DIGEST_PREV,_TARGET_$(target)_DIGEST,FORCE) | $(call DIRDEP,$(inst))
|
---|
1531 | $$(QUIET)$$(RM) -f $$@
|
---|
1532 | $$(if $$(_TARGET_$(target)_DIGEST),$$(if $$(wildcard $(out).lst)\
|
---|
1533 | ,$$(call MSG_REFETCH,$(target)),$$(call MSG_FETCH,$(target))),$$(call MSG_UNFETCH,$(target)))
|
---|
1534 | $$(QUIET)$$(if $$(wildcard $(out).lst ),$$(MAKE) -f $(MAKEFILE) --no-print-directory $(out)_unfetched)
|
---|
1535 | $$(QUIET)$$(if $$(_TARGET_$(target)_DIGEST),$$(MAKE) -f $(MAKEFILE) --no-print-directory $(out).lst,$$(RMDIR) -p --ignore-fail-on-non-empty --ignore-fail-on-not-exist $$(dir $$@))
|
---|
1536 | $$(QUIET2)$$(if $$(_TARGET_$(target)_DIGEST),$$(APPEND) $$@ "_TARGET_$(target)_DIGEST_PREV := $(_TARGET_$(target)_DIGEST)")
|
---|
1537 |
|
---|
1538 | .NOTPARALLEL: $(out).lst $(out)_unfetched $(out)
|
---|
1539 |
|
---|
1540 | endef
|
---|
1541 |
|
---|
1542 |
|
---|
1543 | ##
|
---|
1544 | # Deal with one fetch target.
|
---|
1545 | # @param target
|
---|
1546 | # @param bld_trg
|
---|
1547 | # @param bld_trg_arch
|
---|
1548 | define def_fetch
|
---|
1549 | # common
|
---|
1550 | INSTARGET_$(target) := $($(target)_INST)
|
---|
1551 | ifneq ($(patsubst %/,ok,$(INSTARGET_$(target))),ok)
|
---|
1552 | $(error kBuild: Bad or missing INST property for target '$(target)'. \
|
---|
1553 | $(target)_INST='$($(target)_INST)' ($(origin $(target)_INST)))
|
---|
1554 | endif
|
---|
1555 | _TARGET_$(target)_FETCHED :=
|
---|
1556 | _TARGET_$(target)_UNPACKED :=
|
---|
1557 | _TARGET_$(target)_DIGEST :=
|
---|
1558 |
|
---|
1559 | # The 'sources'.
|
---|
1560 | #$ (warning dbg fetch: target=$(target) sources=$($(target)_SOURCES) $($(target)_SOURCES.$(BUILD_TYPE)) $($(target)_SOURCES.$(BUILD_TARGET)) $($(target)_SOURCES.$(BUILD_TARGET_ARCH)) $($(target)_SOURCES.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)))
|
---|
1561 | $(foreach source,$($(target)_SOURCES) $($(target)_SOURCES.$(BUILD_TYPE)) $($(target)_SOURCES.$(BUILD_TARGET)) $($(target)_SOURCES.$(BUILD_TARGET_ARCH)) $($(target)_SOURCES.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)),\
|
---|
1562 | $(eval $(value def_fetch_src)))
|
---|
1563 |
|
---|
1564 | # The target.
|
---|
1565 | inst := $(INSTARGET_$(target))
|
---|
1566 | out := $(inst)_kBuild_fetch_$(target)
|
---|
1567 |
|
---|
1568 | $(eval includedep $(out))
|
---|
1569 |
|
---|
1570 | $(eval $(def_fetch_rules))
|
---|
1571 |
|
---|
1572 | # Define the aliases here (doesn't work if defined in def_fetch_rules, just like includedep).
|
---|
1573 | $(target): $(out)
|
---|
1574 | $(target)_unfetch: $(out)_unfetched
|
---|
1575 |
|
---|
1576 | _FETCHES += $(out)
|
---|
1577 | _DOWNLOADS += $(_TARGET_$(target)_FETCHED)
|
---|
1578 | _UNPACKS += $(_TARGET_$(target)_UNPACKED)
|
---|
1579 | _UNFETCHES += $(out)_unfetched
|
---|
1580 | _DIRS += $(inst)
|
---|
1581 |
|
---|
1582 | endef
|
---|
1583 |
|
---|
1584 | # Walk the FETCH target lists.
|
---|
1585 | bld_trg := $(BUILD_TARGET)
|
---|
1586 | bld_trg_arch := $(BUILD_TARGET_ARCH)
|
---|
1587 | $(foreach target, $(FETCHES) $(FETCHES.$(BUILD_TARGET)) $(FETCHES.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)), \
|
---|
1588 | $(eval $(value def_fetch)))
|
---|
1589 |
|
---|
1590 | # some aliases.
|
---|
1591 | download: $(_DOWNLOADS)
|
---|
1592 | unpack: $(_UNPACKS)
|
---|
1593 | fetch: $(_FETCHES)
|
---|
1594 | unfetch: $(_UNFETCHES)
|
---|
1595 |
|
---|
1596 | ifdef KBUILD_PROFILE_SELF
|
---|
1597 | _KBUILD_TS_NOW := $(nanots )
|
---|
1598 | $(info prof: $(int-sub $(_KBUILD_TS_NOW), $(_KBUILD_TS_HEADER_START)) - $(int-sub $(_KBUILD_TS_NOW), $(_KBUILD_TS_PREV)) - done fetching targets)
|
---|
1599 | _KBUILD_TS_PREV := $(_KBUILD_TS_NOW)
|
---|
1600 | endif
|
---|
1601 |
|
---|
1602 |
|
---|
1603 |
|
---|
1604 | ##
|
---|
1605 | ## Patching.
|
---|
1606 | ##
|
---|
1607 | ##
|
---|
1608 | #define def_patch_src
|
---|
1609 | #
|
---|
1610 | #endef
|
---|
1611 | #
|
---|
1612 | #
|
---|
1613 | ## Deal with one patch target.
|
---|
1614 | #define def_patch
|
---|
1615 | #
|
---|
1616 | #$(foreach source,$($(target)_SOURCES) $($(target)_SOURCES.$(BUILD_TYPE)) $($(target)_SOURCES.$(BUILD_TARGET)) $($(target)_SOURCES.$(BUILD_TARGET_ARCH)) $($(target)_SOURCES.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)),\
|
---|
1617 | # $(eval $(value def_patch_src)))
|
---|
1618 | #
|
---|
1619 | #_PATCHES +=
|
---|
1620 | #endef
|
---|
1621 | #
|
---|
1622 | #$(foreach target, $(PATCHES) $(PATCHES.$(BUILD_TARGET)) $(PATCHES.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)), \
|
---|
1623 | # $(eval $(value def_patch)))
|
---|
1624 | #
|
---|
1625 |
|
---|
1626 |
|
---|
1627 | #
|
---|
1628 | # Object processing.
|
---|
1629 | #
|
---|
1630 |
|
---|
1631 | ## wrapper the compile command dependency check.
|
---|
1632 | ifndef NO_COMPILE_CMDS_DEPS
|
---|
1633 | _DEP_COMPILE_CMDS = $(comp-cmds $(target)_$(source)_CMDS_PREV_,$(target)_$(source)_CMDS_,FORCE)
|
---|
1634 | else
|
---|
1635 | _DEP_COMPILE_CMDS =
|
---|
1636 | endif
|
---|
1637 |
|
---|
1638 | ## Generates the rules for building a specific object, and the aliases
|
---|
1639 | # for building a source file.
|
---|
1640 | # @param $(obj) The object file.
|
---|
1641 | define def_target_source_rule
|
---|
1642 |
|
---|
1643 | ifdef TOOL_$(tool)_COMPILE_$(type)_USES_KOBJCACHE
|
---|
1644 | $(outbase).koc +| $(obj) $($(target)_$(source)_OUTPUT_) $($(target)_$(source)_OUTPUT_MAYBE_) : \
|
---|
1645 | $($(target)_$(source)_DEPEND_) \
|
---|
1646 | $(_DEP_COMPILE_CMDS) \
|
---|
1647 | | \
|
---|
1648 | $($(target)_$(source)_DEPORD_)
|
---|
1649 | $$(call MSG_COMPILE,$(target),$(source),$$@,$(type))
|
---|
1650 | else
|
---|
1651 | $(obj) + $($(target)_$(source)_OUTPUT_) +| $($(target)_$(source)_OUTPUT_MAYBE_) : \
|
---|
1652 | $($(target)_$(source)_DEPEND_) \
|
---|
1653 | $(_DEP_COMPILE_CMDS) \
|
---|
1654 | | \
|
---|
1655 | $($(target)_$(source)_DEPORD_)
|
---|
1656 | $$(call MSG_COMPILE,$(target),$(source),$$@,$(type))
|
---|
1657 | ifdef TOOL_$(tool)_COMPILE_$(type)_DONT_PURGE_OUTPUT
|
---|
1658 | $$(QUIET)$$(RM) -f $(dep) $(obj) $($(target)_$(source)_OUTPUT_) $($(target)_OUTPUT_MAYBE_)
|
---|
1659 | endif
|
---|
1660 | endif
|
---|
1661 |
|
---|
1662 | $($(target)_$(source)_CMDS_)
|
---|
1663 |
|
---|
1664 | ifndef NO_COMPILE_CMDS_DEPS
|
---|
1665 | $$(QUIET2)$$(APPEND) '$(dep)'
|
---|
1666 | $$(QUIET2)$$(APPEND) '$(dep)' 'define $(target)_$(source)_CMDS_PREV_'
|
---|
1667 | $$(QUIET2)$$(APPEND) -v '$(dep)' '$(target)_$(source)_CMDS_'
|
---|
1668 | $$(QUIET2)$$(APPEND) '$(dep)' 'endef'
|
---|
1669 | endif
|
---|
1670 |
|
---|
1671 | $(basename $(notdir $(obj))).o: $(obj)
|
---|
1672 | $(basename $(notdir $(obj))).obj: $(obj)
|
---|
1673 | endef
|
---|
1674 |
|
---|
1675 |
|
---|
1676 | ## wrapper the link command dependency check.
|
---|
1677 | ifndef NO_COMPILE_CMDS_DEPS
|
---|
1678 | _DEP_LINK_CMDS = $(comp-cmds $(target)_CMDS_PREV_,$(target)_CMDS_,FORCE)
|
---|
1679 | else
|
---|
1680 | _DEP_LINK_CMDS =
|
---|
1681 | endif
|
---|
1682 |
|
---|
1683 | ## Generate the link rule for a target.
|
---|
1684 | # @param $(target) The normalized target name.
|
---|
1685 | # @param $(dirdep) Directories we depend upon begin created before linking.
|
---|
1686 | # @param $(dep) The name of the dependency file.
|
---|
1687 | # @param $(out)
|
---|
1688 | # @param $($(target)_OUTPUT_) Output files from the link.
|
---|
1689 | # @param $($(target)_OUTPUT_MAYBE_) Output files that the link may perhaps create.
|
---|
1690 | # @param $($(target)_DEPEND_) Dependencies.
|
---|
1691 | # @param $($(target)_DEPORD_) Dependencies which should only affect build order.
|
---|
1692 | # @param $($(target)_CMDS_) The link commands.
|
---|
1693 | # @param $($(target)_CMDS_PREV_) The link commands from the previous run.
|
---|
1694 | define def_link_rule
|
---|
1695 | $(out) + $($(target)_OUTPUT_) +| $($(target)_OUTPUT_MAYBE_) : \
|
---|
1696 | $($(target)_DEPEND_) \
|
---|
1697 | $(_DEP_LINK_CMDS) \
|
---|
1698 | | \
|
---|
1699 | $($(target)_DEPORD_)
|
---|
1700 | $$(call MSG_LINK,$(target),$$@,$(tool_do))
|
---|
1701 | $$(QUIET)$$(RM) -f $(dep) $(out) $($(target)_OUTPUT_) $($(target)_OUTPUT_MAYBE_)
|
---|
1702 |
|
---|
1703 | $($(target)_CMDS_)
|
---|
1704 |
|
---|
1705 | ifndef NO_LINK_CMDS_DEPS
|
---|
1706 | $$(QUIET2)$$(APPEND) '$(dep)' 'define $(target)_CMDS_PREV_'
|
---|
1707 | $$(QUIET2)$$(APPEND) -v '$(dep)' '$(target)_CMDS_'
|
---|
1708 | $$(QUIET2)$$(APPEND) '$(dep)' 'endef'
|
---|
1709 | endif
|
---|
1710 |
|
---|
1711 | $(basename $(notdir $(out))): $(out)
|
---|
1712 |
|
---|
1713 | endef
|
---|
1714 |
|
---|
1715 |
|
---|
1716 | ## Generate the link & lib install rule
|
---|
1717 | # @param $(target) Normalized target name.
|
---|
1718 | # @param $(out) The build target.
|
---|
1719 | # @param $(INSTARGET_$(target)) The installation targets.
|
---|
1720 | # @param $(mode) The file mode (optional)
|
---|
1721 | define def_link_install_rule
|
---|
1722 | $(INSTARGET_$(target)) : $(out) | $(call DIRDEP,$(dir $(INSTARGET_$(target))))
|
---|
1723 | $$(call MSG_INST_TRG,$(target),$(out),$$@)
|
---|
1724 | $$(QUIET)$$(INSTALL) $$(if $(mode),-m $(mode)) $(out) $$@
|
---|
1725 |
|
---|
1726 | ifdef KBUILD_DO_AUTO_INSTALL
|
---|
1727 | $(basename $(notdir $(out))): $(INSTARGET_$(target))
|
---|
1728 | endif
|
---|
1729 | endef
|
---|
1730 |
|
---|
1731 |
|
---|
1732 | ## Generic macro for processing C, C++ and Assembly sources.
|
---|
1733 | # @param $(target) Normalized target name.
|
---|
1734 | # @param $(source) Source file name.
|
---|
1735 | # @param $(type) Source type. {C,CXX,AS,OBJC}
|
---|
1736 | # @param bld_type Build type.
|
---|
1737 | # @param bld_trg Build target.
|
---|
1738 | # @param bld_trg_arch Build target arch.
|
---|
1739 | # @param bld_trg_cpu Build target cpu.
|
---|
1740 | def_target_source_c_cpp_objc_asm_rc_new = $(kb-src-one )
|
---|
1741 | ifdef KMK_VERSION
|
---|
1742 | def_target_source_c_cpp_objc_asm_rc_var = def_target_source_c_cpp_objc_asm_rc_new
|
---|
1743 | else
|
---|
1744 | def_target_source_c_cpp_objc_asm_rc_var = def_target_source_c_cpp_objc_asm_rc_old
|
---|
1745 | endif
|
---|
1746 |
|
---|
1747 | ## Generic macro for processing all target sources.
|
---|
1748 | # @param $(target) Normalized target name.
|
---|
1749 | # @param $(defpath)
|
---|
1750 | # @param much-more...
|
---|
1751 | define def_target_sources
|
---|
1752 | #$ (warning def_target_sources)
|
---|
1753 | # C sources
|
---|
1754 | type := C
|
---|
1755 | $(foreach source, $(filter %.c , $($(target)_SOURCES) $($(target)_SOURCES.$(bld_trg)) $($(target)_SOURCES.$(bld_trg).$(bld_trg_arch)) $($(target)_SOURCES.$(bld_trg_arch)) $($(target)_SOURCES.$(bld_trg_cpu)) $($(target)_SOURCES.$(bld_type)))\
|
---|
1756 | ,$(eval $(value $(def_target_source_c_cpp_objc_asm_rc_var))) )
|
---|
1757 |
|
---|
1758 | # C++ sources
|
---|
1759 | type := CXX
|
---|
1760 | $(foreach source, $(filter %.cpp %.cxx %.xx, $($(target)_SOURCES) $($(target)_SOURCES.$(bld_trg)) $($(target)_SOURCES.$(bld_trg).$(bld_trg_arch)) $($(target)_SOURCES.$(bld_trg_arch)) $($(target)_SOURCES.$(bld_trg_cpu)) $($(target)_SOURCES.$(bld_type)))\
|
---|
1761 | ,$(eval $(value $(def_target_source_c_cpp_objc_asm_rc_var))) )
|
---|
1762 |
|
---|
1763 | # Objective-C sources
|
---|
1764 | type := OBJC
|
---|
1765 | $(foreach source, $(filter %.m, $($(target)_SOURCES) $($(target)_SOURCES.$(bld_trg)) $($(target)_SOURCES.$(bld_trg).$(bld_trg_arch)) $($(target)_SOURCES.$(bld_trg_arch)) $($(target)_SOURCES.$(bld_trg_cpu)) $($(target)_SOURCES.$(bld_type)))\
|
---|
1766 | ,$(eval $(value $(def_target_source_c_cpp_objc_asm_rc_var))) )
|
---|
1767 |
|
---|
1768 | # ASM sources
|
---|
1769 | type := AS
|
---|
1770 | $(foreach source, $(filter %.asm %.s %.S , $($(target)_SOURCES) $($(target)_SOURCES.$(bld_trg)) $($(target)_SOURCES.$(bld_trg).$(bld_trg_arch)) $($(target)_SOURCES.$(bld_trg_arch)) $($(target)_SOURCES.$(bld_trg_cpu)) $($(target)_SOURCES.$(bld_type)))\
|
---|
1771 | ,$(eval $(value $(def_target_source_c_cpp_objc_asm_rc_var))) )
|
---|
1772 |
|
---|
1773 | # Resource sources
|
---|
1774 | type := RC
|
---|
1775 | $(foreach source, $(filter %.rc , $($(target)_SOURCES) $($(target)_SOURCES.$(bld_trg)) $($(target)_SOURCES.$(bld_trg).$(bld_trg_arch)) $($(target)_SOURCES.$(bld_trg_arch)) $($(target)_SOURCES.$(bld_trg_cpu)) $($(target)_SOURCES.$(bld_type)))\
|
---|
1776 | ,$(eval $(value $(def_target_source_c_cpp_objc_asm_rc_var))) )
|
---|
1777 |
|
---|
1778 | endef
|
---|
1779 |
|
---|
1780 |
|
---|
1781 |
|
---|
1782 | ## Generic macro for generating the install rule(s) for a target
|
---|
1783 | # and update the globals with default out.
|
---|
1784 | #
|
---|
1785 | # @param $(target) Normalized target name.
|
---|
1786 | # @param $(out) The output file.
|
---|
1787 | # @param $(definst) The default _INST value.
|
---|
1788 | # @param $(typevar) The name of the variable with all the root targets of its type.
|
---|
1789 | # @remark Only library uses this now.
|
---|
1790 | define def_target_install_pluss
|
---|
1791 | ifndef $(target)_NOINST
|
---|
1792 | INSTARGET_$(target) := $(patsubst %/,%/$(notdir $(out)), \
|
---|
1793 | $(if $($(target)_INST), $(addprefix $(PATH_INS)/,$($(target)_INST)), $(definst)/))
|
---|
1794 |
|
---|
1795 | $(eval $(def_link_install_rule))
|
---|
1796 |
|
---|
1797 | _INSTALLS_FILES += $(INSTARGET_$(target))
|
---|
1798 |
|
---|
1799 | ifdef KBUILD_DO_AUTO_INSTALL
|
---|
1800 | $(typevar) += $(INSTARGET_$(target))
|
---|
1801 | else
|
---|
1802 | $(typevar) += $(out)
|
---|
1803 | endif
|
---|
1804 | else # _NOINST
|
---|
1805 | $(typevar) += $(out)
|
---|
1806 | endif
|
---|
1807 |
|
---|
1808 | _OUT_FILES += $($(target)_OUTPUT_) $($(target)_OUTPUT_MAYBE_) $(out)
|
---|
1809 | _CLEAN_FILES += $($(target)_CLEAN) $($(target)_CLEAN.$(bld_trg)) $($(target)_CLEAN.$(bld_trg).$(bld_trg_arch)) $($(target)_CLEAN.$(bld_trg_arch)) $($(target)_CLEAN.$(bld_trg_cpu)) $($(target)_CLEAN.$(bld_type))
|
---|
1810 | _DIRS += $($(target)_BLDDIRS) $($(target)_BLDDIRS.$(bld_trg)) $($(target)_BLDDIRS.$(bld_trg).$(bld_trg_arch)) $($(target)_BLDDIRS.$(bld_trg_arch)) $($(target)_BLDDIRS.$(bld_trg_cpu)) $($(target)_BLDDIRS.$(bld_type))
|
---|
1811 | _OBJS += $($(target)_OBJS_)
|
---|
1812 |
|
---|
1813 | endef
|
---|
1814 |
|
---|
1815 |
|
---|
1816 |
|
---|
1817 | #
|
---|
1818 | # LIBRARIES
|
---|
1819 | #
|
---|
1820 |
|
---|
1821 | ## Library (one).
|
---|
1822 | # @param $(target) Normalized library (target) name.
|
---|
1823 | define def_lib
|
---|
1824 | # library basics
|
---|
1825 | ## @todo prefix
|
---|
1826 | bld_type := $(firstword $($(target)_BLD_TYPE) $(BUILD_TYPE))
|
---|
1827 | bld_trg := $(firstword $($(target)_BLD_TRG) $(BUILD_TARGET))
|
---|
1828 | bld_trg_arch:= $(firstword $($(target)_BLD_TRG_ARCH) $(BUILD_TARGET_ARCH))
|
---|
1829 | bld_trg_cpu := $(firstword $($(target)_BLD_TRG_CPU) $(BUILD_TARGET_CPU))
|
---|
1830 | tool := $(call _TARGET_TOOL,$(target),AR)
|
---|
1831 | ifeq ($(tool),)
|
---|
1832 | $(error kBuild: Library target $(target) does not have a tool defined!)
|
---|
1833 | endif
|
---|
1834 | name := $(firstword\
|
---|
1835 | $($(target)_NAME.$(bld_trg).$(bld_trg_arch))\
|
---|
1836 | $($(target)_NAME.$(bld_trg_arch))\
|
---|
1837 | $($(target)_NAME.$(bld_trg))\
|
---|
1838 | $($(target)_NAME.$(bld_type))\
|
---|
1839 | $($(target)_NAME)\
|
---|
1840 | $(target))
|
---|
1841 | outbase := $(call TARGET_BASE,$(name),$(target))
|
---|
1842 | ifndef PATH_$(target)
|
---|
1843 | PATH_$(target) := $(patsubst %/,%,$(dir $(outbase)))
|
---|
1844 | else
|
---|
1845 | ifneq ($(PATH_$(target)),$(patsubst %/,%,$(dir $(outbase))))
|
---|
1846 | $(error kBuild internal error: PATH_$(target)=$(PATH_$(target)) expected $(patsubst %/,%,$(dir $(outbase))))
|
---|
1847 | endif
|
---|
1848 | endif
|
---|
1849 | suff := $(firstword\
|
---|
1850 | $($(target)_LIBSUFF.$(bld_trg).$(bld_trg_arch))\
|
---|
1851 | $($(target)_LIBSUFF.$(bld_trg))\
|
---|
1852 | $($(target)_LIBSUFF)\
|
---|
1853 | $(TOOL_$(tool)_ARLIBSUFF.$(bld_trg).$(bld_trg_arch))\
|
---|
1854 | $(TOOL_$(tool)_ARLIBSUFF.$(bld_trg))\
|
---|
1855 | $(TOOL_$(tool)_ARLIBSUFF)\
|
---|
1856 | $(SUFF_LIB))
|
---|
1857 | out := $(outbase)$(suff)
|
---|
1858 | TARGET_$(target) := $(out)
|
---|
1859 | $(target)_OBJS_ :=
|
---|
1860 | defpath := $($(target)_PATH)
|
---|
1861 |
|
---|
1862 | # source -> object
|
---|
1863 | $(eval $(value def_target_sources))
|
---|
1864 |
|
---|
1865 | # library linking
|
---|
1866 | tool := $(call _TARGET_TOOL,$(target),AR)
|
---|
1867 | name := $(firstword\
|
---|
1868 | $($(target)_NAME.$(bld_trg).$(bld_trg_arch))\
|
---|
1869 | $($(target)_NAME.$(bld_trg_arch))\
|
---|
1870 | $($(target)_NAME.$(bld_trg))\
|
---|
1871 | $($(target)_NAME.$(bld_type))\
|
---|
1872 | $($(target)_NAME)\
|
---|
1873 | $(target))
|
---|
1874 | outbase := $(call TARGET_BASE,$(name),$(target))
|
---|
1875 | flags :=\
|
---|
1876 | $(TOOL_$(tool)_ARFLAGS)\
|
---|
1877 | $(TOOL_$(tool)_ARFLAGS.$(bld_type))\
|
---|
1878 | $(ARFLAGS)\
|
---|
1879 | $(ARFLAGS.$(bld_type))\
|
---|
1880 | $($(target)_ARFLAGS)\
|
---|
1881 | $($(target)_ARFLAGS.$(bld_type)) \
|
---|
1882 | $($(target)_ARFLAGS.$(bld_trg)) \
|
---|
1883 | $($(target)_ARFLAGS.$(bld_trg_arch)) \
|
---|
1884 | $($(target)_ARFLAGS.$(bld_trg).$(bld_trg_arch)) \
|
---|
1885 | $($(target)_ARFLAGS.$(bld_trg_cpu))
|
---|
1886 | othersrc := $(filter-out %.c %.cpp %.cxx %.cc %.m %.s %.S %.asm %.rc %.o %.obj %.res,\
|
---|
1887 | $($(target)_SOURCES) \
|
---|
1888 | $($(target)_SOURCES.$(bld_trg)) \
|
---|
1889 | $($(target)_SOURCES.$(bld_trg_arch)) \
|
---|
1890 | $($(target)_SOURCES.$(bld_trg).$(bld_trg_arch)) \
|
---|
1891 | $($(target)_SOURCES.$(bld_trg_cpu)) \
|
---|
1892 | $($(target)_SOURCES.$(bld_type)))
|
---|
1893 | objs = $(filter %.o %.obj %.res, \
|
---|
1894 | $($(target)_SOURCES) \
|
---|
1895 | $($(target)_SOURCES.$(bld_trg)) \
|
---|
1896 | $($(target)_SOURCES.$(bld_trg_arch)) \
|
---|
1897 | $($(target)_SOURCES.$(bld_trg).$(bld_trg_arch)) \
|
---|
1898 | $($(target)_SOURCES.$(bld_trg_cpu)) \
|
---|
1899 | $($(target)_SOURCES.$(bld_type))) \
|
---|
1900 | $($(target)_OBJS_)
|
---|
1901 | dirdep := $(call DIRDEP,$(dir $(out)))
|
---|
1902 | deps := $($(target)_DEPS)
|
---|
1903 | orderdeps := $($(target)_ORDERDEPS)
|
---|
1904 |
|
---|
1905 | # Adjust paths if we got a default path.
|
---|
1906 | ifneq ($(defpath),)
|
---|
1907 | objs := $(abspathex $(objs),$(defpath))
|
---|
1908 | deps := $(abspathex $(deps),$(defpath))
|
---|
1909 | orderdeps := $(abspathex $(orderdeps),$(defpath))
|
---|
1910 | othersrc := $(abspathex $(othersrc),$(defpath))
|
---|
1911 | endif
|
---|
1912 |
|
---|
1913 |
|
---|
1914 | # Custom pre-link actions.
|
---|
1915 | ifdef $(target)_PRE_CMDS.$(bld_trg).$(bld_trg_arch).$(bld_type)
|
---|
1916 | pre_cmds := $($(target)_PRE_CMDS.$(bld_trg).$(bld_trg_arch).$(bld_type))
|
---|
1917 | else ifdef $(target)_PRE_CMDS.$(bld_trg).$(bld_trg_arch)
|
---|
1918 | pre_cmds := $($(target)_PRE_CMDS.$(bld_trg).$(bld_trg_arch))
|
---|
1919 | else ifdef $(target)_PRE_CMDS.$(bld_trg).$(bld_type)
|
---|
1920 | pre_cmds := $($(target)_PRE_CMDS.$(bld_trg).$(bld_type))
|
---|
1921 | else ifdef $(target)_PRE_CMDS.$(bld_trg_arch)
|
---|
1922 | pre_cmds := $($(target)_PRE_CMDS.$(bld_trg_arch))
|
---|
1923 | else ifdef $(target)_PRE_CMDS.$(bld_trg)
|
---|
1924 | pre_cmds := $($(target)_PRE_CMDS.$(bld_trg))
|
---|
1925 | else ifdef $(target)_PRE_CMDS.$(bld_type)
|
---|
1926 | pre_cmds := $($(target)_PRE_CMDS.$(bld_type))
|
---|
1927 | else ifdef $(target)_PRE_CMDS
|
---|
1928 | pre_cmds := $($(target)_PRE_CMDS)
|
---|
1929 | else ifdef PRE_CMDS.$(bld_trg).$(bld_trg_arch).$(bld_type)
|
---|
1930 | pre_cmds := $(PRE_CMDS.$(bld_trg).$(bld_trg_arch).$(bld_type))
|
---|
1931 | else ifdef PRE_CMDS.$(bld_trg).$(bld_trg_arch)
|
---|
1932 | pre_cmds := $(PRE_CMDS.$(bld_trg).$(bld_trg_arch))
|
---|
1933 | else ifdef PRE_CMDS.$(bld_trg).$(bld_type)
|
---|
1934 | pre_cmds := $(PRE_CMDS.$(bld_trg).$(bld_type))
|
---|
1935 | else ifdef PRE_CMDS.$(bld_trg_arch)
|
---|
1936 | pre_cmds := $(PRE_CMDS.$(bld_trg_arch))
|
---|
1937 | else ifdef PRE_CMDS.$(bld_trg)
|
---|
1938 | pre_cmds := $(PRE_CMDS.$(bld_trg))
|
---|
1939 | else ifdef PRE_CMDS.$(bld_type)
|
---|
1940 | pre_cmds := $(PRE_CMDS.$(bld_type))
|
---|
1941 | else
|
---|
1942 | pre_cmds := $(PRE_CMDS)
|
---|
1943 | endif
|
---|
1944 |
|
---|
1945 | # Custom post-link actions.
|
---|
1946 | ifdef $(target)_POST_CMDS.$(bld_trg).$(bld_trg_arch).$(bld_type)
|
---|
1947 | post_cmds := $($(target)_POST_CMDS.$(bld_trg).$(bld_trg_arch).$(bld_type))
|
---|
1948 | else ifdef $(target)_POST_CMDS.$(bld_trg).$(bld_trg_arch)
|
---|
1949 | post_cmds := $($(target)_POST_CMDS.$(bld_trg).$(bld_trg_arch))
|
---|
1950 | else ifdef $(target)_POST_CMDS.$(bld_trg).$(bld_type)
|
---|
1951 | post_cmds := $($(target)_POST_CMDS.$(bld_trg).$(bld_type))
|
---|
1952 | else ifdef $(target)_POST_CMDS.$(bld_trg_arch)
|
---|
1953 | post_cmds := $($(target)_POST_CMDS.$(bld_trg_arch))
|
---|
1954 | else ifdef $(target)_POST_CMDS.$(bld_trg)
|
---|
1955 | post_cmds := $($(target)_POST_CMDS.$(bld_trg))
|
---|
1956 | else ifdef $(target)_POST_CMDS.$(bld_type)
|
---|
1957 | post_cmds := $($(target)_POST_CMDS.$(bld_type))
|
---|
1958 | else ifdef $(target)_POST_CMDS
|
---|
1959 | post_cmds := $($(target)_POST_CMDS)
|
---|
1960 | else ifdef POST_CMDS.$(bld_trg).$(bld_trg_arch).$(bld_type)
|
---|
1961 | post_cmds := $(POST_CMDS.$(bld_trg).$(bld_trg_arch).$(bld_type))
|
---|
1962 | else ifdef POST_CMDS.$(bld_trg).$(bld_trg_arch)
|
---|
1963 | post_cmds := $(POST_CMDS.$(bld_trg).$(bld_trg_arch))
|
---|
1964 | else ifdef POST_CMDS.$(bld_trg).$(bld_type)
|
---|
1965 | post_cmds := $(POST_CMDS.$(bld_trg).$(bld_type))
|
---|
1966 | else ifdef POST_CMDS.$(bld_trg_arch)
|
---|
1967 | post_cmds := $(POST_CMDS.$(bld_trg_arch))
|
---|
1968 | else ifdef POST_CMDS.$(bld_trg)
|
---|
1969 | post_cmds := $(POST_CMDS.$(bld_trg))
|
---|
1970 | else ifdef POST_CMDS.$(bld_type)
|
---|
1971 | post_cmds := $(POST_CMDS.$(bld_type))
|
---|
1972 | else
|
---|
1973 | post_cmds := $(POST_CMDS)
|
---|
1974 | endif
|
---|
1975 |
|
---|
1976 | # dependency file
|
---|
1977 | dep := $(out)$(SUFF_DEP)
|
---|
1978 | ifndef NO_LINK_CMDS_DEPS
|
---|
1979 | _DEPFILES_INCLUDED += $(dep)
|
---|
1980 | $(eval includedep $(dep))
|
---|
1981 | endif
|
---|
1982 |
|
---|
1983 | # check that the tool is defined.
|
---|
1984 | ifndef TOOL_$(tool)_LINK_LIBRARY_CMDS
|
---|
1985 | $(warning kBuild: tools: \
|
---|
1986 | 1 $($(target)_$(source)TOOL.$(bld_trg).$(bld_trg_arch)) \
|
---|
1987 | 2 $($(target)_$(source)TOOL.$(bld_trg)) \
|
---|
1988 | 3 $($(target)_$(source)TOOL) \
|
---|
1989 | 4 $($(target)_TOOL.$(bld_trg).$(bld_trg_arch)) \
|
---|
1990 | 5 $($(target)_TOOL.$(bld_trg)) \
|
---|
1991 | 6 $($(target)_TOOL) \
|
---|
1992 | 7 $($(source)TOOL) \
|
---|
1993 | 8 $($(source)TOOL.$(bld_trg).$(bld_trg_arch)) \
|
---|
1994 | 9 $($(source)TOOL.$(bld_trg)) \
|
---|
1995 | 10 $(TOOL.$(bld_trg).$(bld_trg_arch)) \
|
---|
1996 | 11 $(TOOL.$(bld_trg)) \
|
---|
1997 | 12 $(TOOL) )
|
---|
1998 | $(error kBuild: TOOL_$(tool)_LINK_LIBRARY_CMDS isn't defined! target=$(target) )
|
---|
1999 | endif
|
---|
2000 |
|
---|
2001 | # call the tool
|
---|
2002 | $(target)_CMDS_ := $(TOOL_$(tool)_LINK_LIBRARY_CMDS)
|
---|
2003 | ifneq ($(pre_cmds),)
|
---|
2004 | $(target)_CMDS_ := $(TAB)$(pre_cmds)$(NL)$(TAB)$($(target)_CMDS_)
|
---|
2005 | endif
|
---|
2006 | ifneq ($(post_cmds),)
|
---|
2007 | $(target)_CMDS_ := $($(target)_CMDS_)$(NL)$(TAB)$(post_cmds)
|
---|
2008 | endif
|
---|
2009 | $(target)_OUTPUT_ := $(TOOL_$(tool)_LINK_LIBRARY_OUTPUT)
|
---|
2010 | $(target)_OUTPUT_MAYBE_ := $(TOOL_$(tool)_LINK_LIBRARY_OUTPUT_MAYBE)
|
---|
2011 | $(target)_DEPEND_ := $(TOOL_$(tool)_LINK_LIBRARY_DEPEND) $(deps) $(objs)
|
---|
2012 | $(target)_DEPORD_ := $(TOOL_$(tool)_LINK_LIBRARY_DEPORD) $(dirdep) $(orderdeps)
|
---|
2013 |
|
---|
2014 | # generate the link rule.
|
---|
2015 | $(eval $(def_link_rule))
|
---|
2016 |
|
---|
2017 | # installing and globals
|
---|
2018 | $(eval $(value def_target_install_pluss))
|
---|
2019 | endef
|
---|
2020 |
|
---|
2021 | # Process libraries
|
---|
2022 | definst := $(PATH_LIB)
|
---|
2023 | typevar := _LIBS
|
---|
2024 | tool_do := LINK_LIBRARY
|
---|
2025 | mode := 0644
|
---|
2026 | $(foreach target, $(LIBRARIES) $(LIBRARIES.$(BUILD_TARGET)) $(LIBRARIES.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)), $(eval $(value def_lib)))
|
---|
2027 |
|
---|
2028 | ifdef KBUILD_PROFILE_SELF
|
---|
2029 | _KBUILD_TS_NOW := $(nanots )
|
---|
2030 | $(info prof: $(int-sub $(_KBUILD_TS_NOW), $(_KBUILD_TS_HEADER_START)) - $(int-sub $(_KBUILD_TS_NOW), $(_KBUILD_TS_PREV)) - done library targets)
|
---|
2031 | _KBUILD_TS_PREV := $(_KBUILD_TS_NOW)
|
---|
2032 | endif
|
---|
2033 |
|
---|
2034 |
|
---|
2035 | #
|
---|
2036 | # Link operations.
|
---|
2037 | #
|
---|
2038 |
|
---|
2039 | ##
|
---|
2040 | # Link prolog
|
---|
2041 | #
|
---|
2042 | # @param $(target) Normalized target name.
|
---|
2043 | # @param $(EXT) EXE,DLL,SYS.
|
---|
2044 | # @param $(definst) The default _INST value.
|
---|
2045 | # @param $(typevar) The name of the variable with all the root targets of its type.
|
---|
2046 | define def_link_common
|
---|
2047 | # basics
|
---|
2048 | bld_type := $(firstword $($(target)_BLD_TYPE) $(BUILD_TYPE))
|
---|
2049 | bld_trg := $(firstword $($(target)_BLD_TRG) $(BUILD_$(bld_trg_base_var)))
|
---|
2050 | bld_trg_arch:= $(firstword $($(target)_BLD_TRG_ARCH) $(BUILD_$(bld_trg_base_var)_ARCH))
|
---|
2051 | bld_trg_cpu := $(firstword $($(target)_BLD_TRG_CPU) $(BUILD_$(bld_trg_base_var)_CPU))
|
---|
2052 |
|
---|
2053 | tool := $(call _TARGET_TOOL,$(target),LD)
|
---|
2054 | name := $(firstword\
|
---|
2055 | $($(target)_NAME.$(bld_trg).$(bld_trg_arch))\
|
---|
2056 | $($(target)_NAME.$(bld_trg_arch))\
|
---|
2057 | $($(target)_NAME.$(bld_trg))\
|
---|
2058 | $($(target)_NAME.$(bld_type))\
|
---|
2059 | $($(target)_NAME)\
|
---|
2060 | $(target))
|
---|
2061 | outbase := $(call TARGET_BASE,$(name),$(target))
|
---|
2062 | ifndef PATH_$(target)
|
---|
2063 | PATH_$(target) := $(patsubst %/,%,$(dir $(outbase)))
|
---|
2064 | else
|
---|
2065 | ifneq ($(PATH_$(target)),$(patsubst %/,%,$(dir $(outbase))))
|
---|
2066 | $(error kBuild internal error: PATH_$(target)=$(PATH_$(target)) expected $(patsubst %/,%,$(dir $(outbase))))
|
---|
2067 | endif
|
---|
2068 | endif
|
---|
2069 | suff := $(firstword \
|
---|
2070 | $($(target)_$(EXT)SUFF) \
|
---|
2071 | $($(target)_$(EXT)SUFF) \
|
---|
2072 | $(TOOL_$(tool)_LD$(EXT)SUFF) \
|
---|
2073 | $($(EXTPRE)SUFF_$(EXT)))
|
---|
2074 | out := $(outbase)$(suff)
|
---|
2075 | TARGET_$(target) := $(out)
|
---|
2076 | $(target)_OBJS_ :=
|
---|
2077 | defpath := $($(target)_PATH)
|
---|
2078 |
|
---|
2079 | # source -> object
|
---|
2080 | $(eval $(value def_target_sources))
|
---|
2081 |
|
---|
2082 | # more link stuff.
|
---|
2083 | tool := $(call _TARGET_TOOL,$(target),LD)
|
---|
2084 | name := $(firstword\
|
---|
2085 | $($(target)_NAME.$(bld_trg).$(bld_trg_arch))\
|
---|
2086 | $($(target)_NAME.$(bld_trg_arch))\
|
---|
2087 | $($(target)_NAME.$(bld_trg))\
|
---|
2088 | $($(target)_NAME.$(bld_type))\
|
---|
2089 | $($(target)_NAME)\
|
---|
2090 | $(target))
|
---|
2091 | outbase := $(call TARGET_BASE,$(name),$(target))
|
---|
2092 | flags :=\
|
---|
2093 | $(TOOL_$(tool)_LDFLAGS)\
|
---|
2094 | $(TOOL_$(tool)_LDFLAGS.$(bld_type))\
|
---|
2095 | $(TOOL_$(tool)_LDFLAGS.$(bld_trg))\
|
---|
2096 | $(TOOL_$(tool)_LDFLAGS.$(bld_trg_arch))\
|
---|
2097 | $(TOOL_$(tool)_LDFLAGS.$(bld_trg).$(bld_trg_arch))\
|
---|
2098 | $(TOOL_$(tool)_LDFLAGS.$(bld_trg_cpu))\
|
---|
2099 | $(foreach sdk, $(SDKS) \
|
---|
2100 | $(SDKS.$(bld_type)) \
|
---|
2101 | $(SDKS.$(bld_trg)) \
|
---|
2102 | $(SDKS.$(bld_trg_arch)) \
|
---|
2103 | $(SDKS.$(bld_trg).$(bld_trg_arch)),\
|
---|
2104 | $(SDK_$(sdk)_LDFLAGS)\
|
---|
2105 | $(SDK_$(sdk)_LDFLAGS.$(bld_type))\
|
---|
2106 | $(SDK_$(sdk)_LDFLAGS.$(bld_trg))\
|
---|
2107 | $(SDK_$(sdk)_LDFLAGS.$(bld_trg_arch))\
|
---|
2108 | $(SDK_$(sdk)_LDFLAGS.$(bld_trg).$(bld_trg_arch))\
|
---|
2109 | $(SDK_$(sdk)_LDFLAGS.$(bld_trg_cpu)))\
|
---|
2110 | $(LDFLAGS)\
|
---|
2111 | $(LDFLAGS.$(bld_type))\
|
---|
2112 | $(LDFLAGS.$(bld_trg))\
|
---|
2113 | $(LDFLAGS.$(bld_trg_arch))\
|
---|
2114 | $(LDFLAGS.$(bld_trg).$(bld_trg_arch))\
|
---|
2115 | $(LDFLAGS.$(bld_trg_cpu))\
|
---|
2116 | $(foreach sdk, $($(target)_SDKS) \
|
---|
2117 | $($(target)_SDKS.$(bld_type)) \
|
---|
2118 | $($(target)_SDKS.$(bld_trg)) \
|
---|
2119 | $($(target)_SDKS.$(bld_trg_arch)) \
|
---|
2120 | $($(target)_SDKS.$(bld_trg).$(bld_trg_arch)),\
|
---|
2121 | $(SDK_$(sdk)_LDFLAGS)\
|
---|
2122 | $(SDK_$(sdk)_LDFLAGS.$(bld_type))\
|
---|
2123 | $(SDK_$(sdk)_LDFLAGS.$(bld_trg))\
|
---|
2124 | $(SDK_$(sdk)_LDFLAGS.$(bld_trg_arch))\
|
---|
2125 | $(SDK_$(sdk)_LDFLAGS.$(bld_trg).$(bld_trg_arch))\
|
---|
2126 | $(SDK_$(sdk)_LDFLAGS.$(bld_trg_cpu)))\
|
---|
2127 | $($(target)_LDFLAGS)\
|
---|
2128 | $($(target)_LDFLAGS.$(bld_type))\
|
---|
2129 | $($(target)_LDFLAGS.$(bld_trg))\
|
---|
2130 | $($(target)_LDFLAGS.$(bld_trg_arch))\
|
---|
2131 | $($(target)_LDFLAGS.$(bld_trg).$(bld_trg_arch))\
|
---|
2132 | $($(target)_LDFLAGS.$(bld_trg_cpu))
|
---|
2133 | othersrc := $(filter-out %.c %.cpp %.cxx %.cc %.m %.s %.S %.asm %.rc %.o %.obj %.res,\
|
---|
2134 | $($(target)_SOURCES)\
|
---|
2135 | $($(target)_SOURCES.$(bld_trg)) \
|
---|
2136 | $($(target)_SOURCES.$(bld_trg_arch)) \
|
---|
2137 | $($(target)_SOURCES.$(bld_trg).$(bld_trg_arch)) \
|
---|
2138 | $($(target)_SOURCES.$(bld_trg_cpu)) \
|
---|
2139 | $($(target)_SOURCES.$(bld_type)))
|
---|
2140 | objs = $(filter %.o %.obj %.res, \
|
---|
2141 | $($(target)_SOURCES) \
|
---|
2142 | $($(target)_SOURCES.$(bld_trg)) \
|
---|
2143 | $($(target)_SOURCES.$(bld_trg_arch)) \
|
---|
2144 | $($(target)_SOURCES.$(bld_trg).$(bld_trg_arch)) \
|
---|
2145 | $($(target)_SOURCES.$(bld_trg_cpu)) \
|
---|
2146 | $($(target)_SOURCES.$(bld_type))) \
|
---|
2147 | $($(target)_OBJS_)
|
---|
2148 | libs :=\
|
---|
2149 | $($(target)_LIBS.$(bld_trg_cpu))\
|
---|
2150 | $($(target)_LIBS.$(bld_trg).$(bld_trg_arch))\
|
---|
2151 | $($(target)_LIBS.$(bld_trg_arch))\
|
---|
2152 | $($(target)_LIBS.$(bld_trg))\
|
---|
2153 | $($(target)_LIBS.$(bld_type))\
|
---|
2154 | $($(target)_LIBS)\
|
---|
2155 | $(foreach sdk, $($(target)_SDKS.$(bld_trg).$(bld_trg_arch)) \
|
---|
2156 | $($(target)_SDKS.$(bld_trg_arch)) \
|
---|
2157 | $($(target)_SDKS.$(bld_trg)) \
|
---|
2158 | $($(target)_SDKS.$(bld_type)) \
|
---|
2159 | $($(target)_SDKS),\
|
---|
2160 | $(SDK_$(sdk)_LIBS.$(bld_trg_cpu))\
|
---|
2161 | $(SDK_$(sdk)_LIBS.$(bld_trg).$(bld_trg_arch))\
|
---|
2162 | $(SDK_$(sdk)_LIBS.$(bld_trg_arch))\
|
---|
2163 | $(SDK_$(sdk)_LIBS.$(bld_trg))\
|
---|
2164 | $(SDK_$(sdk)_LIBS.$(bld_type))\
|
---|
2165 | $(SDK_$(sdk)_LIBS))\
|
---|
2166 | $(LIBS.$(bld_trg_cpu))\
|
---|
2167 | $(LIBS.$(bld_trg).$(bld_trg_arch))\
|
---|
2168 | $(LIBS.$(bld_trg_arch))\
|
---|
2169 | $(LIBS.$(bld_trg))\
|
---|
2170 | $(LIBS.$(bld_type))\
|
---|
2171 | $(LIBS)\
|
---|
2172 | $(foreach sdk, $(SDKS.$(bld_trg).$(bld_trg_arch)) \
|
---|
2173 | $(SDKS.$(bld_trg_arch)) \
|
---|
2174 | $(SDKS.$(bld_trg)) \
|
---|
2175 | $(SDKS.$(bld_type)) \
|
---|
2176 | $(SDKS),\
|
---|
2177 | $(SDK_$(sdk)_LIBS.$(bld_trg_cpu))\
|
---|
2178 | $(SDK_$(sdk)_LIBS.$(bld_trg).$(bld_trg_arch))\
|
---|
2179 | $(SDK_$(sdk)_LIBS.$(bld_trg_arch))\
|
---|
2180 | $(SDK_$(sdk)_LIBS.$(bld_trg))\
|
---|
2181 | $(SDK_$(sdk)_LIBS.$(bld_type))\
|
---|
2182 | $(SDK_$(sdk)_LIBS))\
|
---|
2183 | $(TOOL_$(tool)_LIBS.$(bld_trg_cpu))\
|
---|
2184 | $(TOOL_$(tool)_LIBS.$(bld_trg).$(bld_trg_arch))\
|
---|
2185 | $(TOOL_$(tool)_LIBS.$(bld_trg_arch))\
|
---|
2186 | $(TOOL_$(tool)_LIBS.$(bld_trg))\
|
---|
2187 | $(TOOL_$(tool)_LIBS.$(bld_type))\
|
---|
2188 | $(TOOL_$(tool)_LIBS)
|
---|
2189 | libpath :=\
|
---|
2190 | $($(target)_LIBPATH.$(bld_trg_cpu))\
|
---|
2191 | $($(target)_LIBPATH.$(bld_trg).$(bld_trg_arch))\
|
---|
2192 | $($(target)_LIBPATH.$(bld_trg_arch))\
|
---|
2193 | $($(target)_LIBPATH.$(bld_trg))\
|
---|
2194 | $($(target)_LIBPATH.$(bld_type))\
|
---|
2195 | $($(target)_LIBPATH)\
|
---|
2196 | $(foreach sdk, $($(target)_SDKS.$(bld_trg).$(bld_trg_arch)) \
|
---|
2197 | $($(target)_SDKS.$(bld_trg_arch)) \
|
---|
2198 | $($(target)_SDKS.$(bld_trg)) \
|
---|
2199 | $($(target)_SDKS.$(bld_type)) \
|
---|
2200 | $($(target)_SDKS),\
|
---|
2201 | $(SDK_$(sdk)_LIBPATH.$(bld_trg_cpu))\
|
---|
2202 | $(SDK_$(sdk)_LIBPATH.$(bld_trg).$(bld_trg_arch))\
|
---|
2203 | $(SDK_$(sdk)_LIBPATH.$(bld_trg_arch))\
|
---|
2204 | $(SDK_$(sdk)_LIBPATH.$(bld_trg))\
|
---|
2205 | $(SDK_$(sdk)_LIBPATH.$(bld_type))\
|
---|
2206 | $(SDK_$(sdk)_LIBPATH))\
|
---|
2207 | $(LIBPATH.$(bld_trg_cpu))\
|
---|
2208 | $(LIBPATH.$(bld_trg).$(bld_trg_arch))\
|
---|
2209 | $(LIBPATH.$(bld_trg_arch))\
|
---|
2210 | $(LIBPATH.$(bld_trg))\
|
---|
2211 | $(LIBPATH.$(bld_type))\
|
---|
2212 | $(LIBPATH)\
|
---|
2213 | $(foreach sdk, $(SDKS.$(bld_trg).$(bld_trg_arch)) \
|
---|
2214 | $(SDKS.$(bld_trg_arch)) \
|
---|
2215 | $(SDKS.$(bld_trg)) \
|
---|
2216 | $(SDKS.$(bld_type)) \
|
---|
2217 | $(SDKS),\
|
---|
2218 | $(SDK_$(sdk)_LIBPATH.$(bld_trg_cpu))\
|
---|
2219 | $(SDK_$(sdk)_LIBPATH.$(bld_trg).$(bld_trg_arch))\
|
---|
2220 | $(SDK_$(sdk)_LIBPATH.$(bld_trg_arch))\
|
---|
2221 | $(SDK_$(sdk)_LIBPATH.$(bld_trg))\
|
---|
2222 | $(SDK_$(sdk)_LIBPATH.$(bld_type))\
|
---|
2223 | $(SDK_$(sdk)_LIBPATH))\
|
---|
2224 | $(TOOL_$(tool)_LIBPATH.$(bld_trg_cpu))\
|
---|
2225 | $(TOOL_$(tool)_LIBPATH.$(bld_trg).$(bld_trg_arch))\
|
---|
2226 | $(TOOL_$(tool)_LIBPATH.$(bld_trg_arch))\
|
---|
2227 | $(TOOL_$(tool)_LIBPATH.$(bld_trg))\
|
---|
2228 | $(TOOL_$(tool)_LIBPATH.$(bld_type))\
|
---|
2229 | $(TOOL_$(tool)_LIBPATH)
|
---|
2230 | dirdep := $(call DIRDEP,$(dir $(out)))
|
---|
2231 | deps := $($(target)_DEPS)
|
---|
2232 | orderdeps := $($(target)_ORDERDEPS)
|
---|
2233 |
|
---|
2234 | # Adjust paths if we got a default path.
|
---|
2235 | ifneq ($(defpath),)
|
---|
2236 | libpath := $(abspathex $(libpath),$(defpath))
|
---|
2237 | objs := $(abspathex $(objs),$(defpath))
|
---|
2238 | deps := $(abspathex $(deps),$(defpath))
|
---|
2239 | orderdeps := $(abspathex $(orderdeps),$(defpath))
|
---|
2240 | othersrc := $(abspathex $(othersrc),$(defpath))
|
---|
2241 | # libs are not subject to this because of the the -l<lib> stuff. Use $(<target>_PATH)/lib if relative to current dir!
|
---|
2242 | endif
|
---|
2243 |
|
---|
2244 | # Custom pre-link actions.
|
---|
2245 | ifdef $(target)_PRE_CMDS.$(bld_trg).$(bld_trg_arch).$(bld_type)
|
---|
2246 | pre_cmds := $($(target)_PRE_CMDS.$(bld_trg).$(bld_trg_arch).$(bld_type))
|
---|
2247 | else ifdef $(target)_PRE_CMDS.$(bld_trg).$(bld_trg_arch)
|
---|
2248 | pre_cmds := $($(target)_PRE_CMDS.$(bld_trg).$(bld_trg_arch))
|
---|
2249 | else ifdef $(target)_PRE_CMDS.$(bld_trg).$(bld_type)
|
---|
2250 | pre_cmds := $($(target)_PRE_CMDS.$(bld_trg).$(bld_type))
|
---|
2251 | else ifdef $(target)_PRE_CMDS.$(bld_trg_arch)
|
---|
2252 | pre_cmds := $($(target)_PRE_CMDS.$(bld_trg_arch))
|
---|
2253 | else ifdef $(target)_PRE_CMDS.$(bld_trg)
|
---|
2254 | pre_cmds := $($(target)_PRE_CMDS.$(bld_trg))
|
---|
2255 | else ifdef $(target)_PRE_CMDS.$(bld_type)
|
---|
2256 | pre_cmds := $($(target)_PRE_CMDS.$(bld_type))
|
---|
2257 | else ifdef $(target)_PRE_CMDS
|
---|
2258 | pre_cmds := $($(target)_PRE_CMDS)
|
---|
2259 | else ifdef PRE_CMDS.$(bld_trg).$(bld_trg_arch).$(bld_type)
|
---|
2260 | pre_cmds := $(PRE_CMDS.$(bld_trg).$(bld_trg_arch).$(bld_type))
|
---|
2261 | else ifdef PRE_CMDS.$(bld_trg).$(bld_trg_arch)
|
---|
2262 | pre_cmds := $(PRE_CMDS.$(bld_trg).$(bld_trg_arch))
|
---|
2263 | else ifdef PRE_CMDS.$(bld_trg).$(bld_type)
|
---|
2264 | pre_cmds := $(PRE_CMDS.$(bld_trg).$(bld_type))
|
---|
2265 | else ifdef PRE_CMDS.$(bld_trg_arch)
|
---|
2266 | pre_cmds := $(PRE_CMDS.$(bld_trg_arch))
|
---|
2267 | else ifdef PRE_CMDS.$(bld_trg)
|
---|
2268 | pre_cmds := $(PRE_CMDS.$(bld_trg))
|
---|
2269 | else ifdef PRE_CMDS.$(bld_type)
|
---|
2270 | pre_cmds := $(PRE_CMDS.$(bld_type))
|
---|
2271 | else
|
---|
2272 | pre_cmds := $(PRE_CMDS)
|
---|
2273 | endif
|
---|
2274 |
|
---|
2275 | # Custom post-link actions.
|
---|
2276 | ifdef $(target)_POST_CMDS.$(bld_trg).$(bld_trg_arch).$(bld_type)
|
---|
2277 | post_cmds := $($(target)_POST_CMDS.$(bld_trg).$(bld_trg_arch).$(bld_type))
|
---|
2278 | else ifdef $(target)_POST_CMDS.$(bld_trg).$(bld_trg_arch)
|
---|
2279 | post_cmds := $($(target)_POST_CMDS.$(bld_trg).$(bld_trg_arch))
|
---|
2280 | else ifdef $(target)_POST_CMDS.$(bld_trg).$(bld_type)
|
---|
2281 | post_cmds := $($(target)_POST_CMDS.$(bld_trg).$(bld_type))
|
---|
2282 | else ifdef $(target)_POST_CMDS.$(bld_trg_arch)
|
---|
2283 | post_cmds := $($(target)_POST_CMDS.$(bld_trg_arch))
|
---|
2284 | else ifdef $(target)_POST_CMDS.$(bld_trg)
|
---|
2285 | post_cmds := $($(target)_POST_CMDS.$(bld_trg))
|
---|
2286 | else ifdef $(target)_POST_CMDS.$(bld_type)
|
---|
2287 | post_cmds := $($(target)_POST_CMDS.$(bld_type))
|
---|
2288 | else ifdef $(target)_POST_CMDS
|
---|
2289 | post_cmds := $($(target)_POST_CMDS)
|
---|
2290 | else ifdef POST_CMDS.$(bld_trg).$(bld_trg_arch).$(bld_type)
|
---|
2291 | post_cmds := $(POST_CMDS.$(bld_trg).$(bld_trg_arch).$(bld_type))
|
---|
2292 | else ifdef POST_CMDS.$(bld_trg).$(bld_trg_arch)
|
---|
2293 | post_cmds := $(POST_CMDS.$(bld_trg).$(bld_trg_arch))
|
---|
2294 | else ifdef POST_CMDS.$(bld_trg).$(bld_type)
|
---|
2295 | post_cmds := $(POST_CMDS.$(bld_trg).$(bld_type))
|
---|
2296 | else ifdef POST_CMDS.$(bld_trg_arch)
|
---|
2297 | post_cmds := $(POST_CMDS.$(bld_trg_arch))
|
---|
2298 | else ifdef POST_CMDS.$(bld_trg)
|
---|
2299 | post_cmds := $(POST_CMDS.$(bld_trg))
|
---|
2300 | else ifdef POST_CMDS.$(bld_type)
|
---|
2301 | post_cmds := $(POST_CMDS.$(bld_type))
|
---|
2302 | else
|
---|
2303 | post_cmds := $(POST_CMDS)
|
---|
2304 | endif
|
---|
2305 |
|
---|
2306 | # installation targets
|
---|
2307 | ifndef $(target)_NOINST
|
---|
2308 | INSTARGET_$(target) := $(patsubst %/,%/$(notdir $(out)), \
|
---|
2309 | $(if $($(target)_INST), $(addprefix $(PATH_INS)/,$($(target)_INST)), $(definst)/))
|
---|
2310 | ifdef KBUILD_DO_AUTO_INSTALL
|
---|
2311 | $(typevar) += $(INSTARGET_$(target))
|
---|
2312 | else
|
---|
2313 | $(typevar) += $(out)
|
---|
2314 | endif
|
---|
2315 | # generate the install rule
|
---|
2316 | $(eval $(def_link_install_rule))
|
---|
2317 |
|
---|
2318 | else # NOINST
|
---|
2319 | INSTARGET_$(target) :=
|
---|
2320 | $(typevar) += $(out)
|
---|
2321 | endif # NOINST
|
---|
2322 |
|
---|
2323 | # dependency file
|
---|
2324 | dep := $(outbase)$(SUFF_DEP)
|
---|
2325 | ifndef NO_LINK_CMDS_DEPS
|
---|
2326 | _DEPFILES_INCLUDED += $(dep)
|
---|
2327 | $(eval includedep $(dep))
|
---|
2328 | endif
|
---|
2329 |
|
---|
2330 | # check that the tool is defined.
|
---|
2331 | ifndef TOOL_$(tool)_$(tool_do)_CMDS
|
---|
2332 | $(warning kBuild: tools: \
|
---|
2333 | 1 $($(target)_$(source)TOOL.$(bld_trg).$(bld_trg_arch)) \
|
---|
2334 | 2 $($(target)_$(source)TOOL.$(bld_trg)) \
|
---|
2335 | 3 $($(target)_$(source)TOOL) \
|
---|
2336 | 4 $($(target)_TOOL.$(bld_trg).$(bld_trg_arch)) \
|
---|
2337 | 5 $($(target)_TOOL.$(bld_trg)) \
|
---|
2338 | 6 $($(target)_TOOL) \
|
---|
2339 | 7 $($(source)TOOL.$(bld_trg).$(bld_trg_arch)) \
|
---|
2340 | 8 $($(source)TOOL.$(bld_trg)) \
|
---|
2341 | 9 $($(source)TOOL) \
|
---|
2342 | 10 $(TOOL.$(bld_trg).$(bld_trg_arch)) \
|
---|
2343 | 11 $(TOOL.$(bld_trg)) \
|
---|
2344 | 12 $(TOOL) )
|
---|
2345 | $(error kBuild: TOOL_$(tool)_$(tool_do)_CMDS isn't defined! target=$(target) )
|
---|
2346 | endif
|
---|
2347 |
|
---|
2348 | # call the tool
|
---|
2349 | $(target)_CMDS_ := $(TOOL_$(tool)_$(tool_do)_CMDS)
|
---|
2350 | ifneq ($(pre_cmds),)
|
---|
2351 | $(target)_CMDS_ := $(TAB)$(pre_cmds)$(NL)$(TAB)$($(target)_CMDS_)
|
---|
2352 | endif
|
---|
2353 | ifneq ($(post_cmds),)
|
---|
2354 | $(target)_CMDS_ := $($(target)_CMDS_)$(NL)$(TAB)$(post_cmds)
|
---|
2355 | endif
|
---|
2356 | $(target)_OUTPUT_ := $(TOOL_$(tool)_$(tool_do)_OUTPUT)
|
---|
2357 | $(target)_OUTPUT_MAYBE_ := $(TOOL_$(tool)_$(tool_do)_OUTPUT_MAYBE)
|
---|
2358 | $(target)_DEPEND_ := $(TOOL_$(tool)_$(tool_do)_DEPEND) $(deps) $(objs)
|
---|
2359 | $(target)_DEPORD_ := $(TOOL_$(tool)_$(tool_do)_DEPORD) $(dirdep) $(orderdeps)
|
---|
2360 |
|
---|
2361 | # generate the link rule.
|
---|
2362 | $(eval $(def_link_rule))
|
---|
2363 |
|
---|
2364 |
|
---|
2365 | # Update globals.
|
---|
2366 | _OBJS += $($(target)_OBJS_)
|
---|
2367 | _OUT_FILES += $($(target)_OUTPUT_) $(out)
|
---|
2368 | _CLEAN_FILES += $($(target)_CLEAN) $($(target)_CLEAN.$(bld_trg)) $($(target)_CLEAN.$(bld_trg).$(bld_trg_arch)) $($(target)_CLEAN.$(bld_trg_arch)) $($(target)_CLEAN.$(bld_trg_cpu)) $($(target)_CLEAN.$(bld_type))
|
---|
2369 | _DIRS += $($(target)_BLDDIRS) $($(target)_BLDDIRS.$(bld_trg)) $($(target)_BLDDIRS.$(bld_trg).$(bld_trg_arch)) $($(target)_BLDDIRS.$(bld_trg_arch)) $($(target)_BLDDIRS.$(bld_trg_cpu)) $($(target)_BLDDIRS.$(bld_type))
|
---|
2370 | _INSTALLS_FILES += $(INSTARGET_$(target))
|
---|
2371 |
|
---|
2372 | endef
|
---|
2373 |
|
---|
2374 |
|
---|
2375 | #
|
---|
2376 | # BLDPROGS
|
---|
2377 | #
|
---|
2378 |
|
---|
2379 | ## Build program (one).
|
---|
2380 | # @param $(target) Normalized target (program) name.
|
---|
2381 | define def_bldprog
|
---|
2382 |
|
---|
2383 | # set NOINST if not forced installation.
|
---|
2384 | ifndef $(target)_INST
|
---|
2385 | $(target)_NOINST := 1
|
---|
2386 | endif
|
---|
2387 |
|
---|
2388 | # do the usual stuff.
|
---|
2389 | $(eval $(value def_link_common))
|
---|
2390 |
|
---|
2391 | endef
|
---|
2392 |
|
---|
2393 | # Process build programs.
|
---|
2394 | EXT := EXE
|
---|
2395 | EXTPRE := HOST
|
---|
2396 | tool_do := LINK_PROGRAM
|
---|
2397 | definst := $(PATH_BIN)
|
---|
2398 | typevar := _BLDPROGS
|
---|
2399 | mode := 0755
|
---|
2400 | bld_trg_base_var := PLATFORM
|
---|
2401 | $(foreach target, $(BLDPROGS) $(BLDPROGS.$(BUILD_PLATFORM)) $(BLDPROGS.$(BUILD_PLATFORM).$(BUILD_PLATFORM_ARCH)), $(eval $(value def_bldprog)))
|
---|
2402 |
|
---|
2403 | ifdef KBUILD_PROFILE_SELF
|
---|
2404 | _KBUILD_TS_NOW := $(nanots )
|
---|
2405 | $(info prof: $(int-sub $(_KBUILD_TS_NOW), $(_KBUILD_TS_HEADER_START)) - $(int-sub $(_KBUILD_TS_NOW), $(_KBUILD_TS_PREV)) - done build program targets)
|
---|
2406 | _KBUILD_TS_PREV := $(_KBUILD_TS_NOW)
|
---|
2407 | endif
|
---|
2408 |
|
---|
2409 |
|
---|
2410 | #
|
---|
2411 | # DLLS
|
---|
2412 | #
|
---|
2413 |
|
---|
2414 | # Process dlls
|
---|
2415 | EXT := DLL
|
---|
2416 | EXTPRE :=
|
---|
2417 | tool_do := LINK_DLL
|
---|
2418 | definst := $(PATH_DLL)
|
---|
2419 | typevar := _DLLS
|
---|
2420 | mode := 0644
|
---|
2421 | bld_trg_base_var := TARGET
|
---|
2422 | $(foreach target, $(DLLS) $(DLLS.$(BUILD_TARGET)) $(DLLS.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)), $(eval $(value def_link_common)))
|
---|
2423 |
|
---|
2424 | ifdef KBUILD_PROFILE_SELF
|
---|
2425 | _KBUILD_TS_NOW := $(nanots )
|
---|
2426 | $(info prof: $(int-sub $(_KBUILD_TS_NOW), $(_KBUILD_TS_HEADER_START)) - $(int-sub $(_KBUILD_TS_NOW), $(_KBUILD_TS_PREV)) - done dll targets)
|
---|
2427 | _KBUILD_TS_PREV := $(_KBUILD_TS_NOW)
|
---|
2428 | endif
|
---|
2429 |
|
---|
2430 |
|
---|
2431 | #
|
---|
2432 | # IMPORT LIBRARIES
|
---|
2433 | #
|
---|
2434 | # - On OS/2 and windows these are libraries.
|
---|
2435 | # - On other platforms they are fake DLLs.
|
---|
2436 | #
|
---|
2437 | EXTPRE :=
|
---|
2438 | typevar := _IMPORT_LIBS
|
---|
2439 | mode := 0644
|
---|
2440 | bld_trg_base_var := TARGET
|
---|
2441 | ifeq ($(filter-out nt os2 win win64 win32,$(BUILD_TARGET)),)
|
---|
2442 | EXT := LIB
|
---|
2443 | tool_do := LINK_LIBRARY
|
---|
2444 | definst := $(PATH_LIB)
|
---|
2445 | $(foreach target, $(IMPORT_LIBS) $(IMPORT_LIBS.$(BUILD_TARGET)) $(IMPORT_LIBS.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)), $(eval $(value def_lib)))
|
---|
2446 | else
|
---|
2447 | EXT := DLL
|
---|
2448 | tool_do := LINK_DLL
|
---|
2449 | definst := $(PATH_DLL)
|
---|
2450 | $(foreach target, $(IMPORT_LIBS) $(IMPORT_LIBS.$(BUILD_TARGET)) $(IMPORT_LIBS.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)), $(eval $(value def_link_common)))
|
---|
2451 | endif
|
---|
2452 |
|
---|
2453 | ifdef KBUILD_PROFILE_SELF
|
---|
2454 | _KBUILD_TS_NOW := $(nanots )
|
---|
2455 | $(info prof: $(int-sub $(_KBUILD_TS_NOW), $(_KBUILD_TS_HEADER_START)) - $(int-sub $(_KBUILD_TS_NOW), $(_KBUILD_TS_PREV)) - done import library targets)
|
---|
2456 | _KBUILD_TS_PREV := $(_KBUILD_TS_NOW)
|
---|
2457 | endif
|
---|
2458 |
|
---|
2459 |
|
---|
2460 | #
|
---|
2461 | # PROGRAMS
|
---|
2462 | #
|
---|
2463 |
|
---|
2464 | # Process programs
|
---|
2465 | EXT := EXE
|
---|
2466 | EXTPRE :=
|
---|
2467 | tool_do := LINK_PROGRAM
|
---|
2468 | definst := $(PATH_BIN)
|
---|
2469 | typevar := _PROGRAMS
|
---|
2470 | mode := 0755
|
---|
2471 | bld_trg_base_var := TARGET
|
---|
2472 | $(foreach target, $(PROGRAMS) $(PROGRAMS.$(BUILD_TARGET)) $(PROGRAMS.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)), $(eval $(value def_link_common)))
|
---|
2473 |
|
---|
2474 | ifdef KBUILD_PROFILE_SELF
|
---|
2475 | _KBUILD_TS_NOW := $(nanots )
|
---|
2476 | $(info prof: $(int-sub $(_KBUILD_TS_NOW), $(_KBUILD_TS_HEADER_START)) - $(int-sub $(_KBUILD_TS_NOW), $(_KBUILD_TS_PREV)) - done program targets)
|
---|
2477 | _KBUILD_TS_PREV := $(_KBUILD_TS_NOW)
|
---|
2478 | endif
|
---|
2479 |
|
---|
2480 |
|
---|
2481 | #
|
---|
2482 | # SYSMODS
|
---|
2483 | #
|
---|
2484 |
|
---|
2485 | # Process sysmods
|
---|
2486 | EXT := SYS
|
---|
2487 | EXTPRE :=
|
---|
2488 | tool_do := LINK_SYSMOD
|
---|
2489 | definst := $(PATH_SYS)
|
---|
2490 | typevar := _SYSMODS
|
---|
2491 | mode := 0644
|
---|
2492 | bld_trg_base_var := TARGET
|
---|
2493 | $(foreach target, $(SYSMODS) $(SYSMODS.$(BUILD_TARGET)) $(SYSMODS.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)), $(eval $(value def_link_common)))
|
---|
2494 |
|
---|
2495 | ifdef KBUILD_PROFILE_SELF
|
---|
2496 | _KBUILD_TS_NOW := $(nanots )
|
---|
2497 | $(info prof: $(int-sub $(_KBUILD_TS_NOW), $(_KBUILD_TS_HEADER_START)) - $(int-sub $(_KBUILD_TS_NOW), $(_KBUILD_TS_PREV)) - done sysmod targets)
|
---|
2498 | _KBUILD_TS_PREV := $(_KBUILD_TS_NOW)
|
---|
2499 | endif
|
---|
2500 |
|
---|
2501 |
|
---|
2502 | #
|
---|
2503 | # OTHERS
|
---|
2504 | #
|
---|
2505 | _OTHERS = $(OTHERS) $(OTHERS.$(BUILD_TARGET)) $(OTHERS.$(BUILD_TARGET).$(BUILD_TARGET_ARCH))
|
---|
2506 |
|
---|
2507 |
|
---|
2508 | #
|
---|
2509 | # INSTALLS
|
---|
2510 | #
|
---|
2511 |
|
---|
2512 | ## generate the install rule
|
---|
2513 | define def_install_src_rule
|
---|
2514 | # the install rule
|
---|
2515 | $(insdst) : $(srcsrc) | $(call DIRDEP,$(dir $(insdst)))
|
---|
2516 | $$(call MSG_INST_FILE,$(srcsrc),$(insdst))
|
---|
2517 | $$(QUIET)$(inscmd)
|
---|
2518 | endef
|
---|
2519 |
|
---|
2520 | ## install one file
|
---|
2521 | define def_install_src
|
---|
2522 |
|
---|
2523 | # deal with '=>' in the source file name.
|
---|
2524 | srcdst := $(subst =>, ,$(src))
|
---|
2525 | srcsrc := $(firstword $(srcdst))
|
---|
2526 | srcdstdir := $(dir $(word 2,$(srcdst)))
|
---|
2527 | srcdst := $(word $(words $(srcdst)),$(srcdst))
|
---|
2528 |
|
---|
2529 | # _INSTFUN
|
---|
2530 | ifdef $(srcsrc)_INSTFUN
|
---|
2531 | instfun := $(srcsrc)_INSTFUN
|
---|
2532 | else ifdef $(target)_INSTFUN
|
---|
2533 | instfun := $(target)_INSTFUN
|
---|
2534 | else
|
---|
2535 | instfun := _INSTALL_FILE
|
---|
2536 | endif
|
---|
2537 |
|
---|
2538 | # _INST
|
---|
2539 | ifdef $(srcsrc)_INST
|
---|
2540 | inst := $(patsubst %/,%,$($(srcsrc)_INST))/$(dir $(srcdstdir))
|
---|
2541 | else ifdef $(target)_INST
|
---|
2542 | inst := $(patsubst %/,%,$($(target)_INST))/$(dir $(srcdstdir))
|
---|
2543 | else
|
---|
2544 | inst := $(dir $(srcdstdir))
|
---|
2545 | endif
|
---|
2546 |
|
---|
2547 | # calc target
|
---|
2548 | insdst := $(call $(instfun),$(srcdst),$(target),$(inst),$(PATH_INS))
|
---|
2549 | #$(warning instfun=$(instfun) srcdst=$(srcdst) target=$(target) inst=$(inst) => insdst=$(insdst))
|
---|
2550 |
|
---|
2551 | # mode, uid and gid
|
---|
2552 | mode := $(firstword \
|
---|
2553 | $($(target)_$(srcsrc)_MODE.$(bld_trg).$(bld_trg_arch)) \
|
---|
2554 | $($(target)_$(srcsrc)_MODE.$(bld_trg)) \
|
---|
2555 | $($(target)_$(srcsrc)_MODE) \
|
---|
2556 | $($(target)_$(srcdst)_MODE.$(bld_trg).$(bld_trg_arch)) \
|
---|
2557 | $($(target)_$(srcdst)_MODE.$(bld_trg)) \
|
---|
2558 | $($(target)_$(srcdst)_MODE) \
|
---|
2559 | $($(srcsrc)_MODE.$(bld_trg).$(bld_trg_arch)) \
|
---|
2560 | $($(srcsrc)_MODE.$(bld_trg)) \
|
---|
2561 | $($(srcsrc)_MODE) \
|
---|
2562 | $($(srcdst)_MODE.$(bld_trg).$(bld_trg_arch)) \
|
---|
2563 | $($(srcdst)_MODE.$(bld_trg)) \
|
---|
2564 | $($(srcdst)_MODE) \
|
---|
2565 | $($(target)_MODE.$(bld_trg).$(bld_trg_arch)) \
|
---|
2566 | $($(target)_MODE.$(bld_trg)) \
|
---|
2567 | $($(target)_MODE))
|
---|
2568 | uid := $(firstword \
|
---|
2569 | $($(target)_$(srcsrc)_UID.$(bld_trg).$(bld_trg_arch)) \
|
---|
2570 | $($(target)_$(srcsrc)_UID.$(bld_trg)) \
|
---|
2571 | $($(target)_$(srcsrc)_UID) \
|
---|
2572 | $($(target)_$(srcdst)_UID.$(bld_trg).$(bld_trg_arch)) \
|
---|
2573 | $($(target)_$(srcdst)_UID.$(bld_trg)) \
|
---|
2574 | $($(target)_$(srcdst)_UID) \
|
---|
2575 | $($(srcsrc)_UID.$(bld_trg).$(bld_trg_arch)) \
|
---|
2576 | $($(srcsrc)_UID.$(bld_trg)) \
|
---|
2577 | $($(srcsrc)_UID) \
|
---|
2578 | $($(srcdst)_UID.$(bld_trg).$(bld_trg_arch)) \
|
---|
2579 | $($(srcdst)_UID.$(bld_trg)) \
|
---|
2580 | $($(srcdst)_UID) \
|
---|
2581 | $($(target)_UID.$(bld_trg).$(bld_trg_arch)) \
|
---|
2582 | $($(target)_UID.$(bld_trg)) \
|
---|
2583 | $($(target)_UID))
|
---|
2584 | gid := $(firstword \
|
---|
2585 | $($(target)_$(srcsrc)_GID.$(bld_trg).$(bld_trg_arch)) \
|
---|
2586 | $($(target)_$(srcsrc)_GID.$(bld_trg)) \
|
---|
2587 | $($(target)_$(srcsrc)_GID) \
|
---|
2588 | $($(target)_$(srcdst)_GID.$(bld_trg).$(bld_trg_arch)) \
|
---|
2589 | $($(target)_$(srcdst)_GID.$(bld_trg)) \
|
---|
2590 | $($(target)_$(srcdst)_GID) \
|
---|
2591 | $($(srcsrc)_GID.$(bld_trg).$(bld_trg_arch)) \
|
---|
2592 | $($(srcsrc)_GID.$(bld_trg)) \
|
---|
2593 | $($(srcsrc)_GID) \
|
---|
2594 | $($(srcdst)_GID.$(bld_trg).$(bld_trg_arch)) \
|
---|
2595 | $($(srcdst)_GID.$(bld_trg)) \
|
---|
2596 | $($(srcdst)_GID) \
|
---|
2597 | $($(target)_GID.$(bld_trg).$(bld_trg_arch)) \
|
---|
2598 | $($(target)_GID.$(bld_trg)) \
|
---|
2599 | $($(target)_GID))
|
---|
2600 | flags := \
|
---|
2601 | $($(target)_IFFLAGS) \
|
---|
2602 | $($(target)_IFFLAGS.$(bld_trg)) \
|
---|
2603 | $($(target)_IFFLAGS.$(bld_trg).$(bld_trg_arch)) \
|
---|
2604 | $($(srcdst)_IFFLAGS) \
|
---|
2605 | $($(srcdst)_IFFLAGS.$(bld_trg)) \
|
---|
2606 | $($(srcdst)_IFFLAGS.$(bld_trg).$(bld_trg_arch)) \
|
---|
2607 | $($(srcsrc)_IFFLAGS) \
|
---|
2608 | $($(srcsrc)_IFFLAGS.$(bld_trg)) \
|
---|
2609 | $($(srcsrc)_IFFLAGS.$(bld_trg).$(bld_trg_arch)) \
|
---|
2610 | $($(target)_$(srcdst)_IFFLAGS) \
|
---|
2611 | $($(target)_$(srcdst)_IFFLAGS.$(bld_trg)) \
|
---|
2612 | $($(target)_$(srcdst)_IFFLAGS.$(bld_trg).$(bld_trg_arch)) \
|
---|
2613 | $($(target)_$(srcsrc)_IFFLAGS) \
|
---|
2614 | $($(target)_$(srcsrc)_IFFLAGS.$(bld_trg)) \
|
---|
2615 | $($(target)_$(srcsrc)_IFFLAGS.$(bld_trg).$(bld_trg_arch))
|
---|
2616 |
|
---|
2617 |
|
---|
2618 | # Adjust the source if we got a default PATH. (This must be done this late!)
|
---|
2619 | ifdef $(target)_PATH
|
---|
2620 | srcsrc := $(abspathex $(srcsrc),$($(target)_PATH))
|
---|
2621 | endif
|
---|
2622 |
|
---|
2623 | # create the command
|
---|
2624 | ifdef $(srcsrc)_INSTALLER
|
---|
2625 | inscmd := $(call $(srcsrc)_INSTALLER,$(srcsrc),$(insdst),$(target),$(flags))
|
---|
2626 | else ifdef $(target)_INSTALLER
|
---|
2627 | inscmd := $(call $(target)_INSTALLER,$(srcsrc),$(insdst),$(target),$(flags))
|
---|
2628 | else
|
---|
2629 | inscmd := $$(INSTALL)\
|
---|
2630 | $(if $(uid),-o $(uid))\
|
---|
2631 | $(if $(gid),-g $(gid))\
|
---|
2632 | $(if $(mode),-m $(mode))\
|
---|
2633 | $(flags)\
|
---|
2634 | $(srcsrc) $(insdst)
|
---|
2635 | endif
|
---|
2636 |
|
---|
2637 | # generate the rule (need double evaluation here)
|
---|
2638 | $(eval $(def_install_src_rule))
|
---|
2639 |
|
---|
2640 | INSTARGET_$(target) += $(insdst)
|
---|
2641 | endef
|
---|
2642 |
|
---|
2643 |
|
---|
2644 | ## generate the symlink rule
|
---|
2645 | define def_install_symlink_rule
|
---|
2646 | # the install rule
|
---|
2647 | $(insdst) : | $(call DIRDEP,$(dir $(insdst)))
|
---|
2648 | $$(call MSG_INST_SYM,$(insdst),$(symdst))
|
---|
2649 | $$(QUIET)$$(RM) -f $$@
|
---|
2650 | $$(QUIET)$$(LN_SYMLINK) $(symdst) $(insdst)
|
---|
2651 | endef
|
---|
2652 |
|
---|
2653 | ## create one symlink
|
---|
2654 | define def_install_symlink
|
---|
2655 |
|
---|
2656 | # deal with '=>' in the source file name.
|
---|
2657 | symdst := $(subst =>, ,$(src))
|
---|
2658 | symlnk := $(firstword $(symdst))
|
---|
2659 | symdst := $(word $(words $(symdst)),$(symdst))
|
---|
2660 |
|
---|
2661 | # _INSTFUN
|
---|
2662 | ifdef $(symlnk)_INSTFUN
|
---|
2663 | instfun := $(symlnk)_INSTFUN
|
---|
2664 | else ifdef $(target)_INSTFUN
|
---|
2665 | instfun := $(target)_INSTFUN
|
---|
2666 | else
|
---|
2667 | instfun := _INSTALL_FILE
|
---|
2668 | endif
|
---|
2669 |
|
---|
2670 | # _INST
|
---|
2671 | ifdef $(symlnk)_INST
|
---|
2672 | inst := $(patsubst %/,%,$($(symlnk)_INST))/$(dir $(symlnk))
|
---|
2673 | else ifdef $(target)_INST
|
---|
2674 | inst := $(patsubst %/,%,$($(target)_INST))/$(dir $(symlnk))
|
---|
2675 | else
|
---|
2676 | inst := $(dir $(symlnk))
|
---|
2677 | endif
|
---|
2678 |
|
---|
2679 | # calc target
|
---|
2680 | insdst := $(call $(instfun),$(symlnk),$(target),$(inst),$(PATH_INS))
|
---|
2681 | #$(warning symlnk=$(symlnk) symdst=$(symdst) insdst=$(insdst) instfun=$(instfun) inst='$(inst)')
|
---|
2682 |
|
---|
2683 | # generate the rule (need double evaluation here)
|
---|
2684 | $(eval $(def_install_symlink_rule))
|
---|
2685 |
|
---|
2686 | INSTARGET_$(target) += $(insdst)
|
---|
2687 | endef
|
---|
2688 |
|
---|
2689 |
|
---|
2690 | ## generate the install rule
|
---|
2691 | define def_install_directory_rule
|
---|
2692 | # the install rule
|
---|
2693 | $(insdst):
|
---|
2694 | $$(call MSG_INST_DIR,$(insdst))
|
---|
2695 | $$(QUIET)$$(INSTALL) -d \
|
---|
2696 | $(if $(uid),-o $(uid))\
|
---|
2697 | $(if $(gid),-g $(gid))\
|
---|
2698 | $(if $(mode),-m $(mode))\
|
---|
2699 | $(flags)\
|
---|
2700 | $(insdst)
|
---|
2701 |
|
---|
2702 | .NOTPARALLEL: $(insdst)
|
---|
2703 | endef
|
---|
2704 |
|
---|
2705 |
|
---|
2706 | ## create one directory
|
---|
2707 | define def_install_directory
|
---|
2708 |
|
---|
2709 | # _INST
|
---|
2710 | ifdef $(directory)_INST
|
---|
2711 | inst := $(PATH_INS)/$(patsubst %/,%,$($(directory)_INST))
|
---|
2712 | else ifdef $(target)_INST
|
---|
2713 | inst := $(PATH_INS)/$(patsubst %/,%,$($(target)_INST))
|
---|
2714 | else
|
---|
2715 | inst := $(PATH_INS)
|
---|
2716 | endif
|
---|
2717 |
|
---|
2718 | mode := $(firstword \
|
---|
2719 | $($(target)_$(directory)_MODE.$(bld_trg).$(bld_trg_arch)) \
|
---|
2720 | $($(target)_$(directory)_MODE.$(bld_trg)) \
|
---|
2721 | $($(target)_$(directory)_MODE) \
|
---|
2722 | $($(directory)_MODE.$(bld_trg).$(bld_trg_arch)) \
|
---|
2723 | $($(directory)_MODE.$(bld_trg)) \
|
---|
2724 | $($(directory)_MODE) \
|
---|
2725 | $($(target)_MODE.$(bld_trg).$(bld_trg_arch)) \
|
---|
2726 | $($(target)_MODE.$(bld_trg)) \
|
---|
2727 | $($(target)_MODE))
|
---|
2728 | uid := $(firstword \
|
---|
2729 | $($(target)_$(directory)_UID.$(bld_trg).$(bld_trg_arch)) \
|
---|
2730 | $($(target)_$(directory)_UID.$(bld_trg)) \
|
---|
2731 | $($(target)_$(directory)_UID) \
|
---|
2732 | $($(directory)_UID.$(bld_trg).$(bld_trg_arch)) \
|
---|
2733 | $($(directory)_UID.$(bld_trg)) \
|
---|
2734 | $($(directory)_UID) \
|
---|
2735 | $($(target)_UID.$(bld_trg).$(bld_trg_arch)) \
|
---|
2736 | $($(target)_UID.$(bld_trg)) \
|
---|
2737 | $($(target)_UID))
|
---|
2738 | gid := $(firstword \
|
---|
2739 | $($(target)_$(directory)_GID.$(bld_trg).$(bld_trg_arch)) \
|
---|
2740 | $($(target)_$(directory)_GID.$(bld_trg)) \
|
---|
2741 | $($(target)_$(directory)_GID) \
|
---|
2742 | $($(directory)_GID.$(bld_trg).$(bld_trg_arch)) \
|
---|
2743 | $($(directory)_GID.$(bld_trg)) \
|
---|
2744 | $($(directory)_GID) \
|
---|
2745 | $($(target)_GID.$(bld_trg).$(bld_trg_arch)) \
|
---|
2746 | $($(target)_GID.$(bld_trg)) \
|
---|
2747 | $($(target)_GID))
|
---|
2748 | flags := \
|
---|
2749 | $($(target)_IDFLAGS)\
|
---|
2750 | $($(target)_IDFLAGS.$(bld_trg)) \
|
---|
2751 | $($(target)_IDFLAGS.$(bld_trg).$(bld_trg_arch)) \
|
---|
2752 | $($(directory)_IDFLAGS) \
|
---|
2753 | $($(directory)_IDFLAGS.$(bld_trg)) \
|
---|
2754 | $($(directory)_IDFLAGS.$(bld_trg).$(bld_trg_arch)) \
|
---|
2755 | $($(target)_$(directory)_IDFLAGS) \
|
---|
2756 | $($(target)_$(directory)_IDFLAGS.$(bld_trg)) \
|
---|
2757 | $($(target)_$(directory)_IDFLAGS.$(bld_trg).$(bld_trg_arch))
|
---|
2758 |
|
---|
2759 | insdst := $(inst)/$(directory)/
|
---|
2760 | #$(warning directory=$(directory) inst=$(inst) insdst=$(insdst) mode=$(mode) gid=$(gid) uid=$(uid))
|
---|
2761 |
|
---|
2762 | # generate the rule (need double evaluation here)
|
---|
2763 | $(eval $(def_install_directory_rule))
|
---|
2764 |
|
---|
2765 | INSTARGET_DIRS_$(target) += $(insdst)
|
---|
2766 | endef
|
---|
2767 |
|
---|
2768 |
|
---|
2769 | ## process one install target.
|
---|
2770 | define def_install
|
---|
2771 | # the basics.
|
---|
2772 | bld_type := $(firstword $($(target)_BLD_TYPE) $(BUILD_TYPE))
|
---|
2773 | bld_trg := $(firstword $($(target)_BLD_TRG) $(BUILD_TARGET))
|
---|
2774 | bld_trg_arch:= $(firstword $($(target)_BLD_TRG_ARCH) $(BUILD_TARGET_ARCH))
|
---|
2775 | bld_trg_cpu := $(firstword $($(target)_BLD_TRG_CPU) $(BUILD_TARGET_CPU))
|
---|
2776 |
|
---|
2777 | INSTARGET_$(target) := $($(target)_GOALS)
|
---|
2778 | INSTARGET_DIRS_$(target) :=
|
---|
2779 |
|
---|
2780 | $(foreach directory,$($(target)_DIRS) $($(target)_DIRS.$(bld_trg)) $($(target)_DIRS.$(bld_trg).$(bld_trg_arch)) $($(target)_DIRS.$(bld_trg_arch)) $($(target)_DIRS.$(bld_trg_cpu)) $($(target)_DIRS.$(bld_type)), \
|
---|
2781 | $(eval $(value def_install_directory)))
|
---|
2782 |
|
---|
2783 | $(foreach src,$($(target)_SOURCES) $($(target)_SOURCES.$(bld_trg)) $($(target)_SOURCES.$(bld_trg).$(bld_trg_arch)) $($(target)_SOURCES.$(bld_trg_arch)) $($(target)_SOURCES.$(bld_trg_cpu)) $($(target)_SOURCES.$(bld_type)), \
|
---|
2784 | $(eval $(value def_install_src)))
|
---|
2785 |
|
---|
2786 | $(foreach src,$($(target)_SYMLINKS) $($(target)_SYMLINKS.$(bld_trg)) $($(target)_SYMLINKS.$(bld_trg).$(bld_trg_arch)) $($(target)_SYMLINKS.$(bld_trg_arch)) $($(target)_SYMLINKS.$(bld_trg_cpu)) $($(target)_SYMLINKS.$(bld_type)), \
|
---|
2787 | $(eval $(value def_install_symlink)))
|
---|
2788 |
|
---|
2789 | # the collection target
|
---|
2790 | TARGET_$(target) := $(PATH_TARGET)/$(target).ins
|
---|
2791 | $(TARGET_$(target)): $(INSTARGET_$(target)) | $(INSTARGET_DIRS_$(target)) $(call DIRDEP,$(PATH_TARGET))
|
---|
2792 | @$(QUIET2)$(APPEND) $@
|
---|
2793 |
|
---|
2794 | $(target): $(TARGET_$(target))
|
---|
2795 |
|
---|
2796 | _INSTALLS += $(TARGET_$(target))
|
---|
2797 | _INSTALLS_FILES += $(INSTARGET_$(target))
|
---|
2798 | _INSTALLS_DIRS += $(INSTARGET_DIRS_$(target))
|
---|
2799 | _CLEAN_FILES += $($(target)_CLEAN) $($(target)_CLEAN.$(bld_trg)) $($(target)_CLEAN.$(bld_trg).$(bld_trg_arch)) $($(target)_CLEAN.$(bld_trg_arch)) $($(target)_CLEAN.$(bld_trg_cpu)) $($(target)_CLEAN.$(bld_type))
|
---|
2800 | _DIRS += $($(target)_BLDDIRS) $($(target)_BLDDIRS.$(bld_trg)) $($(target)_BLDDIRS.$(bld_trg).$(bld_trg_arch)) $($(target)_BLDDIRS.$(bld_trg_arch)) $($(target)_BLDDIRS.$(bld_trg_cpu)) $($(target)_BLDDIRS.$(bld_type))
|
---|
2801 | endef
|
---|
2802 |
|
---|
2803 | ## process all install targets
|
---|
2804 | $(foreach target, $(INSTALLS) $(INSTALLS.$(BUILD_TARGET)) $(INSTALLS.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)), \
|
---|
2805 | $(eval $(value def_install)))
|
---|
2806 |
|
---|
2807 | ifdef KBUILD_PROFILE_SELF
|
---|
2808 | _KBUILD_TS_NOW := $(nanots )
|
---|
2809 | $(info prof: $(int-sub $(_KBUILD_TS_NOW), $(_KBUILD_TS_HEADER_START)) - $(int-sub $(_KBUILD_TS_NOW), $(_KBUILD_TS_PREV)) - done install targets)
|
---|
2810 | _KBUILD_TS_PREV := $(_KBUILD_TS_NOW)
|
---|
2811 | endif
|
---|
2812 |
|
---|
2813 |
|
---|
2814 | #
|
---|
2815 | # PACKING
|
---|
2816 | #
|
---|
2817 | _PACKING += $(PACKING) $(PACKING.$(BUILD_TARGET)) $(PACKING.$(BUILD_TARGET).$(BUILD_TARGET_ARCH))
|
---|
2818 |
|
---|
2819 |
|
---|
2820 | #
|
---|
2821 | # DOCS
|
---|
2822 | #
|
---|
2823 |
|
---|
2824 |
|
---|
2825 | #
|
---|
2826 | # DIRECTORIES
|
---|
2827 | #
|
---|
2828 | _DIR_ALL := $(sort $(addsuffix /,$(patsubst %/,%,$(_DIRS))) $(dir $(_OUT_FILES) $(_OBJS) $(_INSTALLS_FILES)))
|
---|
2829 | $(foreach directory,$(_INSTALLS_DIRS), $(eval _DIR_ALL := $(filter-out $(directory),$(_DIR_ALL))))
|
---|
2830 |
|
---|
2831 |
|
---|
2832 | define def_mkdir_rule
|
---|
2833 | $(directory):
|
---|
2834 | $$(call MSG_MKDIR,$$@)
|
---|
2835 | $$(QUIET)$$(MKDIR) -p $$@
|
---|
2836 | endef
|
---|
2837 |
|
---|
2838 | $(foreach directory,$(_DIR_ALL),$(eval $(def_mkdir_rule)))
|
---|
2839 |
|
---|
2840 | ifdef KBUILD_PROFILE_SELF
|
---|
2841 | _KBUILD_TS_NOW := $(nanots )
|
---|
2842 | $(info prof: $(int-sub $(_KBUILD_TS_NOW), $(_KBUILD_TS_HEADER_START)) - $(int-sub $(_KBUILD_TS_NOW), $(_KBUILD_TS_PREV)) - done directories)
|
---|
2843 | _KBUILD_TS_PREV := $(_KBUILD_TS_NOW)
|
---|
2844 | endif
|
---|
2845 |
|
---|
2846 |
|
---|
2847 | #
|
---|
2848 | # NOTHING
|
---|
2849 | #
|
---|
2850 | do-nothing:
|
---|
2851 | ifdef KBUILD_PROFILE_SELF
|
---|
2852 | @$(ECHO) 'prof: $(int-sub $(nanots ), $(_KBUILD_TS_HEADER_START)) - $(int-sub $(nanots ), $(_KBUILD_TS_PREV)) - executing $@'
|
---|
2853 | endif
|
---|
2854 | $(call MSG_NOTHING)
|
---|
2855 |
|
---|
2856 |
|
---|
2857 | #
|
---|
2858 | # CLEAN UP
|
---|
2859 | #
|
---|
2860 | do-clean:
|
---|
2861 | $(call MSG_CLEAN)
|
---|
2862 | $(QUIET)$(RM) -f $(_OUT_FILES) $(_OBJS) $(_DEPFILES) $(_DEPFILES_INCLUDED) $(_CLEAN_FILES) $(OTHER_CLEAN)
|
---|
2863 | $(QUIET)$(RMDIR) -p --ignore-fail-on-non-empty --ignore-fail-on-not-exist $(rsort $(dir $(_OUT_FILES) $(_OBJS) $(_DEPFILES) $(_DEPFILES_INCLUDED) $(_CLEAN_FILES) $(OTHER_CLEAN)))
|
---|
2864 |
|
---|
2865 |
|
---|
2866 |
|
---|
2867 | #
|
---|
2868 | # PASSES (including directory and makefile walking)
|
---|
2869 | #
|
---|
2870 |
|
---|
2871 | ## Subdir
|
---|
2872 | # @param $(pass) Lowercase pass name.
|
---|
2873 | # @param $(PASS) Uppercase pass name.
|
---|
2874 | # @param $(subdir) Subdirectory
|
---|
2875 | # @param $(tag) tag to attach to the rule name.
|
---|
2876 | define def_pass_subdir
|
---|
2877 | pass_$(pass)$(tag):: $(dep)
|
---|
2878 | + $$(QUIET)$$(MAKE) -C $(subdir) -f $$(notdir $$(firstword $$(wildcard $$(addprefix $(subdir)/,$$(DEFAULT_MAKEFILE))))) pass_$(pass)
|
---|
2879 | endef
|
---|
2880 |
|
---|
2881 | ## Submakefile
|
---|
2882 | # @param $(pass) Lowercase pass name.
|
---|
2883 | # @param $(PASS) Uppercase pass name.
|
---|
2884 | # @param $(makefile) Makefile.
|
---|
2885 | # @param $(tag) tag to attach to the rule name.
|
---|
2886 | define def_pass_makefile
|
---|
2887 | pass_$(pass)$(tag):: $(dep)
|
---|
2888 | + $$(QUIET)$$(MAKE) -C $(patsubst %/,%,$(dir $(makefile))) -f $(notdir $(makefile)) pass_$(pass)
|
---|
2889 | endef
|
---|
2890 |
|
---|
2891 | ## Execute a pass.
|
---|
2892 | # @param $(pass) Lowercase pass name.
|
---|
2893 | # @param $(PASS) Uppercase pass name.
|
---|
2894 | define def_pass_old
|
---|
2895 | $(eval SUBDIRS_$(PASS) ?= $(SUBDIRS) $(SUBDIRS.$(BUILD_TARGET)) $(SUBDIRS.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)) )
|
---|
2896 | $(eval SUBDIRS_AFTER_$(PASS) ?= $(SUBDIRS_AFTER) $(SUBDIRS_AFTER.$(BUILD_TARGET)) $(SUBDIRS_AFTER.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)) )
|
---|
2897 | $(eval MAKEFILES_BEFORE_$(PASS) ?= $(MAKEFILES_BEFORE) $(MAKEFILES_BEFORE.$(BUILD_TARGET)) $(MAKEFILES_BEFORE.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)) )
|
---|
2898 | $(eval MAKEFILES_AFTER_$(PASS) ?= $(MAKEFILES_AFTER) $(MAKEFILES_AFTER.$(BUILD_TARGET)) $(MAKEFILES_AFTER.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)) )
|
---|
2899 |
|
---|
2900 | $(eval tag:=_before)
|
---|
2901 | $(eval dep:=)
|
---|
2902 | $(foreach subdir,$(SUBDIRS_$(PASS)) $(SUBDIRS_$(PASS).$(BUILD_TARGET)) $(SUBDIRS_$(PASS).$(BUILD_TARGET).$(BUILD_TARGET_ARCH)) ,$(eval $(def_pass_subdir)))
|
---|
2903 | $(foreach makefile,$(MAKEFILES_BEFORE_$(PASS)) $(MAKEFILES_BEFORE_$(PASS).$(BUILD_TARGET)) $(MAKEFILES_BEFORE_$(PASS).$(BUILD_TARGET).$(BUILD_TARGET_ARCH)),$(eval $(def_pass_makefile)))
|
---|
2904 |
|
---|
2905 | $(eval tag:=_after)
|
---|
2906 | $(eval dep:=pass_$(pass)_doit)
|
---|
2907 | $(foreach subdir,$(SUBDIRS_AFTER_$(PASS)) $(SUBDIRS_AFTER_$(PASS).$(BUILD_TARGET)) $(SUBDIRS_AFTER_$(PASS).$(BUILD_TARGET).$(BUILD_TARGET_ARCH)) ,$(eval $(def_pass_subdir)))
|
---|
2908 | $(foreach makefile,$(MAKEFILES_AFTER_$(PASS)) $(MAKEFILES_AFTER_$(PASS).$(BUILD_TARGET)) $(MAKEFILES_AFTER_$(PASS).$(BUILD_TARGET).$(BUILD_TARGET_ARCH)) ,$(eval $(def_pass_makefile)))
|
---|
2909 |
|
---|
2910 | .NOTPARALLEL: pass_$(pass)_before pass_$(pass)_after
|
---|
2911 | .PHONY: pass_$(pass) pass_$(pass)_before pass_$(pass)_doit pass_$(pass)_after
|
---|
2912 | pass_$(pass)_doit: $(PASS_$(PASS)_trgs) $(foreach var,$(PASS_$(PASS)_vars),$(var))
|
---|
2913 | pass_$(pass)_this: pass_$(pass)_before
|
---|
2914 | + $$(QUIET)$$(MAKE) -f $$(MAKEFILE) pass_$(pass)_doit
|
---|
2915 | pass_$(pass)_after:: pass_$(pass)_this
|
---|
2916 | pass_$(pass): pass_$(pass)_after
|
---|
2917 |
|
---|
2918 | endef
|
---|
2919 |
|
---|
2920 | define def_pass
|
---|
2921 | $(eval SUBDIRS_$(PASS) ?= $(SUBDIRS) $(SUBDIRS.$(BUILD_TARGET)) $(SUBDIRS.$(BUILD_TARGET.$(BUILD_TARGET_ARCH))) )
|
---|
2922 | $(eval SUBDIRS_AFTER_$(PASS) ?= $(SUBDIRS_AFTER) $(SUBDIRS_AFTER.$(BUILD_TARGET)) $(SUBDIRS_AFTER.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)) )
|
---|
2923 | $(eval MAKEFILES_BEFORE_$(PASS) ?= $(MAKEFILES_BEFORE) $(MAKEFILES_BEFORE.$(BUILD_TARGET)) $(MAKEFILES_BEFORE.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)) )
|
---|
2924 | $(eval MAKEFILES_AFTER_$(PASS) ?= $(MAKEFILES_AFTER) $(MAKEFILES_AFTER.$(BUILD_TARGET)) $(MAKEFILES_AFTER.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)) )
|
---|
2925 |
|
---|
2926 | $(eval tag:=_before)
|
---|
2927 | $(eval dep:=)
|
---|
2928 | $(foreach subdir,$(SUBDIRS_$(PASS)) $(SUBDIRS_$(PASS).$(BUILD_TARGET)) $(SUBDIRS_$(PASS).$(BUILD_TARGET).$(BUILD_TARGET_ARCH)) ,$(eval $(def_pass_subdir)))
|
---|
2929 | $(foreach makefile,$(MAKEFILES_BEFORE_$(PASS)) $(MAKEFILES_BEFORE_$(PASS).$(BUILD_TARGET)) $(MAKEFILES_BEFORE_$(PASS).$(BUILD_TARGET).$(BUILD_TARGET_ARCH)),$(eval $(def_pass_makefile)))
|
---|
2930 |
|
---|
2931 | $(eval tag:=_after)
|
---|
2932 | $(eval dep:=pass_$(pass)_doit)
|
---|
2933 | $(foreach subdir,$(SUBDIRS_AFTER_$(PASS)) $(SUBDIRS_AFTER_$(PASS).$(BUILD_TARGET)) $(SUBDIRS_AFTER_$(PASS).$(BUILD_TARGET).$(BUILD_TARGET_ARCH)) ,$(eval $(def_pass_subdir)))
|
---|
2934 | $(foreach makefile,$(MAKEFILES_AFTER_$(PASS)) $(MAKEFILES_AFTER_$(PASS).$(BUILD_TARGET)) $(MAKEFILES_AFTER_$(PASS).$(BUILD_TARGET).$(BUILD_TARGET_ARCH)) ,$(eval $(def_pass_makefile)))
|
---|
2935 |
|
---|
2936 | ifdef KBUILD_SAFE_PARALLEL
|
---|
2937 | .NOTPARALLEL: pass_$(pass) pass_$(pass)_before pass_$(pass)_after pass_$(pass)_this
|
---|
2938 | .PHONY: pass_$(pass) pass_$(pass)_before pass_$(pass)_after pass_$(pass)_this pass_$(pass)_doit
|
---|
2939 | pass_$(pass)_doit: $(PASS_$(PASS)_trgs) $(foreach var,$(PASS_$(PASS)_vars),$(var))
|
---|
2940 | pass_$(pass)_this: pass_$(pass)_before
|
---|
2941 | + $$(QUIET)$$(MAKE) -f $$(MAKEFILE) pass_$(pass)_doit
|
---|
2942 | pass_$(pass)_after:: pass_$(pass)_this
|
---|
2943 | pass_$(pass): pass_$(pass)_after
|
---|
2944 | else
|
---|
2945 | .NOTPARALLEL: pass_$(pass) pass_$(pass)_before pass_$(pass)_after pass_$(pass)_doit
|
---|
2946 | .PHONY: pass_$(pass) pass_$(pass)_before pass_$(pass)_after pass_$(pass)_doit
|
---|
2947 | pass_$(pass)_doit: pass_$(pass)_before \
|
---|
2948 | $(PASS_$(PASS)_trgs) $(foreach var,$(PASS_$(PASS)_vars),$($(var)))
|
---|
2949 | pass_$(pass): \
|
---|
2950 | pass_$(pass)_before \
|
---|
2951 | pass_$(pass)_doit \
|
---|
2952 | pass_$(pass)_after
|
---|
2953 | endif
|
---|
2954 |
|
---|
2955 | #$ (warning pass=$(pass) PASS=$(PASS): $(PASS_$(PASS)_trgs) $(PASS_$(PASS)_trgs) $(foreach var,$(PASS_$(PASS)_vars),$($(var))))
|
---|
2956 | endef
|
---|
2957 |
|
---|
2958 | # Generate the defined passes.
|
---|
2959 | $(foreach PASS, $(PASSES), \
|
---|
2960 | $(eval pass := $(PASS_$(PASS)_pass)) \
|
---|
2961 | $(eval $(def_pass)))
|
---|
2962 |
|
---|
2963 | ## Pass order
|
---|
2964 | # @param $(pass) Current pass name.
|
---|
2965 | # @param $(prev_pass) The previous pass name.
|
---|
2966 | define def_pass_order
|
---|
2967 | ifdef KBUILD_SAFE_PARALLEL
|
---|
2968 | .NOTPARALLEL: pass_$(pass)_order
|
---|
2969 | .PHONY: pass_$(pass)_order
|
---|
2970 | pass_$(pass)_order: $(pass_prev)
|
---|
2971 | $$(call MSG_PASS,$$(if $$(PASS_$(PASS)),$$(PASS_$(PASS)),$(pass)))
|
---|
2972 | + $$(QUIET)$$(MAKE) -f $$(MAKEFILE) pass_$(pass)
|
---|
2973 | else
|
---|
2974 | .NOTPARALLEL: pass_$(pass)_order pass_$(pass)_banner
|
---|
2975 | .PHONY: pass_$(pass)_order pass_$(pass)_banner
|
---|
2976 | pass_$(pass)_banner:
|
---|
2977 | $$(call MSG_PASS,$$(if $$(PASS_$(PASS)),$$(PASS_$(PASS)),$(pass)))
|
---|
2978 | pass_$(pass)_order: \
|
---|
2979 | $(pass_prev) \
|
---|
2980 | pass_$(pass)_banner \
|
---|
2981 | pass_$(pass)
|
---|
2982 | endif
|
---|
2983 | $(eval pass_prev := pass_$(pass)_order)
|
---|
2984 | endef
|
---|
2985 |
|
---|
2986 | ## PASS: order
|
---|
2987 | # Use dependencies to ensure correct pass order.
|
---|
2988 | pass_prev :=
|
---|
2989 | $(foreach PASS,$(DEFAULT_PASSES),\
|
---|
2990 | $(eval pass := $(PASS_$(PASS)_pass)) \
|
---|
2991 | $(eval $(def_pass_order)))
|
---|
2992 |
|
---|
2993 | ifdef KBUILD_PROFILE_SELF
|
---|
2994 | _KBUILD_TS_NOW := $(nanots )
|
---|
2995 | $(info prof: $(int-sub $(_KBUILD_TS_NOW), $(_KBUILD_TS_HEADER_START)) - $(int-sub $(_KBUILD_TS_NOW), $(_KBUILD_TS_PREV)) - done passes)
|
---|
2996 | _KBUILD_TS_PREV := $(_KBUILD_TS_NOW)
|
---|
2997 | endif
|
---|
2998 |
|
---|
2999 |
|
---|
3000 | #
|
---|
3001 | # THE MAIN RULES
|
---|
3002 | #
|
---|
3003 | all_recursive: $(pass_prev)
|
---|
3004 |
|
---|
3005 | rebuild: clean
|
---|
3006 | + $(MAKE) -f $(firstword $(MAKEFILE_LIST)) all_recursive
|
---|
3007 |
|
---|
3008 | # @todo make this a non-default pass!
|
---|
3009 | uninstall:
|
---|
3010 | $(RM) -f $(_INSTALLS_FILES)
|
---|
3011 |
|
---|
3012 | install: pass_installs
|
---|
3013 |
|
---|
3014 | # misc shortcuts.
|
---|
3015 | targets: bldprogs libraries dlls programs sysmods others installs
|
---|
3016 | objects: $(_OBJS)
|
---|
3017 | bldprogs: $(_BLDPROGS)
|
---|
3018 | libraries: $(_LIBS) $(_IMPORT_LIBS) $(_OTHER_LIBRARIES)
|
---|
3019 | dlls: $(_DLLS)
|
---|
3020 | programs: $(_PROGRAMS)
|
---|
3021 | sysmods: $(_SYSMODS)
|
---|
3022 | others: $(_OTHERS)
|
---|
3023 | installs: $(_INSTALLS) $(_INSTALLS_DIRS) $(_INSTALLS_FILES)
|
---|
3024 |
|
---|
3025 |
|
---|
3026 |
|
---|
3027 | #
|
---|
3028 | # kBuild debugging stuff.
|
---|
3029 | #
|
---|
3030 | show_targets:
|
---|
3031 | @$(foreach target, $(_ALL_TARGETS),\
|
---|
3032 | @$(ECHO) "target: $(target)" $(NLTAB)\
|
---|
3033 | @$(ECHO) " PATH_$(target)=$(PATH_$(target))" $(NLTAB)\
|
---|
3034 | @$(ECHO) " TARGET_$(target)=$(TARGET_$(target))" $(NLTAB)\
|
---|
3035 | @$(ECHO) " INSTARGET_$(target)=$(INSTARGET_$(target))" $(NLTAB)\
|
---|
3036 | $(foreach prop,$(PROPS_SINGLE) $(PROPS_ACCUMULATE_L) $(PROPS_ACCUMULATE_R) OBJS_ CLEAN, \
|
---|
3037 | $(eval _tmp:=$(firstword $($(target)_BLD_TRG) $(BUILD_TARGET))) \
|
---|
3038 | $(if $($(target)_$(prop).$(_tmp)),\
|
---|
3039 | @$(ECHO) " $(target)_$(prop).$(_tmp)=$($(target)_$(prop).$(_tmp))" $(NLTAB)) \
|
---|
3040 | $(if $($(target)_$(prop)), $(NLTAB)@$(ECHO) " $(target)_$(prop)=$($(target)_$(prop))" $(NLTAB)) \
|
---|
3041 | )\
|
---|
3042 | $(foreach prop,$(PROPS_DEFERRED), \
|
---|
3043 | $(eval _tmp:=$(firstword $($(target)_BLD_TRG) $(BUILD_TARGET))) \
|
---|
3044 | $(if $(value $(target)_$(prop).$(_tmp)),\
|
---|
3045 | @$(ECHO) ' $(target)_$(prop).$(_tmp)=$(value $(TARGET)_$(prop).$(_tmp))' $(NLTAB)) \
|
---|
3046 | $(if $(value $(target)_$(prop)), $(NLTAB)@$(ECHO) ' $(target)_$(prop)=$(value $(target)_$(prop))' $(NLTAB)) \
|
---|
3047 | ))
|
---|
3048 |
|
---|
3049 |
|
---|
3050 |
|
---|
3051 | #
|
---|
3052 | # Include dependency files.
|
---|
3053 | #
|
---|
3054 | ifneq ($(_DEPFILES),)
|
---|
3055 | includedep $(_DEPFILES)
|
---|
3056 | endif
|
---|
3057 |
|
---|
3058 |
|
---|
3059 | ifdef KBUILD_PROFILE_SELF
|
---|
3060 | _KBUILD_TS_FOOTER_END := $(nanots )
|
---|
3061 | $(info prof: $(int-sub $(_KBUILD_TS_FOOTER_END), $(_KBUILD_TS_HEADER_START)) - $(int-sub $(_KBUILD_TS_FOOTER_END), $(_KBUILD_TS_PREV)) - end of footer.kmk)
|
---|
3062 | $(info prof: footer.kmk: $(int-sub $(_KBUILD_TS_FOOTER_END), $(_KBUILD_TS_FOOTER_START)))
|
---|
3063 | _KBUILD_TS_PREV := $(_KBUILD_TS_FOOTER_END)
|
---|
3064 | endif
|
---|
3065 |
|
---|
3066 | # end-of-file-content
|
---|
3067 | __footer_kmk__ := target
|
---|
3068 | endif # __footer_kmk__
|
---|
3069 |
|
---|