1 | # $Id: footer.kmk 760 2007-01-17 10:01:10Z bird $
|
---|
2 | ## @file
|
---|
3 | #
|
---|
4 | # kBuild - File included at top of makefile.
|
---|
5 | #
|
---|
6 | # Copyright (c) 2004-2006 knut st. osmundsen <bird-srcspam@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 |
|
---|
30 | #
|
---|
31 | # Make sure that the core variables we defined in recursive expansion mode
|
---|
32 | # up in header.kmk get expanded before we really start using them. The kBuild
|
---|
33 | # functions added to kmk to speed stuff up assumes that the variables are
|
---|
34 | # expanded here.
|
---|
35 | #
|
---|
36 | PATH_OBJ := $(PATH_OBJ)
|
---|
37 | PATH_TARGET := $(PATH_TARGET)
|
---|
38 | PATH_INS := $(PATH_INS)
|
---|
39 | PATH_BIN := $(PATH_BIN)
|
---|
40 | PATH_DLL := $(PATH_DLL)
|
---|
41 | PATH_SYS := $(PATH_SYS)
|
---|
42 | PATH_LIB := $(PATH_LIB)
|
---|
43 | PATH_DOC := $(PATH_DOC)
|
---|
44 |
|
---|
45 | #
|
---|
46 | # Variables.
|
---|
47 | # (Some of these need initialization before including definitions using them.)
|
---|
48 | #
|
---|
49 |
|
---|
50 | # all targets.
|
---|
51 | ALL_TARGETS += \
|
---|
52 | $(FETCHES) $(FETCHES.$(BUILD_TARGET)) $(FETCHES.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)) \
|
---|
53 | $(PATCHES) $(PATCHES.$(BUILD_TARGET)) $(PATCHES.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)) \
|
---|
54 | $(BLDPROGS) $(BLDPROGS.$(BUILD_PLATFORM)) $(BLDPROGS.$(BUILD_PLATFORM).$(BUILD_PLATFORM_ARCH)) \
|
---|
55 | $(LIBRARIES) $(LIBRARIES.$(BUILD_TARGET)) $(LIBRARIES.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)) \
|
---|
56 | $(IMPORT_LIBS) $(IMPORT_LIBS.$(BUILD_TARGET)) $(IMPORT_LIBS.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)) \
|
---|
57 | $(DLLS) $(DLLS.$(BUILD_TARGET)) $(DLLS.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)) \
|
---|
58 | $(PROGRAMS) $(PROGRAMS.$(BUILD_TARGET)) $(PROGRAMS.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)) \
|
---|
59 | $(SYSMODS) $(SYSMODS.$(BUILD_TARGET)) $(SYSMODS.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)) \
|
---|
60 | $(INSTALLS) $(INSTALLS.$(BUILD_TARGET)) $(INSTALLS.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)) \
|
---|
61 | $(OTHERS) $(OTHERS.$(BUILD_TARGET)) $(OTHERS.$(BUILD_TARGET).$(BUILD_TARGET_ARCH))
|
---|
62 |
|
---|
63 | # all $(BUILD_TARGET) targets.
|
---|
64 | _ALL_BUILD_TARGET_TARGETS += \
|
---|
65 | $(FETCHES) $(FETCHES.$(BUILD_TARGET)) $(FETCHES.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)) \
|
---|
66 | $(PATCHES) $(PATCHES.$(BUILD_TARGET)) $(PATCHES.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)) \
|
---|
67 | $(LIBRARIES) $(LIBRARIES.$(BUILD_TARGET)) $(LIBRARIES.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)) \
|
---|
68 | $(IMPORT_LIBS) $(IMPORT_LIBS.$(BUILD_TARGET)) $(IMPORT_LIBS.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)) \
|
---|
69 | $(DLLS) $(DLLS.$(BUILD_TARGET)) $(DLLS.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)) \
|
---|
70 | $(PROGRAMS) $(PROGRAMS.$(BUILD_TARGET)) $(PROGRAMS.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)) \
|
---|
71 | $(SYSMODS) $(SYSMODS.$(BUILD_TARGET)) $(SYSMODS.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)) \
|
---|
72 | $(INSTALLS) $(INSTALLS.$(BUILD_TARGET)) $(INSTALLS.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)) \
|
---|
73 | $(OTHERS) $(OTHERS.$(BUILD_TARGET)) $(OTHERS.$(BUILD_TARGET).$(BUILD_TARGET_ARCH))
|
---|
74 |
|
---|
75 | # all $(BUILD_TARGET) targets.
|
---|
76 | _ALL_BUILD_PLATFORM_TARGETS += \
|
---|
77 | $(BLDPROGS) $(BLDPROGS.$(BUILD_PLATFORM)) $(BLDPROGS.$(BUILD_PLATFORM).$(BUILD_PLATFORM_ARCH))
|
---|
78 |
|
---|
79 | # all targets making use of srcname.
|
---|
80 | _ALL_SRCNAME_TARGETS += \
|
---|
81 | $(FETCHES) $(FETCHES.$(BUILD_TARGET)) $(FETCHES.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)) \
|
---|
82 | $(PATCHES) $(PATCHES.$(BUILD_TARGET)) $(PATCHES.$(BUILD_TARGET).$(BUILD_TARGET_ARCH))
|
---|
83 |
|
---|
84 | # dependency files.
|
---|
85 | _DEPFILES :=
|
---|
86 |
|
---|
87 | # included dependency files.
|
---|
88 | _DEPFILES_INCLUDED :=
|
---|
89 |
|
---|
90 |
|
---|
91 | # All kind of output files except for _OBJS and _DEPFILES.
|
---|
92 | # Compiling or linking definition outputting other things that $@ and any
|
---|
93 | # required dependency file must add those output files to this variable.
|
---|
94 | _OUT_FILES :=
|
---|
95 |
|
---|
96 | # Files which only requires cleaning up.
|
---|
97 | _CLEAN_FILES :=
|
---|
98 |
|
---|
99 | # all of a type
|
---|
100 | _OBJS :=
|
---|
101 | _FETCHES :=
|
---|
102 | _DOWNLOADS:=
|
---|
103 | _UNPACKS :=
|
---|
104 | _PATCHES :=
|
---|
105 | _UNFETCHES:=
|
---|
106 | _BLDPROGS :=
|
---|
107 | _LIBS :=
|
---|
108 | _DLLS :=
|
---|
109 | _PROGRAMS :=
|
---|
110 | _SYSMODS :=
|
---|
111 | _INSTALLS :=
|
---|
112 | _INSTALLS_DIRS :=
|
---|
113 | _OTHERS :=
|
---|
114 | _PACKING :=
|
---|
115 | _DIRS := $(PATH_TARGET)/ $(PATH_TARGET)
|
---|
116 | _IMPORT_LIBS :=
|
---|
117 |
|
---|
118 | # misc
|
---|
119 | pass_prev :=
|
---|
120 |
|
---|
121 |
|
---|
122 | #
|
---|
123 | # Basic macros
|
---|
124 | #
|
---|
125 |
|
---|
126 | ## Figure out the tool for a target.
|
---|
127 | # @param $1 normalized target.
|
---|
128 | # @param $2 tooltype.
|
---|
129 | # @param bld_trg build target.
|
---|
130 | # @param bld_trg_arch build target architecture.
|
---|
131 | _TARGET_TOOL = $(strip $(firstword \
|
---|
132 | $($(1)_$(2)TOOL.$(bld_trg).$(bld_trg_arch)) \
|
---|
133 | $($(1)_$(2)TOOL.$(bld_trg)) \
|
---|
134 | $($(1)_$(2)TOOL) \
|
---|
135 | $($(1)_TOOL.$(bld_trg).$(bld_trg_arch)) \
|
---|
136 | $($(1)_TOOL.$(bld_trg)) \
|
---|
137 | $($(1)_TOOL) \
|
---|
138 | $($(2)TOOL.$(bld_trg).$(bld_trg_arch)) \
|
---|
139 | $($(2)TOOL.$(bld_trg)) \
|
---|
140 | $($(2)TOOL) \
|
---|
141 | $(TOOL.$(bld_trg).$(bld_trg_arch)) \
|
---|
142 | $(TOOL.$(bld_trg)) \
|
---|
143 | $(TOOL) \
|
---|
144 | ))
|
---|
145 |
|
---|
146 | ## Figure out the actual name of an installed file.
|
---|
147 | # @param $1 The file to install.
|
---|
148 | # @param $2 The target name.
|
---|
149 | # @param $3 The _INST value (can be empty).
|
---|
150 | # @param $4 The default directory to use when $3 is empty.
|
---|
151 | _INSTALL_FILE = $(patsubst %/,%/$(notdir $(1)),$(if $(3),$(PATH_INS)/$(3),$(4)/))
|
---|
152 |
|
---|
153 |
|
---|
154 | #
|
---|
155 | # Include the additional footer macros when bootstrapping kBuild.
|
---|
156 | #
|
---|
157 | ifndef KMK_VERSION
|
---|
158 | include $(PATH_KBUILD)/gnumake-footer.kmk
|
---|
159 | endif
|
---|
160 |
|
---|
161 |
|
---|
162 |
|
---|
163 | #
|
---|
164 | # Check syntax which leads to weird syntax errors.
|
---|
165 | #
|
---|
166 |
|
---|
167 | ## Check
|
---|
168 | # @param $(target) Target name.
|
---|
169 | define def_check_target
|
---|
170 | ifneq ("$($(target)_TEMPLATE)","$(strip $($(target)_TEMPLATE))")
|
---|
171 | $$(error $(target) have an incorrect template name. Remove any tabs!)
|
---|
172 | endif
|
---|
173 | endef
|
---|
174 | $(foreach target, $(ALL_TARGETS),$(eval $(def_check_target)))
|
---|
175 |
|
---|
176 |
|
---|
177 | #
|
---|
178 | # Include templates
|
---|
179 | #
|
---|
180 | _TEMPLATES := $(TEMPLATE)
|
---|
181 | define def_templates
|
---|
182 | ifdef $(target)_TEMPLATE
|
---|
183 | _TEMPLATES += $($(target)_TEMPLATE)
|
---|
184 | endif
|
---|
185 | endef
|
---|
186 | $(foreach target, $(ALL_TARGETS), $(eval $(def_templates)))
|
---|
187 | _TEMPLATES := $(sort $(_TEMPLATES))
|
---|
188 | # $ (warning dbg: _TEMPLATES=$(_TEMPLATES))
|
---|
189 |
|
---|
190 | define def_templates_include
|
---|
191 | ifndef TEMPLATE_$(template)
|
---|
192 | include $(firstword $(foreach path, $(TEMPLATE_PATHS) $(PATH_KBUILD)/templates/, $(wildcard $(path)/$(template).kmk)))
|
---|
193 | endif
|
---|
194 | endef
|
---|
195 | $(foreach template, $(_TEMPLATES), $(eval $(def_templates)))
|
---|
196 |
|
---|
197 |
|
---|
198 | #
|
---|
199 | # Template Inheritance.
|
---|
200 | #
|
---|
201 | define def_template_extends_prop
|
---|
202 | ifndef TEMPLATE_$(template)_$(prop)
|
---|
203 | ifdef TEMPLATE_$(parent)_$(prop)
|
---|
204 | TEMPLATE_$(template)_$(prop) = $$(TEMPLATE_$(parent)_$(prop))
|
---|
205 | endif
|
---|
206 | endif
|
---|
207 | endef
|
---|
208 |
|
---|
209 |
|
---|
210 | define def_template_extends
|
---|
211 | ifdef TEMPLATE_$(template)_EXTENDS
|
---|
212 | ifndef TEMPLATE_$(template)_EXTENDS_STATUS_
|
---|
213 | TEMPLATE_$(template)_EXTENDS_STATUS_ := 0
|
---|
214 | parent := $(strip $(TEMPLATE_$(template)_EXTENDS))
|
---|
215 |
|
---|
216 | # recursivly process the parent if it's inherting from somebody too.
|
---|
217 | ifdef TEMPLATE_$(parent)_EXTENDS
|
---|
218 | ifneq ($(TEMPLATE_$(parent)_EXTENDS_STATUS_),42)
|
---|
219 | # foreach will create 'template' in a new variable context hiding our current variable.
|
---|
220 | $(foreach template, $(parent), $(eval $(value def_template_extends)))
|
---|
221 | parent := $(strip $(TEMPLATE_$(template)_EXTENDS))
|
---|
222 | endif
|
---|
223 | endif
|
---|
224 |
|
---|
225 | # inherit properties.
|
---|
226 | $(foreach prop, $(PROPS_SINGLE) $(PROPS_ACCUMULATE_R) $(PROPS_ACCUMULATE_L) $(PROPS_DEFERRED)\
|
---|
227 | $(addsuffix .$(BUILD_TARGET), $(PROPS_SINGLE) $(PROPS_ACCUMULATE_L) $(PROPS_ACCUMULATE_R) $(PROPS_DEFERRED))\
|
---|
228 | $(addsuffix .$(BUILD_TARGET).$(BUILD_TARGET_ARCH), $(PROPS_SINGLE) $(PROPS_ACCUMULATE_L) $(PROPS_ACCUMULATE_R) $(PROPS_DEFERRED))\
|
---|
229 | $(addsuffix .$(BUILD_TARGET_ARCH), $(PROPS_SINGLE) $(PROPS_ACCUMULATE_L) $(PROPS_ACCUMULATE_R) $(PROPS_DEFERRED))\
|
---|
230 | $(addsuffix .$(BUILD_TARGET_CPU), $(PROPS_SINGLE) $(PROPS_ACCUMULATE_L) $(PROPS_ACCUMULATE_R) $(PROPS_DEFERRED))\
|
---|
231 | $(addsuffix .$(BUILD_TYPE), $(PROPS_SINGLE) $(PROPS_ACCUMULATE_L) $(PROPS_ACCUMULATE_R) $(PROPS_DEFERRED))\
|
---|
232 | ,$(eval $(def_template_extends_prop))) # exploits the 2 evaluation, so no value!
|
---|
233 |
|
---|
234 | TEMPLATE_$(template)_EXTENDS_STATUS_ := 42
|
---|
235 | else
|
---|
236 | # protect against inheritance loops.
|
---|
237 | ifneq ($(TEMPLATE_$(template)_EXTENDS_STATUS_),42)
|
---|
238 | $(error kBuild: inheritance loop! template=$(template))
|
---|
239 | endif
|
---|
240 | endif
|
---|
241 | endif
|
---|
242 | endef
|
---|
243 |
|
---|
244 | # $ (foreach template, $(_TEMPLATES), $(if TEMPLATE_$(template)_EXTENDS, $(eval $(value def_template_extends))))
|
---|
245 | $(foreach template, $(_TEMPLATES), $(eval $(value def_template_extends)))
|
---|
246 |
|
---|
247 |
|
---|
248 | #
|
---|
249 | # Common Inheritance
|
---|
250 | #
|
---|
251 |
|
---|
252 | ## Inherit one template property in a non-accumulative manner.
|
---|
253 | # @param $(prop) Property name
|
---|
254 | # @param $(target) Target name
|
---|
255 | # @todo fix the precedence order for some properties.
|
---|
256 | define def_inherit_template_one
|
---|
257 | ifdef TEMPLATE_$($(target)_TEMPLATE)_$(prop)
|
---|
258 | ifndef $(target)_$(prop)
|
---|
259 | $(target)_$(prop) := $(TEMPLATE_$($(target)_TEMPLATE)_$(prop))
|
---|
260 | #$ (warning dbgtarget: $(target)_$(prop):='$(value $(target)_$(prop))' TEMPLATE_$($(target)_TEMPLATE)_$(prop))
|
---|
261 | endif
|
---|
262 | endif
|
---|
263 | ifdef TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg)
|
---|
264 | ifndef $(target)_$(prop).$(bld_trg)
|
---|
265 | #$ (warning dbgsource: $(target)_$(prop).$(bld_trg)="TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg)" TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg))
|
---|
266 | $(target)_$(prop).$(bld_trg) := $(TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg))
|
---|
267 | endif
|
---|
268 | endif
|
---|
269 | ifdef TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg).$(bld_trg_arch)
|
---|
270 | ifndef $(target)_$(prop).$(bld_trg).$(bld_trg_arch)
|
---|
271 | #$ (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))
|
---|
272 | $(target)_$(prop).$(bld_trg).$(bld_trg_arch) := $(TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg).$(bld_trg_arch))
|
---|
273 | endif
|
---|
274 | endif
|
---|
275 | ifdef TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg_arch)
|
---|
276 | ifndef $(target)_$(prop).$(bld_trg_arch)
|
---|
277 | #$ (warning dbgsource: $(target)_$(prop).$(bld_trg_arch)="TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg_arch)" TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg_arch))
|
---|
278 | $(target)_$(prop).$(bld_trg_arch) := $(TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg_arch))
|
---|
279 | endif
|
---|
280 | endif
|
---|
281 | ifdef TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg_cpu)
|
---|
282 | ifndef $(target)_$(prop).$(bld_trg_cpu)
|
---|
283 | #$ (warning dbgsource: $(target)_$(prop).$(bld_trg_cpu)="TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg_cpu)" TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg_cpu))
|
---|
284 | $(target)_$(prop).$(bld_trg_cpu) := $(TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg_cpu))
|
---|
285 | endif
|
---|
286 | endif
|
---|
287 | endef
|
---|
288 |
|
---|
289 | ## Inherit one template property in a non-accumulative manner, deferred expansion.
|
---|
290 | # @param 1: $(prop) Property name
|
---|
291 | # @param 2: $(target) Target name
|
---|
292 | # @todo fix the precedence order for some properties.
|
---|
293 | # @remark this define relies on double evaluation
|
---|
294 | define def_inherit_template_one_deferred
|
---|
295 | ifdef TEMPLATE_$($(target)_TEMPLATE)_$(prop)
|
---|
296 | ifndef $(target)_$(prop)
|
---|
297 | $(target)_$(prop) = $$(TEMPLATE_$($(target)_TEMPLATE)_$(prop))
|
---|
298 | #$ (warning dbgtarget: $(target)_$(prop):='$(value $(target)_$(prop))' TEMPLATE_$($(target)_TEMPLATE)_$(prop))
|
---|
299 | endif
|
---|
300 | endif
|
---|
301 | ifdef TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg)
|
---|
302 | ifndef $(target)_$(prop).$(bld_trg)
|
---|
303 | #$ (warning dbgsource: $(target)_$(prop).$(bld_trg)="TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg)" TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg))
|
---|
304 | $(target)_$(prop).$(bld_trg) = $$(TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg))
|
---|
305 | endif
|
---|
306 | endif
|
---|
307 | ifdef TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg).$(bld_trg_arch)
|
---|
308 | ifndef $(target)_$(prop).$(bld_trg).$(bld_trg_arch)
|
---|
309 | #$ (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))
|
---|
310 | $(target)_$(prop).$(bld_trg).$(bld_trg_arch) = $$(TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg).$(bld_trg_arch))
|
---|
311 | endif
|
---|
312 | endif
|
---|
313 | ifdef TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg_arch)
|
---|
314 | ifndef $(target)_$(prop).$(bld_trg_arch)
|
---|
315 | #$ (warning dbgsource: $(target)_$(prop).$(bld_trg_arch)="TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg_arch)" TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg_arch))
|
---|
316 | $(target)_$(prop).$(bld_trg_arch) = $$(TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg_arch))
|
---|
317 | endif
|
---|
318 | endif
|
---|
319 | ifdef TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg_cpu)
|
---|
320 | ifndef $(target)_$(prop).$(bld_trg_cpu)
|
---|
321 | #$ (warning dbgsource: $(target)_$(prop).$(bld_trg_cpu)="TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg_cpu)" TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg_cpu))
|
---|
322 | $(target)_$(prop).$(bld_trg_cpu) = $$(TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg_cpu))
|
---|
323 | endif
|
---|
324 | endif
|
---|
325 | endef
|
---|
326 |
|
---|
327 | ## Inherit one acculumlative template property where the 'most significant' items are at the left end.
|
---|
328 | # @param $(prop) Property name
|
---|
329 | # @param $(target) Target name
|
---|
330 | define def_inherit_template_one_accumulate_l
|
---|
331 | ifdef TEMPLATE_$($(target)_TEMPLATE)_$(prop)
|
---|
332 | #$ (warning dbgtype: TEMPLATE_$($(target)_TEMPLATE)_$(prop) $(target)_$(prop)=$($(target)_$(prop)) $(TEMPLATE_$($(target)_TEMPLATE)_$(prop)))
|
---|
333 | $(target)_$(prop) += $$(TEMPLATE_$($(target)_TEMPLATE)_$(prop))
|
---|
334 | #$ (warning dbgtype: $(target)_$(prop)=$($(target)_$(prop)))
|
---|
335 | endif
|
---|
336 | ifdef TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(BUILD_TYPE)
|
---|
337 | #$ (warning dbg4: TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(BUILD_TYPE))
|
---|
338 | $(target)_$(prop).$(BUILD_TYPE) += $$(TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(BUILD_TYPE))
|
---|
339 | endif
|
---|
340 | ifdef TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg)
|
---|
341 | #$ (warning dbg5: TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg))
|
---|
342 | $(target)_$(prop).$(bld_trg) += $$(TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg))
|
---|
343 | endif
|
---|
344 | ifdef TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg).$(bld_trg_arch)
|
---|
345 | #$ (warning dbg4: TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg).$(bld_trg_arch))
|
---|
346 | $(target)_$(prop).$(bld_trg).$(bld_trg_arch) += $$(TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg).$(bld_trg_arch))
|
---|
347 | endif
|
---|
348 | ifdef TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg_cpu)
|
---|
349 | #$ (warning dbg5: TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg_cpu))
|
---|
350 | $(target)_$(prop).$(bld_trg_cpu) += $$(TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg_cpu))
|
---|
351 | endif
|
---|
352 | ifdef TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg_arch)
|
---|
353 | #$ (warning dbg6: TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg_arch))
|
---|
354 | $(target)_$(prop).$(bld_trg_arch) += $$(TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg_arch))
|
---|
355 | endif
|
---|
356 | endef
|
---|
357 |
|
---|
358 | ## Inherit one acculumlative template property where the 'most significant' items are at the right end.
|
---|
359 | # First pass, $(value) referenced.
|
---|
360 | # @param $(prop) Property name
|
---|
361 | # @param $(target) Target name
|
---|
362 | define def_inherit_template_one_accumulate_r1
|
---|
363 | ifdef TEMPLATE_$($(target)_TEMPLATE)_$(prop)
|
---|
364 | $(eval _$(target)_$(prop)_R = $(value $(target)_$(prop)))
|
---|
365 | endif
|
---|
366 | ifdef TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(BUILD_TYPE)
|
---|
367 | $(eval _$(target)_$(prop).$(BUILD_TYPE)_R = $(value $(target)_$(prop).$(BUILD_TYPE)))
|
---|
368 | endif
|
---|
369 | ifdef TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg)
|
---|
370 | $(eval _$(target)_$(prop).$(bld_trg)_R = $(value $(target)_$(prop).$(bld_trg)))
|
---|
371 | endif
|
---|
372 | ifdef TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg).$(bld_trg_arch)
|
---|
373 | $(eval _$(target)_$(prop).$(bld_trg).$(bld_trg_arch)_R = $(value $(target)_$(prop).$(bld_trg).$(bld_trg_arch)))
|
---|
374 | endif
|
---|
375 | ifdef TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg_cpu)
|
---|
376 | $(eval _$(target)_$(prop).$(bld_trg_cpu)_R = $(value $(target)_$(prop).$(bld_trg_cpu)))
|
---|
377 | endif
|
---|
378 | ifdef TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg_arch)
|
---|
379 | $(eval _$(target)_$(prop).$(bld_trg_arch)_R = $(value $(target)_$(prop).$(bld_trg_arch)))
|
---|
380 | endif
|
---|
381 | endef
|
---|
382 |
|
---|
383 | ## Inherit one template property the other way around.
|
---|
384 | # Second pass, not $(value) referenced.
|
---|
385 | # @param $(prop) Property name
|
---|
386 | # @param $(target) Target name
|
---|
387 | define def_inherit_template_one_accumulate_r2
|
---|
388 | ifdef TEMPLATE_$($(target)_TEMPLATE)_$(prop)
|
---|
389 | $(target)_$(prop) = $$(TEMPLATE_$($(target)_TEMPLATE)_$(prop)) $$(_$(target)_$(prop)_R)
|
---|
390 | endif
|
---|
391 | ifdef TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(BUILD_TYPE)
|
---|
392 | $(target)_$(prop).$(BUILD_TYPE) = $$(TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(BUILD_TYPE)) $$(_$(target)_$(prop).$(BUILD_TYPE)_R)
|
---|
393 | endif
|
---|
394 | ifdef TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg)
|
---|
395 | $(target)_$(prop).$(bld_trg) = $$(TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg)) $$(_$(target)_$(prop).$(bld_trg)_R)
|
---|
396 | endif
|
---|
397 | ifdef TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg).$(bld_trg_arch)
|
---|
398 | $(target)_$(prop).$(bld_trg).$(bld_trg_arch) = $$(TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg).$(bld_trg_arch)) $$(_$(target)_$(prop).$(bld_trg).$(bld_trg_arch)_R)
|
---|
399 | endif
|
---|
400 | ifdef TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg_cpu)
|
---|
401 | $(target)_$(prop).$(bld_trg_cpu) = $$(TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg_cpu)) $$(_$(target)_$(prop).$(bld_trg_cpu)_R)
|
---|
402 | endif
|
---|
403 | ifdef TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg_arch)
|
---|
404 | $(target)_$(prop).$(bld_trg_arch) = $$(TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg_arch)) $$(_$(target)_$(prop).$(bld_trg_arch)_R)
|
---|
405 | endif
|
---|
406 | endef
|
---|
407 |
|
---|
408 |
|
---|
409 | ## Inherit template properties for on target.
|
---|
410 | # @param $(target) Target name.
|
---|
411 | define def_inherit_template
|
---|
412 | # sanity check.
|
---|
413 | ifdef _$(target)_ALREADY_PROCESSED
|
---|
414 | $(error kBuild: The target $(target) appears more than once in the target lists! Please correct the makefile(s))
|
---|
415 | endif
|
---|
416 | _$(target)_ALREADY_PROCESSED := 1
|
---|
417 |
|
---|
418 | # Inherit any default template.
|
---|
419 | ifdef TEMPLATE
|
---|
420 | ifeq ($($(target)_TEMPLATE),)
|
---|
421 | $(eval $(target)_TEMPLATE:=$(TEMPLATE))
|
---|
422 | endif
|
---|
423 | endif
|
---|
424 | # Expand the template if specified.
|
---|
425 | ifneq ($($(target)_TEMPLATE),)
|
---|
426 | $(foreach prop,$(PROPS_SINGLE),$(eval $(value def_inherit_template_one)))
|
---|
427 | $(foreach prop,$(PROPS_DEFERRED),$(eval $(def_inherit_template_one_deferred))) # exploits the 2 evaluation, so no value!
|
---|
428 | $(foreach prop,$(PROPS_ACCUMULATE_L),$(eval $(def_inherit_template_one_accumulate_l))) # += works fine (better) without value.
|
---|
429 | $(foreach prop,$(PROPS_ACCUMULATE_R),\
|
---|
430 | $(eval $(value def_inherit_template_one_accumulate_r1))\
|
---|
431 | $(eval $(def_inherit_template_one_accumulate_r2))\
|
---|
432 | ) # This is a hack! (but it appears to work)
|
---|
433 | endif
|
---|
434 | endef
|
---|
435 |
|
---|
436 | # Inherit template properties
|
---|
437 | bld_trg := $(BUILD_TARGET)
|
---|
438 | bld_trg_arch := $(BUILD_TARGET_ARCH)
|
---|
439 | bld_trg_cpu := $(BUILD_TARGET_CPU)
|
---|
440 | $(foreach target, $(_ALL_BUILD_TARGET_TARGETS),$(eval $(value def_inherit_template)))
|
---|
441 |
|
---|
442 | bld_trg := $(BUILD_PLATFORM)
|
---|
443 | bld_trg_arch := $(BUILD_PLATFORM_ARCH)
|
---|
444 | bld_trg_cpu := $(BUILD_PLATFORM_CPU)
|
---|
445 | $(foreach target, $(_ALL_BUILD_PLATFORM_TARGETS),$(eval $(value def_inherit_template)))
|
---|
446 |
|
---|
447 |
|
---|
448 | #
|
---|
449 | # Include tools & sdks
|
---|
450 | #
|
---|
451 | _TOOLS := $(TOOL.$(BUILD_TARGET)) $(TOOL.$(BUILD_TARGET_ARCH)) $(TOOL.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)) \
|
---|
452 | $(TOOL.$(BUILD_PLATFORM)) $(TOOL.$(BUILD_PLATFORM_ARCH)) $(TOOL.$(BUILD_PLATFORM).$(BUILD_PLATFORM_ARCH)) \
|
---|
453 | $(TOOL)
|
---|
454 | _SDKS := $(SDKS.$(BUILD_TARGET)) $(SDKS.$(BUILD_TARGET_ARCH)) $(SDKS.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)) \
|
---|
455 | $(SDKS.$(BUILD_PLATFORM)) $(SDKS.$(BUILD_PLATFORM_ARCH)) $(SDKS.$(BUILD_PLATFORM).$(BUILD_PLATFORM_ARCH)) \
|
---|
456 | $(SDKS.$(BUILD_TYPE)) \
|
---|
457 | $(SDKS)
|
---|
458 | define def_tools_sdks_target_source
|
---|
459 | $(eval _TOOLS += $(foreach prop, $(PROPS_TOOLS), \
|
---|
460 | $($(source)_$(prop).$(_bld_trg)) \
|
---|
461 | $($(target)_$(source)_$(prop).$(_bld_trg)) \
|
---|
462 | $($(source)_$(prop).$(_bld_trg).$(_bld_trg_arch)) \
|
---|
463 | $($(target)_$(source)_$(prop).$(_bld_trg).$(_bld_trg_arch)) \
|
---|
464 | $($(source)_$(prop).$(_bld_trg_arch)) \
|
---|
465 | $($(target)_$(source)_$(prop).$(_bld_trg_arch)) \
|
---|
466 | $($(source)_$(prop)) \
|
---|
467 | $($(target)_$(source)_$(prop))))
|
---|
468 | $(eval _SDKS += \
|
---|
469 | $($(source)_SDKS.$(_bld_trg)) \
|
---|
470 | $($(target)_$(source)_SDKS.$(_bld_trg)) \
|
---|
471 | $($(source)_SDKS.$(_bld_trg).$(_bld_trg_arch)) \
|
---|
472 | $($(target)_$(source)_SDKS.$(_bld_trg).$(_bld_trg_arch)) \
|
---|
473 | $($(source)_SDKS.$(_bld_trg_arch)) \
|
---|
474 | $($(target)_$(source)_SDKS.$(_bld_trg_arch)) \
|
---|
475 | $($(source)_SDKS.$(BUILD_TYPE)) \
|
---|
476 | $($(target)_$(source)_SDKS.$(BUILD_TYPE)) \
|
---|
477 | $($(source)_SDKS) \
|
---|
478 | $($(target)_$(source)_SDKS))
|
---|
479 | endef
|
---|
480 |
|
---|
481 | define def_tools_sdks_target
|
---|
482 | _bld_trg := $(firstword $($(target)_BLD_TRG) $(bld_trg))
|
---|
483 | _bld_trg_arch := $(firstword $($(target)_BLD_TRG_ARCH) $(bld_trg_arch))
|
---|
484 | _bld_trg_cpu := $(firstword $($(target)_BLD_TRG_CPU) $(bld_trg_cpu))
|
---|
485 |
|
---|
486 | $(eval _TOOLS += $(foreach prop, $(PROPS_TOOLS), \
|
---|
487 | $($(target)_$(prop).$(_bld_trg)) \
|
---|
488 | $($(target)_$(prop).$(_bld_trg_arch)) \
|
---|
489 | $($(target)_$(prop).$(_bld_trg).$(_bld_trg_arch)) \
|
---|
490 | $($(target)_$(prop))))
|
---|
491 | $(eval _SDKS += \
|
---|
492 | $($(target)_SDKS.$(_bld_trg)) \
|
---|
493 | $($(target)_SDKS.$(_bld_trg_arch)) \
|
---|
494 | $($(target)_SDKS.$(_bld_trg).$(_bld_trg_arch)) \
|
---|
495 | $($(target)_SDKS))
|
---|
496 | $(foreach source, \
|
---|
497 | $($(target)_SOURCES.$(_bld_trg)) \
|
---|
498 | $($(target)_SOURCES.$(_bld_trg_arch)) \
|
---|
499 | $($(target)_SOURCES.$(_bld_trg).$(_bld_trg_arch)) \
|
---|
500 | $($(target)_SOURCES.$(_bld_trg_cpu)) \
|
---|
501 | $($(target)_SOURCES.$(BUILD_TYPE)) \
|
---|
502 | $($(target)_SOURCES) \
|
---|
503 | , $(eval $(value def_tools_sdks_target_source)))
|
---|
504 | endef
|
---|
505 |
|
---|
506 | define def_tools_srcname_target
|
---|
507 | _bld_trg := $(firstword $($(target)_BLD_TRG) $(bld_trg))
|
---|
508 | _bld_trg_arch := $(firstword $($(target)_BLD_TRG_ARCH) $(bld_trg_arch))
|
---|
509 | _bld_trg_cpu := $(firstword $($(target)_BLD_TRG_CPU) $(bld_trg_cpu))
|
---|
510 |
|
---|
511 | $(foreach source, $(notdir\
|
---|
512 | $($(target)_SOURCES.$(_bld_trg)) \
|
---|
513 | $($(target)_SOURCES.$(_bld_trg_arch)) \
|
---|
514 | $($(target)_SOURCES.$(_bld_trg).$(_bld_trg_arch)) \
|
---|
515 | $($(target)_SOURCES.$(_bld_trg_cpu)) \
|
---|
516 | $($(target)_SOURCES.$(BUILD_TYPE)) \
|
---|
517 | $($(target)_SOURCES) \
|
---|
518 | ), $(eval $(value def_tools_sdks_target_source)))
|
---|
519 | endef
|
---|
520 |
|
---|
521 | bld_trg := $(BUILD_TARGET)
|
---|
522 | bld_trg_arch := $(BUILD_TARGET_ARCH)
|
---|
523 | bld_trg_cpu := $(BUILD_TARGET_CPU)
|
---|
524 | $(foreach target, $(_ALL_BUILD_TARGET_TARGETS), $(eval $(value def_tools_sdks_target)))
|
---|
525 | $(foreach target, $(_ALL_SRCNAME_TARGETS), $(eval $(value def_tools_srcname_target)))
|
---|
526 |
|
---|
527 | bld_trg := $(BUILD_PLATFORM)
|
---|
528 | bld_trg_arch := $(BUILD_PLATFORM_ARCH)
|
---|
529 | bld_trg_cpu := $(BUILD_PLATFORM_CPU)
|
---|
530 | $(foreach target, $(_ALL_BUILD_PLATFORM_TARGETS), $(eval $(value def_tools_sdks_target)))
|
---|
531 |
|
---|
532 |
|
---|
533 | # include TOOLS
|
---|
534 | define def_tools_include
|
---|
535 | ifndef TOOL_$(tool)
|
---|
536 | TOOL_$(tool)_KMK_FILE := $(firstword $(foreach path, $(TOOL_PATHS) $(PATH_KBUILD)/tools, $(wildcard $(path)/$(tool).kmk)))
|
---|
537 | ifeq ($(TOOL_$(tool)_KMK_FILE),)
|
---|
538 | $(error kBuild: Cannot find include file for the tool '$(tool)'! Searched: $(TOOL_PATHS) $(PATH_KBUILD)/tools)
|
---|
539 | endif
|
---|
540 | include $(TOOL_$(tool)_KMK_FILE)
|
---|
541 | endif
|
---|
542 | endef
|
---|
543 |
|
---|
544 | _TOOLS := $(sort $(_TOOLS))
|
---|
545 | $(foreach tool, $(_TOOLS), $(eval $(value def_tools_include)))
|
---|
546 |
|
---|
547 |
|
---|
548 | # include SDKS
|
---|
549 | define def_sdks_include_one
|
---|
550 | ifndef SDK_$(sdk)
|
---|
551 | SDK_$(sdk)_KMK_FILE := $(firstword $(foreach path, $(SDK_PATHS) $(PATH_KBUILD)/sdks, $(wildcard $(path)/$(sdk).kmk)))
|
---|
552 | ifeq ($(SDK_$(sdk)_KMK_FILE),)
|
---|
553 | $(error kBuild: Cannot find include file for the SDK '$(sdk)'! Searched: $(SDK_PATHS) $(PATH_KBUILD)/sdks)
|
---|
554 | endif
|
---|
555 | include $(SDK_$(sdk)_KMK_FILE)
|
---|
556 | endif
|
---|
557 | endef
|
---|
558 |
|
---|
559 | _SDKS := $(sort $(_SDKS))
|
---|
560 | $(foreach sdk, $(_SDKS), $(eval $(value def_sdks_include_one)))
|
---|
561 |
|
---|
562 |
|
---|
563 |
|
---|
564 | ## @page pg_fetches Fetching Tools, Sources and Similar.
|
---|
565 | #
|
---|
566 | # The targets listed in the the FETCHES target list have the following attributes:
|
---|
567 | # SOURCES
|
---|
568 | # INST
|
---|
569 | # FETCHTOOL
|
---|
570 | # FETCHFLAGS
|
---|
571 | # FETCHDIR
|
---|
572 | # UNPACKTOOL
|
---|
573 | # UNPACKFLAGS
|
---|
574 | #
|
---|
575 | # As usual the target name is an alias for 'creating' the target. Other
|
---|
576 | # aliases are:
|
---|
577 | # pass_fetches
|
---|
578 | # fetch
|
---|
579 | # unfetch
|
---|
580 | # download
|
---|
581 | # unpack
|
---|
582 | #
|
---|
583 | # @remark
|
---|
584 | #
|
---|
585 | # This is a little bit complex because we must guarantee that if a source file
|
---|
586 | # changes only sligtly we must refetch it and to a proper unpacking of it. It
|
---|
587 | # is also a desire that fetched archives and unpacked files can be deleted to
|
---|
588 | # save space.
|
---|
589 | #
|
---|
590 | # Thus, we must be able to cleanup what we've unpacked should any of the
|
---|
591 | # sources be removed. We do this by maintaining a file listing the files
|
---|
592 | # and directories that was unpacked. This operation is named 'unfetch'.
|
---|
593 | #
|
---|
594 | # We make use of the SIZE and MD5 attributes for each of the sources to
|
---|
595 | # create a digest that is stored in the primary target file. Subsequent
|
---|
596 | # runswill compare their digest with it to decide if a refetch is required.
|
---|
597 | # When a refetch is found necessary, an 'unfetch' is performed first to
|
---|
598 | # clean out old files and directores. Note even changes in source order
|
---|
599 | # will cause a refetch due to the way the digest is constructed and
|
---|
600 | # evaluated.
|
---|
601 | #
|
---|
602 | # By not depending directly on the archives (nor on any unpacked files)
|
---|
603 | # but on a goal made up from the archive name, size and md5, we allow
|
---|
604 | # the user to delete the archives. Naturally, this means we'll have to
|
---|
605 | # check and fetch missing archives before attempting to unpack them.
|
---|
606 | #
|
---|
607 | # @remark
|
---|
608 | #
|
---|
609 | # This feature will *NOT* work correctly with vanilla GNU make becuase
|
---|
610 | # it makes use of includedep to avoid too many unnecessary files.
|
---|
611 | #
|
---|
612 | # @todo
|
---|
613 | # 1. Port md5sum or some equivalent tool and include it in kBuild.
|
---|
614 | # 2. Download corruption / continuation.
|
---|
615 | # 3. It's quite possible that there is one too many indirect dependency now...
|
---|
616 | #
|
---|
617 |
|
---|
618 | ## @todo move this!
|
---|
619 | MD5SUM := md5sum
|
---|
620 |
|
---|
621 | ## generates the fetch rule
|
---|
622 | define def_fetch_src_fetch_rule
|
---|
623 | # Indirect goal for downloading something.
|
---|
624 | .PRECIOUS: $(out)
|
---|
625 | $(out) $($(target)_$(srcname)_FETCH_OUTPUT_): | $($(target)_$(srcname)_FETCH_DEPORD_)
|
---|
626 | $$(call MSG_L1,Downloading $(source)...)
|
---|
627 | @## @todo do fancy stuff like download continuation.
|
---|
628 | $$(QUIET)$$(RM) -f $(out) $(out).md5
|
---|
629 | $($(target)_$(srcname)_FETCH_CMDS_)
|
---|
630 | $$(QUIET2)$(if $(md5),$$(APPEND) $(out).md5 "$(md5) *$(out)")
|
---|
631 | $$(QUIET)$(if $(md5),$$(MD5SUM) -c $(out).md5)
|
---|
632 |
|
---|
633 |
|
---|
634 |
|
---|
635 | # Intermediate goal for making sure the md5 and size matches. it will (re) fetch the archive if necessary.
|
---|
636 | $(out).checked_$(md5)_$(size): $($(target)_$(srcname)_FETCH_DEPEND_) | $($(target)_$(srcname)_FETCH_DEPORD_)
|
---|
637 | $$(call MSG_L1,Checking $(out),($(source))...)
|
---|
638 | $$(QUIET)$$(RM) -f $$@ $(out).md5
|
---|
639 | @# creates the .md5 we pass to md5sum.
|
---|
640 | $$(QUIET2)$(if $(md5),$$(APPEND) $(out).md5 "$(md5) *$(out)")
|
---|
641 | @# (re)fetch the file if it doesn't exist or if it doesn't matches the md5.
|
---|
642 | @## @todo do fancy stuff like download continuation.
|
---|
643 | $$(QUIET)( test -f $(out) && $(if $(md5),$$(MD5SUM) -c $(out).md5, true) ) \
|
---|
644 | || ( $$(RM_EXT) -f $(out) \
|
---|
645 | && $$(MAKE) $(out) -f $(MAKEFILE) --no-print-directory )
|
---|
646 | $$(QUIET2)$$(APPEND) $$@
|
---|
647 |
|
---|
648 | _TARGET_$(target)_FETCHED += $(out) $(out).checked_$(md5)_$(size)
|
---|
649 |
|
---|
650 | # Just a little precaution.
|
---|
651 | .NOTPARALLEL: $(out) $(out).checked_$(md5)_$(size)
|
---|
652 |
|
---|
653 | endef
|
---|
654 |
|
---|
655 | ## generates the unpack rule
|
---|
656 | define def_fetch_src_unpack_rule
|
---|
657 | # This is the unpack rule. it has an order-only dependency on the download check.
|
---|
658 | $(out) $($(target)_$(srcname)_UNPACK_OUTPUT_): $($(target)_$(srcname)_UNPACK_DEPEND_) \
|
---|
659 | | $($(target)_$(srcname)_UNPACK_DEPORD_) $(archive).checked_$(md5)_$(size)
|
---|
660 | $$(call MSG_L1,Unpacking $(archive),into $(inst)...)
|
---|
661 | $$(QUIET)$$(RM) -f $(out)
|
---|
662 | @# if the source archive doesn't exist fetch it (can have been deleted to save space).
|
---|
663 | $$(QUIET)test -f $(archive) \
|
---|
664 | || ( $$(RM_EXT) -f $(archive).checked_$(md5)_$(size) \
|
---|
665 | && $$(MAKE) $(archive).checked_$(md5)_$(size) -f $(MAKEFILE) --no-print-directory )
|
---|
666 | $($(target)_$(srcname)_UNPACK_CMDS_)
|
---|
667 | $$(QUIET2)$$(APPEND) $(out) $(notdir $(archive).checked_$(md5)_$(size))
|
---|
668 | $$(QUIET2)$$(APPEND) $(out) $(notdir $(out))
|
---|
669 |
|
---|
670 | $(eval _TARGET_$(target)_UNPACKED += $(out))
|
---|
671 | _TARGET_$(target)_DIGEST := $(_TARGET_$(target)_DIGEST)-$(srcname)_$(md5)_$(size)
|
---|
672 |
|
---|
673 | .NOTPARALLEL: $(out)
|
---|
674 |
|
---|
675 | endef
|
---|
676 |
|
---|
677 | ## Processes a fetch source
|
---|
678 | #
|
---|
679 | define def_fetch_src
|
---|
680 | #$ (warning dbg: def_fetch_src: source='$(source)' target='$(target)')
|
---|
681 |
|
---|
682 | # common
|
---|
683 | srcname := $(notdir $(source))
|
---|
684 | inst := $(firstword \
|
---|
685 | $($(target)_$(source)_INST)\
|
---|
686 | $($(target)_$(srcname)_INST)\
|
---|
687 | $($(source)_INST)\
|
---|
688 | $($(srcname)_INST)\
|
---|
689 | $($(target)_INST)\
|
---|
690 | )
|
---|
691 | ifneq ($(patsubst %/,ok,$(inst)),ok)
|
---|
692 | $(error kBuild: Bad or missing INST property for source '$(source)' in target '$(target)': $(inst))
|
---|
693 | endif
|
---|
694 | INSTARGET_$(target)_$(srcname) := $(inst)
|
---|
695 | fetchdir := $(firstword \
|
---|
696 | $($(target)_$(source)_FETCHDIR)\
|
---|
697 | $($(target)_$(srcname)_FETCHDIR)\
|
---|
698 | $($(source)_FETCHDIR)\
|
---|
699 | $($(srcname)_FETCHDIR)\
|
---|
700 | $($(target)_FETCHDIR)\
|
---|
701 | $(FETCHDIR)\
|
---|
702 | $(PATH_TARGET)\
|
---|
703 | )
|
---|
704 | deps := \
|
---|
705 | $($(target)_$(source)_DEPS)\
|
---|
706 | $($(target)_$(srcname)_DEPS)\
|
---|
707 | $($(source)_DEPS)\
|
---|
708 | $($(srcname)_DEPS)\
|
---|
709 | $($(target)_DEPS)
|
---|
710 | md5 := $(firstword \
|
---|
711 | $($(target)_$(source)_MD5)\
|
---|
712 | $($(target)_$(srcname)_MD5)\
|
---|
713 | $($(source)_MD5)\
|
---|
714 | $($(srcname)_MD5)\
|
---|
715 | $($(target)_MD5)\
|
---|
716 | )
|
---|
717 | size := $(firstword \
|
---|
718 | $($(target)_$(source)_SIZE)\
|
---|
719 | $($(target)_$(srcname)_SIZE)\
|
---|
720 | $($(source)_SIZE)\
|
---|
721 | $($(srcname)_SIZE)\
|
---|
722 | $($(target)_SIZE)\
|
---|
723 | )
|
---|
724 | dep := # not legal for fetch and unpack tools
|
---|
725 |
|
---|
726 |
|
---|
727 | #
|
---|
728 | # The fetching.
|
---|
729 | #
|
---|
730 | out := $(fetchdir)/$(srcname)
|
---|
731 | archive := $(out)
|
---|
732 | TARGET_$(target)_$(srcname) := $(out)
|
---|
733 | dirdep := $(call DIRDEP,$(fetchdir))
|
---|
734 | tool := $(firstword \
|
---|
735 | $($(target)_$(source)_FETCHTOOL)\
|
---|
736 | $($(target)_$(srcname)_FETCHTOOL)\
|
---|
737 | $($(target)_$(source)_TOOL)\
|
---|
738 | $($(target)_$(srcname)_TOOL)\
|
---|
739 | $($(source)_FETCHTOOL)\
|
---|
740 | $($(srcname)_FETCHTOOL)\
|
---|
741 | $($(source)_TOOL)\
|
---|
742 | $($(srcname)_TOOL)\
|
---|
743 | $($(target)_FETCHTOOL)\
|
---|
744 | $($(target)_TOOL)\
|
---|
745 | )
|
---|
746 | flags :=\
|
---|
747 | $(TOOL_$(tool)_FETCHFLAGS)\
|
---|
748 | $(FETCHFLAGS)\
|
---|
749 | $($(target)_FETCHFLAGS)\
|
---|
750 | $($(srcname)_FETCHFLAGS)\
|
---|
751 | $($(source)_FETCHFLAGS)\
|
---|
752 | $($(target)_$(srcname)_FETCHFLAGS)\
|
---|
753 | $($(target)_$(source)_FETCHFLAGS)
|
---|
754 |
|
---|
755 | #$ (warning dbg: target=$(target) source=$(source) $(srcname)=$(srcname) tool=$(tool) out=$(out) flags=$(flags) dirdep=$(dirdep) fetchdir=$(fetchdir) md5=$(md5) size=$(size))
|
---|
756 |
|
---|
757 | ifndef TOOL_$(tool)_FETCH_CMDS
|
---|
758 | $(warning kBuild: tools: \
|
---|
759 | 1 $($(target)_$(source)_FETCHTOOL)\
|
---|
760 | 2 $($(target)_$(srcname)_FETCHTOOL)\
|
---|
761 | 3 $($(target)_$(source)_TOOL)\
|
---|
762 | 4 $($(target)_$(srcname)_TOOL)\
|
---|
763 | 5 $($(source)_FETCHTOOL)\
|
---|
764 | 6 $($(srcname)_FETCHTOOL)\
|
---|
765 | 7 $($(source)_TOOL)\
|
---|
766 | 8 $($(srcname)_TOOL)\
|
---|
767 | 9 $($(target)_FETCHTOOL)\
|
---|
768 | 10 $($(target)_TOOL) )
|
---|
769 | $(error kBuild: TOOL_$(tool)_FETCH_CMDS is not defined. source=$(source) target=$(target) )
|
---|
770 | endif
|
---|
771 |
|
---|
772 | # call the tool
|
---|
773 | $(target)_$(srcname)_FETCH_CMDS_ := $(TOOL_$(tool)_FETCH_CMDS)
|
---|
774 | $(target)_$(srcname)_FETCH_OUTPUT_ := $(TOOL_$(tool)_FETCH_OUTPUT)
|
---|
775 | $(target)_$(srcname)_FETCH_DEPEND_ := $(TOOL_$(tool)_FETCH_DEPEND) $(deps)
|
---|
776 | $(target)_$(srcname)_FETCH_DEPORD_ := $(TOOL_$(tool)_FETCH_DEPORD) $(dirdep)
|
---|
777 |
|
---|
778 | # generate the fetch rule.
|
---|
779 | $(eval $(def_fetch_src_fetch_rule))
|
---|
780 |
|
---|
781 |
|
---|
782 | #
|
---|
783 | # The unpacking / installing.
|
---|
784 | #
|
---|
785 | out := $(inst)_kBuild_$(target)_$(srcname)_unpacked.lst
|
---|
786 | dirdep := $(call DIRDEP,$(inst))
|
---|
787 | tool := $(firstword \
|
---|
788 | $($(target)_$(source)_UNPACKTOOL)\
|
---|
789 | $($(target)_$(srcname)_UNPACKTOOL)\
|
---|
790 | $($(target)_$(source)_TOOL)\
|
---|
791 | $($(target)_$(srcname)_TOOL)\
|
---|
792 | $($(source)_UNPACKTOOL)\
|
---|
793 | $($(srcname)_UNPACKTOOL)\
|
---|
794 | $($(source)_TOOL)\
|
---|
795 | $($(srcname)_TOOL)\
|
---|
796 | $($(target)_UNPACKTOOL)\
|
---|
797 | $($(target)_TOOL) \
|
---|
798 | )
|
---|
799 | ifeq ($(tool),)
|
---|
800 | tool := $(toupper $(subst .,,$(suffix $(subst tar.,TAR,$(srcname)))))
|
---|
801 | $(eval $(value def_tools_include))
|
---|
802 | endif
|
---|
803 | flags :=\
|
---|
804 | $(TOOL_$(tool)_UNPACKFLAGS)\
|
---|
805 | $(UNPACKFLAGS)\
|
---|
806 | $($(target)_UNPACKFLAGS)\
|
---|
807 | $($(srcname)_UNPACKFLAGS)\
|
---|
808 | $($(source)_UNPACKFLAGS)\
|
---|
809 | $($(target)_$(srcname)_UNPACKFLAGS)\
|
---|
810 | $($(target)_$(source)_UNPACKFLAGS)
|
---|
811 |
|
---|
812 | #$ (warning dbg: target=$(target) source=$(source) $(srcname)=$(srcname) tool=$(tool) out=$(out) flags=$(flags) dirdep=$(dirdep) inst=$(inst) md5=$(md5) size=$(size))
|
---|
813 | ifndef TOOL_$(tool)_UNPACK_CMDS
|
---|
814 | $(warning kBuild: tools: \
|
---|
815 | 1 $($(target)_$(source)_UNPACKTOOL)\
|
---|
816 | 2 $($(target)_$(srcname)_UNPACKTOOL)\
|
---|
817 | 3 $($(target)_$(source)_TOOL)\
|
---|
818 | 4 $($(target)_$(srcname)_TOOL)\
|
---|
819 | 5 $($(source)_UNPACKTOOL)\
|
---|
820 | 6 $($(srcname)_UNPACKTOOL)\
|
---|
821 | 7 $($(source)_TOOL)\
|
---|
822 | 8 $($(srcname)_TOOL)\
|
---|
823 | 9 $($(target)_UNPACKTOOL)\
|
---|
824 | 10 $($(target)_TOOL) \
|
---|
825 | 11 $(toupper $(subst tar.,TAR,$(ext $(srcname)))) \
|
---|
826 | )
|
---|
827 | $(error kBuild: TOOL_$(tool)_UNPACK_CMDS is not defined. source=$(source) target=$(target) )
|
---|
828 | endif
|
---|
829 |
|
---|
830 | # call the tool
|
---|
831 | $(target)_$(srcname)_UNPACK_CMDS_ := $(TOOL_$(tool)_UNPACK_CMDS)
|
---|
832 | $(target)_$(srcname)_UNPACK_OUTPUT_ := $(TOOL_$(tool)_UNPACK_OUTPUT)
|
---|
833 | $(target)_$(srcname)_UNPACK_DEPEND_ := $(TOOL_$(tool)_UNPACK_DEPEND) $(deps)
|
---|
834 | $(target)_$(srcname)_UNPACK_DEPORD_ := $(TOOL_$(tool)_UNPACK_DEPORD) $(dirdep)
|
---|
835 |
|
---|
836 | # generate the fetch rule.
|
---|
837 | $(eval $(def_fetch_src_unpack_rule))
|
---|
838 |
|
---|
839 | _DIRS += $(inst) $(fetchdir)
|
---|
840 |
|
---|
841 | endef
|
---|
842 |
|
---|
843 |
|
---|
844 | ##
|
---|
845 | # Define the target level rules for a fetch.
|
---|
846 | # @param target
|
---|
847 | # @param out
|
---|
848 | # @param inst
|
---|
849 | # @param _TARGET_$(target)_UNPACKED
|
---|
850 | # @param _TARGET_$(target)_DIGEST
|
---|
851 | # @param bld_trg
|
---|
852 | # @param bld_trg_arch
|
---|
853 | define def_fetch_rules
|
---|
854 |
|
---|
855 | $(out).lst: $(_TARGET_$(target)_UNPACKED) | $(call DIRDEP,$(inst))
|
---|
856 | $$(call MSG_L1,Successfully fetched $(target))
|
---|
857 | $$(QUIET)$$(RM) -f $$@ $$@.tmp
|
---|
858 | $$(QUIET2)$$(APPEND) $$@.tmp "$(notdir $(out))"
|
---|
859 | $$(QUIET)$(if $(_TARGET_$(target)_UNPACKED),$$(CAT_EXT) $(_TARGET_$(target)_UNPACKED) >> $$@.tmp)
|
---|
860 | $$(QUIET)$$(MV) -f $$@.tmp $$@
|
---|
861 |
|
---|
862 | $(out)_unfetched:
|
---|
863 | $$(call MSG_L1,Unfetching $(target)...)
|
---|
864 | $$(QUIET)$$(RM) -f $$(addprefix $(inst),$$(shell $$(CAT_EXT) $(out).lst 2> /dev/null | $$(SED) -e '/\/$$$$/d'))
|
---|
865 | $$(QUIET)$$(RMDIR) -p --ignore-fail-on-non-empty --ignore-fail-on-not-exist $$(dir $$@) \
|
---|
866 | $$(addprefix $(inst),$$(sort $$(dir $$(shell $$(CAT_EXT) $(out).lst 2> /dev/null))))
|
---|
867 | $$(QUIET)$$(RM) -f $(out).lst $(out)
|
---|
868 | $$(QUIET)$$(RMDIR) -p --ignore-fail-on-non-empty --ignore-fail-on-not-exist $$(dir $$@)
|
---|
869 |
|
---|
870 | $(out): $(comp-vars _TARGET_$(target)_DIGEST_PREV,_TARGET_$(target)_DIGEST,FORCE) | $(call DIRDEP,$(inst))
|
---|
871 | $$(QUIET)$$(RM) -f $$@
|
---|
872 | $$(call MSG_L1,$$(if $$(_TARGET_$(target)_DIGEST),$$(if $$(wildcard $(out).lst),Re-fetching,Fetching),Removing) $(target)...)
|
---|
873 | $$(QUIET)$$(if $$(wildcard $(out).lst ),$$(MAKE) -f $(MAKEFILE) --no-print-directory $(out)_unfetched)
|
---|
874 | $$(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 $$@))
|
---|
875 | $$(QUIET2)$$(if $$(_TARGET_$(target)_DIGEST),$$(APPEND) $$@ "_TARGET_$(target)_DIGEST_PREV := $(_TARGET_$(target)_DIGEST)")
|
---|
876 |
|
---|
877 | .NOTPARALLEL: $(out).lst $(out)_unfetched $(out)
|
---|
878 |
|
---|
879 | endef
|
---|
880 |
|
---|
881 |
|
---|
882 | ##
|
---|
883 | # Deal with one fetch target.
|
---|
884 | # @param target
|
---|
885 | # @param bld_trg
|
---|
886 | # @param bld_trg_arch
|
---|
887 | define def_fetch
|
---|
888 | # common
|
---|
889 | INSTARGET_$(target) := $($(target)_INST)
|
---|
890 | ifneq ($(patsubst %/,ok,$(INSTARGET_$(target))),ok)
|
---|
891 | $(error kBuild: Bad or missing INST property for target '$(target)'. \
|
---|
892 | $(target)_INST='$($(target)_INST)' ($(origin $(target)_INST)))
|
---|
893 | endif
|
---|
894 | _TARGET_$(target)_FETCHED :=
|
---|
895 | _TARGET_$(target)_UNPACKED :=
|
---|
896 | _TARGET_$(target)_DIGEST :=
|
---|
897 |
|
---|
898 | # The 'sources'.
|
---|
899 | #$ (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)))
|
---|
900 | $(foreach source,$($(target)_SOURCES) $($(target)_SOURCES.$(BUILD_TYPE)) $($(target)_SOURCES.$(BUILD_TARGET)) $($(target)_SOURCES.$(BUILD_TARGET_ARCH)) $($(target)_SOURCES.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)),\
|
---|
901 | $(eval $(value def_fetch_src)))
|
---|
902 |
|
---|
903 | # The target.
|
---|
904 | inst := $(INSTARGET_$(target))
|
---|
905 | out := $(inst)_kBuild_fetch_$(target)
|
---|
906 |
|
---|
907 | $(eval includedep $(out))
|
---|
908 |
|
---|
909 | $(eval $(def_fetch_rules))
|
---|
910 |
|
---|
911 | # Define the aliases here (doesn't work if defined in def_fetch_rules, just like includedep).
|
---|
912 | $(target): $(out)
|
---|
913 | $(target)_unfetch: $(out)_unfetched
|
---|
914 |
|
---|
915 | _FETCHES += $(out)
|
---|
916 | _DOWNLOADS += $(_TARGET_$(target)_FETCHED)
|
---|
917 | _UNPACKS += $(_TARGET_$(target)_UNPACKED)
|
---|
918 | _UNFETCHES += $(out)_unfetched
|
---|
919 | _DIRS += $(inst)
|
---|
920 |
|
---|
921 | endef
|
---|
922 |
|
---|
923 | # Walk the FETCH target lists.
|
---|
924 | bld_trg := $(BUILD_TARGET)
|
---|
925 | bld_trg_arch := $(BUILD_TARGET_ARCH)
|
---|
926 | $(foreach target, $(FETCHES) $(FETCHES.$(BUILD_TARGET)) $(FETCHES.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)), \
|
---|
927 | $(eval $(value def_fetch)))
|
---|
928 |
|
---|
929 | # some aliases.
|
---|
930 | download: $(_DOWNLOADS)
|
---|
931 | unpack: $(_UNPACKS)
|
---|
932 | fetch: $(_FETCHES)
|
---|
933 | unfetch: $(_UNFETCHES)
|
---|
934 |
|
---|
935 |
|
---|
936 |
|
---|
937 | ##
|
---|
938 | ## Patching.
|
---|
939 | ##
|
---|
940 | ##
|
---|
941 | #define def_patch_src
|
---|
942 | #
|
---|
943 | #endef
|
---|
944 | #
|
---|
945 | #
|
---|
946 | ## Deal with one patch target.
|
---|
947 | #define def_patch
|
---|
948 | #
|
---|
949 | #$(foreach source,$($(target)_SOURCES) $($(target)_SOURCES.$(BUILD_TYPE)) $($(target)_SOURCES.$(BUILD_TARGET)) $($(target)_SOURCES.$(BUILD_TARGET_ARCH)) $($(target)_SOURCES.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)),\
|
---|
950 | # $(eval $(value def_patch_src)))
|
---|
951 | #
|
---|
952 | #_PATCHES +=
|
---|
953 | #endef
|
---|
954 | #
|
---|
955 | #$(foreach target, $(PATCHES) $(PATCHES.$(BUILD_TARGET)) $(PATCHES.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)), \
|
---|
956 | # $(eval $(value def_patch)))
|
---|
957 | #
|
---|
958 |
|
---|
959 |
|
---|
960 | #
|
---|
961 | # Object processing.
|
---|
962 | #
|
---|
963 |
|
---|
964 | ## wrapper the compile command dependency check.
|
---|
965 | ifndef NO_COMPILE_CMDS_DEPS
|
---|
966 | _DEP_COMPILE_CMDS = $(comp-cmds $(target)_$(source)_CMDS_PREV_,$(target)_$(source)_CMDS_,FORCE)
|
---|
967 | else
|
---|
968 | _DEP_COMPILE_CMDS =
|
---|
969 | endif
|
---|
970 |
|
---|
971 | ## Generates the rules for building a specific object, and the aliases
|
---|
972 | # for building a source file.
|
---|
973 | # @param $(obj) The object file.
|
---|
974 | define def_target_source_rule
|
---|
975 | $(obj) $($(target)_$(source)_OUTPUT_): \
|
---|
976 | $($(target)_$(source)_DEPEND_) \
|
---|
977 | $(_DEP_COMPILE_CMDS) \
|
---|
978 | | \
|
---|
979 | $($(target)_$(source)_DEPORD_)
|
---|
980 | $$(call MSG_L1,Compiling $(target) - $(source),=> $$@)
|
---|
981 | $$(QUIET)$$(RM) -f $(dep) $(obj) $($(target)_$(source)_OUTPUT_)
|
---|
982 | $(custom_pre)
|
---|
983 |
|
---|
984 | $($(target)_$(source)_CMDS_)
|
---|
985 |
|
---|
986 | $(custom_post)
|
---|
987 | ifndef NO_COMPILE_CMDS_DEPS
|
---|
988 | $$(QUIET2)$$(APPEND) "$(dep)"
|
---|
989 | $$(QUIET2)$$(APPEND) "$(dep)" 'define $(target)_$(source)_CMDS_PREV_'
|
---|
990 | $$(QUIET2)$$(APPEND) "$(dep)" '$(subst $(NL),'$(NL)$(TAB)@$(APPEND) "$(dep)" ',$($(target)_$(source)_CMDS_))'
|
---|
991 | $$(QUIET2)$$(APPEND) "$(dep)" 'endef'
|
---|
992 | endif
|
---|
993 |
|
---|
994 | $(basename $(notdir $(obj))).o: $(obj)
|
---|
995 | $(basename $(notdir $(obj))).obj: $(obj)
|
---|
996 | endef
|
---|
997 |
|
---|
998 |
|
---|
999 | ## wrapper the link command dependency check.
|
---|
1000 | ifndef NO_COMPILE_CMDS_DEPS
|
---|
1001 | _DEP_LINK_CMDS = $(comp-cmds $(target)_CMDS_PREV_,$(target)_CMDS_,FORCE)
|
---|
1002 | else
|
---|
1003 | _DEP_LINK_CMDS =
|
---|
1004 | endif
|
---|
1005 |
|
---|
1006 | ## Generate the link rule for a target.
|
---|
1007 | # @param $(target) The normalized target name.
|
---|
1008 | # @param $(dirdep) Directories we depend upon begin created before linking.
|
---|
1009 | # @param $(dep) The name of the dependency file.
|
---|
1010 | # @param $(out)
|
---|
1011 | # @param $($(target)_OUTPUT_) Output files from the link.
|
---|
1012 | # @param $($(target)_DEPEND_) Dependencies.
|
---|
1013 | # @param $($(target)_DEPORD_) Dependencies which should only affect build order.
|
---|
1014 | # @param $($(target)_CMDS_) The link commands.
|
---|
1015 | # @param $($(target)_CMDS_PREV_) The link commands from the previous run.
|
---|
1016 | define def_link_rule
|
---|
1017 | $(out) $($(target)_OUTPUT_): \
|
---|
1018 | $($(target)_DEPEND_) \
|
---|
1019 | $(_DEP_LINK_CMDS) \
|
---|
1020 | | \
|
---|
1021 | $($(target)_DEPORD_)
|
---|
1022 | $$(call MSG_L1,Linking $$@)
|
---|
1023 | $$(QUIET)$$(RM) -f $(dep) $(out) $($(target)_OUTPUT_)
|
---|
1024 | $(custom_pre)
|
---|
1025 |
|
---|
1026 | $($(target)_CMDS_)
|
---|
1027 |
|
---|
1028 | $(custom_post)
|
---|
1029 | ifndef NO_LINK_CMDS_DEPS
|
---|
1030 | $$(QUIET2)$$(APPEND) "$(dep)" 'define $(target)_CMDS_PREV_'
|
---|
1031 | $$(QUIET2)$$(APPEND) "$(dep)" '$(subst $(NL),'$(NL)$(TAB)@$(APPEND) "$(dep)" ',$($(target)_CMDS_))'
|
---|
1032 | $$(QUIET2)$$(APPEND) "$(dep)" 'endef'
|
---|
1033 | endif
|
---|
1034 |
|
---|
1035 | $(basename $(notdir $(out))): $(out)
|
---|
1036 |
|
---|
1037 | endef
|
---|
1038 |
|
---|
1039 |
|
---|
1040 | ## Generate the link & lib install rule
|
---|
1041 | # @param $(target) Normalized target name.
|
---|
1042 | # @param $(out) The build target.
|
---|
1043 | # @param $(INSTARGET_$(target)) The installation targets.
|
---|
1044 | # @param $(mode) The file mode (optional)
|
---|
1045 | define def_link_install_rule
|
---|
1046 | $(INSTARGET_$(target)) : $(out) | $(call DIRDEP,$(dir $(INSTARGET_$(target))))
|
---|
1047 | $$(call MSG_L1,Installing $(target) => $$@)
|
---|
1048 | $$(QUIET)$$(INSTALL) $$(if $(mode),-m $(mode)) $(out) $$@
|
---|
1049 |
|
---|
1050 | ifdef KBUILD_DO_AUTO_INSTALL
|
---|
1051 | $(basename $(notdir $(out))): $(INSTARGET_$(target))
|
---|
1052 | endif
|
---|
1053 | endef
|
---|
1054 |
|
---|
1055 |
|
---|
1056 | ## Generic macro for processing C, C++ and Assembly sources.
|
---|
1057 | # @param $(target) Normalized target name.
|
---|
1058 | # @param $(source) Source file name.
|
---|
1059 | # @param $(type) Source type. {C,CXX,AS}
|
---|
1060 | # @param bld_type Build type.
|
---|
1061 | # @param bld_trg Build target.
|
---|
1062 | # @param bld_trg_arch Build target arch.
|
---|
1063 | # @param bld_trg_cpu Build target cpu.
|
---|
1064 | def_target_source_c_cpp_asm_rc_new = $(kb-src-one )
|
---|
1065 | ifdef KMK_VERSION
|
---|
1066 | def_target_source_c_cpp_asm_rc_var = def_target_source_c_cpp_asm_rc_new
|
---|
1067 | else
|
---|
1068 | def_target_source_c_cpp_asm_rc_var = def_target_source_c_cpp_asm_rc_old
|
---|
1069 | endif
|
---|
1070 |
|
---|
1071 | ## Generic macro for processing all target sources.
|
---|
1072 | # @param $(target) Normalized target name.
|
---|
1073 | # @param $(defpath)
|
---|
1074 | # @param much-more...
|
---|
1075 | define def_target_sources
|
---|
1076 | #$ (warning def_target_sources)
|
---|
1077 | # C sources
|
---|
1078 | type := C
|
---|
1079 | $(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)))\
|
---|
1080 | ,$(eval $(value $(def_target_source_c_cpp_asm_rc_var))) )
|
---|
1081 |
|
---|
1082 | # C++ sources
|
---|
1083 | type := CXX
|
---|
1084 | $(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)))\
|
---|
1085 | ,$(eval $(value $(def_target_source_c_cpp_asm_rc_var))) )
|
---|
1086 |
|
---|
1087 | # ASM sources
|
---|
1088 | type := AS
|
---|
1089 | $(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)))\
|
---|
1090 | ,$(eval $(value $(def_target_source_c_cpp_asm_rc_var))) )
|
---|
1091 |
|
---|
1092 | # Resource sources
|
---|
1093 | type := RC
|
---|
1094 | $(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)))\
|
---|
1095 | ,$(eval $(value $(def_target_source_c_cpp_asm_rc_var))) )
|
---|
1096 |
|
---|
1097 | endef
|
---|
1098 |
|
---|
1099 |
|
---|
1100 |
|
---|
1101 | ## Generic macro for generating the install rule(s) for a target
|
---|
1102 | # and update the globals with default out.
|
---|
1103 | #
|
---|
1104 | # @param $(target) Normalized target name.
|
---|
1105 | # @param $(out) The output file.
|
---|
1106 | # @param $(definst) The default _INST value.
|
---|
1107 | # @param $(typevar) The name of the variable with all the root targets of its type.
|
---|
1108 | # @remark Only library uses this now.
|
---|
1109 | define def_target_install_pluss
|
---|
1110 | ifndef $(target)_NOINST
|
---|
1111 | INSTARGET_$(target) := $(patsubst %/,%/$(notdir $(out)), \
|
---|
1112 | $(if $($(target)_INST), $(addprefix $(PATH_INS)/,$($(target)_INST)), $(definst)/))
|
---|
1113 |
|
---|
1114 | $(eval $(def_link_install_rule))
|
---|
1115 |
|
---|
1116 | _INSTALLS += $(INSTARGET_$(target))
|
---|
1117 |
|
---|
1118 | ifdef KBUILD_DO_AUTO_INSTALL
|
---|
1119 | $(typevar) += $(INSTARGET_$(target))
|
---|
1120 | else
|
---|
1121 | $(typevar) += $(out)
|
---|
1122 | endif
|
---|
1123 | else # _NOINST
|
---|
1124 | $(typevar) += $(out)
|
---|
1125 | endif
|
---|
1126 |
|
---|
1127 | _OUT_FILES += $($(target)_OUTPUT_) $(out)
|
---|
1128 | _CLEAN_FILES += $($(target)_CLEAN)
|
---|
1129 | _OBJS += $($(target)_OBJS_)
|
---|
1130 |
|
---|
1131 | endef
|
---|
1132 |
|
---|
1133 |
|
---|
1134 |
|
---|
1135 | #
|
---|
1136 | # LIBRARIES
|
---|
1137 | #
|
---|
1138 |
|
---|
1139 | ## Library (one).
|
---|
1140 | # @param $(target) Normalized library (target) name.
|
---|
1141 | define def_lib
|
---|
1142 | # library basics
|
---|
1143 | ## @todo prefix
|
---|
1144 | bld_type := $(firstword $($(target)_BLD_TYPE) $(BUILD_TYPE))
|
---|
1145 | bld_trg := $(firstword $($(target)_BLD_TRG) $(BUILD_TARGET))
|
---|
1146 | bld_trg_arch:= $(firstword $($(target)_BLD_TRG_ARCH) $(BUILD_TARGET_ARCH))
|
---|
1147 | bld_trg_cpu := $(firstword $($(target)_BLD_TRG_CPU) $(BUILD_TARGET_CPU))
|
---|
1148 | tool := $(call _TARGET_TOOL,$(target),AR)
|
---|
1149 | ifeq ($(tool),)
|
---|
1150 | $(error kBuild: Library target $(target) does not have a tool defined!)
|
---|
1151 | endif
|
---|
1152 | outbase := $(call TARGET_BASE,$(target),$(target))
|
---|
1153 | ifndef PATH_$(target)
|
---|
1154 | PATH_$(target) := $(patsubst %/,%,$(dir $(outbase)))
|
---|
1155 | else
|
---|
1156 | ifneq ($(PATH_$(target)),$(patsubst %/,%,$(dir $(outbase))))
|
---|
1157 | $(error kBuild internal error: PATH_$(target)=$(PATH_$(target)) expected $(patsubst %/,%,$(dir $(outbase))))
|
---|
1158 | endif
|
---|
1159 | endif
|
---|
1160 | suff := $(firstword\
|
---|
1161 | $($(target)_LIBSUFF.$(bld_trg).$(bld_trg_arch))\
|
---|
1162 | $($(target)_LIBSUFF.$(bld_trg))\
|
---|
1163 | $($(target)_LIBSUFF)\
|
---|
1164 | $(TOOL_$(tool)_ARLIBSUFF.$(bld_trg).$(bld_trg_arch))\
|
---|
1165 | $(TOOL_$(tool)_ARLIBSUFF.$(bld_trg))\
|
---|
1166 | $(TOOL_$(tool)_ARLIBSUFF)\
|
---|
1167 | $(SUFF_LIB))
|
---|
1168 | out := $(outbase)$(suff)
|
---|
1169 | TARGET_$(target) := $(out)
|
---|
1170 | $(target)_OBJS_ :=
|
---|
1171 | defpath := $($(target)_PATH)
|
---|
1172 |
|
---|
1173 | # source -> object
|
---|
1174 | $(eval $(value def_target_sources))
|
---|
1175 |
|
---|
1176 | # library linking
|
---|
1177 | tool := $(call _TARGET_TOOL,$(target),AR)
|
---|
1178 | outbase := $(call TARGET_BASE,$(target),$(target))
|
---|
1179 | flags :=\
|
---|
1180 | $(TOOL_$(tool)_ARFLAGS)\
|
---|
1181 | $(TOOL_$(tool)_ARFLAGS.$(bld_type))\
|
---|
1182 | $(ARFLAGS)\
|
---|
1183 | $(ARFLAGS.$(bld_type))\
|
---|
1184 | $($(target)_ARFLAGS)\
|
---|
1185 | $($(target)_ARFLAGS.$(bld_type)) \
|
---|
1186 | $($(target)_ARFLAGS.$(bld_trg)) \
|
---|
1187 | $($(target)_ARFLAGS.$(bld_trg_arch)) \
|
---|
1188 | $($(target)_ARFLAGS.$(bld_trg).$(bld_trg_arch)) \
|
---|
1189 | $($(target)_ARFLAGS.$(bld_trg_cpu))
|
---|
1190 | othersrc := $(filter-out %.c %.cpp %.cxx %.cc %.s %.S %.asm %.o %.obj,\
|
---|
1191 | $($(target)_SOURCES) \
|
---|
1192 | $($(target)_SOURCES.$(bld_trg)) \
|
---|
1193 | $($(target)_SOURCES.$(bld_trg_arch)) \
|
---|
1194 | $($(target)_SOURCES.$(bld_trg).$(bld_trg_arch)) \
|
---|
1195 | $($(target)_SOURCES.$(bld_trg_cpu)) \
|
---|
1196 | $($(target)_SOURCES.$(bld_type)))
|
---|
1197 | objs = $(filter %.o %.obj, \
|
---|
1198 | $($(target)_SOURCES) \
|
---|
1199 | $($(target)_SOURCES.$(bld_trg)) \
|
---|
1200 | $($(target)_SOURCES.$(bld_trg_arch)) \
|
---|
1201 | $($(target)_SOURCES.$(bld_trg).$(bld_trg_arch)) \
|
---|
1202 | $($(target)_SOURCES.$(bld_trg_cpu)) \
|
---|
1203 | $($(target)_SOURCES.$(bld_type))) \
|
---|
1204 | $($(target)_OBJS_)
|
---|
1205 | dirdep := $(call DIRDEP,$(dir $(out)))
|
---|
1206 | ## @todo fix dependencies on makefiles an such
|
---|
1207 | deps := $($(target)_DEPS)
|
---|
1208 |
|
---|
1209 | # Adjust paths if we got a default path.
|
---|
1210 | ifneq ($(defpath),)
|
---|
1211 | objs := $(call abspathex,$(objs),$(defpath))
|
---|
1212 | deps := $(call abspathex,$(deps),$(defpath))
|
---|
1213 | othersrc := $(call abspathex,$(othersrc),$(defpath))
|
---|
1214 | endif
|
---|
1215 |
|
---|
1216 | # dependency file
|
---|
1217 | dep := $(out)$(SUFF_DEP)
|
---|
1218 | ifndef NO_LINK_CMDS_DEPS
|
---|
1219 | _DEPFILES_INCLUDED += $(dep)
|
---|
1220 | $(if $(wildcard $(dep)),$(eval include $(dep)))
|
---|
1221 | endif
|
---|
1222 |
|
---|
1223 | # check that the tool is defined.
|
---|
1224 | ifndef TOOL_$(tool)_LINK_LIBRARY_CMDS
|
---|
1225 | $(warning kBuild: tools: \
|
---|
1226 | 1 $($(target)_$(source)TOOL.$(bld_trg).$(bld_trg_arch)) \
|
---|
1227 | 2 $($(target)_$(source)TOOL.$(bld_trg)) \
|
---|
1228 | 3 $($(target)_$(source)TOOL) \
|
---|
1229 | 4 $($(target)_TOOL.$(bld_trg).$(bld_trg_arch)) \
|
---|
1230 | 5 $($(target)_TOOL.$(bld_trg)) \
|
---|
1231 | 6 $($(target)_TOOL) \
|
---|
1232 | 7 $($(source)TOOL) \
|
---|
1233 | 8 $($(source)TOOL.$(bld_trg).$(bld_trg_arch)) \
|
---|
1234 | 9 $($(source)TOOL.$(bld_trg)) \
|
---|
1235 | 10 $(TOOL.$(bld_trg).$(bld_trg_arch)) \
|
---|
1236 | 11 $(TOOL.$(bld_trg)) \
|
---|
1237 | 12 $(TOOL) )
|
---|
1238 | $(error kBuild: TOOL_$(tool)_LINK_LIBRARY_CMDS isn't defined! target=$(target) )
|
---|
1239 | endif
|
---|
1240 |
|
---|
1241 | # call the tool
|
---|
1242 | $(target)_CMDS_ := $(TOOL_$(tool)_LINK_LIBRARY_CMDS)
|
---|
1243 | $(target)_OUTPUT_ := $(TOOL_$(tool)_LINK_LIBRARY_OUTPUT)
|
---|
1244 | $(target)_DEPEND_ := $(TOOL_$(tool)_LINK_LIBRARY_DEPEND) $(deps) $(objs)
|
---|
1245 | $(target)_DEPORD_ := $(TOOL_$(tool)_LINK_LIBRARY_DEPORD) $(dirdep)
|
---|
1246 |
|
---|
1247 | # generate the link rule.
|
---|
1248 | $(eval $(def_link_rule))
|
---|
1249 |
|
---|
1250 | # installing and globals
|
---|
1251 | definst := $(PATH_LIB)
|
---|
1252 | typevar := _LIBS
|
---|
1253 | $(eval $(value def_target_install_pluss))
|
---|
1254 | endef
|
---|
1255 |
|
---|
1256 | # Process libraries
|
---|
1257 | mode := 0644
|
---|
1258 | $(foreach target, $(LIBRARIES) $(LIBRARIES.$(BUILD_TARGET)) $(LIBRARIES.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)), $(eval $(value def_lib)))
|
---|
1259 |
|
---|
1260 |
|
---|
1261 | #
|
---|
1262 | # Link operations.
|
---|
1263 | #
|
---|
1264 |
|
---|
1265 | ##
|
---|
1266 | # Link prolog
|
---|
1267 | #
|
---|
1268 | # @param $(target) Normalized target name.
|
---|
1269 | # @param $(EXT) EXE,DLL,SYS.
|
---|
1270 | # @param $(definst) The default _INST value.
|
---|
1271 | # @param $(typevar) The name of the variable with all the root targets of its type.
|
---|
1272 | define def_link_common
|
---|
1273 | # basics
|
---|
1274 | bld_type := $(firstword $($(target)_BLD_TYPE) $(BUILD_TYPE))
|
---|
1275 | bld_trg := $(firstword $($(target)_BLD_TRG) $(BUILD_$(bld_trg_base_var)))
|
---|
1276 | bld_trg_arch:= $(firstword $($(target)_BLD_TRG_ARCH) $(BUILD_$(bld_trg_base_var)_ARCH))
|
---|
1277 | bld_trg_cpu := $(firstword $($(target)_BLD_TRG_CPU) $(BUILD_$(bld_trg_base_var)_CPU))
|
---|
1278 |
|
---|
1279 | tool := $(call _TARGET_TOOL,$(target),LD)
|
---|
1280 | outbase := $(call TARGET_BASE,$(target),$(target))
|
---|
1281 | ifndef PATH_$(target)
|
---|
1282 | PATH_$(target) := $(patsubst %/,%,$(dir $(outbase)))
|
---|
1283 | else
|
---|
1284 | ifneq ($(PATH_$(target)),$(patsubst %/,%,$(dir $(outbase))))
|
---|
1285 | $(error kBuild internal error: PATH_$(target)=$(PATH_$(target)) expected $(patsubst %/,%,$(dir $(outbase))))
|
---|
1286 | endif
|
---|
1287 | endif
|
---|
1288 | suff := $(firstword \
|
---|
1289 | $($(target)_$(EXT)SUFF) \
|
---|
1290 | $($(target)_$(EXT)SUFF) \
|
---|
1291 | $(TOOL_$(tool)_LD$(EXT)SUFF) \
|
---|
1292 | $($(EXTPRE)SUFF_$(EXT)))
|
---|
1293 | out := $(outbase)$(suff)
|
---|
1294 | TARGET_$(target) := $(out)
|
---|
1295 | $(target)_OBJS_ :=
|
---|
1296 | defpath := $($(target)_PATH)
|
---|
1297 |
|
---|
1298 | # source -> object
|
---|
1299 | $(eval $(value def_target_sources))
|
---|
1300 |
|
---|
1301 | # more link stuff.
|
---|
1302 | tool := $(call _TARGET_TOOL,$(target),LD)
|
---|
1303 | outbase := $(call TARGET_BASE,$(target),$(target))
|
---|
1304 | flags :=\
|
---|
1305 | $(TOOL_$(tool)_LDFLAGS)\
|
---|
1306 | $(TOOL_$(tool)_LDFLAGS.$(bld_type))\
|
---|
1307 | $(TOOL_$(tool)_LDFLAGS.$(bld_trg))\
|
---|
1308 | $(TOOL_$(tool)_LDFLAGS.$(bld_trg_arch))\
|
---|
1309 | $(TOOL_$(tool)_LDFLAGS.$(bld_trg).$(bld_trg_arch))\
|
---|
1310 | $(TOOL_$(tool)_LDFLAGS.$(bld_trg_cpu))\
|
---|
1311 | $(LDFLAGS)\
|
---|
1312 | $(LDFLAGS.$(bld_type))\
|
---|
1313 | $(LDFLAGS.$(bld_trg))\
|
---|
1314 | $(LDFLAGS.$(bld_trg_arch))\
|
---|
1315 | $(LDFLAGS.$(bld_trg).$(bld_trg_arch))\
|
---|
1316 | $(LDFLAGS.$(bld_trg_cpu))\
|
---|
1317 | $($(target)_LDFLAGS)\
|
---|
1318 | $($(target)_LDFLAGS.$(bld_type))\
|
---|
1319 | $($(target)_LDFLAGS.$(bld_trg))\
|
---|
1320 | $($(target)_LDFLAGS.$(bld_trg_arch))\
|
---|
1321 | $($(target)_LDFLAGS.$(bld_trg).$(bld_trg_arch))\
|
---|
1322 | $($(target)_LDFLAGS.$(bld_trg_cpu))
|
---|
1323 | othersrc := $(filter-out %.c %.cpp %.cxx %.cc %.s %.S %.asm %.o %.obj,\
|
---|
1324 | $($(target)_SOURCES)\
|
---|
1325 | $($(target)_SOURCES.$(bld_trg)) \
|
---|
1326 | $($(target)_SOURCES.$(bld_trg_arch)) \
|
---|
1327 | $($(target)_SOURCES.$(bld_trg).$(bld_trg_arch)) \
|
---|
1328 | $($(target)_SOURCES.$(bld_trg_cpu)) \
|
---|
1329 | $($(target)_SOURCES.$(bld_type)))
|
---|
1330 | objs = $(filter %.o %.obj, \
|
---|
1331 | $($(target)_SOURCES) \
|
---|
1332 | $($(target)_SOURCES.$(bld_trg)) \
|
---|
1333 | $($(target)_SOURCES.$(bld_trg_arch)) \
|
---|
1334 | $($(target)_SOURCES.$(bld_trg).$(bld_trg_arch)) \
|
---|
1335 | $($(target)_SOURCES.$(bld_trg_cpu)) \
|
---|
1336 | $($(target)_SOURCES.$(bld_type))) \
|
---|
1337 | $($(target)_OBJS_)
|
---|
1338 | libs :=\
|
---|
1339 | $($(target)_LIBS.$(bld_trg_cpu))\
|
---|
1340 | $($(target)_LIBS.$(bld_trg).$(bld_trg_arch))\
|
---|
1341 | $($(target)_LIBS.$(bld_trg_arch))\
|
---|
1342 | $($(target)_LIBS.$(bld_trg))\
|
---|
1343 | $($(target)_LIBS.$(bld_type))\
|
---|
1344 | $($(target)_LIBS)\
|
---|
1345 | $(foreach sdk, $($(target)_SDKS.$(bld_trg).$(bld_trg_arch)) \
|
---|
1346 | $($(target)_SDKS.$(bld_trg_arch)) \
|
---|
1347 | $($(target)_SDKS.$(bld_trg)) \
|
---|
1348 | $($(target)_SDKS.$(bld_type)) \
|
---|
1349 | $($(target)_SDKS),\
|
---|
1350 | $(SDK_$(sdk)_LIBS.$(bld_trg_cpu))\
|
---|
1351 | $(SDK_$(sdk)_LIBS.$(bld_trg).$(bld_trg_arch))\
|
---|
1352 | $(SDK_$(sdk)_LIBS.$(bld_trg_arch))\
|
---|
1353 | $(SDK_$(sdk)_LIBS.$(bld_trg))\
|
---|
1354 | $(SDK_$(sdk)_LIBS.$(bld_type))\
|
---|
1355 | $(SDK_$(sdk)_LIBS))\
|
---|
1356 | $(LIBS.$(bld_trg_cpu))\
|
---|
1357 | $(LIBS.$(bld_trg).$(bld_trg_arch))\
|
---|
1358 | $(LIBS.$(bld_trg_arch))\
|
---|
1359 | $(LIBS.$(bld_trg))\
|
---|
1360 | $(LIBS.$(bld_type))\
|
---|
1361 | $(LIBS)\
|
---|
1362 | $(foreach sdk, $(SDKS.$(bld_trg).$(bld_trg_arch)) \
|
---|
1363 | $(SDKS.$(bld_trg_arch)) \
|
---|
1364 | $(SDKS.$(bld_trg)) \
|
---|
1365 | $(SDKS.$(bld_type)) \
|
---|
1366 | $(SDKS),\
|
---|
1367 | $(SDK_$(sdk)_LIBS.$(bld_trg_cpu))\
|
---|
1368 | $(SDK_$(sdk)_LIBS.$(bld_trg).$(bld_trg_arch))\
|
---|
1369 | $(SDK_$(sdk)_LIBS.$(bld_trg_arch))\
|
---|
1370 | $(SDK_$(sdk)_LIBS.$(bld_trg))\
|
---|
1371 | $(SDK_$(sdk)_LIBS.$(bld_type))\
|
---|
1372 | $(SDK_$(sdk)_LIBS))\
|
---|
1373 | $(TOOL_$(tool)_LIBS.$(bld_trg_cpu))\
|
---|
1374 | $(TOOL_$(tool)_LIBS.$(bld_trg).$(bld_trg_arch))\
|
---|
1375 | $(TOOL_$(tool)_LIBS.$(bld_trg_arch))\
|
---|
1376 | $(TOOL_$(tool)_LIBS.$(bld_trg))\
|
---|
1377 | $(TOOL_$(tool)_LIBS.$(bld_type))\
|
---|
1378 | $(TOOL_$(tool)_LIBS)
|
---|
1379 | libpath :=\
|
---|
1380 | $($(target)_LIBPATH.$(bld_trg_cpu))\
|
---|
1381 | $($(target)_LIBPATH.$(bld_trg).$(bld_trg_arch))\
|
---|
1382 | $($(target)_LIBPATH.$(bld_trg_arch))\
|
---|
1383 | $($(target)_LIBPATH.$(bld_trg))\
|
---|
1384 | $($(target)_LIBPATH.$(bld_type))\
|
---|
1385 | $($(target)_LIBPATH)\
|
---|
1386 | $(foreach sdk, $($(target)_SDKS.$(bld_trg).$(bld_trg_arch)) \
|
---|
1387 | $($(target)_SDKS.$(bld_trg_arch)) \
|
---|
1388 | $($(target)_SDKS.$(bld_trg)) \
|
---|
1389 | $($(target)_SDKS.$(bld_type)) \
|
---|
1390 | $($(target)_SDKS),\
|
---|
1391 | $(SDK_$(sdk)_LIBPATH.$(bld_trg_cpu))\
|
---|
1392 | $(SDK_$(sdk)_LIBPATH.$(bld_trg).$(bld_trg_arch))\
|
---|
1393 | $(SDK_$(sdk)_LIBPATH.$(bld_trg_arch))\
|
---|
1394 | $(SDK_$(sdk)_LIBPATH.$(bld_trg))\
|
---|
1395 | $(SDK_$(sdk)_LIBPATH.$(bld_type))\
|
---|
1396 | $(SDK_$(sdk)_LIBPATH))\
|
---|
1397 | $(LIBPATH.$(bld_trg_cpu))\
|
---|
1398 | $(LIBPATH.$(bld_trg).$(bld_trg_arch))\
|
---|
1399 | $(LIBPATH.$(bld_trg_arch))\
|
---|
1400 | $(LIBPATH.$(bld_trg))\
|
---|
1401 | $(LIBPATH.$(bld_type))\
|
---|
1402 | $(LIBPATH)\
|
---|
1403 | $(foreach sdk, $(SDKS.$(bld_trg).$(bld_trg_arch)) \
|
---|
1404 | $(SDKS.$(bld_trg_arch)) \
|
---|
1405 | $(SDKS.$(bld_trg)) \
|
---|
1406 | $(SDKS.$(bld_type)) \
|
---|
1407 | $(SDKS),\
|
---|
1408 | $(SDK_$(sdk)_LIBPATH.$(bld_trg_cpu))\
|
---|
1409 | $(SDK_$(sdk)_LIBPATH.$(bld_trg).$(bld_trg_arch))\
|
---|
1410 | $(SDK_$(sdk)_LIBPATH.$(bld_trg_arch))\
|
---|
1411 | $(SDK_$(sdk)_LIBPATH.$(bld_trg))\
|
---|
1412 | $(SDK_$(sdk)_LIBPATH.$(bld_type))\
|
---|
1413 | $(SDK_$(sdk)_LIBPATH))\
|
---|
1414 | $(TOOL_$(tool)_LIBPATH.$(bld_trg_cpu))\
|
---|
1415 | $(TOOL_$(tool)_LIBPATH.$(bld_trg).$(bld_trg_arch))\
|
---|
1416 | $(TOOL_$(tool)_LIBPATH.$(bld_trg_arch))\
|
---|
1417 | $(TOOL_$(tool)_LIBPATH.$(bld_trg))\
|
---|
1418 | $(TOOL_$(tool)_LIBPATH.$(bld_type))\
|
---|
1419 | $(TOOL_$(tool)_LIBPATH)
|
---|
1420 | dirdep := $(call DIRDEP,$(dir $(out)))
|
---|
1421 | ## @todo fix dependencies
|
---|
1422 | deps := $($(target)_DEPS)
|
---|
1423 |
|
---|
1424 | # Adjust paths if we got a default path.
|
---|
1425 | ifneq ($(defpath),)
|
---|
1426 | libpath := $(call abspathex,$(libpath),$(defpath))
|
---|
1427 | objs := $(call abspathex,$(objs),$(defpath))
|
---|
1428 | deps := $(call abspathex,$(deps),$(defpath))
|
---|
1429 | othersrc := $(call abspathex,$(othersrc),$(defpath))
|
---|
1430 | # libs are not subject to this because of the the -l<lib> stuff. Use $(<target>_PATH)/lib if relative to current dir!
|
---|
1431 | endif
|
---|
1432 |
|
---|
1433 | ## @todo this stuff can't be working.
|
---|
1434 | custom_pre := $(strip $(firstword \
|
---|
1435 | $($(target)_CUSTOM_PRE.$(bld_trg).$(bld_trg_arch))\
|
---|
1436 | $($(target)_CUSTOM_PRE.$(bld_trg).$(bld_type))\
|
---|
1437 | $($(target)_CUSTOM_PRE.$(bld_trg))\
|
---|
1438 | $($(target)_CUSTOM_PRE.$(bld_type))\
|
---|
1439 | $($(target)_CUSTOM_PRE)\
|
---|
1440 | $(CUSTOM_PRE.$(bld_trg).$(bld_trg_arch))\
|
---|
1441 | $(CUSTOM_PRE.$(bld_trg).$(bld_type))\
|
---|
1442 | $(CUSTOM_PRE.$(bld_trg))\
|
---|
1443 | $(CUSTOM_PRE.$(bld_type))\
|
---|
1444 | $(CUSTOM_PRE)\
|
---|
1445 | ))
|
---|
1446 | custom_post := $(strip $(firstword \
|
---|
1447 | $($(target)_CUSTOM_POST.$(bld_trg).$(bld_trg_arch))\
|
---|
1448 | $($(target)_CUSTOM_POST.$(bld_trg).$(bld_type))\
|
---|
1449 | $($(target)_CUSTOM_POST.$(bld_trg))\
|
---|
1450 | $($(target)_CUSTOM_POST.$(bld_type))\
|
---|
1451 | $($(target)_CUSTOM_POST)\
|
---|
1452 | $(CUSTOM_POST.$(bld_trg).$(bld_trg_arch))\
|
---|
1453 | $(CUSTOM_POST.$(bld_trg).$(bld_type))\
|
---|
1454 | $(CUSTOM_POST.$(bld_trg))\
|
---|
1455 | $(CUSTOM_POST.$(bld_type))\
|
---|
1456 | $(CUSTOM_POST)\
|
---|
1457 | ))
|
---|
1458 |
|
---|
1459 | # installation targets
|
---|
1460 | ifndef $(target)_NOINST
|
---|
1461 | INSTARGET_$(target) := $(patsubst %/,%/$(notdir $(out)), \
|
---|
1462 | $(if $($(target)_INST), $(addprefix $(PATH_INS)/,$($(target)_INST)), $(definst)/))
|
---|
1463 | ifdef KBUILD_DO_AUTO_INSTALL
|
---|
1464 | $(typevar) += $(INSTARGET_$(target))
|
---|
1465 | else
|
---|
1466 | $(typevar) += $(out)
|
---|
1467 | endif
|
---|
1468 | # generate the install rule
|
---|
1469 | $(eval $(def_link_install_rule))
|
---|
1470 |
|
---|
1471 | else # NOINST
|
---|
1472 | INSTARGET_$(target) :=
|
---|
1473 | $(typevar) += $(out)
|
---|
1474 | endif # NOINST
|
---|
1475 |
|
---|
1476 | # dependency file
|
---|
1477 | dep := $(outbase)$(SUFF_DEP)
|
---|
1478 | ifndef NO_LINK_CMDS_DEPS
|
---|
1479 | _DEPFILES_INCLUDED += $(dep)
|
---|
1480 | $(if $(wildcard $(dep)),$(eval include $(dep)))
|
---|
1481 | endif
|
---|
1482 |
|
---|
1483 | # check that the tool is defined.
|
---|
1484 | ifndef TOOL_$(tool)_$(tool_do)_CMDS
|
---|
1485 | $(warning kBuild: tools: \
|
---|
1486 | 1 $($(target)_$(source)TOOL.$(bld_trg).$(bld_trg_arch)) \
|
---|
1487 | 2 $($(target)_$(source)TOOL.$(bld_trg)) \
|
---|
1488 | 3 $($(target)_$(source)TOOL) \
|
---|
1489 | 4 $($(target)_TOOL.$(bld_trg).$(bld_trg_arch)) \
|
---|
1490 | 5 $($(target)_TOOL.$(bld_trg)) \
|
---|
1491 | 6 $($(target)_TOOL) \
|
---|
1492 | 7 $($(source)TOOL.$(bld_trg).$(bld_trg_arch)) \
|
---|
1493 | 8 $($(source)TOOL.$(bld_trg)) \
|
---|
1494 | 9 $($(source)TOOL) \
|
---|
1495 | 10 $(TOOL.$(bld_trg).$(bld_trg_arch)) \
|
---|
1496 | 11 $(TOOL.$(bld_trg)) \
|
---|
1497 | 12 $(TOOL) )
|
---|
1498 | $(error kBuild: TOOL_$(tool)_$(tool_do)_CMDS isn't defined! target=$(target) )
|
---|
1499 | endif
|
---|
1500 |
|
---|
1501 | # call the tool
|
---|
1502 | $(target)_CMDS_ := $(TOOL_$(tool)_$(tool_do)_CMDS)
|
---|
1503 | $(target)_OUTPUT_ := $(TOOL_$(tool)_$(tool_do)_OUTPUT)
|
---|
1504 | $(target)_DEPEND_ := $(TOOL_$(tool)_$(tool_do)_DEPEND) $(deps) $(objs)
|
---|
1505 | $(target)_DEPORD_ := $(TOOL_$(tool)_$(tool_do)_DEPORD) $(dirdep)
|
---|
1506 |
|
---|
1507 | # generate the link rule.
|
---|
1508 | $(eval $(def_link_rule))
|
---|
1509 |
|
---|
1510 |
|
---|
1511 | # Update globals.
|
---|
1512 | _OBJS += $($(target)_OBJS_)
|
---|
1513 | _OUT_FILES += $($(target)_OUTPUT_) $(out)
|
---|
1514 | _CLEAN_FILES += $($(target)_CLEAN)
|
---|
1515 | _INSTALLS += $(INSTARGET_$(target))
|
---|
1516 |
|
---|
1517 | endef
|
---|
1518 |
|
---|
1519 |
|
---|
1520 | #
|
---|
1521 | # BLDPROGS
|
---|
1522 | #
|
---|
1523 |
|
---|
1524 | ## Build program (one).
|
---|
1525 | # @param $(target) Normalized target (program) name.
|
---|
1526 | define def_bldprog
|
---|
1527 |
|
---|
1528 | # set NOINST if not forced installation.
|
---|
1529 | ifndef $(target)_INST
|
---|
1530 | $(target)_NOINST := 1
|
---|
1531 | endif
|
---|
1532 |
|
---|
1533 | # do the usual stuff.
|
---|
1534 | $(eval $(value def_link_common))
|
---|
1535 |
|
---|
1536 | endef
|
---|
1537 |
|
---|
1538 | # Process build programs.
|
---|
1539 | EXT := EXE
|
---|
1540 | EXTPRE := HOST
|
---|
1541 | tool_do := LINK_PROGRAM
|
---|
1542 | definst := $(PATH_BIN)
|
---|
1543 | typevar := _BLDPROGS
|
---|
1544 | mode := 0755
|
---|
1545 | bld_trg_base_var := PLATFORM
|
---|
1546 | $(foreach target, $(BLDPROGS) $(BLDPROGS.$(BUILD_PLATFORM)) $(BLDPROGS.$(BUILD_PLATFORM).$(BUILD_PLATFORM_ARCH)), $(eval $(value def_bldprog)))
|
---|
1547 |
|
---|
1548 |
|
---|
1549 |
|
---|
1550 | #
|
---|
1551 | # DLLS
|
---|
1552 | #
|
---|
1553 |
|
---|
1554 | # Process dlls
|
---|
1555 | EXT := DLL
|
---|
1556 | EXTPRE :=
|
---|
1557 | tool_do := LINK_DLL
|
---|
1558 | definst := $(PATH_DLL)
|
---|
1559 | typevar := _DLLS
|
---|
1560 | mode := 0755
|
---|
1561 | bld_trg_base_var := TARGET
|
---|
1562 | $(foreach target, $(DLLS) $(DLLS.$(BUILD_TARGET)) $(DLLS.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)), $(eval $(value def_link_common)))
|
---|
1563 |
|
---|
1564 |
|
---|
1565 | #
|
---|
1566 | # Process import libraries.
|
---|
1567 | #
|
---|
1568 | # - On OS/2 and windows these are libraries.
|
---|
1569 | # - On other platforms they are fake DLLs.
|
---|
1570 | ifeq ($(filter-out nt os2 win win64 win32,$(BUILD_TARGET)),)
|
---|
1571 | $(foreach target, $(IMPORT_LIBS) $(IMPORT_LIBS.$(BUILD_TARGET)) $(IMPORT_LIBS.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)), $(eval $(value def_lib)))
|
---|
1572 | else
|
---|
1573 | $(foreach target, $(IMPORT_LIBS) $(IMPORT_LIBS.$(BUILD_TARGET)) $(IMPORT_LIBS.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)), $(eval $(value def_link_common)))
|
---|
1574 | endif
|
---|
1575 | $(foreach target, $(IMPORT_LIBS) $(IMPORT_LIBS.$(BUILD_TARGET)) $(IMPORT_LIBS.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)), \
|
---|
1576 | $(eval _IMPORT_LIBS += $(if $(INSTARGET_$(target)),$(INSTARGET_$(target)), $(TARGET_$(target)))))
|
---|
1577 |
|
---|
1578 |
|
---|
1579 | #
|
---|
1580 | # PROGRAMS
|
---|
1581 | #
|
---|
1582 |
|
---|
1583 | # Process programs
|
---|
1584 | EXT := EXE
|
---|
1585 | EXTPRE :=
|
---|
1586 | tool_do := LINK_PROGRAM
|
---|
1587 | definst := $(PATH_BIN)
|
---|
1588 | typevar := _PROGRAMS
|
---|
1589 | mode := 0755
|
---|
1590 | bld_trg_base_var := TARGET
|
---|
1591 | $(foreach target, $(PROGRAMS) $(PROGRAMS.$(BUILD_TARGET)) $(PROGRAMS.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)), $(eval $(value def_link_common)))
|
---|
1592 |
|
---|
1593 |
|
---|
1594 |
|
---|
1595 | #
|
---|
1596 | # SYSMODS
|
---|
1597 | #
|
---|
1598 |
|
---|
1599 | # Process sysmods
|
---|
1600 | EXT := SYS
|
---|
1601 | EXTPRE :=
|
---|
1602 | tool_do := LINK_SYSMOD
|
---|
1603 | definst := $(PATH_SYS)
|
---|
1604 | typevar := _SYSMODS
|
---|
1605 | mode := 0644
|
---|
1606 | bld_trg_base_var := TARGET
|
---|
1607 | $(foreach target, $(SYSMODS) $(SYSMODS.$(BUILD_TARGET)) $(SYSMODS.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)), $(eval $(value def_link_common)))
|
---|
1608 |
|
---|
1609 |
|
---|
1610 | #
|
---|
1611 | # OTHERS
|
---|
1612 | #
|
---|
1613 | _OTHERS = $(OTHERS) $(OTHERS.$(BUILD_TARGET)) $(OTHERS.$(BUILD_TARGET).$(BUILD_TARGET_ARCH))
|
---|
1614 |
|
---|
1615 |
|
---|
1616 | #
|
---|
1617 | # INSTALLS
|
---|
1618 | #
|
---|
1619 |
|
---|
1620 | ## generate the install rule
|
---|
1621 | define def_install_src_rule
|
---|
1622 | # the install rule
|
---|
1623 | $(insdst) : $(srcsrc) | $(call DIRDEP,$(dir $(insdst)))
|
---|
1624 | $$(call MSG_L1,Installing $(insdst),(<= $(srcsrc)))
|
---|
1625 | $$(QUIET)$$(if $$(filter $(INSTALL),$(inscmd)),,$$(RM) -f $$@)
|
---|
1626 | $$(QUIET)$(inscmd)
|
---|
1627 | endef
|
---|
1628 |
|
---|
1629 | ## install one file
|
---|
1630 | define def_install_src
|
---|
1631 |
|
---|
1632 | # deal with '=>' in the source file name.
|
---|
1633 | srcdst := $(subst =>, ,$(src))
|
---|
1634 | srcsrc := $(firstword $(srcdst))
|
---|
1635 | srcdstdir := $(dir $(word 2,$(srcdst)))
|
---|
1636 | srcdst := $(word $(words $(srcdst)),$(srcdst))
|
---|
1637 |
|
---|
1638 | # _INSTFUN
|
---|
1639 | ifdef $(srcsrc)_INSTFUN
|
---|
1640 | instfun := $(srcsrc)_INSTFUN
|
---|
1641 | else
|
---|
1642 | ifdef $(target)_INSTFUN
|
---|
1643 | instfun := $(target)_INSTFUN
|
---|
1644 | else
|
---|
1645 | instfun := _INSTALL_FILE
|
---|
1646 | endif
|
---|
1647 | endif
|
---|
1648 |
|
---|
1649 | # _INST
|
---|
1650 | ifdef $(srcsrc)_INST
|
---|
1651 | inst := $(patsubst %/,%,$($(srcsrc)_INST))/$(dir $(srcdstdir))
|
---|
1652 | else
|
---|
1653 | ifdef $(target)_INST
|
---|
1654 | inst := $(patsubst %/,%,$($(target)_INST))/$(dir $(srcdstdir))
|
---|
1655 | else
|
---|
1656 | inst := $(dir $(srcdstdir))
|
---|
1657 | endif
|
---|
1658 | endif
|
---|
1659 |
|
---|
1660 | # calc target
|
---|
1661 | insdst := $(call $(instfun),$(srcdst),$(target),$(inst),$(PATH_INS))
|
---|
1662 | #$(warning instfun=$(instfun) srcdst=$(srcdst) target=$(target) inst=$(inst) => insdst=$(insdst))
|
---|
1663 |
|
---|
1664 | # mode, uid and gid
|
---|
1665 | mode := $(firstword \
|
---|
1666 | $($(target)_$(srcsrc)_MODE.$(bld_trg).$(bld_trg_arch)) \
|
---|
1667 | $($(target)_$(srcsrc)_MODE.$(bld_trg)) \
|
---|
1668 | $($(target)_$(srcsrc)_MODE) \
|
---|
1669 | $($(target)_$(srcdst)_MODE.$(bld_trg).$(bld_trg_arch)) \
|
---|
1670 | $($(target)_$(srcdst)_MODE.$(bld_trg)) \
|
---|
1671 | $($(target)_$(srcdst)_MODE) \
|
---|
1672 | $($(srcsrc)_MODE.$(bld_trg).$(bld_trg_arch)) \
|
---|
1673 | $($(srcsrc)_MODE.$(bld_trg)) \
|
---|
1674 | $($(srcsrc)_MODE) \
|
---|
1675 | $($(srcdst)_MODE.$(bld_trg).$(bld_trg_arch)) \
|
---|
1676 | $($(srcdst)_MODE.$(bld_trg)) \
|
---|
1677 | $($(srcdst)_MODE) \
|
---|
1678 | $($(target)_MODE.$(bld_trg).$(bld_trg_arch)) \
|
---|
1679 | $($(target)_MODE.$(bld_trg)) \
|
---|
1680 | $($(target)_MODE))
|
---|
1681 | uid := $(firstword \
|
---|
1682 | $($(target)_$(srcsrc)_UID.$(bld_trg).$(bld_trg_arch)) \
|
---|
1683 | $($(target)_$(srcsrc)_UID.$(bld_trg)) \
|
---|
1684 | $($(target)_$(srcsrc)_UID) \
|
---|
1685 | $($(target)_$(srcdst)_UID.$(bld_trg).$(bld_trg_arch)) \
|
---|
1686 | $($(target)_$(srcdst)_UID.$(bld_trg)) \
|
---|
1687 | $($(target)_$(srcdst)_UID) \
|
---|
1688 | $($(srcsrc)_UID.$(bld_trg).$(bld_trg_arch)) \
|
---|
1689 | $($(srcsrc)_UID.$(bld_trg)) \
|
---|
1690 | $($(srcsrc)_UID) \
|
---|
1691 | $($(srcdst)_UID.$(bld_trg).$(bld_trg_arch)) \
|
---|
1692 | $($(srcdst)_UID.$(bld_trg)) \
|
---|
1693 | $($(srcdst)_UID) \
|
---|
1694 | $($(target)_UID.$(bld_trg).$(bld_trg_arch)) \
|
---|
1695 | $($(target)_UID.$(bld_trg)) \
|
---|
1696 | $($(target)_UID))
|
---|
1697 | gid := $(firstword \
|
---|
1698 | $($(target)_$(srcsrc)_GID.$(bld_trg).$(bld_trg_arch)) \
|
---|
1699 | $($(target)_$(srcsrc)_GID.$(bld_trg)) \
|
---|
1700 | $($(target)_$(srcsrc)_GID) \
|
---|
1701 | $($(target)_$(srcdst)_GID.$(bld_trg).$(bld_trg_arch)) \
|
---|
1702 | $($(target)_$(srcdst)_GID.$(bld_trg)) \
|
---|
1703 | $($(target)_$(srcdst)_GID) \
|
---|
1704 | $($(srcsrc)_GID.$(bld_trg).$(bld_trg_arch)) \
|
---|
1705 | $($(srcsrc)_GID.$(bld_trg)) \
|
---|
1706 | $($(srcsrc)_GID) \
|
---|
1707 | $($(srcdst)_GID.$(bld_trg).$(bld_trg_arch)) \
|
---|
1708 | $($(srcdst)_GID.$(bld_trg)) \
|
---|
1709 | $($(srcdst)_GID) \
|
---|
1710 | $($(target)_GID.$(bld_trg).$(bld_trg_arch)) \
|
---|
1711 | $($(target)_GID.$(bld_trg)) \
|
---|
1712 | $($(target)_GID))
|
---|
1713 |
|
---|
1714 |
|
---|
1715 | # Adjust the source if we got a default PATH. (This must be done this late!)
|
---|
1716 | ifdef $(target)_PATH
|
---|
1717 | srcsrc := $(call abspathex,$(srcsrc),$($(target)_PATH))
|
---|
1718 | endif
|
---|
1719 |
|
---|
1720 | # create the command
|
---|
1721 | ifdef $(srcsrc)_INSTALLER
|
---|
1722 | inscmd := $(call $(srcsrc)_INSTALLER,$(srcsrc),$(insdst),$(target))
|
---|
1723 | else
|
---|
1724 | ifdef $(target)_INSTALLER
|
---|
1725 | inscmd := $(call $(target)_INSTALLER,$(srcsrc),$(insdst),$(target))
|
---|
1726 | else
|
---|
1727 | inscmd := $$(INSTALL)\
|
---|
1728 | $(if $(uid),-o $(uid))\
|
---|
1729 | $(if $(gid),-g $(gid))\
|
---|
1730 | $(if $(mode),-m $(mode))\
|
---|
1731 | $(srcsrc) $(insdst)
|
---|
1732 | endif
|
---|
1733 | endif
|
---|
1734 |
|
---|
1735 | # generate the rule (need double evaluation here)
|
---|
1736 | $(eval $(def_install_src_rule))
|
---|
1737 |
|
---|
1738 | INSTARGET_$(target) += $(insdst)
|
---|
1739 | endef
|
---|
1740 |
|
---|
1741 |
|
---|
1742 | ## generate the symlink rule
|
---|
1743 | define def_install_symlink_rule
|
---|
1744 | # the install rule
|
---|
1745 | $(insdst) : | $(call DIRDEP,$(dir $(insdst)))
|
---|
1746 | $$(call MSG_L1,Installing symlink $(insdst),pointing to $(symdst))
|
---|
1747 | $$(QUIET)$$(RM) -f $$@
|
---|
1748 | $$(QUIET)$$(LN_SYMLINK) $(symdst) $(insdst)
|
---|
1749 | endef
|
---|
1750 |
|
---|
1751 | ## create one symlink
|
---|
1752 | define def_install_symlink
|
---|
1753 |
|
---|
1754 | # deal with '=>' in the source file name.
|
---|
1755 | symdst := $(subst =>, ,$(src))
|
---|
1756 | symlnk := $(firstword $(symdst))
|
---|
1757 | symdst := $(word $(words $(symdst)),$(symdst))
|
---|
1758 |
|
---|
1759 | # _INSTFUN
|
---|
1760 | ifdef $(symlnk)_INSTFUN
|
---|
1761 | instfun := $(symlnk)_INSTFUN
|
---|
1762 | else
|
---|
1763 | ifdef $(target)_INSTFUN
|
---|
1764 | instfun := $(target)_INSTFUN
|
---|
1765 | else
|
---|
1766 | instfun := _INSTALL_FILE
|
---|
1767 | endif
|
---|
1768 | endif
|
---|
1769 |
|
---|
1770 | # _INST
|
---|
1771 | ifdef $(symlnk)_INST
|
---|
1772 | inst := $(patsubst %/,%,$($(symlnk)_INST))/$(dir $(symlnk))
|
---|
1773 | else
|
---|
1774 | ifdef $(target)_INST
|
---|
1775 | inst := $(patsubst %/,%,$($(target)_INST))/$(dir $(symlnk))
|
---|
1776 | else
|
---|
1777 | inst := $(dir $(symlnk))
|
---|
1778 | endif
|
---|
1779 | endif
|
---|
1780 |
|
---|
1781 | # calc target
|
---|
1782 | insdst := $(call $(instfun),$(symlnk),$(target),$(inst),$(PATH_INS))
|
---|
1783 | #$(warning symlnk=$(symlnk) symdst=$(symdst) insdst=$(insdst) instfun=$(instfun) inst='$(inst)')
|
---|
1784 |
|
---|
1785 | # generate the rule (need double evaluation here)
|
---|
1786 | $(eval $(def_install_symlink_rule))
|
---|
1787 |
|
---|
1788 | INSTARGET_$(target) += $(insdst)
|
---|
1789 | endef
|
---|
1790 |
|
---|
1791 |
|
---|
1792 | ## generate the install rule
|
---|
1793 | define def_install_directory_rule
|
---|
1794 | # the install rule
|
---|
1795 | $(insdst):
|
---|
1796 | $$(call MSG_L1,Installing directory $(insdst))
|
---|
1797 | $$(QUIET)$$(INSTALL) -d \
|
---|
1798 | $(if $(uid),-o $(uid))\
|
---|
1799 | $(if $(gid),-g $(gid))\
|
---|
1800 | $(if $(mode),-m $(mode))\
|
---|
1801 | $(insdst)
|
---|
1802 |
|
---|
1803 | .NOTPARALLEL: $(insdst)
|
---|
1804 | endef
|
---|
1805 |
|
---|
1806 |
|
---|
1807 | ## create one directory
|
---|
1808 | define def_install_directory
|
---|
1809 |
|
---|
1810 | # _INST
|
---|
1811 | ifdef $(directory)_INST
|
---|
1812 | inst := $(PATH_INS)/$(patsubst %/,%,$($(directory)_INST))
|
---|
1813 | else
|
---|
1814 | ifdef $(target)_INST
|
---|
1815 | inst := $(PATH_INS)/$(patsubst %/,%,$($(target)_INST))
|
---|
1816 | else
|
---|
1817 | inst := $(PATH_INS)
|
---|
1818 | endif
|
---|
1819 | endif
|
---|
1820 |
|
---|
1821 | mode := $(firstword \
|
---|
1822 | $($(target)_$(directory)_MODE.$(bld_trg).$(bld_trg_arch)) \
|
---|
1823 | $($(target)_$(directory)_MODE.$(bld_trg)) \
|
---|
1824 | $($(target)_$(directory)_MODE) \
|
---|
1825 | $($(directory)_MODE.$(bld_trg).$(bld_trg_arch)) \
|
---|
1826 | $($(directory)_MODE.$(bld_trg)) \
|
---|
1827 | $($(directory)_MODE) \
|
---|
1828 | $($(target)_MODE.$(bld_trg).$(bld_trg_arch)) \
|
---|
1829 | $($(target)_MODE.$(bld_trg)) \
|
---|
1830 | $($(target)_MODE))
|
---|
1831 | uid := $(firstword \
|
---|
1832 | $($(target)_$(directory)_UID.$(bld_trg).$(bld_trg_arch)) \
|
---|
1833 | $($(target)_$(directory)_UID.$(bld_trg)) \
|
---|
1834 | $($(target)_$(directory)_UID) \
|
---|
1835 | $($(directory)_UID.$(bld_trg).$(bld_trg_arch)) \
|
---|
1836 | $($(directory)_UID.$(bld_trg)) \
|
---|
1837 | $($(directory)_UID) \
|
---|
1838 | $($(target)_UID.$(bld_trg).$(bld_trg_arch)) \
|
---|
1839 | $($(target)_UID.$(bld_trg)) \
|
---|
1840 | $($(target)_UID))
|
---|
1841 | gid := $(firstword \
|
---|
1842 | $($(target)_$(directory)_GID.$(bld_trg).$(bld_trg_arch)) \
|
---|
1843 | $($(target)_$(directory)_GID.$(bld_trg)) \
|
---|
1844 | $($(target)_$(directory)_GID) \
|
---|
1845 | $($(directory)_GID.$(bld_trg).$(bld_trg_arch)) \
|
---|
1846 | $($(directory)_GID.$(bld_trg)) \
|
---|
1847 | $($(directory)_GID) \
|
---|
1848 | $($(target)_GID.$(bld_trg).$(bld_trg_arch)) \
|
---|
1849 | $($(target)_GID.$(bld_trg)) \
|
---|
1850 | $($(target)_GID))
|
---|
1851 |
|
---|
1852 | insdst := $(inst)/$(directory)/
|
---|
1853 | #$(warning directory=$(directory) inst=$(inst) insdst=$(insdst) mode=$(mode) gid=$(gid) uid=$(uid))
|
---|
1854 |
|
---|
1855 | # generate the rule (need double evaluation here)
|
---|
1856 | $(eval $(def_install_directory_rule))
|
---|
1857 |
|
---|
1858 | INSTARGET_DIRS_$(target) += $(insdst)
|
---|
1859 | endef
|
---|
1860 |
|
---|
1861 |
|
---|
1862 | ## process one install target.
|
---|
1863 | define def_install
|
---|
1864 | # the basics.
|
---|
1865 | bld_type := $(firstword $($(target)_BLD_TYPE) $(BUILD_TYPE))
|
---|
1866 | bld_trg := $(firstword $($(target)_BLD_TRG) $(BUILD_TARGET))
|
---|
1867 | bld_trg_arch:= $(firstword $($(target)_BLD_TRG_ARCH) $(BUILD_TARGET_ARCH))
|
---|
1868 | bld_trg_cpu := $(firstword $($(target)_BLD_TRG_CPU) $(BUILD_TARGET_CPU))
|
---|
1869 |
|
---|
1870 | INSTARGET_$(target) :=
|
---|
1871 | INSTARGET_DIRS_$(target) :=
|
---|
1872 |
|
---|
1873 | $(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)), \
|
---|
1874 | $(eval $(value def_install_directory)))
|
---|
1875 |
|
---|
1876 | $(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)), \
|
---|
1877 | $(eval $(value def_install_src)))
|
---|
1878 |
|
---|
1879 | $(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)), \
|
---|
1880 | $(eval $(value def_install_symlink)))
|
---|
1881 |
|
---|
1882 | _INSTALLS += $(INSTARGET_$(target)) $($(target)_GOALS)
|
---|
1883 | _INSTALLS_DIRS += $(INSTARGET_DIRS_$(target))
|
---|
1884 | endef
|
---|
1885 |
|
---|
1886 | ## process all install targets
|
---|
1887 | $(foreach target, $(INSTALLS) $(INSTALLS.$(BUILD_TARGET)) $(INSTALLS.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)), \
|
---|
1888 | $(eval $(value def_install)))
|
---|
1889 |
|
---|
1890 |
|
---|
1891 | #
|
---|
1892 | # PACKING
|
---|
1893 | #
|
---|
1894 | _PACKING += $(PACKING) $(PACKING.$(BUILD_TARGET)) $(PACKING.$(BUILD_TARGET).$(BUILD_TARGET_ARCH))
|
---|
1895 |
|
---|
1896 |
|
---|
1897 | #
|
---|
1898 | # DOCS
|
---|
1899 | #
|
---|
1900 |
|
---|
1901 |
|
---|
1902 | #
|
---|
1903 | # DIRECTORIES
|
---|
1904 | #
|
---|
1905 | _DIR_ALL := $(sort $(addsuffix /,$(patsubst %/,%,$(_DIRS))) $(dir $(_OUT_FILES) $(_OBJS) $(_INSTALLS)))
|
---|
1906 | $(foreach directory,$(_INSTALLS_DIRS), $(eval _DIR_ALL := $(filter-out $(directory),$(_DIR_ALL))))
|
---|
1907 |
|
---|
1908 |
|
---|
1909 | define def_mkdir_rule
|
---|
1910 | $(directory):
|
---|
1911 | $$(call MSG_L2,Creating directory $$@)
|
---|
1912 | $$(QUIET)$$(MKDIR) -p $$@
|
---|
1913 | endef
|
---|
1914 |
|
---|
1915 | $(foreach directory,$(_DIR_ALL),$(eval $(def_mkdir_rule)))
|
---|
1916 |
|
---|
1917 |
|
---|
1918 | #
|
---|
1919 | # NOTHING
|
---|
1920 | #
|
---|
1921 | do-nothing:
|
---|
1922 | $(call MSG_L1,Did nothing in $(CURDIR))
|
---|
1923 |
|
---|
1924 |
|
---|
1925 | #
|
---|
1926 | # CLEAN UP
|
---|
1927 | #
|
---|
1928 | do-clean:
|
---|
1929 | $(call MSG_L1,Cleaning...)
|
---|
1930 | $(QUIET)$(RM) -f $(_OUT_FILES) $(_OBJS) $(_DEPFILES) $(_DEPFILES_INCLUDED) $(_CLEAN_FILES) $(OTHER_CLEAN)
|
---|
1931 |
|
---|
1932 |
|
---|
1933 | #
|
---|
1934 | # PASSES (including directory and makefile walking)
|
---|
1935 | #
|
---|
1936 |
|
---|
1937 | ## Subdir
|
---|
1938 | # @param $(pass) Lowercase pass name.
|
---|
1939 | # @param $(PASS) Uppercase pass name.
|
---|
1940 | # @param $(subdir) Subdirectory
|
---|
1941 | # @param $(tag) tag to attach to the rule name.
|
---|
1942 | define def_pass_subdir
|
---|
1943 | pass_$(pass)$(tag):: $(dep)
|
---|
1944 | + $$(QUIET)$$(MAKE) -C $(subdir) -f $$(notdir $$(firstword $$(wildcard $$(addprefix $(subdir)/,$$(DEFAULT_MAKEFILE))))) pass_$(pass)
|
---|
1945 | endef
|
---|
1946 |
|
---|
1947 | ## Submakefile
|
---|
1948 | # @param $(pass) Lowercase pass name.
|
---|
1949 | # @param $(PASS) Uppercase pass name.
|
---|
1950 | # @param $(makefile) Makefile.
|
---|
1951 | # @param $(tag) tag to attach to the rule name.
|
---|
1952 | define def_pass_makefile
|
---|
1953 | pass_$(pass)$(tag):: $(dep)
|
---|
1954 | + $$(QUIET)$$(MAKE) -C $(patsubst %/,%,$(dir $(makefile))) -f $(notdir $(makefile)) pass_$(pass)
|
---|
1955 | endef
|
---|
1956 |
|
---|
1957 | ## Execute a pass.
|
---|
1958 | # @param $(pass) Lowercase pass name.
|
---|
1959 | # @param $(PASS) Uppercase pass name.
|
---|
1960 | define def_pass_old
|
---|
1961 | $(eval SUBDIRS_$(PASS) ?= $(SUBDIRS) $(SUBDIRS.$(BUILD_TARGET)) $(SUBDIRS.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)) )
|
---|
1962 | $(eval SUBDIRS_AFTER_$(PASS) ?= $(SUBDIRS_AFTER) $(SUBDIRS_AFTER.$(BUILD_TARGET)) $(SUBDIRS_AFTER.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)) )
|
---|
1963 | $(eval MAKEFILES_BEFORE_$(PASS) ?= $(MAKEFILES_BEFORE) $(MAKEFILES_BEFORE.$(BUILD_TARGET)) $(MAKEFILES_BEFORE.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)) )
|
---|
1964 | $(eval MAKEFILES_AFTER_$(PASS) ?= $(MAKEFILES_AFTER) $(MAKEFILES_AFTER.$(BUILD_TARGET)) $(MAKEFILES_AFTER.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)) )
|
---|
1965 |
|
---|
1966 | $(eval tag:=_before)
|
---|
1967 | $(eval dep:=)
|
---|
1968 | $(foreach subdir,$(SUBDIRS_$(PASS)) $(SUBDIRS_$(PASS).$(BUILD_TARGET)) $(SUBDIRS_$(PASS).$(BUILD_TARGET).$(BUILD_TARGET_ARCH)) ,$(eval $(def_pass_subdir)))
|
---|
1969 | $(foreach makefile,$(MAKEFILES_BEFORE_$(PASS)) $(MAKEFILES_BEFORE_$(PASS).$(BUILD_TARGET)) $(MAKEFILES_BEFORE_$(PASS).$(BUILD_TARGET).$(BUILD_TARGET_ARCH)),$(eval $(def_pass_makefile)))
|
---|
1970 |
|
---|
1971 | $(eval tag:=_after)
|
---|
1972 | $(eval dep:=pass_$(pass)_doit)
|
---|
1973 | $(foreach subdir,$(SUBDIRS_AFTER_$(PASS)) $(SUBDIRS_AFTER_$(PASS).$(BUILD_TARGET)) $(SUBDIRS_AFTER_$(PASS).$(BUILD_TARGET).$(BUILD_TARGET_ARCH)) ,$(eval $(def_pass_subdir)))
|
---|
1974 | $(foreach makefile,$(MAKEFILES_AFTER_$(PASS)) $(MAKEFILES_AFTER_$(PASS).$(BUILD_TARGET)) $(MAKEFILES_AFTER_$(PASS).$(BUILD_TARGET).$(BUILD_TARGET_ARCH)) ,$(eval $(def_pass_makefile)))
|
---|
1975 |
|
---|
1976 | .NOTPARALLEL: pass_$(pass)_before pass_$(pass)_after
|
---|
1977 | .PHONY: pass_$(pass) pass_$(pass)_before pass_$(pass)_doit pass_$(pass)_after
|
---|
1978 | pass_$(pass)_doit: $(PASS_$(PASS)_trgs) $(foreach var,$(PASS_$(PASS)_vars),$(var))
|
---|
1979 | pass_$(pass)_this: pass_$(pass)_before
|
---|
1980 | + $$(QUIET)$$(MAKE) -f $$(MAKEFILE) pass_$(pass)_doit
|
---|
1981 | pass_$(pass)_after:: pass_$(pass)_this
|
---|
1982 | pass_$(pass): pass_$(pass)_after
|
---|
1983 |
|
---|
1984 | endef
|
---|
1985 |
|
---|
1986 | define def_pass
|
---|
1987 | $(eval SUBDIRS_$(PASS) ?= $(SUBDIRS) $(SUBDIRS.$(BUILD_TARGET)) $(SUBDIRS.$(BUILD_TARGET.$(BUILD_TARGET_ARCH))) )
|
---|
1988 | $(eval SUBDIRS_AFTER_$(PASS) ?= $(SUBDIRS_AFTER) $(SUBDIRS_AFTER.$(BUILD_TARGET)) $(SUBDIRS_AFTER.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)) )
|
---|
1989 | $(eval MAKEFILES_BEFORE_$(PASS) ?= $(MAKEFILES_BEFORE) $(MAKEFILES_BEFORE.$(BUILD_TARGET)) $(MAKEFILES_BEFORE.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)) )
|
---|
1990 | $(eval MAKEFILES_AFTER_$(PASS) ?= $(MAKEFILES_AFTER) $(MAKEFILES_AFTER.$(BUILD_TARGET)) $(MAKEFILES_AFTER.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)) )
|
---|
1991 |
|
---|
1992 | $(eval tag:=_before)
|
---|
1993 | $(eval dep:=)
|
---|
1994 | $(foreach subdir,$(SUBDIRS_$(PASS)) $(SUBDIRS_$(PASS).$(BUILD_TARGET)) $(SUBDIRS_$(PASS).$(BUILD_TARGET).$(BUILD_TARGET_ARCH)) ,$(eval $(def_pass_subdir)))
|
---|
1995 | $(foreach makefile,$(MAKEFILES_BEFORE_$(PASS)) $(MAKEFILES_BEFORE_$(PASS).$(BUILD_TARGET)) $(MAKEFILES_BEFORE_$(PASS).$(BUILD_TARGET).$(BUILD_TARGET_ARCH)),$(eval $(def_pass_makefile)))
|
---|
1996 |
|
---|
1997 | $(eval tag:=_after)
|
---|
1998 | $(eval dep:=pass_$(pass)_doit)
|
---|
1999 | $(foreach subdir,$(SUBDIRS_AFTER_$(PASS)) $(SUBDIRS_AFTER_$(PASS).$(BUILD_TARGET)) $(SUBDIRS_AFTER_$(PASS).$(BUILD_TARGET).$(BUILD_TARGET_ARCH)) ,$(eval $(def_pass_subdir)))
|
---|
2000 | $(foreach makefile,$(MAKEFILES_AFTER_$(PASS)) $(MAKEFILES_AFTER_$(PASS).$(BUILD_TARGET)) $(MAKEFILES_AFTER_$(PASS).$(BUILD_TARGET).$(BUILD_TARGET_ARCH)) ,$(eval $(def_pass_makefile)))
|
---|
2001 |
|
---|
2002 | ifdef KBUILD_SAFE_PARALLEL
|
---|
2003 | .NOTPARALLEL: pass_$(pass) pass_$(pass)_before pass_$(pass)_after pass_$(pass)_this
|
---|
2004 | .PHONY: pass_$(pass) pass_$(pass)_before pass_$(pass)_after pass_$(pass)_this pass_$(pass)_doit
|
---|
2005 | pass_$(pass)_doit: $(PASS_$(PASS)_trgs) $(foreach var,$(PASS_$(PASS)_vars),$(var))
|
---|
2006 | pass_$(pass)_this: pass_$(pass)_before
|
---|
2007 | + $$(QUIET)$$(MAKE) -f $$(MAKEFILE) pass_$(pass)_doit
|
---|
2008 | pass_$(pass)_after:: pass_$(pass)_this
|
---|
2009 | pass_$(pass): pass_$(pass)_after
|
---|
2010 | else
|
---|
2011 | .NOTPARALLEL: pass_$(pass) pass_$(pass)_before pass_$(pass)_after pass_$(pass)_doit
|
---|
2012 | .PHONY: pass_$(pass) pass_$(pass)_before pass_$(pass)_after pass_$(pass)_doit
|
---|
2013 | pass_$(pass)_doit: pass_$(pass)_before \
|
---|
2014 | $(PASS_$(PASS)_trgs) $(foreach var,$(PASS_$(PASS)_vars),$($(var)))
|
---|
2015 | pass_$(pass): \
|
---|
2016 | pass_$(pass)_before \
|
---|
2017 | pass_$(pass)_doit \
|
---|
2018 | pass_$(pass)_after
|
---|
2019 | endif
|
---|
2020 |
|
---|
2021 | #$ (warning pass=$(pass) PASS=$(PASS): $(PASS_$(PASS)_trgs) $(PASS_$(PASS)_trgs) $(foreach var,$(PASS_$(PASS)_vars),$($(var))))
|
---|
2022 | endef
|
---|
2023 |
|
---|
2024 | # Generate the defined passes.
|
---|
2025 | $(foreach PASS, $(PASSES), \
|
---|
2026 | $(eval pass := $(PASS_$(PASS)_pass)) \
|
---|
2027 | $(eval $(def_pass)))
|
---|
2028 |
|
---|
2029 | ## Pass order
|
---|
2030 | # @param $(pass) Current pass name.
|
---|
2031 | # @param $(prev_pass) The previous pass name.
|
---|
2032 | define def_pass_order
|
---|
2033 | ifdef KBUILD_SAFE_PARALLEL
|
---|
2034 | .NOTPARALLEL: pass_$(pass)_order
|
---|
2035 | .PHONY: pass_$(pass)_order
|
---|
2036 | pass_$(pass)_order: $(pass_prev)
|
---|
2037 | $$(call MSG_L1,Pass - $$(if $$(PASS_$(PASS)),$$(PASS_$(PASS)),$(pass)))
|
---|
2038 | + $$(QUIET)$$(MAKE) -f $$(MAKEFILE) pass_$(pass)
|
---|
2039 | else
|
---|
2040 | .NOTPARALLEL: pass_$(pass)_order pass_$(pass)_banner
|
---|
2041 | .PHONY: pass_$(pass)_order pass_$(pass)_banner
|
---|
2042 | pass_$(pass)_banner:
|
---|
2043 | $$(call MSG_L1,Pass - $$(if $$(PASS_$(PASS)),$$(PASS_$(PASS)),$(pass)))
|
---|
2044 | pass_$(pass)_order: \
|
---|
2045 | $(pass_prev) \
|
---|
2046 | pass_$(pass)_banner \
|
---|
2047 | pass_$(pass)
|
---|
2048 | endif
|
---|
2049 | $(eval pass_prev := pass_$(pass)_order)
|
---|
2050 | endef
|
---|
2051 |
|
---|
2052 | ## PASS: order
|
---|
2053 | # Use dependencies to ensure correct pass order.
|
---|
2054 | pass_prev :=
|
---|
2055 | $(foreach PASS,$(DEFAULT_PASSES),\
|
---|
2056 | $(eval pass := $(PASS_$(PASS)_pass)) \
|
---|
2057 | $(eval $(def_pass_order)))
|
---|
2058 |
|
---|
2059 |
|
---|
2060 | #
|
---|
2061 | # THE MAIN RULES
|
---|
2062 | #
|
---|
2063 | all_recursive: $(pass_prev)
|
---|
2064 |
|
---|
2065 | rebuild: clean
|
---|
2066 | + $(MAKE) -f $(firstword $(MAKEFILE_LIST)) all_recursive
|
---|
2067 |
|
---|
2068 | # @todo make this a non-default pass!
|
---|
2069 | uninstall:
|
---|
2070 | $(RM) -f $(_INSTALLS)
|
---|
2071 |
|
---|
2072 | install: pass_installs
|
---|
2073 |
|
---|
2074 | # misc shortcuts.
|
---|
2075 | targets: bldprogs libraries dlls programs sysmods others installs
|
---|
2076 | objects: $(_OBJS)
|
---|
2077 | bldprogs: $(_BLDPROGS)
|
---|
2078 | libraries: $(_LIBS) $(_IMPORT_LIBS) $(_OTHER_LIBRARIES)
|
---|
2079 | dlls: $(_DLLS)
|
---|
2080 | programs: $(_PROGRAMS)
|
---|
2081 | sysmods: $(_SYSMODS)
|
---|
2082 | others: $(_OTHERS)
|
---|
2083 | installs: $(_INSTALLS_DIRS) $(_INSTALLS)
|
---|
2084 |
|
---|
2085 |
|
---|
2086 | #
|
---|
2087 | # kBuild debugging stuff.
|
---|
2088 | #
|
---|
2089 | _SPACE := $(subst ., ,.)
|
---|
2090 | _TAB := $(subst ., ,.)
|
---|
2091 | define _NEWLINE
|
---|
2092 |
|
---|
2093 |
|
---|
2094 | endef
|
---|
2095 | NLTAB = $(_NEWLINE)$(TAB)
|
---|
2096 | show_targets:
|
---|
2097 | @$(foreach target, $(ALL_TARGETS),\
|
---|
2098 | @$(ECHO) "target: $(target)" $(NLTAB)\
|
---|
2099 | @$(ECHO) " PATH_$(target)=$(PATH_$(target))" $(NLTAB)\
|
---|
2100 | @$(ECHO) " TARGET_$(target)=$(TARGET_$(target))" $(NLTAB)\
|
---|
2101 | @$(ECHO) " INSTARGET_$(target)=$(INSTARGET_$(target))" $(NLTAB)\
|
---|
2102 | $(foreach prop,$(PROPS_SINGLE) $(PROPS_ACCUMULATE_L) $(PROPS_ACCUMULATE_R) OBJS_ CLEAN, \
|
---|
2103 | $(eval _tmp:=$(firstword $($(target)_BLD_TRG) $(BUILD_TARGET))) \
|
---|
2104 | $(if $($(target)_$(prop).$(_tmp)),\
|
---|
2105 | @$(ECHO) " $(target)_$(prop).$(_tmp)=$($(target)_$(prop).$(_tmp))" $(NLTAB)) \
|
---|
2106 | $(if $($(target)_$(prop)), $(NLTAB)@$(ECHO) " $(target)_$(prop)=$($(target)_$(prop))" $(NLTAB)) \
|
---|
2107 | )\
|
---|
2108 | $(foreach prop,$(PROPS_DEFERRED), \
|
---|
2109 | $(eval _tmp:=$(firstword $($(target)_BLD_TRG) $(BUILD_TARGET))) \
|
---|
2110 | $(if $(value $(target)_$(prop).$(_tmp)),\
|
---|
2111 | @$(ECHO) ' $(target)_$(prop).$(_tmp)=$(value $(TARGET)_$(prop).$(_tmp))' $(NLTAB)) \
|
---|
2112 | $(if $(value $(target)_$(prop)), $(NLTAB)@$(ECHO) ' $(target)_$(prop)=$(value $(target)_$(prop))' $(NLTAB)) \
|
---|
2113 | ))
|
---|
2114 |
|
---|
2115 |
|
---|
2116 |
|
---|
2117 | #
|
---|
2118 | # Include dependency files.
|
---|
2119 | #
|
---|
2120 | $(foreach dep,$(wildcard $(_DEPFILES)),$(eval include $(dep)))
|
---|
2121 |
|
---|
2122 |
|
---|
2123 | # end-of-file-content
|
---|
2124 | __footer_kmk__ := target
|
---|
2125 | endif # __footer_kmk__
|
---|
2126 |
|
---|
2127 |
|
---|