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