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