3 # kBuild - Footer - Target lists - Pass 2 - Template & Target Inheritance, Uses and Tools.
7 # Copyright (c) 2004-2017 knut st. osmundsen <bird-kBuild-spam-xviiv@anduin.net>
9 # This file is part of kBuild.
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.
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.
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
26 # As a special exception you are granted permission to include this file, via
27 # the kmk include directive, as you wish without this in itself causing the
28 # resulting makefile, program or whatever to be covered by the GPL license.
29 # This exception does not however invalidate any other reasons why the makefile,
30 # program, whatever should not be covered the GPL.
34 ## Converts a variable from simple to recursive flavor.
35 # This is used by def_inherit_template_one_accumulate_l and def_inherit_template_one_accumulate_r.
36 # @param $1 The variable name.
37 define def_simple_2_recursive
43 ## Inherit one keyword in a non-accumulative manner.
44 # @param $(trg) Target object.
45 # @param $(prop) The property.
46 # @param $(src_key) Source keyword.
47 # @param $(trg_key) Target keyword.
48 define def_inherit_one_keyword
49 ifdef $(trg
)_
$(prop
).
$(src_key
)
50 ifndef $(trg
)_
$(prop
).
$(trg_key
)
51 $(trg
)_
$(prop
).
$(trg_key
) = $($(trg
)_
$(prop
).
$(src_key
))
57 # EXPAND_BY = overriding
59 ## Inherit one keyword in a non-accumulative manner.
60 # @param $(trg) Target object.
61 # @param $(prop) The property.
62 # @param $(src_key) Source keyword.
63 # @param $(trg_key) Target keyword.
64 define def_inherit_one_keyword_overriding_now_l
65 ifdef $(trg
)_
$(prop
).
$(src_key
)
66 ifndef $(trg
)_
$(prop
).
$(trg_key
)
67 $(trg
)_
$(prop
).
$(trg_key
) := $($(trg
)_
$(prop
).
$(src_key
))
72 ## @copydoc def_inherit_one_overriding_now_l
73 define def_inherit_one_keyword_overriding_now_r
74 ifdef $(trg
)_
$(prop
).
$(src_key
)
75 ifndef $(trg
)_
$(prop
).
$(trg_key
)
76 $(trg
)_
$(prop
).
$(trg_key
) := $($(trg
)_
$(prop
).
$(src_key
))
81 ## Inherit one keyword in a non-accumulative manner, deferred expansion.
82 # @param $(trg) Target object.
83 # @param $(prop) The property.
84 # @param $(src_key) Source keyword.
85 # @param $(trg_key) Target keyword.
86 # @remark This define relies on double evaluation
87 define def_inherit_one_keyword_overriding_deferred
88 ifdef $(trg
)_
$(prop
).
$(src_key
)
89 ifndef $(trg
)_
$(prop
).
$(trg_key
)
90 $(trg
)_
$(prop
).
$(trg_key
) = $$($(trg
)_
$(prop
).
$(src_key
))
95 ## @copydoc def_inherit_one_overriding_deferred
96 define def_inherit_one_keyword_overriding_deferred_l
97 ifdef $(trg
)_
$(prop
).
$(src_key
)
98 ifndef $(trg
)_
$(prop
).
$(trg_key
)
99 $(trg
)_
$(prop
).
$(trg_key
) = $$($(trg
)_
$(prop
).
$(src_key
))
104 ## @copydoc def_inherit_one_overriding_deferred
105 define def_inherit_one_keyword_overriding_deferred_r
106 ifdef $(trg
)_
$(prop
).
$(src_key
)
107 ifndef $(trg
)_
$(prop
).
$(trg_key
)
108 $(trg
)_
$(prop
).
$(trg_key
) = $$($(trg
)_
$(prop
).
$(src_key
))
114 # EXPAND_BY = prepending
116 ## Inherit one keyword in a prepending manner.
117 # @param $(trg) Target object.
118 # @param $(prop) The property.
119 # @param $(src_key) Source keyword.
120 # @param $(trg_key) Target keyword.
121 define def_inherit_one_keyword_prepending_now_l
122 ifdef $(trg
)_
$(prop
).
$(src_key
)
123 $(trg
)_
$(prop
).
$(trg_key
) := $($(trg
)_
$(prop
).
$(src_key
)) $($(trg
)_
$(prop
).
$(trg_key
))
127 ## @copydoc def_inherit_one_prepending_now_l
128 define def_inherit_one_keyword_prepending_now_r
129 ifdef $(trg
)_
$(prop
).
$(src_key
)
130 $(trg
)_
$(prop
).
$(trg_key
) := $($(trg
)_
$(prop
).
$(trg_key
)) $($(trg
)_
$(prop
).
$(src_key
))
134 ## Inherit one keyword in a non-accumulative manner, deferred expansion.
135 # @param $(trg) Target object.
136 # @param $(prop) The property.
137 # @param $(src_key) Source keyword.
138 # @param $(trg_key) Target keyword.
139 # @remark This define relies on double evaluation
140 define def_inherit_one_keyword_prepending_deferred
141 ifdef $(trg
)_
$(prop
).
$(src_key
)
142 ifndef $(trg
)_
$(prop
).
$(trg_key
)
143 $(trg
)_
$(prop
).
$(trg_key
) = $$($(trg
)_
$(prop
).
$(src_key
))
148 ## Inherit one keyword in a prepending manner, deferred expansion.
149 # @param $(trg) Target object.
150 # @param $(prop) The property.
151 # @param $(src_key) Source keyword.
152 # @param $(trg_key) Target keyword.
153 define def_inherit_one_keyword_prepending_deferred_l
154 ifdef $(trg
)_
$(prop
).
$(src_key
)
155 ifeq ($$(flavor
$(trg
)_
$(prop
).
$(trg_key
)),simple
)
156 $$(evalcall2 def_simple_2_recursive
,$(trg
)_
$(prop
).
$(trg_key
))
158 $(trg
)_
$(prop
).
$(trg_key
) <= $$($(trg
)_
$(prop
).
$(src_key
))
162 ## @copydoc def_inherit_one_prepending_deferred_l
163 define def_inherit_one_keyword_prepending_deferred_r
164 ifdef $(trg
)_
$(prop
).
$(src_key
)
165 ifeq ($$(flavor
$(trg
)_
$(prop
).
$(trg_key
)),simple
)
166 $$(evalcall2 def_simple_2_recursive
,$(trg
)_
$(prop
).
$(trg_key
))
168 $(trg
)_
$(prop
).
$(trg_key
) += $$($(trg
)_
$(prop
).
$(src_key
))
173 # EXPAND_BY = appending
175 ## Inherit one keyword in an appending manner.
176 # @param $(trg) Target object.
177 # @param $(prop) The property.
178 # @param $(src_key) Source keyword.
179 # @param $(trg_key) Target keyword.
180 define def_inherit_one_keyword_appending_now_l
181 ifdef $(trg
)_
$(prop
).
$(src_key
)
182 $(trg
)_
$(prop
).
$(trg_key
) := $($(trg
)_
$(prop
).
$(trg_key
)) $($(trg
)_
$(prop
).
$(src_key
))
186 ## @copydoc def_inherit_one_appending_now_l
187 define def_inherit_one_keyword_appending_now_r
188 ifdef $(trg
)_
$(prop
).
$(src_key
)
189 $(trg
)_
$(prop
).
$(trg_key
) := $($(trg
)_
$(prop
).
$(src_key
)) $($(trg
)_
$(prop
).
$(trg_key
))
193 ## Inherit one keyword in a non-accumulative manner, deferred expansion.
194 # @param $(trg) Target object.
195 # @param $(prop) The property.
196 # @param $(src_key) Source keyword.
197 # @param $(trg_key) Target keyword.
198 # @remark This define relies on double evaluation
199 define def_inherit_one_keyword_appending_deferred
200 ifdef $(trg
)_
$(prop
).
$(src_key
)
201 ifndef $(trg
)_
$(prop
).
$(trg_key
)
202 $(trg
)_
$(prop
).
$(trg_key
) = $$($(trg
)_
$(prop
).
$(src_key
))
207 ## Inherit one keyword in an appending manner, deferred expansion.
208 # @param $(trg) Target object.
209 # @param $(prop) The property.
210 # @param $(src_key) Source keyword.
211 # @param $(trg_key) Target keyword.
212 define def_inherit_one_keyword_appending_deferred_l
213 ifdef $(trg
)_
$(prop
).
$(src_key
)
214 ifeq ($$(flavor
$(trg
)_
$(prop
).
$(trg_key
)),simple
)
215 $$(evalcall2 def_simple_2_recursive
,$(trg
)_
$(prop
).
$(trg_key
))
217 $(trg
)_
$(prop
).
$(trg_key
) += $$($(trg
)_
$(prop
).
$(src_key
))
221 ## @copydoc def_inherit_one_appending_deferred_l
222 define def_inherit_one_keyword_appending_deferred_r
223 ifdef $(trg
)_
$(prop
).
$(src_key
)
224 ifeq ($$(flavor
$(trg
)_
$(prop
).
$(trg_key
)),simple
)
225 $$(evalcall2 def_simple_2_recursive
,$(trg
)_
$(prop
).
$(trg_key
))
227 $(trg
)_
$(prop
).
$(trg_key
) <= $$($(trg
)_
$(prop
).
$(src_key
))
232 ## Worker for def_inherit that deals with one keyword that makes
233 # use of inheritance.
234 # @param prefix_keyword key_prefix:keyword. The cool join/split game as usual.
235 # @param trg Object to consider for inheriting.
236 # @param properties List of the properties with straight expansion.
237 # @param properties_now_l List of the properties with immediate expansion, accumulating on the left side.
238 # @param properties_now_r List of the properties with immediate expansion, accumulating on the right side.
239 # @param properties_deferred List of the properties with deferred expansion (e.g. function), non-accumulative .
240 # @param properties_deferred_l List of the properties with deferred expansion (e.g. function), accumulating on the left side.
241 # @param properties_deferred_r List of the properties with deferred expansion (e.g. function), accumulating on the right side.
242 define def_inherit_keyword
243 local
prefix := $(word 1,$(subst :, ,$(prefix_keyword
)))
244 local trg_key
:= $(word 2,$(subst :, ,$(prefix_keyword
)))
245 local src_key
:= $($(prefix)_
$(trg_key
)_EXTENDS
)
246 local by
:= $($(prefix)_
$(trg_key
)_EXTENDS_BY
)
248 # Inherit the properties.
249 $(foreach prop
, $(properties
), $(eval
$(def_inherit_one_keyword
)))
250 $(foreach prop
, $(properties_now_l
), $(eval
$(def_inherit_one_keyword_
$(by
)_now_l
)))
251 $(foreach prop
, $(properties_now_r
), $(eval
$(def_inherit_one_keyword_
$(by
)_now_r
)))
252 $(foreach prop
, $(properties_deferred
), $(eval
$(def_inherit_one_keyword_
$(by
)_deferred
)))
253 $(foreach prop
, $(properties_deferred_l
), $(eval
$(def_inherit_one_keyword_
$(by
)_deferred_l
)))
254 $(foreach prop
, $(properties_deferred_r
), $(eval
$(def_inherit_one_keyword_
$(by
)_deferred_r
)))
256 endef # def_inherit_keyword
259 ## Inherit one template property in a non-accumulative manner.
260 # @param $(prop) Property name
261 # @param $(src) Source (parent) object.
262 # @param $(trg) Target (child) object.
263 define def_inherit_one
265 ifndef $(trg
)_
$(prop
)
266 $(trg
)_
$(prop
) = $($(src
)_
$(prop
))
272 # EXPAND_BY = overriding
274 ## Inherit one template property in a non-accumulative manner.
275 # @param $(prop) Property name
276 # @param $(src) Source (parent) object.
277 # @param $(trg) Target (child) object.
278 define def_inherit_one_overriding_now_l
280 ifndef $(trg
)_
$(prop
)
281 $(trg
)_
$(prop
) := $($(src
)_
$(prop
))
286 ## @copydoc def_inherit_one_overriding_now_l
287 define def_inherit_one_overriding_now_r
289 ifndef $(trg
)_
$(prop
)
290 $(trg
)_
$(prop
) := $($(src
)_
$(prop
))
295 ## Inherit one template property in a non-accumulative manner, deferred expansion.
296 # @param $(prop) Property name
297 # @param $(src) Source
298 # @param $(trg) Target
299 # @remark This define relies on double evaluation
300 define def_inherit_one_overriding_deferred
302 ifndef $(trg
)_
$(prop
)
303 $(trg
)_
$(prop
) = $$($(src
)_
$(prop
))
308 ## @copydoc def_inherit_one_overriding_deferred
309 define def_inherit_one_overriding_deferred_l
311 ifndef $(trg
)_
$(prop
)
312 $(trg
)_
$(prop
) = $$($(src
)_
$(prop
))
317 ## @copydoc def_inherit_one_overriding_deferred
318 define def_inherit_one_overriding_deferred_r
320 ifndef $(trg
)_
$(prop
)
321 $(trg
)_
$(prop
) = $$($(src
)_
$(prop
))
327 # EXPAND_BY = prepending
329 ## Inherit one template property in a prepending manner.
330 # @param $(prop) Property name
331 # @param $(src) Source (parent) object.
332 # @param $(trg) Target (child) object.
333 define def_inherit_one_prepending_now_l
335 $(trg
)_
$(prop
) := $($(src
)_
$(prop
)) $($(trg
)_
$(prop
))
339 ## @copydoc def_inherit_one_prepending_now_l
340 define def_inherit_one_prepending_now_r
342 $(trg
)_
$(prop
) := $($(trg
)_
$(prop
)) $($(src
)_
$(prop
))
346 ## Inherit one template property in a non-accumulative manner, deferred expansion.
347 # @param $(prop) Property name
348 # @param $(src) Source
349 # @param $(trg) Target
350 # @remark This define relies on double evaluation
351 define def_inherit_one_prepending_deferred
353 ifndef $(trg
)_
$(prop
)
354 $(trg
)_
$(prop
) = $$($(src
)_
$(prop
))
359 ## Inherit one template property in a prepending manner, deferred expansion.
360 # @param $(prop) Property name
361 # @param $(src) Source (parent) object.
362 # @param $(trg) Target (child) object.
363 define def_inherit_one_prepending_deferred_l
365 ifeq ($$(flavor
$(trg
)_
$(prop
)),simple
)
366 $$(evalcall2 def_simple_2_recursive
,$(trg
)_
$(prop
))
368 $(trg
)_
$(prop
) <= $$($(src
)_
$(prop
))
372 ## @copydoc def_inherit_one_prepending_deferred_l
373 define def_inherit_one_prepending_deferred_r
375 ifeq ($$(flavor
$(trg
)_
$(prop
)),simple
)
376 $$(evalcall2 def_simple_2_recursive
,$(trg
)_
$(prop
))
378 $(trg
)_
$(prop
) += $$($(src
)_
$(prop
))
383 # EXPAND_BY = appending
385 ## Inherit one template property in an appending manner.
386 # @param $(prop) Property name
387 # @param $(src) Source (parent) object.
388 # @param $(trg) Target (child) object.
389 define def_inherit_one_appending_now_l
391 $(trg
)_
$(prop
) := $($(trg
)_
$(prop
)) $($(src
)_
$(prop
))
395 ## @copydoc def_inherit_one_appending_now_l
396 define def_inherit_one_appending_now_r
398 $(trg
)_
$(prop
) := $($(src
)_
$(prop
)) $($(trg
)_
$(prop
))
402 ## Inherit one template property in a non-accumulative manner, deferred expansion.
403 # @param $(prop) Property name
404 # @param $(src) Source
405 # @param $(trg) Target
406 # @remark This define relies on double evaluation
407 define def_inherit_one_appending_deferred
409 ifndef $(trg
)_
$(prop
)
410 $(trg
)_
$(prop
) = $$($(src
)_
$(prop
))
415 ## Inherit one template property in an appending manner, deferred expansion.
416 # @param $(prop) Property name
417 # @param $(src) Source (parent) object.
418 # @param $(trg) Target (child) object.
419 define def_inherit_one_appending_deferred_l
421 ifeq ($$(flavor
$(trg
)_
$(prop
)),simple
)
422 $$(evalcall2 def_simple_2_recursive
,$(trg
)_
$(prop
))
424 $(trg
)_
$(prop
) += $$($(src
)_
$(prop
))
428 ## @copydoc def_inherit_one_appending_deferred_l
429 define def_inherit_one_appending_deferred_r
431 ifeq ($$(flavor
$(trg
)_
$(prop
)),simple
)
432 $$(evalcall2 def_simple_2_recursive
,$(trg
)_
$(prop
))
434 $(trg
)_
$(prop
) <= $$($(src
)_
$(prop
))
439 ## combines the specified properties $(1) with the $(_KEYWORDS) list.
440 _INHERIT_JOIN_KEYWORDS
= $(1) $(foreach keyword
,$(_KEYWORDS
), $(addsuffix .
$(keyword
), $(1)))
443 ## Generic inheritance for use with targets templates and tools.
444 # @param trg Object to consider for inheriting.
445 # @param src_prefix What to prefix the value found in EXTENDS with to get the object.
446 # @param load_function Load function for stuff that needs
447 # @param properties List of the properties with straight expansion.
448 # @param properties_now_l List of the properties with immediate expansion, accumulating on the left side.
449 # @param properties_now_r List of the properties with immediate expansion, accumulating on the right side.
450 # @param properties_deferred List of the properties with deferred expansion (e.g. function), non-accumulative .
451 # @param properties_deferred_l List of the properties with deferred expansion (e.g. function), accumulating on the left side.
452 # @param properties_deferred_r List of the properties with deferred expansion (e.g. function), accumulating on the right side.
455 # Load it - loading is a mess, fix.
456 ifneq ($(load_function
),)
457 local loading
:= $(patsubst $(src_prefix
)%,%,$(trg
))
458 $(evalvalctx
$(load_function
))
461 local src
:= $(strip $($(trg
)_EXTENDS
))
463 ifndef $(trg
)_EXTENDS_STATUS_
464 $(trg
)_EXTENDS_STATUS_
:= 0
467 ifneq ($(load_function
),)
468 local loading
:= $(src
)
469 $(evalvalctx
$(load_function
))
473 local src
:= $(src_prefix
)$(src
)
475 # Recursivly process the parent (src) if it's inherting from somebody too.
477 ifneq ($($(src
)_EXTENDS_STATUS_
),42)
478 # 'foreach' will create 'trg' in a new variable context hiding
479 # out current variable. 'src' OTOH will be overwritten.
480 $(foreach trg
, $(src
), $(evalval def_inherit
))
481 local src
:= $(src_prefix
)$(strip $($(trg
)_EXTENDS
))
485 # Get & check EXTENDS_BY.
486 local by
= $(strip $($(trg
)_EXTENDS_BY
))
488 local by
= overriding
489 else ifn1of
($(by
), overriding appending prepending
)
490 $(error kBuild
: Invalid EXTENDS_BY value
'$(by)' on
'$(trg)'!)
493 # Inherit the properties.
494 $(foreach prop
, $(call _INHERIT_JOIN_KEYWORDS
,$(properties
)), $(eval
$(def_inherit_one
)))
495 $(foreach prop
, $(call _INHERIT_JOIN_KEYWORDS
,$(properties_now_l
)), $(eval
$(def_inherit_one_
$(by
)_now_l
)))
496 $(foreach prop
, $(call _INHERIT_JOIN_KEYWORDS
,$(properties_now_r
)), $(eval
$(def_inherit_one_
$(by
)_now_r
)))
497 $(foreach prop
, $(call _INHERIT_JOIN_KEYWORDS
,$(properties_deferred
)), $(eval
$(def_inherit_one_
$(by
)_deferred
)))
498 $(foreach prop
, $(call _INHERIT_JOIN_KEYWORDS
,$(properties_deferred_l
)), $(eval
$(def_inherit_one_
$(by
)_deferred_l
)))
499 $(foreach prop
, $(call _INHERIT_JOIN_KEYWORDS
,$(properties_deferred_r
)), $(eval
$(def_inherit_one_
$(by
)_deferred_r
)))
501 # Mark the target as done.
502 $(trg
)_EXTENDS_STATUS_
:= 42
504 # Check for inheritance loops.
505 ifneq ($($(trg
)_EXTENDS_STATUS_
),42)
506 $(error kBuild
: Target inheritance loop
! target
=$(trg
) $(trg
)_EXTENDS_STATUS_
=$($(trg
)_EXTENDS_STATUS_
))
511 # Keyword inheritance.
512 $(foreach prefix_keyword
, $(join $(_KEYWORDS_PREFIX
), $(addprefix :,$(_KEYWORDS_EXTENDS
))), $(evalval def_inherit_keyword
))
518 # Load global units before doing any inheriting so they can add new properties.
520 # This only applies to the guys listed in the global USES since there is
521 # no reliable way to deal with things on a target level without first
522 # applying templates. So, to avoid having USES mess up all targets,
523 # we'll make the global and per-target USES property work differently:
524 # The global USES does not apply to targets, just globally.
527 ## Unit load function.
528 # @param loading The unit name
529 define def_unit_load_function
530 ifndef UNIT_
$(loading
)
531 UNIT_
$(loading
)_KMK_FILE
:= $(firstword $(foreach path
, $(KBUILD_UNIT_PATHS
) $(KBUILD_PATH
)/units
$(KBUILD_DEFAULT_PATHS
), $(wildcard $(path
)/$(loading
).kmk
)))
532 ifeq ($(UNIT_
$(loading
)_KMK_FILE
),)
533 $(error kBuild
: Cannot find
include file for the unit
'$(loading)'! Searched
: $(KBUILD_UNIT_PATHS
) $(KBUILD_PATH
)/units
$(KBUILD_DEFAULT_PATHS
))
535 include $(UNIT_
$(loading
)_KMK_FILE
)
536 ifndef UNIT_
$(loading
)
537 $(warning kBuild
: UNIT_
$(loading
) was not defined by
$(UNIT_
$(loading
)_KMK_FILE
)!)
540 endef # def_unit_load_function
543 $(USES.
$(KBUILD_TARGET
).
$(KBUILD_TARGET_ARCH
)) \
544 $(USES.
$(KBUILD_TARGET_CPU
)) \
545 $(USES.
$(KBUILD_TARGET_ARCH
)) \
546 $(USES.
$(KBUILD_TARGET
)) \
547 $(USES.
$(KBUILD_HOST
).
$(KBUILD_HOST_ARCH
)) \
548 $(USES.
$(KBUILD_HOST_CPU
)) \
549 $(USES.
$(KBUILD_HOST_ARCH
)) \
550 $(USES.
$(KBUILD_TARGET
)) \
551 $(USES.
$(KBUILD_TYPE
)) \
552 $(USES
),$(evalval def_unit_load_function
))
556 # Determin all the templates that is being used and make
557 # sure they are present before we try collect keywords.
559 _TEMPLATES
:= $(TEMPLATE
)
561 ifdef $(target
)_TEMPLATE
562 ifneq ("$($(target)_TEMPLATE)","$(strip $($(target)_TEMPLATE))")
563 $$(error kBuild
: The template name of target
'$(target)' contains tabs
($($(target
)_TEMPLATE
))). Please remove them
)
565 _TEMPLATES
+= $($(target
)_TEMPLATE
)
567 endef # def_templates
568 $(foreach target
, $(_ALL_TARGETS
), $(eval
$(def_templates
)))
569 _TEMPLATES
:= $(sort $(_TEMPLATES
))
571 ## Template load function.
572 # @param loading The template name. This is prefixed.
573 define def_templates_load_function
574 ifndef TEMPLATE_
$(loading
)
575 TEMPLATE_
$(loading
)_KMK_FILE
:= $(firstword $(foreach path
, $(KBUILD_TEMPLATE_PATHS
) $(KBUILD_PATH
)/templates
$(KBUILD_DEFAULT_PATHS
), $(wildcard $(path
)/$(loading
).kmk
)))
576 ifeq ($(TEMPLATE_
$(loading
)_KMK_FILE
),)
577 $(error kBuild
: Cannot find
include file for the template
'$(loading)'! Searched
: $(KBUILD_TEMPLATE_PATHS
) $(KBUILD_PATH
)/templates
$(KBUILD_DEFAULT_PATHS
) Used by target
(s
): $(strip $(foreach target
, $(_ALL_TARGETS
),$(if-expr
"$($(target)_TEMPLATE)" == "$(loading)",$(target
) (in
$(where
$(target
)_TEMPLATE
)),))))
579 include $(TEMPLATE_
$(loading
)_KMK_FILE
)
580 ifndef TEMPLATE_
$(loading
)
581 $(warning kBuild
: TEMPLATE_
$(loading
) was not defined by
$(TEMPLATE_
$(loading
)_KMK_FILE
)!)
584 endef # def_templates_load_function
585 $(foreach loading
, $(_TEMPLATES
), $(evalval def_templates_load_function
))
589 # Determin the keywords required for correct inherting and setup keyword inheritance.
591 # This means walking all the lists of immediate template and targets and
592 # pick up all the BLD_T* keywords. Since templates that are referenced
593 # indirectly in the inheritance hierarchy, the result from this exercise
594 # might not be 100% accurate... :-/
596 _BLD_TYPES
:= $(KBUILD_TYPE
)
597 _BLD_TARGETS
:= $(KBUILD_TARGET
) $(KBUILD_HOSTS
)
598 _BLD_ARCHES
:= $(KBUILD_TARGET_ARCH
) $(KBUILD_HOST_ARCH
)
599 _BLD_CPUS
:= $(KBUILD_TARGET_CPU
) $(KBUILD_HOST_CPU
)
601 define def_collect_bld_xyz
602 ifdef $(src
)_BLD_TYPE
603 ifn1of
($($(src
)_BLD_TYPE
), $(KBUILD_BLD_TYPES
))
604 $(error kBuild
: $(src
)_BLD_TYPE
=$($(src
)_BLD_TYPE
) not in KBUILD_BLD_TYPES
={$(KBUILD_BLD_TYPES
)}!)
606 _BLD_TYPES
+= $($(src
)_BLD_TYPE
)
609 ifn1of
($($(src
)_BLD_TRG
), $(KBUILD_OSES
))
610 $(error kBuild
: $(src
)_BLD_TRG
=$($(src
)_BLD_TRG
) not in KBUILD_OSES
={$(KBUILD_OSES
)}!)
612 _BLD_TARGETS
+= $($(src
)_BLD_TRG
)
614 ifdef $(src
)_BLD_TRG_ARCH
615 ifn1of
($($(src
)_BLD_TRG_ARCH
), $(KBUILD_ARCHES
))
616 $(error kBuild
: $(src
)_BLD_TRG_ARCH
=$($(src
)_BLD_TRG_ARCH
) not in KBUILD_ARCHES
={$(KBUILD_ARCHES
)}!)
618 _BLD_ARCHES
+= $($(src
)_BLD_TRG_ARCH
)
620 ifdef $(src
)_BLD_TRG_CPU
621 if1of
($($(src
)_BLD_CPU
), $(KBUILD_ARCHES
) $(KBUILD_OSES
) $(KBUILD_BLD_TYPES
))
622 $(error kBuild
: $(src
)_BLD_TRG_CPU
=$($(src
)_BLD_TRG_CPU
) found in KBUILD_ARCHES
, KBUILD_OSES or KBUILD_BLD_TYPES
!)
624 _BLD_CPUS
+= $($(src
)_BLD_TRG_CPU
)
626 endef # def_collect_bld_xyz
627 $(foreach src
, $(addprefix TEMPLATE_
, $(_TEMPLATES
)) $(_ALL_TARGETS
) \
628 ,$(evalval def_collect_bld_xyz
))
630 # Drop duplicate values.
631 # WARNING! These list might not include keywords only involved in inheritance.
632 _BLD_TYPES
:= $(sort $(_BLD_TYPES
))
633 _BLD_TARGETS
:= $(sort $(_BLD_TARGETS
))
634 _BLD_ARCHES
:= $(sort $(_BLD_ARCHES
))
635 _BLD_CPUS
:= $(sort $(_BLD_CPUS
))
637 ## Look for keywords which extends others and order them.
641 define def_keyword_ordering
642 # Check for EXTENDS, fix and validate it if found.
643 local src
:= $(strip $($(prefix)_
$(keyword
)_EXTENDS
))
645 ifndef $(prefix)_
$(keyword
)_EXTENDS_STATUS_
646 ifn1of
($(src
), $(valid
))
647 $(error kBuild
: $(keyword
) tries to extend unknown keyword
'$(src)'! (known
= $(valid
)))
650 # Recursivly process the parent (src).
651 ifneq ($($(prefix)_
$(src
)_EXTENDS_STATUS_
),42)
652 $(prefix)_
$(keyword
)_EXTENDS_STATUS_
:= 0
653 # 'foreach' will create 'keyword' in a new variable context hiding
654 # out current variable. 'src' OTOH will be overwritten.
655 $(foreach keyword
, $(src
), $(evalval def_keyword_ordering
))
656 local src
:= $(strip $($(prefix)_
$(keyword
)_EXTENDS
))
659 # Check and strip EXTENDS_BY.
660 local by
= $(strip $($(prefix)_
$(keyword
)_EXTENDS_BY
))
662 local by
= overriding
663 else ifn1of
($(by
), overriding appending prepending
)
664 $(error kBuild
: Invalid EXTENDS_BY value
'$(by)' on
'$(keyword)'!)
667 # Update the attributes with stripped
668 $(prefix)_
$(keyword
)_EXTENDS_BY
:= $(by
)
669 $(prefix)_
$(keyword
)_EXTENDS
:= $(src
)
671 # Add it to the list and mark it as done.
672 _KEYWORDS_EXTENDS
+= $(keyword
)
673 _KEYWORDS_PREFIX
+= $(prefix)
674 $(prefix)_
$(keyword
)_EXTENDS_STATUS_
:= 42
676 # Check for inheritance loops.
677 ifneq ($($(trg
)_EXTENDS_STATUS_
),42)
678 $(error kBuild
: Keyword inheritance loop
! keyword
=$(keyword
) $(prefix)_
$(keyword
)_EXTENDS_STATUS_
=$($(prefix)_
$(keyword
)_EXTENDS_STATUS_
))
682 # Add it to the ordered list and mark it as done.
683 _KEYWORDS_ORDERED
+= $(keyword
)
684 $(prefix)_
$(src
)_EXTENDS_STATUS_
:= 42
686 endef # def_keyword_ordering
687 $(eval-opt-var def_keyword_ordering
)
689 # Look for keywords which extends others and their parents, and from this
690 # construct two lists.
696 valid
:= $(KBUILD_BLD_TYPES
)
697 $(foreach keyword
, $(_BLD_TYPES
) , $(evalval def_keyword_ordering
))
700 valid
:= $(KBUILD_OSES
)
701 $(foreach keyword
, $(_BLD_TARGETS
), $(evalval def_keyword_ordering
))
704 valid
:= $(KBUILD_ARCHES
)
705 $(foreach keyword
, $(_BLD_ARCHES
) , $(evalval def_keyword_ordering
))
708 valid
:= $(KBUILD_CPUS
)
709 $(foreach keyword
, $(_BLD_CPUS
) , $(evalval def_keyword_ordering
))
711 ## @todo Inherit bld_trg.bld_arch for too?
713 # Construct all the possible keywords.
714 _KEYWORDS
:= $(_KEYWORDS_ORDERED
) $(_KEYWORDS_EXTENDS
) \
715 $(foreach bld_trg
,$(_BLD_TARGETS
),$(addprefix $(bld_trg
).
,$(_BLD_ARCHES
)))
717 ifdef KBUILD_PROFILE_SELF
718 $(evalcall def_profile_self
, done keywords
)
723 # Target inheritance.
725 # This has to be done on a per target list basis as to avoid adding
726 # incorrect properties that will wast memory, time, and may confuse
727 # later strictness checks. This also has to be done *before* templates
728 # are applied to the targets. Since we're doing that part rather
729 # early on, the target inheritance feature is a bit restricted at
730 # the moment. However, this will be addressed in a little(?) while.
735 properties_deferred_l
:=
736 properties_deferred_r
:=
739 properties
:= $(PROPS_FETCHES_SINGLE
)
740 properties_now_l
:= $(PROPS_FETCHES_ACCUMULATE_L
)
741 properties_now_r
:= $(PROPS_FETCHES_ACCUMULATE_R
)
742 properties_deferred
:= $(PROPS_FETCHES_DEFERRED
)
743 $(foreach trg
, $(_ALL_FETCHES
),$(evalval def_inherit
))
745 ## Patches. - not implemented yet.
746 #properties := $(PROPS_PATCHES_SINGLE)
747 #properties_now_l := $(PROPS_PATCHES_ACCUMULATE_L)
748 #properties_now_r := $(PROPS_PATCHES_ACCUMULATE_R)
749 #properties_deferred := $(PROPS_PATCHES_DEFERRED)
750 #$(foreach trg, $(_ALL_PATCHES),$(evalval def_inherit))
752 # Programs and build programs.
753 properties
:= $(PROPS_PROGRAMS_SINGLE
)
754 properties_now_l
:= $(PROPS_PROGRAMS_ACCUMULATE_L
)
755 properties_now_r
:= $(PROPS_PROGRAMS_ACCUMULATE_R
)
756 properties_deferred
:= $(PROPS_PROGRAMS_DEFERRED
)
757 $(foreach trg
, $(_ALL_BLDPROGS
) $(_ALL_PROGRAMS
),$(evalval def_inherit
))
759 # Libraries and import libraries.
760 properties
:= $(PROPS_LIBRARIES_SINGLE
)
761 properties_now_l
:= $(PROPS_LIBRARIES_ACCUMULATE_L
)
762 properties_now_r
:= $(PROPS_LIBRARIES_ACCUMULATE_R
)
763 properties_deferred
:= $(PROPS_LIBRARIES_DEFERRED
)
764 if1of
($(KBUILD_TARGET
), nt os2 win
)
765 $(foreach trg
, $(_ALL_LIBRARIES
) $(_ALL_IMPORT_LIBS
),$(evalval def_inherit
))
767 $(foreach trg
, $(_ALL_LIBRARIES
),$(evalval def_inherit
))
771 properties
:= $(PROPS_DLLS_SINGLE
)
772 properties_now_l
:= $(PROPS_DLLS_ACCUMULATE_L
)
773 properties_now_r
:= $(PROPS_DLLS_ACCUMULATE_R
)
774 properties_deferred
:= $(PROPS_DLLS_DEFERRED
)
775 if1of
($(KBUILD_TARGET
), nt os2 win
)
776 $(foreach trg
, $(_ALL_DLLS
),$(evalval def_inherit
))
778 $(foreach trg
, $(_ALL_DLLS
) $(_ALL_IMPORT_LIBS
),$(evalval def_inherit
))
782 properties
:= $(PROPS_SYSMODS_SINGLE
)
783 properties_now_l
:= $(PROPS_SYSMODS_ACCUMULATE_L
)
784 properties_now_r
:= $(PROPS_SYSMODS_ACCUMULATE_R
)
785 properties_deferred
:= $(PROPS_SYSMODS_DEFERRED
)
786 $(foreach trg
, $(_ALL_SYSMODS
),$(evalval def_inherit
))
789 properties
:= $(PROPS_MISCBINS_SINGLE
)
790 properties_now_l
:= $(PROPS_MISCBINS_ACCUMULATE_L
)
791 properties_now_r
:= $(PROPS_MISCBINS_ACCUMULATE_R
)
792 properties_deferred
:= $(PROPS_MISCBINS_DEFERRED
)
793 $(foreach trg
, $(_ALL_MISCBINS
),$(evalval def_inherit
))
796 properties
:= $(PROPS_INSTALLS_SINGLE
)
797 properties_now_l
:= $(PROPS_INSTALLS_ACCUMULATE_L
)
798 properties_now_r
:= $(PROPS_INSTALLS_ACCUMULATE_R
)
799 properties_deferred
:= $(PROPS_INSTALLS_DEFERRED
)
800 $(foreach trg
, $(_ALL_INSTALLS
),$(evalval def_inherit
))
802 ifdef KBUILD_PROFILE_SELF
803 $(evalcall def_profile_self
, done target inheritance
)
808 # Template Inheritance.
810 # This is much the same as with target inheritance, except we cannot
811 # restrict the properties involved since we haven't got a clue which
812 # target platforms/archs are using them. But, we can drop the instance
813 # expansion we're doing for targets since there won't be any more
814 # changes to either the source nor the target templates beyond this
818 src_prefix
:= TEMPLATE_
819 load_function
:= def_templates_load_function
823 properties_deferred
:= $(PROPS_SINGLE
) $(PROPS_DEFERRED
)
824 properties_deferred_l
:= $(PROPS_ACCUMULATE_L
)
825 properties_deferred_r
:= $(PROPS_ACCUMULATE_R
)
826 $(foreach trg
, $(addprefix TEMPLATE_
,$(_TEMPLATES
)),$(evalval def_inherit
))
834 properties_deferred
:=
835 properties_deferred_l
:=
836 properties_deferred_r
:=
838 ifdef KBUILD_PROFILE_SELF
839 $(evalcall def_profile_self
, done template inheritance
)
846 # Template/Target Expansion.
848 # Extend all targets with the values from the template. Doing this up front
849 # allows more generic code and less mess down in the pass 2 target handling.
850 # However it does eat a good deal of memory.
853 define def_inherit_template_workaround_target
854 local _tmpl
:= $(firstword $($(target
)_TEMPLATE
) $(TEMPLATE
))
855 local _bld_type
:= $(firstword $($(target
)_BLD_TYPE
) $(TEMPLATE_
$(_tmpl
)_BLD_TYPE
) $(KBUILD_TYPE
))
856 local _bld_trg
:= $(firstword $($(target
)_BLD_TRG
) $(TEMPLATE_
$(_tmpl
)_BLD_TRG
) $(KBUILD_TARGET
))
857 local _bld_trg_arch
:= $(firstword $($(target
)_BLD_TRG_ARCH
) $(TEMPLATE_
$(_tmpl
)_BLD_TRG_ARCH
) $(KBUILD_TARGET_ARCH
))
858 local _bld_trg_cpu
:= $(firstword $($(target
)_BLD_TRG_CPU
) $(TEMPLATE_
$(_tmpl
)_BLD_TRG_CPU
) $(KBUILD_TARGET_CPU
))
859 $(kb-exp-tmpl
1,$(target
),$(_bld_trg
),$(_bld_trg_arch
),$(_bld_trg_cpu
),$(_bld_type
))
860 endef # def_inherit_template_workaround_target
861 #$(kb-exp-tmpl 1,$(_ALL_TARGET_TARGETS),$(KBUILD_TARGET),$(KBUILD_TARGET_ARCH),$(KBUILD_TARGET_CPU),$(KBUILD_TYPE))
862 $(foreach target
,$(_ALL_TARGET_TARGETS
),$(evalval def_inherit_template_workaround_target
))
864 define def_inherit_template_workaround_host
865 local _tmpl
:= $(firstword $($(target
)_TEMPLATE
) $(TEMPLATE
))
866 local _bld_type
:= $(firstword $($(target
)_BLD_TYPE
) $(TEMPLATE_
$(_tmpl
)_BLD_TYPE
) $(KBUILD_TYPE
))
867 local _bld_trg
:= $(firstword $($(target
)_BLD_TRG
) $(TEMPLATE_
$(_tmpl
)_BLD_TRG
) $(KBUILD_HOST
))
868 local _bld_trg_arch
:= $(firstword $($(target
)_BLD_TRG_ARCH
) $(TEMPLATE_
$(_tmpl
)_BLD_TRG_ARCH
) $(KBUILD_HOST_ARCH
))
869 local _bld_trg_cpu
:= $(firstword $($(target
)_BLD_TRG_CPU
) $(TEMPLATE_
$(_tmpl
)_BLD_TRG_CPU
) $(KBUILD_HOST_CPU
))
870 $(kb-exp-tmpl
1,$(target
),$(_bld_trg
),$(_bld_trg_arch
),$(_bld_trg_cpu
),$(_bld_type
))
871 endef # def_inherit_template_workaround_target
872 #$(kb-exp-tmpl 1,$(_ALL_HOST_TARGETS),$(KBUILD_HOST),$(KBUILD_HOST_ARCH),$(KBUILD_HOST_CPU),$(KBUILD_TYPE))
873 $(foreach target
,$(_ALL_HOST_TARGETS
),$(evalval def_inherit_template_workaround_host
))
875 ifdef KBUILD_PROFILE_SELF
876 $(evalcall def_profile_self
, done template
/target expansion
)
881 # Include tools, sdks and units.
883 # The first part of this exercise is to figure out which TOOLS and SDKS
884 # that should be included.
886 _TOOLS
:= $(TOOL.
$(KBUILD_TARGET
)) $(TOOL.
$(KBUILD_TARGET_ARCH
)) $(TOOL.
$(KBUILD_TARGET
).
$(KBUILD_TARGET_ARCH
)) \
887 $(TOOL.
$(KBUILD_HOST
)) $(TOOL.
$(KBUILD_HOST_ARCH
)) $(TOOL.
$(KBUILD_HOST
).
$(KBUILD_HOST_ARCH
)) \
889 _SDKS
:= $(SDKS.
$(KBUILD_TARGET
)) $(SDKS.
$(KBUILD_TARGET_ARCH
)) $(SDKS.
$(KBUILD_TARGET
).
$(KBUILD_TARGET_ARCH
)) \
890 $(SDKS.
$(KBUILD_HOST
)) $(SDKS.
$(KBUILD_HOST_ARCH
)) $(SDKS.
$(KBUILD_HOST
).
$(KBUILD_HOST_ARCH
)) \
891 $(SDKS.
$(KBUILD_TYPE
)) \
893 _USES
:= $(USES.
$(KBUILD_TARGET
)) $(USES.
$(KBUILD_TARGET_ARCH
)) $(USES.
$(KBUILD_TARGET
).
$(KBUILD_TARGET_ARCH
)) \
894 $(USES.
$(KBUILD_HOST
)) $(USES.
$(KBUILD_HOST_ARCH
)) $(USES.
$(KBUILD_HOST
).
$(KBUILD_HOST_ARCH
)) \
895 $(USES.
$(KBUILD_TYPE
)) \
897 define def_tools_sdks_target_source
898 $(eval _TOOLS
+= $(foreach prop
, $(PROPS_TOOLS
), \
899 $($(source
)_
$(prop
).
$(_bld_trg
)) \
900 $($(target
)_
$(source
)_
$(prop
).
$(_bld_trg
)) \
901 $($(source
)_
$(prop
).
$(_bld_trg
).
$(_bld_trg_arch
)) \
902 $($(target
)_
$(source
)_
$(prop
).
$(_bld_trg
).
$(_bld_trg_arch
)) \
903 $($(source
)_
$(prop
).
$(_bld_trg_arch
)) \
904 $($(target
)_
$(source
)_
$(prop
).
$(_bld_trg_arch
)) \
905 $($(source
)_
$(prop
)) \
906 $($(target
)_
$(source
)_
$(prop
))))
908 $($(source
)_SDKS.
$(_bld_trg
)) \
909 $($(target
)_
$(source
)_SDKS.
$(_bld_trg
)) \
910 $($(source
)_SDKS.
$(_bld_trg
).
$(_bld_trg_arch
)) \
911 $($(target
)_
$(source
)_SDKS.
$(_bld_trg
).
$(_bld_trg_arch
)) \
912 $($(source
)_SDKS.
$(_bld_trg_arch
)) \
913 $($(target
)_
$(source
)_SDKS.
$(_bld_trg_arch
)) \
914 $($(source
)_SDKS.
$(KBUILD_TYPE
)) \
915 $($(target
)_
$(source
)_SDKS.
$(KBUILD_TYPE
)) \
917 $($(target
)_
$(source
)_SDKS
))
919 $($(source
)_USES.
$(_bld_trg
)) \
920 $($(target
)_
$(source
)_USES.
$(_bld_trg
)) \
921 $($(source
)_USES.
$(_bld_trg
).
$(_bld_trg_arch
)) \
922 $($(target
)_
$(source
)_USES.
$(_bld_trg
).
$(_bld_trg_arch
)) \
923 $($(source
)_USES.
$(_bld_trg_arch
)) \
924 $($(target
)_
$(source
)_USES.
$(_bld_trg_arch
)) \
925 $($(source
)_USES.
$(KBUILD_TYPE
)) \
926 $($(target
)_
$(source
)_USES.
$(KBUILD_TYPE
)) \
928 $($(target
)_
$(source
)_USES
))
929 endef # def_tools_sdks_target_source
930 $(eval-opt-var def_tools_sdks_target_source
)
932 define def_tools_sdks_target
933 local _bld_type
:= $(firstword $($(target
)_BLD_TYPE
) $(KBUILD_TYPE
))
934 local _bld_trg
:= $(firstword $($(target
)_BLD_TRG
) $(bld_trg
))
935 local _bld_trg_arch
:= $(firstword $($(target
)_BLD_TRG_ARCH
) $(bld_trg_arch
))
936 local _bld_trg_cpu
:= $(firstword $($(target
)_BLD_TRG_CPU
) $(bld_trg_cpu
))
938 $(eval _TOOLS
+= $(foreach prop
, $(PROPS_TOOLS
), \
939 $($(target
)_
$(prop
).
$(_bld_trg
)) \
940 $($(target
)_
$(prop
).
$(_bld_trg_arch
)) \
941 $($(target
)_
$(prop
).
$(_bld_trg
).
$(_bld_trg_arch
)) \
942 $($(target
)_
$(prop
))))
944 $($(target
)_SDKS.
$(_bld_trg
)) \
945 $($(target
)_SDKS.
$(_bld_trg_arch
)) \
946 $($(target
)_SDKS.
$(_bld_trg
).
$(_bld_trg_arch
)) \
949 $($(target
)_USES.
$(_bld_trg
)) \
950 $($(target
)_USES.
$(_bld_trg_arch
)) \
951 $($(target
)_USES.
$(_bld_trg
).
$(_bld_trg_arch
)) \
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 , $(evalval def_tools_sdks_target_source
))
961 endef # def_tools_sdks_target
962 $(eval-opt-var def_tools_sdks_target
)
964 define def_tools_srcname_target
965 local _bld_type
:= $(firstword $($(target
)_BLD_TYPE
) $(KBUILD_TYPE
))
966 local _bld_trg
:= $(firstword $($(target
)_BLD_TRG
) $(bld_trg
))
967 local _bld_trg_arch
:= $(firstword $($(target
)_BLD_TRG_ARCH
) $(bld_trg_arch
))
968 local _bld_trg_cpu
:= $(firstword $($(target
)_BLD_TRG_CPU
) $(bld_trg_cpu
))
970 $(foreach source
, $(notdir\
971 $($(target
)_SOURCES.
$(_bld_trg
)) \
972 $($(target
)_SOURCES.
$(_bld_trg_arch
)) \
973 $($(target
)_SOURCES.
$(_bld_trg
).
$(_bld_trg_arch
)) \
974 $($(target
)_SOURCES.
$(_bld_trg_cpu
)) \
975 $($(target
)_SOURCES.
$(_bld_type
)) \
976 $($(target
)_SOURCES
) \
977 ), $(evalval def_tools_sdks_target_source
))
978 endef # def_tools_srcname_target
979 $(eval-opt-var def_tools_srcname_target
)
981 bld_trg
:= $(KBUILD_TARGET
)
982 bld_trg_arch
:= $(KBUILD_TARGET_ARCH
)
983 bld_trg_cpu
:= $(KBUILD_TARGET_CPU
)
984 $(foreach target
, $(_ALL_TARGET_TARGETS
), $(evalval def_tools_sdks_target
))
985 $(foreach target
, $(_ALL_SRCNAME_TARGETS
), $(evalval def_tools_srcname_target
))
987 bld_trg
:= $(KBUILD_HOST
)
988 bld_trg_arch
:= $(KBUILD_HOST_ARCH
)
989 bld_trg_cpu
:= $(KBUILD_HOST_CPU
)
990 $(foreach target
, $(_ALL_HOST_TARGETS
), $(evalval def_tools_sdks_target
))
992 _TOOLS
:= $(sort $(_TOOLS
))
993 _SDKS
:= $(sort $(_SDKS
))
995 ## Tool load function.
996 # @param loading The tool name
997 define def_tools_load_function
998 ifndef TOOL_
$(loading
)
999 TOOL_
$(loading
)_KMK_FILE
:= $(firstword $(foreach path
, $(KBUILD_TOOL_PATHS
) $(KBUILD_PATH
)/tools
$(KBUILD_DEFAULT_PATHS
), $(wildcard $(path
)/$(loading
).kmk
)))
1000 ifeq ($(TOOL_
$(loading
)_KMK_FILE
),)
1001 $(error kBuild
: Cannot find
include file for the tool
'$(loading)'! Searched
: $(KBUILD_TOOL_PATHS
) $(KBUILD_PATH
)/tools
$(KBUILD_DEFAULT_PATHS
))
1003 include $(TOOL_
$(loading
)_KMK_FILE
)
1004 ifndef TOOL_
$(loading
)
1005 $(warning kBuild
: TOOL_
$(loading
) was not defined by
$(TOOL_
$(loading
)_KMK_FILE
)!)
1008 endef # def_tools_include
1010 ## SDK load function.
1011 # @param loading The tool name
1012 define def_sdk_load_function
1013 ifndef SDK_
$(loading
)
1014 SDK_
$(loading
)_KMK_FILE
:= $(firstword $(foreach path
, $(KBUILD_SDK_PATHS
) $(KBUILD_PATH
)/sdks
$(KBUILD_DEFAULT_PATHS
), $(wildcard $(path
)/$(loading
).kmk
)))
1015 ifeq ($(SDK_
$(loading
)_KMK_FILE
),)
1016 $(error kBuild
: Cannot find
include file for the SDK
'$(loading)'! Searched
: $(KBUILD_SDK_PATHS
) $(KBUILD_PATH
)/sdks
$(KBUILD_DEFAULT_PATHS
))
1018 include $(SDK_
$(loading
)_KMK_FILE
)
1019 ifndef SDK_
$(loading
)
1020 $(warning kBuild
: SDK_
$(loading
) was not defined by
$(SDK_
$(loading
)_KMK_FILE
)!)
1023 endef # def_sdk_load_function
1029 properties_deferred
:= $(PROPS_SINGLE
) $(PROPS_DEFERRED
)
1030 properties_deferred_l
:= $(PROPS_ACCUMULATE_L
)
1031 properties_deferred_r
:= $(PROPS_ACCUMULATE_R
)
1034 load_function
:= def_sdk_load_function
1035 $(foreach trg
, $(addprefix SDK_
,$(_SDKS
)), $(evalval def_inherit
))
1037 properties_deferred
:= $(PROPS_SINGLE
) $(PROPS_DEFERRED
) $(PROPS_TOOLS_ONLY
)
1039 load_function
:= def_tools_load_function
1040 $(foreach trg
, $(addprefix TOOL_
,$(_TOOLS
)), $(evalval def_inherit
))
1048 properties_deferred
:=
1049 properties_deferred_l
:=
1050 properties_deferred_r
:=
1052 # No inheriting for the uses, they're just global 'code'.
1053 $(foreach loading
, $(_USES
), $(evalval def_unit_load_function
))
1056 ifdef KBUILD_PROFILE_SELF
1057 $(evalcall def_profile_self
, done tools
+ sdks
+ units
)