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