1 | # $Id: footer.kmk 353 2005-12-12 03:36:07Z bird $
|
---|
2 | ## @file
|
---|
3 | #
|
---|
4 | # kBuild - File included at top of makefile.
|
---|
5 | #
|
---|
6 | # Copyright (c) 2004-2005 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 | # Variables.
|
---|
32 | # (Some of these need initialization before including definitions using them.)
|
---|
33 | #
|
---|
34 |
|
---|
35 | # all targets.
|
---|
36 | ALL_TARGETS += \
|
---|
37 | $(BLDPROGS) $(BLDPROGS.$(BUILD_PLATFORM)) \
|
---|
38 | $(LIBRARIES) $(LIBRARIES.$(BUILD_TARGET)) \
|
---|
39 | $(IMPORT_LIBS) $(IMPORT_LIBS.$(BUILD_TARGET)) \
|
---|
40 | $(DLLS) $(DLLS.$(BUILD_TARGET)) \
|
---|
41 | $(PROGRAMS) $(PROGRAMS.$(BUILD_TARGET)) \
|
---|
42 | $(SYSMODS) $(SYSMODS.$(BUILD_TARGET)) \
|
---|
43 | $(INSTALLS) $(INSTALLS.$(BUILD_TARGET)) \
|
---|
44 | $(OTHERS) $(OTHERS.$(BUILD_TARGET))
|
---|
45 |
|
---|
46 | # dependency files.
|
---|
47 | _DEPFILES :=
|
---|
48 |
|
---|
49 | # All kind of output files except for _OBJS and _DEPFILES.
|
---|
50 | # Compiling or linking definition outputting other things that $@ and any
|
---|
51 | # required dependency file must add those output files to this variable.
|
---|
52 | _OUT_FILES :=
|
---|
53 |
|
---|
54 | # Files which only requires cleaning up.
|
---|
55 | _CLEAN_FILES :=
|
---|
56 |
|
---|
57 | # all of a type
|
---|
58 | _OBJS :=
|
---|
59 | _BLDPROGS :=
|
---|
60 | _LIBS :=
|
---|
61 | _DLLS :=
|
---|
62 | _PROGRAMS :=
|
---|
63 | _SYSMODS :=
|
---|
64 | _INSTALLS :=
|
---|
65 | _OTHERS :=
|
---|
66 | _DIRS := $(PATH_TARGET)/
|
---|
67 | _IMPORT_LIBS :=
|
---|
68 |
|
---|
69 | # misc
|
---|
70 | pass_prev :=
|
---|
71 |
|
---|
72 |
|
---|
73 | #
|
---|
74 | # Basic macros
|
---|
75 | #
|
---|
76 |
|
---|
77 | ## Figure out the tool for a source
|
---|
78 | # @param $target source file
|
---|
79 | # @param $source normalized main target
|
---|
80 | # @param $type tooltype
|
---|
81 | # @param bld_trg build target.
|
---|
82 | _SOURCE_TOOL = $(strip $(firstword \
|
---|
83 | $($(target)_$(source)_$(type)TOOL.$(bld_trg)) \
|
---|
84 | $($(target)_$(source)_$(type)TOOL) \
|
---|
85 | $($(target)_$(source)_TOOL.$(bld_trg)) \
|
---|
86 | $($(target)_$(source)_TOOL) \
|
---|
87 | $($(target)_$(type)TOOL.$(bld_trg)) \
|
---|
88 | $($(target)_$(type)TOOL) \
|
---|
89 | $($(target)_TOOL.$(bld_trg)) \
|
---|
90 | $($(target)_TOOL) \
|
---|
91 | $($(source)_$(type)TOOL.$(bld_trg)) \
|
---|
92 | $($(source)_$(type)TOOL) \
|
---|
93 | $($(source)_TOOL.$(bld_trg)) \
|
---|
94 | $($(source)_TOOL) \
|
---|
95 | $($(type)TOOL.$(bld_trg)) \
|
---|
96 | $($(type)TOOL) \
|
---|
97 | $(TOOL.$(bld_trg)) \
|
---|
98 | $(TOOL) ))
|
---|
99 |
|
---|
100 | ## Figure out the tool for a target.
|
---|
101 | # @param $target normalized target.
|
---|
102 | # @param $source tooltype.
|
---|
103 | # @param bld_trg build target.
|
---|
104 | _TARGET_TOOL = $(strip $(firstword \
|
---|
105 | $($(target)_$(source)TOOL.$(bld_trg)) \
|
---|
106 | $($(target)_$(source)TOOL) \
|
---|
107 | $($(target)_TOOL.$(bld_trg)) \
|
---|
108 | $($(target)_TOOL) \
|
---|
109 | $($(source)TOOL.$(bld_trg)) \
|
---|
110 | $($(source)TOOL) \
|
---|
111 | $(TOOL.$(bld_trg)) \
|
---|
112 | $(TOOL) \
|
---|
113 | ))
|
---|
114 |
|
---|
115 | ## Removes the drive letter from a path (if it has one)
|
---|
116 | # @param $1 the path
|
---|
117 | no-drive=$(word $(words $(subst :, ,$(1))),$(subst :, ,$(1)))
|
---|
118 |
|
---|
119 | ## Removes the root slash from a path (if it has one)
|
---|
120 | # @param $1 the path
|
---|
121 | no-root-slash=$(patsubst /%,%,$(1))
|
---|
122 |
|
---|
123 | ## Figure out where to put object files.
|
---|
124 | # @param $1 source file
|
---|
125 | # @param $2 normalized main target
|
---|
126 | # @remark There are two major hacks here:
|
---|
127 | # 1. Source files in the output directory are translated into a gen/ subdir.
|
---|
128 | # 2. Catch anyone specifying $(PATH_CURRENT)/sourcefile.c.
|
---|
129 | _OBJECT_BASE = $(PATH_TARGET)/$(2)/$(call no-root-slash,$(call no-drive,$(basename \
|
---|
130 | $(patsubst $(PATH_ROOT)/%,%,$(patsubst $(PATH_CURRENT)/%,%,$(patsubst $(PATH_TARGET)/$(2)/%,gen/%,$(1)))))))
|
---|
131 |
|
---|
132 | ## Figure out where to put object files.
|
---|
133 | # @param $1 real target name.
|
---|
134 | # @param $2 normalized main target
|
---|
135 | _TARGET_BASE = $(PATH_TARGET)/$(2)/$(call no-root-slash,$(call no-drive,$(basename $(1))))
|
---|
136 |
|
---|
137 |
|
---|
138 | ## Figure out the actual name of an installed file.
|
---|
139 | # @param $1 The file to install.
|
---|
140 | # @param $2 The target name.
|
---|
141 | # @param $3 The _INST value (can be empty).
|
---|
142 | # @param $4 The default directory to use when $3 is empty.
|
---|
143 | _INSTALL_FILE = $(patsubst %/,%/$(notdir $(1)),$(if $(3),$(PATH_INS)/$(3),$(4)/))
|
---|
144 |
|
---|
145 |
|
---|
146 | #
|
---|
147 | # Check syntax which leads to weird syntax errors.
|
---|
148 | #
|
---|
149 |
|
---|
150 | ## Check
|
---|
151 | # @param $(target) Target name.
|
---|
152 | define def_check_target
|
---|
153 | ifneq ("$($(target)_TEMPLATE)","$(strip $($(target)_TEMPLATE))")
|
---|
154 | $$(error $(target) have an incorrect template name. Remove any tabs!)
|
---|
155 | endif
|
---|
156 | endef
|
---|
157 | $(foreach target, $(ALL_TARGETS),$(eval $(def_check_target)))
|
---|
158 |
|
---|
159 |
|
---|
160 | #
|
---|
161 | # Include templates
|
---|
162 | #
|
---|
163 | _TEMPLATES := $(TEMPLATE)
|
---|
164 | define def_templates
|
---|
165 | ifdef $(target)_TEMPLATE
|
---|
166 | _TEMPLATES += $($(target)_TEMPLATE)
|
---|
167 | endif
|
---|
168 | endef
|
---|
169 | $(foreach target, $(ALL_TARGETS), $(eval $(def_templates)))
|
---|
170 | _TEMPLATES := $(sort $(_TEMPLATES))
|
---|
171 | # $ (warning dbg: _TEMPLATES=$(_TEMPLATES))
|
---|
172 |
|
---|
173 | define def_templates_include
|
---|
174 | ifndef TEMPLATE_$(template)
|
---|
175 | include $(firstword $(foreach path, $(TEMPLATE_PATHS) $(PATH_KBUILD)/templates/, $(wildcard $(path)/$(template).kmk)))
|
---|
176 | endif
|
---|
177 | endef
|
---|
178 | $(foreach template, $(_TEMPLATES), $(eval $(def_templates)))
|
---|
179 |
|
---|
180 |
|
---|
181 | #
|
---|
182 | # Common Inheritance
|
---|
183 | #
|
---|
184 |
|
---|
185 | ## Inherit defaults property
|
---|
186 | # @param $(prop) Property name
|
---|
187 | # @param $(target) Target name.
|
---|
188 | define def_inherit_defaults_one
|
---|
189 | ifndef $(target)_$(prop)
|
---|
190 | ifndef $(target)_$(prop).$(BUILD_TARGET)
|
---|
191 | ifdef $(prop)
|
---|
192 | $$(eval $(target)_$(prop) := $($(prop)))
|
---|
193 | endif
|
---|
194 | ifdef $(prop).$(BUILD_TARGET)
|
---|
195 | $$(eval $(target)_$(prop).$(BUILD_TARGET) := $($(prop).$(BUILD_TARGET)))
|
---|
196 | endif
|
---|
197 | endif
|
---|
198 | endif
|
---|
199 | endef
|
---|
200 |
|
---|
201 | ## Inherit default properties for one target.
|
---|
202 | # A bit tricky this one, but it depends a bit on whether or not TEMPLATE
|
---|
203 | # is inherited from the default properties.
|
---|
204 | # @param $(target) Target name
|
---|
205 | #
|
---|
206 | define def_inherit_defaults
|
---|
207 | ifdef $(target)_TEMPLATE
|
---|
208 | ifeq ($(strip $(TEMPLATE_$($(target)_TEMPLATE)_TOOL) $(TEMPLATE_$($(target)_TEMPLATE)_TOOL.$(BUILD_TARGET))),)
|
---|
209 | $$(foreach prop,TOOL, $$(eval $$(def_inherit_defaults_one)))
|
---|
210 | endif
|
---|
211 | ifeq ($(strip $(TEMPLATE_$($(target)_TEMPLATE)_SDKS) $(TEMPLATE_$($(target)_TEMPLATE)_SDKS.$(BUILD_TARGET))),)
|
---|
212 | $$(foreach prop,SDKS, $$(eval $$(def_inherit_defaults_one)))
|
---|
213 | endif
|
---|
214 | else
|
---|
215 | $$(foreach prop,TEMPLATE TOOL SDKS, $$(eval $$(def_inherit_defaults_one)))
|
---|
216 | endif
|
---|
217 | endef
|
---|
218 | # Inherit default properties.
|
---|
219 | # !!!!!!THIS IS MESSY AND NOT NECESSARY!!!!!!
|
---|
220 | $(foreach target, $(ALL_TARGETS),$(eval $(def_inherit_defaults)))
|
---|
221 |
|
---|
222 |
|
---|
223 | ## Inherit one template property in a non-accumulative manner.
|
---|
224 | # @param $(prop) Property name
|
---|
225 | # @param $(target) Target name
|
---|
226 | # @todo fix the precedence order for some properties.
|
---|
227 | define def_inherit_template_one
|
---|
228 | ifdef TEMPLATE_$($(target)_TEMPLATE)_$(prop)
|
---|
229 | ifndef $(target)_$(prop)
|
---|
230 | $(target)_$(prop) := $(TEMPLATE_$($(target)_TEMPLATE)_$(prop))
|
---|
231 | #$ (warning dbgtarget: $(target)_$(prop):='$(value $(target)_$(prop))' TEMPLATE_$($(target)_TEMPLATE)_$(prop))
|
---|
232 | endif
|
---|
233 | endif
|
---|
234 | ifdef TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(BUILD_TARGET)
|
---|
235 | ifndef $(target)_$(prop).$(BUILD_TARGET)
|
---|
236 | #$ (warning dbgsource: $(target)_$(prop).$(BUILD_TARGET)="TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(BUILD_TARGET)" TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(BUILD_TARGET))
|
---|
237 | $(target)_$(prop).$(BUILD_TARGET) := $(TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(BUILD_TARGET))
|
---|
238 | endif
|
---|
239 | endif
|
---|
240 | endef
|
---|
241 |
|
---|
242 | ## Inherit one template property in a non-accumulative manner, deferred expansion.
|
---|
243 | # @param 1: $(prop) Property name
|
---|
244 | # @param 2: $(target) Target name
|
---|
245 | # @todo fix the precedence order for some properties.
|
---|
246 | # @remark this define relies on double evaluation
|
---|
247 | define def_inherit_template_one_deferred
|
---|
248 | ifdef TEMPLATE_$($(target)_TEMPLATE)_$(prop)
|
---|
249 | ifndef $(target)_$(prop)
|
---|
250 | $(target)_$(prop) = $$(TEMPLATE_$($(target)_TEMPLATE)_$(prop))
|
---|
251 | #$ (warning dbgtarget: $(target)_$(prop):='$(value $(target)_$(prop))' TEMPLATE_$($(target)_TEMPLATE)_$(prop))
|
---|
252 | endif
|
---|
253 | endif
|
---|
254 | ifdef TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(BUILD_TARGET)
|
---|
255 | ifndef $(target)_$(prop).$(BUILD_TARGET)
|
---|
256 | #$ (warning dbgsource: $(target)_$(prop).$(BUILD_TARGET)="TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(BUILD_TARGET)" TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(BUILD_TARGET))
|
---|
257 | $(target)_$(prop).$(BUILD_TARGET) = $$(TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(BUILD_TARGET))
|
---|
258 | endif
|
---|
259 | endif
|
---|
260 | endef
|
---|
261 |
|
---|
262 | ## Inherit one template property.
|
---|
263 | # @param $(prop) Property name
|
---|
264 | # @param $(target) Target name
|
---|
265 | define def_inherit_template_one_accumulate
|
---|
266 | ifdef TEMPLATE_$($(target)_TEMPLATE)_$(prop)
|
---|
267 | #$ (warning dbgtype: TEMPLATE_$($(target)_TEMPLATE)_$(prop) $(target)_$(prop)=$($(target)_$(prop)) $(TEMPLATE_$($(target)_TEMPLATE)_$(prop)))
|
---|
268 | $(target)_$(prop) := $($(target)_$(prop)) $(TEMPLATE_$($(target)_TEMPLATE)_$(prop))
|
---|
269 | #$ (warning dbgtype: $(target)_$(prop)=$($(target)_$(prop)))
|
---|
270 | endif
|
---|
271 | ifdef TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(BUILD_TYPE)
|
---|
272 | #$ (warning dbg4: TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(BUILD_TYPE))
|
---|
273 | $(target)_$(prop).$(BUILD_TYPE) := $($(target)_$(prop).$(BUILD_TYPE)) $(TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(BUILD_TYPE))
|
---|
274 | endif
|
---|
275 | ifdef TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(BUILD_TARGET)
|
---|
276 | #$ (warning dbg4: TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(BUILD_TARGET))
|
---|
277 | $(target)_$(prop).$(BUILD_TARGET) := $($(target)_$(prop).$(BUILD_TARGET)) $(TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(BUILD_TARGET))
|
---|
278 | endif
|
---|
279 | ifdef TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(BUILD_TARGET_CPU)
|
---|
280 | #$ (warning dbg5: TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(BUILD_TARGET_CPU))
|
---|
281 | $(target)_$(prop).$(BUILD_TARGET_CPU) := $($(target)_$(prop).$(BUILD_TARGET)) $(TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(BUILD_TARGET_CPU))
|
---|
282 | endif
|
---|
283 | ifdef TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(BUILD_TARGET_ARCH)
|
---|
284 | #$ (warning dbg6: TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(BUILD_TARGET_ARCH))
|
---|
285 | $(target)_$(prop).$(BUILD_TARGET_ARCH) := $($(target)_$(prop).$(BUILD_TARGET)) $(TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(BUILD_TARGET_ARCH))
|
---|
286 | endif
|
---|
287 | endef
|
---|
288 |
|
---|
289 | ## Inherit template properties for on target.
|
---|
290 | # @param $(target) Target name.
|
---|
291 | define def_inherit_template
|
---|
292 | $(foreach prop,$(PROPS_SINGLE),$(eval $(value def_inherit_template_one)))
|
---|
293 | $(foreach prop,$(PROPS_DEFERRED),$(eval $(def_inherit_template_one_deferred))) # exploits the 2 evaluation, so no value!
|
---|
294 | $(foreach prop,$(PROPS_ACCUMULATE),$(eval $(value def_inherit_template_one_accumulate)))
|
---|
295 | endef
|
---|
296 |
|
---|
297 | # Inherit template properties
|
---|
298 | $(foreach target, $(ALL_TARGETS),$(eval $(value def_inherit_template)))
|
---|
299 |
|
---|
300 |
|
---|
301 | #
|
---|
302 | # Include tools
|
---|
303 | #
|
---|
304 | _TOOLS := $(TOOL)
|
---|
305 | define def_tools_target_source
|
---|
306 | $(eval _TOOLS += $(foreach prop, $(PROPS_TOOLS), \
|
---|
307 | $($(source)_$(prop).$(BUILD_TARGET)) \
|
---|
308 | $($(target)_$(source)_$(prop).$(BUILD_TARGET)) \
|
---|
309 | $($(source)_$(prop)) \
|
---|
310 | $($(target)_$(source)_$(prop))))
|
---|
311 | endef
|
---|
312 |
|
---|
313 | define def_tools_target
|
---|
314 | $(eval _TOOLS += $(foreach prop, $(PROPS_TOOLS), \
|
---|
315 | $($(target)_$(prop).$(BUILD_TARGET)) \
|
---|
316 | $($(target)_$(prop))))
|
---|
317 | $(foreach source, \
|
---|
318 | $($(target)_SOURCES.$(BUILD_TARGET)) \
|
---|
319 | $($(target)_SOURCES.$(BUILD_TYPE)) \
|
---|
320 | $($(target)_SOURCES) \
|
---|
321 | , $(eval $(value def_tools_target_source)))
|
---|
322 | endef
|
---|
323 |
|
---|
324 | $(foreach target, $(ALL_TARGETS), $(eval $(value def_tools_target)))
|
---|
325 | _TOOLS := $(sort $(_TOOLS))
|
---|
326 |
|
---|
327 | define def_tools_include
|
---|
328 | ifndef TOOL_$(tool)
|
---|
329 | TOOL_$(tool)_KMK_FILE := $(firstword $(foreach path, $(TOOL_PATHS) $(PATH_KBUILD)/tools, $(wildcard $(path)/$(tool).kmk)))
|
---|
330 | ifeq ($(TOOL_$(tool)_KMK_FILE),)
|
---|
331 | $(error kBuild: Cannot find include file for the tool '$(tool)'! Searched: $(TOOL_PATHS) $(PATH_KBUILD)/tools)
|
---|
332 | endif
|
---|
333 | include $(TOOL_$(tool)_KMK_FILE)
|
---|
334 | endif
|
---|
335 | endef
|
---|
336 | $(foreach tool, $(_TOOLS), $(eval $(value def_tools_include)))
|
---|
337 |
|
---|
338 |
|
---|
339 | #
|
---|
340 | # Include SDKs
|
---|
341 | #
|
---|
342 | _SDKS := $(SDKS)
|
---|
343 | define def_sdks_target_source
|
---|
344 | $(foreach sdk, $($(source)_SDKS) $($(source)_SDKS.$(BUILD_TARGET)) $($(source)_SDKS.$(BUILD_TYPE)) \
|
---|
345 | $($(target)_$(source)_SDKS) $($(target)_$(source)_SDKS.$(BUILD_TARGET)) $($(target)_$(source)_SDKS.$(BUILD_TYPE)), \
|
---|
346 | $(eval _SDKS += $(sdk)))
|
---|
347 | endef
|
---|
348 | define def_sdks_target
|
---|
349 | $(foreach sdk, $($(target)_SDKS) $($(target)_SDKS.$(BUILD_TARGET)) $($(target)_SDKS.$(BUILD_TYPE))\
|
---|
350 | , $(eval _SDKS += $(sdk)))
|
---|
351 | $(foreach source, $($(target)_SOURCES) $($(target)_SOURCES.$(BUILD_TARGET)) $($(target)_SOURCES.$(BUILD_TYPE))\
|
---|
352 | , $(eval $(def_sdks_target_source)))
|
---|
353 | endef
|
---|
354 | $(foreach target, $(ALL_TARGETS), $(eval $(def_sdks_target)))
|
---|
355 | _SDKS := $(sort $(_SDKS))
|
---|
356 |
|
---|
357 | define def_sdks_include_one
|
---|
358 | ifndef SDK_$(sdk)
|
---|
359 | SDK_$(sdk)_KMK_FILE := $(firstword $(foreach path, $(SDK_PATHS) $(PATH_KBUILD)/sdks, $(wildcard $(path)/$(sdk).kmk)))
|
---|
360 | ifeq ($(SDK_$(sdk)_KMK_FILE),)
|
---|
361 | $(error kBuild: Cannot find include file for the SDK '$(sdk)'! Searched: $(SDK_PATHS) $(PATH_KBUILD)/sdks)
|
---|
362 | endif
|
---|
363 | include $(SDK_$(sdk)_KMK_FILE)
|
---|
364 | endif
|
---|
365 | endef
|
---|
366 | $(foreach sdk, $(_SDKS), $(eval $(value def_sdks_include_one)))
|
---|
367 |
|
---|
368 | #
|
---|
369 | # Object processing.
|
---|
370 | #
|
---|
371 |
|
---|
372 | ## Generates the '::' rule for building all objects of a source file.
|
---|
373 | # @param $(obj) The object file.
|
---|
374 | define def_target_obj_rule
|
---|
375 | $(basename $(notdir $(obj))).o::
|
---|
376 | + $$(MAKE) -B -f $$(MAKEFILE) $(obj)
|
---|
377 | $(basename $$(notdir $$(obj))).obj::
|
---|
378 | + $$(MAKE) -B -f $$(MAKEFILE) $(obj)
|
---|
379 | endef
|
---|
380 |
|
---|
381 |
|
---|
382 | ## Generic macro for processing C, C++ and Assembly sources.
|
---|
383 | # @param $(target) Normalized target name.
|
---|
384 | # @param $(source) Source file name.
|
---|
385 | # @param $(type) Source type. {C,CXX,AS}
|
---|
386 | # @param bld_type Build type.
|
---|
387 | # @param bld_trg Build target.
|
---|
388 | # @param bld_trg_arch Build target arch.
|
---|
389 | # @param bld_trg_cpu Build target cpu.
|
---|
390 | #
|
---|
391 | # @remark I've no clue why I've to $(eval ..) everything in this define. MAKE bug?
|
---|
392 | # @remark I now have a clue. Have to use $$ if not.
|
---|
393 | define def_target_source_c_cpp_asm
|
---|
394 | #$ (warning dbg: def_target_source_c_cpp_asm: source='$(source)' target='$(target)' type='$(type)')
|
---|
395 |
|
---|
396 | tool := $(call _SOURCE_TOOL,$(source),$(target),$(type))
|
---|
397 | outbase := $(call _OBJECT_BASE,$(source),$(target))
|
---|
398 | PATH_$(target)_$(source) := $(patsubst %/,%,$(dir $(outbase)))
|
---|
399 | dirdep := $(call DIRDEP,$(dir $(outbase)))
|
---|
400 | defs :=\
|
---|
401 | $(TOOL_$(tool)_DEFS)\
|
---|
402 | $(TOOL_$(tool)_DEFS.$(bld_type))\
|
---|
403 | $(TOOL_$(tool)_DEFS.$(bld_trg))\
|
---|
404 | $(TOOL_$(tool)_DEFS.$(bld_trg_arch))\
|
---|
405 | $(TOOL_$(tool)_DEFS.$(bld_trg_cpu))\
|
---|
406 | $(TOOL_$(tool)_$(type)DEFS)\
|
---|
407 | $(TOOL_$(tool)_$(type)DEFS.$(bld_type))\
|
---|
408 | $(foreach sdk, $(SDKS.$(bld_trg)) \
|
---|
409 | $(SDKS.$(bld_type)) \
|
---|
410 | $(SDKS),\
|
---|
411 | $(SDK_$(sdk)_DEFS)\
|
---|
412 | $(SDK_$(sdk)_DEFS.$(bld_type))\
|
---|
413 | $(SDK_$(sdk)_DEFS.$(bld_trg))\
|
---|
414 | $(SDK_$(sdk)_DEFS.$(bld_trg_arch))\
|
---|
415 | $(SDK_$(sdk)_DEFS.$(bld_trg_cpu))\
|
---|
416 | $(SDK_$(sdk)_$(type)DEFS)\
|
---|
417 | $(SDK_$(sdk)_$(type)DEFS.$(bld_type))\
|
---|
418 | $(SDK_$(sdk)_$(type)DEFS.$(bld_trg))\
|
---|
419 | $(SDK_$(sdk)_$(type)DEFS.$(bld_trg_arch))\
|
---|
420 | $(SDK_$(sdk)_$(type)DEFS.$(bld_trg_cpu)))\
|
---|
421 | $(DEFS)\
|
---|
422 | $(DEFS.$(bld_type))\
|
---|
423 | $(DEFS.$(bld_trg))\
|
---|
424 | $(DEFS.$(bld_trg_arch))\
|
---|
425 | $(DEFS.$(bld_trg_cpu))\
|
---|
426 | $($(type)DEFS)\
|
---|
427 | $($(type)DEFS.$(bld_type))\
|
---|
428 | $($(type)DEFS.$(bld_trg))\
|
---|
429 | $($(type)DEFS.$(bld_trg_arch))\
|
---|
430 | $($(type)DEFS.$(bld_trg_cpu))\
|
---|
431 | $(foreach sdk, $($(target)_SDKS.$(bld_trg)) \
|
---|
432 | $($(target)_SDKS.$(bld_type)) \
|
---|
433 | $($(target)_SDKS),\
|
---|
434 | $(SDK_$(sdk)_DEFS)\
|
---|
435 | $(SDK_$(sdk)_DEFS.$(bld_type))\
|
---|
436 | $(SDK_$(sdk)_DEFS.$(bld_trg))\
|
---|
437 | $(SDK_$(sdk)_DEFS.$(bld_trg_arch))\
|
---|
438 | $(SDK_$(sdk)_DEFS.$(bld_trg_cpu))\
|
---|
439 | $(SDK_$(sdk)_$(type)DEFS)\
|
---|
440 | $(SDK_$(sdk)_$(type)DEFS.$(bld_type))\
|
---|
441 | $(SDK_$(sdk)_$(type)DEFS.$(bld_trg))\
|
---|
442 | $(SDK_$(sdk)_$(type)DEFS.$(bld_trg_arch))\
|
---|
443 | $(SDK_$(sdk)_$(type)DEFS.$(bld_trg_cpu)))\
|
---|
444 | $($(target)_DEFS)\
|
---|
445 | $($(target)_DEFS.$(bld_type))\
|
---|
446 | $($(target)_DEFS.$(bld_trg))\
|
---|
447 | $($(target)_DEFS.$(bld_trg_arch))\
|
---|
448 | $($(target)_DEFS.$(bld_trg_cpu))\
|
---|
449 | $($(target)_$(type)DEFS)\
|
---|
450 | $($(target)_$(type)DEFS.$(bld_type))\
|
---|
451 | $($(target)_$(type)DEFS.$(bld_trg))\
|
---|
452 | $($(target)_$(type)DEFS.$(bld_trg_arch))\
|
---|
453 | $($(target)_$(type)DEFS.$(bld_trg_cpu))\
|
---|
454 | $(foreach sdk, $($(source)_SDKS.$(bld_trg)) \
|
---|
455 | $($(source)_SDKS.$(bld_type)) \
|
---|
456 | $($(source)_SDKS),\
|
---|
457 | $(SDK_$(sdk)_DEFS)\
|
---|
458 | $(SDK_$(sdk)_DEFS.$(bld_type))\
|
---|
459 | $(SDK_$(sdk)_DEFS.$(bld_trg))\
|
---|
460 | $(SDK_$(sdk)_DEFS.$(bld_trg_arch))\
|
---|
461 | $(SDK_$(sdk)_DEFS.$(bld_trg_cpu))\
|
---|
462 | $(SDK_$(sdk)_$(type)DEFS)\
|
---|
463 | $(SDK_$(sdk)_$(type)DEFS.$(bld_type))\
|
---|
464 | $(SDK_$(sdk)_$(type)DEFS.$(bld_trg))\
|
---|
465 | $(SDK_$(sdk)_$(type)DEFS.$(bld_trg_arch))\
|
---|
466 | $(SDK_$(sdk)_$(type)DEFS.$(bld_trg_cpu)))\
|
---|
467 | $($(source)_DEFS)\
|
---|
468 | $($(source)_DEFS.$(bld_type))\
|
---|
469 | $($(source)_DEFS.$(bld_trg))\
|
---|
470 | $($(source)_DEFS.$(bld_trg_arch))\
|
---|
471 | $($(source)_DEFS.$(bld_trg_cpu))\
|
---|
472 | $($(source)_$(type)DEFS)\
|
---|
473 | $($(source)_$(type)DEFS.$(bld_type))\
|
---|
474 | $($(source)_$(type)DEFS.$(bld_trg))\
|
---|
475 | $($(source)_$(type)DEFS.$(bld_trg_arch))\
|
---|
476 | $($(source)_$(type)DEFS.$(bld_trg_cpu))\
|
---|
477 | $(foreach sdk, $($(target)_$(source)_SDKS.$(bld_trg)) \
|
---|
478 | $($(target)_$(source)_SDKS.$(bld_type)) \
|
---|
479 | $($(target)_$(source)_SDKS),\
|
---|
480 | $(SDK_$(sdk)_DEFS)\
|
---|
481 | $(SDK_$(sdk)_DEFS.$(bld_type))\
|
---|
482 | $(SDK_$(sdk)_DEFS.$(bld_trg))\
|
---|
483 | $(SDK_$(sdk)_DEFS.$(bld_trg_arch))\
|
---|
484 | $(SDK_$(sdk)_DEFS.$(bld_trg_cpu))\
|
---|
485 | $(SDK_$(sdk)_$(type)DEFS)\
|
---|
486 | $(SDK_$(sdk)_$(type)DEFS.$(bld_type))\
|
---|
487 | $(SDK_$(sdk)_$(type)DEFS.$(bld_trg))\
|
---|
488 | $(SDK_$(sdk)_$(type)DEFS.$(bld_trg_arch))\
|
---|
489 | $(SDK_$(sdk)_$(type)DEFS.$(bld_trg_cpu)))\
|
---|
490 | $($(target)_$(source)_DEFS)\
|
---|
491 | $($(target)_$(source)_DEFS.$(bld_type))\
|
---|
492 | $($(target)_$(source)_DEFS.$(bld_trg))\
|
---|
493 | $($(target)_$(source)_DEFS.$(bld_trg_arch))\
|
---|
494 | $($(target)_$(source)_DEFS.$(bld_trg_cpu))\
|
---|
495 | $($(target)_$(source)_$(type)DEFS)\
|
---|
496 | $($(target)_$(source)_$(type)DEFS.$(bld_type))\
|
---|
497 | $($(target)_$(source)_$(type)DEFS.$(bld_trg))\
|
---|
498 | $($(target)_$(source)_$(type)DEFS.$(bld_trg_arch))\
|
---|
499 | $($(target)_$(source)_$(type)DEFS.$(bld_trg_cpu))
|
---|
500 | incs :=\
|
---|
501 | $($(target)_$(source)_$(type)INCS.$(bld_trg_cpu))\
|
---|
502 | $($(target)_$(source)_$(type)INCS.$(bld_trg_arch))\
|
---|
503 | $($(target)_$(source)_$(type)INCS.$(bld_trg))\
|
---|
504 | $($(target)_$(source)_$(type)INCS.$(bld_type))\
|
---|
505 | $($(target)_$(source)_$(type)INCS)\
|
---|
506 | $($(target)_$(source)_INCS.$(bld_trg_cpu))\
|
---|
507 | $($(target)_$(source)_INCS.$(bld_trg_arch))\
|
---|
508 | $($(target)_$(source)_INCS.$(bld_trg))\
|
---|
509 | $($(target)_$(source)_INCS.$(bld_type))\
|
---|
510 | $($(target)_$(source)_INCS)\
|
---|
511 | $(foreach sdk, $($(target)_$(source)_SDKS.$(bld_trg)) \
|
---|
512 | $($(target)_$(source)_SDKS.$(bld_type)) \
|
---|
513 | $($(target)_$(source)_SDKS),\
|
---|
514 | $(SDK_$(sdk)_$(type)INCS.$(bld_trg_cpu))\
|
---|
515 | $(SDK_$(sdk)_$(type)INCS.$(bld_trg_arch))\
|
---|
516 | $(SDK_$(sdk)_$(type)INCS.$(bld_trg))\
|
---|
517 | $(SDK_$(sdk)_$(type)INCS.$(bld_type))\
|
---|
518 | $(SDK_$(sdk)_$(type)INCS)\
|
---|
519 | $(SDK_$(sdk)_INCS.$(bld_trg_cpu))\
|
---|
520 | $(SDK_$(sdk)_INCS.$(bld_trg_arch))\
|
---|
521 | $(SDK_$(sdk)_INCS.$(bld_trg))\
|
---|
522 | $(SDK_$(sdk)_INCS.$(bld_type))\
|
---|
523 | $(SDK_$(sdk)_INCS))\
|
---|
524 | $($(source)_$(type)INCS.$(bld_trg_cpu))\
|
---|
525 | $($(source)_$(type)INCS.$(bld_trg_arch))\
|
---|
526 | $($(source)_$(type)INCS.$(bld_trg))\
|
---|
527 | $($(source)_$(type)INCS.$(bld_type))\
|
---|
528 | $($(source)_$(type)INCS)\
|
---|
529 | $($(source)_INCS.$(bld_trg_cpu))\
|
---|
530 | $($(source)_INCS.$(bld_trg_arch))\
|
---|
531 | $($(source)_INCS.$(bld_trg))\
|
---|
532 | $($(source)_INCS.$(bld_type))\
|
---|
533 | $($(source)_INCS)\
|
---|
534 | $(foreach sdk, $($(source)_SDKS.$(bld_trg)) \
|
---|
535 | $($(source)_SDKS.$(bld_type)) \
|
---|
536 | $($(source)_SDKS),\
|
---|
537 | $(SDK_$(sdk)_$(type)INCS.$(bld_trg_cpu))\
|
---|
538 | $(SDK_$(sdk)_$(type)INCS.$(bld_trg_arch))\
|
---|
539 | $(SDK_$(sdk)_$(type)INCS.$(bld_trg))\
|
---|
540 | $(SDK_$(sdk)_$(type)INCS.$(bld_type))\
|
---|
541 | $(SDK_$(sdk)_$(type)INCS)\
|
---|
542 | $(SDK_$(sdk)_INCS.$(bld_trg_cpu))\
|
---|
543 | $(SDK_$(sdk)_INCS.$(bld_trg_arch))\
|
---|
544 | $(SDK_$(sdk)_INCS.$(bld_trg))\
|
---|
545 | $(SDK_$(sdk)_INCS.$(bld_type))\
|
---|
546 | $(SDK_$(sdk)_INCS))\
|
---|
547 | $($(target)_$(type)INCS.$(bld_trg_cpu))\
|
---|
548 | $($(target)_$(type)INCS.$(bld_trg_arch))\
|
---|
549 | $($(target)_$(type)INCS.$(bld_trg))\
|
---|
550 | $($(target)_$(type)INCS.$(bld_type))\
|
---|
551 | $($(target)_$(type)INCS)\
|
---|
552 | $($(target)_INCS.$(bld_trg_cpu))\
|
---|
553 | $($(target)_INCS.$(bld_trg_arch))\
|
---|
554 | $($(target)_INCS.$(bld_trg))\
|
---|
555 | $($(target)_INCS.$(bld_type))\
|
---|
556 | $($(target)_INCS)\
|
---|
557 | $(foreach sdk, $($(target)_SDKS.$(bld_trg)) \
|
---|
558 | $($(target)_SDKS.$(bld_type)) \
|
---|
559 | $($(target)_SDKS),\
|
---|
560 | $(SDK_$(sdk)_$(type)INCS.$(bld_trg_cpu))\
|
---|
561 | $(SDK_$(sdk)_$(type)INCS.$(bld_trg_arch))\
|
---|
562 | $(SDK_$(sdk)_$(type)INCS.$(bld_trg))\
|
---|
563 | $(SDK_$(sdk)_$(type)INCS.$(bld_type))\
|
---|
564 | $(SDK_$(sdk)_$(type)INCS)\
|
---|
565 | $(SDK_$(sdk)_INCS.$(bld_trg_cpu))\
|
---|
566 | $(SDK_$(sdk)_INCS.$(bld_trg_arch))\
|
---|
567 | $(SDK_$(sdk)_INCS.$(bld_trg))\
|
---|
568 | $(SDK_$(sdk)_INCS.$(bld_type))\
|
---|
569 | $(SDK_$(sdk)_INCS))\
|
---|
570 | $(INCS.$(bld_trg_cpu))\
|
---|
571 | $(INCS.$(bld_trg_arch))\
|
---|
572 | $(INCS.$(bld_trg))\
|
---|
573 | $(INCS.$(bld_type))\
|
---|
574 | $(INCS)\
|
---|
575 | $(foreach sdk, $(SDKS.$(bld_trg)) \
|
---|
576 | $(SDKS.$(bld_type)) \
|
---|
577 | $(SDKS),\
|
---|
578 | $(SDK_$(sdk)_$(type)INCS.$(bld_trg_cpu))\
|
---|
579 | $(SDK_$(sdk)_$(type)INCS.$(bld_trg_arch))\
|
---|
580 | $(SDK_$(sdk)_$(type)INCS.$(bld_trg))\
|
---|
581 | $(SDK_$(sdk)_$(type)INCS.$(bld_type))\
|
---|
582 | $(SDK_$(sdk)_$(type)INCS)\
|
---|
583 | $(SDK_$(sdk)_INCS.$(bld_trg_cpu))\
|
---|
584 | $(SDK_$(sdk)_INCS.$(bld_trg_arch))\
|
---|
585 | $(SDK_$(sdk)_INCS.$(bld_trg))\
|
---|
586 | $(SDK_$(sdk)_INCS.$(bld_type))\
|
---|
587 | $(SDK_$(sdk)_INCS))\
|
---|
588 | $(TOOL_$(tool)_$(type)INCS.$(bld_trg_cpu))\
|
---|
589 | $(TOOL_$(tool)_$(type)INCS.$(bld_trg_arch))\
|
---|
590 | $(TOOL_$(tool)_$(type)INCS.$(bld_trg))\
|
---|
591 | $(TOOL_$(tool)_$(type)INCS.$(bld_type))\
|
---|
592 | $(TOOL_$(tool)_$(type)INCS)
|
---|
593 | flags :=\
|
---|
594 | $(TOOL_$(tool)_$(type)FLAGS)\
|
---|
595 | $(TOOL_$(tool)_$(type)FLAGS.$(bld_type))\
|
---|
596 | $(TOOL_$(tool)_$(type)FLAGS.$(bld_trg))\
|
---|
597 | $(TOOL_$(tool)_$(type)FLAGS.$(bld_trg_arch))\
|
---|
598 | $(TOOL_$(tool)_$(type)FLAGS.$(bld_trg_cpu))\
|
---|
599 | $($(type)FLAGS)\
|
---|
600 | $($(type)FLAGS.$(bld_type))\
|
---|
601 | $($(type)FLAGS.$(bld_trg))\
|
---|
602 | $($(type)FLAGS.$(bld_trg_arch))\
|
---|
603 | $($(type)FLAGS.$(bld_trg_cpu))\
|
---|
604 | $($(target)_$(type)FLAGS)\
|
---|
605 | $($(target)_$(type)FLAGS.$(bld_type))\
|
---|
606 | $($(target)_$(type)FLAGS.$(bld_trg))\
|
---|
607 | $($(target)_$(type)FLAGS.$(bld_trg_arch))\
|
---|
608 | $($(target)_$(type)FLAGS.$(bld_trg_cpu))\
|
---|
609 | $($(source)_$(type)FLAGS)\
|
---|
610 | $($(source)_$(type)FLAGS.$(bld_type))\
|
---|
611 | $($(source)_$(type)FLAGS.$(bld_trg))\
|
---|
612 | $($(source)_$(type)FLAGS.$(bld_trg_arch))\
|
---|
613 | $($(source)_$(type)FLAGS.$(bld_trg_cpu))\
|
---|
614 | $($(target)_$(source)_$(type)FLAGS)\
|
---|
615 | $($(target)_$(source)_$(type)FLAGS.$(bld_type))\
|
---|
616 | $($(target)_$(source)_$(type)FLAGS.$(bld_trg))\
|
---|
617 | $($(target)_$(source)_$(type)FLAGS.$(bld_trg_arch))\
|
---|
618 | $($(target)_$(source)_$(type)FLAGS.$(bld_trg_cpu))
|
---|
619 | objsuff := $(firstword \
|
---|
620 | $($(target)_$(source)_OBJSUFF.$(bld_trg))\
|
---|
621 | $($(target)_$(source)_OBJSUFF)\
|
---|
622 | $($(source)_OBJSUFF.$(bld_trg))\
|
---|
623 | $($(source)_OBJSUFF)\
|
---|
624 | $($(target)_OBJSUFF.$(bld_trg))\
|
---|
625 | $($(target)_OBJSUFF)\
|
---|
626 | $(TOOL_$(tool)_$(type)OBJSUFF.$(bld_trg))\
|
---|
627 | $(TOOL_$(tool)_$(type)OBJSUFF)\
|
---|
628 | $(SUFF_OBJ))
|
---|
629 | obj := $(outbase)$(objsuff)
|
---|
630 | dep := $(outbase)$(SUFF_DEP)
|
---|
631 | deps := \
|
---|
632 | $($(target)_$(source)_DEPS)\
|
---|
633 | $($(target)_$(source)_DEPS.$(bld_type))\
|
---|
634 | $($(target)_$(source)_DEPS.$(bld_trg))\
|
---|
635 | $($(target)_$(source)_DEPS.$(bld_trg_arch))\
|
---|
636 | $($(target)_$(source)_DEPS.$(bld_trg_cpu))\
|
---|
637 | $($(source)_DEPS)\
|
---|
638 | $($(source)_DEPS.$(bld_type))\
|
---|
639 | $($(source)_DEPS.$(bld_trg))\
|
---|
640 | $($(source)_DEPS.$(bld_trg_arch))\
|
---|
641 | $($(source)_DEPS.$(bld_trg_cpu))\
|
---|
642 | $($(target)_DEPS)\
|
---|
643 | $($(target)_DEPS.$(bld_type))\
|
---|
644 | $($(target)_DEPS.$(bld_trg_arch))\
|
---|
645 | $($(target)_DEPS.$(bld_trg_cpu))
|
---|
646 |
|
---|
647 |
|
---|
648 | #$ (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))
|
---|
649 | ifndef TOOL_$(tool)_COMPILE_$(type)
|
---|
650 | $(warning kBuild: tools: \
|
---|
651 | 1 $($(target)_$(source)_$(type)TOOL.$(bld_trg)) \
|
---|
652 | 2 $($(target)_$(source)_$(type)TOOL) \
|
---|
653 | 3 $($(target)_$(source)_TOOL.$(bld_trg)) \
|
---|
654 | 4 $($(target)_$(source)_TOOL) \
|
---|
655 | 5 $($(target)_$(type)TOOL.$(bld_trg)) \
|
---|
656 | 6 $($(target)_$(type)TOOL) \
|
---|
657 | 7 $($(target)_TOOL.$(bld_trg)) \
|
---|
658 | 8 $($(target)_TOOL) \
|
---|
659 | 9 $($(source)_$(type)TOOL.$(bld_trg)) \
|
---|
660 | 10 $($(source)_$(type)TOOL) \
|
---|
661 | 11 $($(source)_TOOL.$(bld_trg)) \
|
---|
662 | 12 $($(source)_TOOL) \
|
---|
663 | 13 $($(type)TOOL.$(bld_trg)) \
|
---|
664 | 14 $($(type)TOOL) \
|
---|
665 | 15 $(TOOL.$(bld_trg)) \
|
---|
666 | 16 $(TOOL) )
|
---|
667 | $(error kBuild: TOOL_$(tool)_COMPILE_$(type) is not defined. source=$(source) target=$(target) )
|
---|
668 | endif
|
---|
669 |
|
---|
670 | # generate the rules
|
---|
671 | $(eval $(TOOL_$(tool)_COMPILE_$(type)))
|
---|
672 |
|
---|
673 | $(eval $(def_target_obj_rule))
|
---|
674 |
|
---|
675 | $(target)_OBJS_ += $(obj)
|
---|
676 | _DEPFILES += $(dep)
|
---|
677 |
|
---|
678 | endef
|
---|
679 |
|
---|
680 | ## Generic macro for processing all target sources.
|
---|
681 | # @param $(target) Normalized target name.
|
---|
682 | define def_target_sources
|
---|
683 | #$ (warning def_target_sources)
|
---|
684 | # C sources
|
---|
685 | type := C
|
---|
686 | $(foreach source, $(filter %.c, $($(target)_SOURCES) $($(target)_SOURCES.$(bld_trg)) $($(target)_SOURCES.$(bld_trg_arch)) $($(target)_SOURCES.$(bld_trg_cpu)) $($(target)_SOURCES.$(bld_type)))\
|
---|
687 | ,$(eval $(value def_target_source_c_cpp_asm)) )
|
---|
688 |
|
---|
689 | # C++ sources
|
---|
690 | type := CXX
|
---|
691 | $(foreach source, $(filter %.cpp %.cxx %.xx, $($(target)_SOURCES) $($(target)_SOURCES.$(bld_trg)) $($(target)_SOURCES.$(bld_trg_arch)) $($(target)_SOURCES.$(bld_trg_cpu)) $($(target)_SOURCES.$(bld_type)))\
|
---|
692 | ,$(eval $(value def_target_source_c_cpp_asm)) )
|
---|
693 |
|
---|
694 | # ASM sources
|
---|
695 | type := AS
|
---|
696 | $(foreach source, $(filter %.asm %.s %.S, $($(target)_SOURCES) $($(target)_SOURCES.$(bld_trg)) $($(target)_SOURCES.$(bld_trg_arch)) $($(target)_SOURCES.$(bld_trg_cpu)) $($(target)_SOURCES.$(bld_type)))\
|
---|
697 | ,$(eval $(value def_target_source_c_cpp_asm)) )
|
---|
698 |
|
---|
699 | endef
|
---|
700 |
|
---|
701 | ## Generate the link & lib install rule
|
---|
702 | # @param $(target) Normalized target name.
|
---|
703 | # @param $(out) The build target.
|
---|
704 | # @param $(INSTARGET_$(target)) The installation targets.
|
---|
705 | define def_link_install_rule
|
---|
706 | $(INSTARGET_$(target)) : $(out) | $(call DIRDEP,$(dir $(INSTARGET_$(target))))
|
---|
707 | $(RM) -f $$@
|
---|
708 | $(CP) $(out) $$@
|
---|
709 | endef
|
---|
710 |
|
---|
711 |
|
---|
712 |
|
---|
713 | ## Generic macro for generating the install rule(s) for a target
|
---|
714 | # and update the globals with default out.
|
---|
715 | #
|
---|
716 | # @param $(target) Normalized target name.
|
---|
717 | # @param $(out) The output file.
|
---|
718 | # @param $(definst) The default _INST value.
|
---|
719 | # @param $(typevar) The name of the variable with all the root targets of its type.
|
---|
720 | # @obsolete
|
---|
721 | define def_target_install_pluss
|
---|
722 | ifndef $(target)_NOINST
|
---|
723 | INSTARGET_$(target) := $(patsubst %/,%/$(notdir $(out)), \
|
---|
724 | $(if $($(target)_INST), $(addprefix $(PATH_INS)/,$($(target)_INST)), $(definst)/))
|
---|
725 |
|
---|
726 | $(eval $(def_link_install_rule))
|
---|
727 |
|
---|
728 | _INSTALLS += $(INSTARGET_$(target))
|
---|
729 |
|
---|
730 | ifdef KBUILD_DO_AUTO_INSTALL
|
---|
731 | $(typevar) += $(INSTARGET_$(target))
|
---|
732 | else
|
---|
733 | $(typevar) += $(out)
|
---|
734 | endif
|
---|
735 | else # _NOINST
|
---|
736 | $(typevar) += $(out)
|
---|
737 | endif
|
---|
738 |
|
---|
739 | _OUT_FILES += $(out)
|
---|
740 | _CLEAN_FILES += $($(target)_CLEAN)
|
---|
741 | _OBJS += $($(target)_OBJS_)
|
---|
742 |
|
---|
743 | endef
|
---|
744 |
|
---|
745 |
|
---|
746 |
|
---|
747 | #
|
---|
748 | # LIBRARIES
|
---|
749 | #
|
---|
750 |
|
---|
751 | ## Library (one).
|
---|
752 | # @param $(target) Normalized library (target) name.
|
---|
753 | define def_lib
|
---|
754 | # library basics
|
---|
755 | ## @todo prefix
|
---|
756 | bld_type := $(firstword $($(target)_BLD_TYPE) $(BUILD_TYPE))
|
---|
757 | bld_trg := $(firstword $($(target)_BLD_TRG) $(BUILD_TARGET))
|
---|
758 | bld_trg_arch:= $(firstword $($(target)_BLD_TRG_ARCH) $(BUILD_TARGET_ARCH))
|
---|
759 | bld_trg_cpu := $(firstword $($(target)_BLD_TRG_CPU) $(BUILD_TARGET_CPU))
|
---|
760 | tool := $(call _TARGET_TOOL,$(target),AR)
|
---|
761 | ifeq ($(tool),)
|
---|
762 | $(error kBuild: Library target $(target) does not have a tool defined!)
|
---|
763 | endif
|
---|
764 | outbase := $(call _TARGET_BASE,$(target),$(target))
|
---|
765 | PATH_$(target) := $(patsubst %/,%,$(dir $(outbase)))
|
---|
766 | suff := $(firstword\
|
---|
767 | $($(target)_LIBSUFF.$(bld_trg))\
|
---|
768 | $($(target)_LIBSUFF)\
|
---|
769 | $(TOOL_$(tool)_ARLIBSUFF.$(bld_trg))\
|
---|
770 | $(TOOL_$(tool)_ARLIBSUFF)\
|
---|
771 | $(SUFF_LIB))
|
---|
772 | out := $(outbase)$(suff)
|
---|
773 | TARGET_$(target) := $(out)
|
---|
774 | $(target)_OBJS_ := $(filter %.o %.obj, \
|
---|
775 | $($(target)_SOURCES) \
|
---|
776 | $($(target)_SOURCES.$(bld_trg)) \
|
---|
777 | $($(target)_SOURCES.$(bld_trg_arch)) \
|
---|
778 | $($(target)_SOURCES.$(bld_trg_cpu)) \
|
---|
779 | $($(target)_SOURCES.$(bld_type)))
|
---|
780 |
|
---|
781 |
|
---|
782 | # source -> object
|
---|
783 | $(eval $(value def_target_sources))
|
---|
784 |
|
---|
785 | # library linking
|
---|
786 | tool := $(call _TARGET_TOOL,$(target),AR)
|
---|
787 | outbase := $(call _TARGET_BASE,$(target),$(target))
|
---|
788 | flags :=\
|
---|
789 | $(TOOL_$(tool)_ARFLAGS)\
|
---|
790 | $(TOOL_$(tool)_ARFLAGS.$(bld_type))\
|
---|
791 | $(ARFLAGS)\
|
---|
792 | $(ARFLAGS.$(bld_type))\
|
---|
793 | $($(target)_ARFLAGS)\
|
---|
794 | $($(target)_ARFLAGS.$(bld_type))
|
---|
795 | othersrc := $(filter-out %.c %.cpp %.cxx %.cc %.s %.S %.asm %.o %.obj,\
|
---|
796 | $($(target)_SOURCES) \
|
---|
797 | $($(target)_SOURCES.$(bld_trg)) \
|
---|
798 | $($(target)_SOURCES.$(bld_trg_arch)) \
|
---|
799 | $($(target)_SOURCES.$(bld_trg_cpu)) \
|
---|
800 | $($(target)_SOURCES.$(bld_type)))
|
---|
801 | objs = $($(target)_OBJS_)
|
---|
802 | dirdep := $(call DIRDEP,$(dir $(out)))
|
---|
803 | ## @todo fix dependencies on makefiles an such
|
---|
804 | deps := $($(target)_DEPS)
|
---|
805 |
|
---|
806 | lib := $(out)
|
---|
807 | libsuff := $(suff)
|
---|
808 | $(eval $(TOOL_$(tool)_LINK_LIBRARY))
|
---|
809 |
|
---|
810 | # installing and globals
|
---|
811 | definst := $(PATH_LIB)
|
---|
812 | typevar :=_LIBS
|
---|
813 | $(eval $(value def_target_install_pluss))
|
---|
814 | endef
|
---|
815 |
|
---|
816 | # Process libraries
|
---|
817 | $(foreach target, $(LIBRARIES) $(LIBRARIES.$(BUILD_TARGET)), $(eval $(value def_lib)))
|
---|
818 |
|
---|
819 |
|
---|
820 | #
|
---|
821 | # Link operations.
|
---|
822 | #
|
---|
823 |
|
---|
824 | ##
|
---|
825 | # Link prolog
|
---|
826 | #
|
---|
827 | # @param $(target) Normalized target name.
|
---|
828 | # @param $(EXT) EXE,DLL,SYS.
|
---|
829 | # @param $(definst) The default _INST value.
|
---|
830 | # @param $(typevar) The name of the variable with all the root targets of its type.
|
---|
831 | define def_link_prolog
|
---|
832 | # basics
|
---|
833 | bld_type := $(firstword $($(target)_BLD_TYPE) $(BUILD_TYPE))
|
---|
834 | bld_trg := $(firstword $($(target)_BLD_TRG) $(BUILD_$(bld_trg_base_var)))
|
---|
835 | bld_trg_arch:= $(firstword $($(target)_BLD_TRG_ARCH) $(BUILD_$(bld_trg_base_var)_ARCH))
|
---|
836 | bld_trg_cpu := $(firstword $($(target)_BLD_TRG_CPU) $(BUILD_$(bld_trg_base_var)_CPU))
|
---|
837 |
|
---|
838 | tool := $(call _TARGET_TOOL,$(target),LD)
|
---|
839 | outbase := $(call _TARGET_BASE,$(target),$(target))
|
---|
840 | suff := $(firstword \
|
---|
841 | $($(target)_$(EXT)SUFF) \
|
---|
842 | $($(target)_$(EXT)SUFF) \
|
---|
843 | $(TOOL_$(tool)_LD$(EXT)SUFF) \
|
---|
844 | $($(EXTPRE)SUFF_$(EXT)))
|
---|
845 | out := $(outbase)$(suff)
|
---|
846 | PATH_$(target) := $(patsubst %/,%,$(dir $(outbase)))
|
---|
847 | TARGET_$(target) := $(out)
|
---|
848 | $(target)_OBJS_ := $(filter %.o %.obj, \
|
---|
849 | $($(target)_SOURCES) \
|
---|
850 | $($(target)_SOURCES.$(bld_trg)) \
|
---|
851 | $($(target)_SOURCES.$(bld_trg_arch)) \
|
---|
852 | $($(target)_SOURCES.$(bld_trg_cpu)) \
|
---|
853 | $($(target)_SOURCES.$(bld_type)))
|
---|
854 |
|
---|
855 | # source -> object
|
---|
856 | $(eval $(value def_target_sources))
|
---|
857 |
|
---|
858 | # more library stuff.
|
---|
859 | tool := $(call _TARGET_TOOL,$(target),LD)
|
---|
860 | outbase := $(call _TARGET_BASE,$(target),$(target))
|
---|
861 | flags :=\
|
---|
862 | $(TOOL_$(tool)_LDFLAGS)\
|
---|
863 | $(TOOL_$(tool)_LDFLAGS.$(bld_type))\
|
---|
864 | $(TOOL_$(tool)_LDFLAGS.$(bld_trg))\
|
---|
865 | $(TOOL_$(tool)_LDFLAGS.$(bld_trg_arch))\
|
---|
866 | $(TOOL_$(tool)_LDFLAGS.$(bld_trg_cpu))\
|
---|
867 | $(LDFLAGS)\
|
---|
868 | $(LDFLAGS.$(bld_type))\
|
---|
869 | $(LDFLAGS.$(bld_trg))\
|
---|
870 | $(LDFLAGS.$(bld_trg_arch))\
|
---|
871 | $(LDFLAGS.$(bld_trg_cpu))\
|
---|
872 | $($(target)_LDFLAGS)\
|
---|
873 | $($(target)_LDFLAGS.$(bld_type))\
|
---|
874 | $($(target)_LDFLAGS.$(bld_trg))\
|
---|
875 | $($(target)_LDFLAGS.$(bld_trg_arch))\
|
---|
876 | $($(target)_LDFLAGS.$(bld_trg_cpu))
|
---|
877 | othersrc := $(filter-out %.c %.cpp %.cxx %.cc %.s %.S %.asm %.o %.obj,\
|
---|
878 | $($(target)_SOURCES)\
|
---|
879 | $($(target)_SOURCES.$(bld_trg)) \
|
---|
880 | $($(target)_SOURCES.$(bld_trg_arch)) \
|
---|
881 | $($(target)_SOURCES.$(bld_trg_cpu)) \
|
---|
882 | $($(target)_SOURCES.$(bld_type)))
|
---|
883 | objs = $($(target)_OBJS_)
|
---|
884 | libs :=\
|
---|
885 | $($(target)_LIBS.$(bld_trg_cpu))\
|
---|
886 | $($(target)_LIBS.$(bld_trg_arch))\
|
---|
887 | $($(target)_LIBS.$(bld_trg))\
|
---|
888 | $($(target)_LIBS.$(bld_type))\
|
---|
889 | $($(target)_LIBS)\
|
---|
890 | $(foreach sdk, $($(target)_SDKS.$(bld_trg)) \
|
---|
891 | $($(target)_SDKS.$(bld_type)) \
|
---|
892 | $($(target)_SDKS),\
|
---|
893 | $(SDK_$(sdk)_LIBS.$(bld_trg_cpu))\
|
---|
894 | $(SDK_$(sdk)_LIBS.$(bld_trg_arch))\
|
---|
895 | $(SDK_$(sdk)_LIBS.$(bld_trg))\
|
---|
896 | $(SDK_$(sdk)_LIBS.$(bld_type))\
|
---|
897 | $(SDK_$(sdk)_LIBS))\
|
---|
898 | $(LIBS.$(bld_trg_cpu))\
|
---|
899 | $(LIBS.$(bld_trg_arch))\
|
---|
900 | $(LIBS.$(bld_trg))\
|
---|
901 | $(LIBS.$(bld_type))\
|
---|
902 | $(LIBS)\
|
---|
903 | $(foreach sdk, $(SDKS.$(bld_trg)) \
|
---|
904 | $(SDKS.$(bld_type)) \
|
---|
905 | $(SDKS),\
|
---|
906 | $(SDK_$(sdk)_LIBS.$(bld_trg_cpu))\
|
---|
907 | $(SDK_$(sdk)_LIBS.$(bld_trg_arch))\
|
---|
908 | $(SDK_$(sdk)_LIBS.$(bld_trg))\
|
---|
909 | $(SDK_$(sdk)_LIBS.$(bld_type))\
|
---|
910 | $(SDK_$(sdk)_LIBS))\
|
---|
911 | $(TOOL_$(tool)_LIBS.$(bld_trg_cpu))\
|
---|
912 | $(TOOL_$(tool)_LIBS.$(bld_trg_arch))\
|
---|
913 | $(TOOL_$(tool)_LIBS.$(bld_trg))\
|
---|
914 | $(TOOL_$(tool)_LIBS.$(bld_type))\
|
---|
915 | $(TOOL_$(tool)_LIBS)
|
---|
916 | libpath :=\
|
---|
917 | $($(target)_LIBPATH.$(bld_trg_cpu))\
|
---|
918 | $($(target)_LIBPATH.$(bld_trg_arch))\
|
---|
919 | $($(target)_LIBPATH.$(bld_trg))\
|
---|
920 | $($(target)_LIBPATH.$(bld_type))\
|
---|
921 | $($(target)_LIBPATH)\
|
---|
922 | $(foreach sdk, $($(target)_SDKS.$(bld_trg)) \
|
---|
923 | $($(target)_SDKS.$(bld_type)) \
|
---|
924 | $($(target)_SDKS),\
|
---|
925 | $(SDK_$(sdk)_LIBPATH.$(bld_trg_cpu))\
|
---|
926 | $(SDK_$(sdk)_LIBPATH.$(bld_trg_arch))\
|
---|
927 | $(SDK_$(sdk)_LIBPATH.$(bld_trg))\
|
---|
928 | $(SDK_$(sdk)_LIBPATH.$(bld_type))\
|
---|
929 | $(SDK_$(sdk)_LIBPATH))\
|
---|
930 | $(LIBPATH.$(bld_trg_cpu))\
|
---|
931 | $(LIBPATH.$(bld_trg_arch))\
|
---|
932 | $(LIBPATH.$(bld_trg))\
|
---|
933 | $(LIBPATH.$(bld_type))\
|
---|
934 | $(LIBPATH)\
|
---|
935 | $(foreach sdk, $(SDKS.$(bld_trg)) \
|
---|
936 | $(SDKS.$(bld_type)) \
|
---|
937 | $(SDKS),\
|
---|
938 | $(SDK_$(sdk)_LIBPATH.$(bld_trg_cpu))\
|
---|
939 | $(SDK_$(sdk)_LIBPATH.$(bld_trg_arch))\
|
---|
940 | $(SDK_$(sdk)_LIBPATH.$(bld_trg))\
|
---|
941 | $(SDK_$(sdk)_LIBPATH.$(bld_type))\
|
---|
942 | $(SDK_$(sdk)_LIBPATH))\
|
---|
943 | $(TOOL_$(tool)_LIBPATH.$(bld_trg_cpu))\
|
---|
944 | $(TOOL_$(tool)_LIBPATH.$(bld_trg_arch))\
|
---|
945 | $(TOOL_$(tool)_LIBPATH.$(bld_trg))\
|
---|
946 | $(TOOL_$(tool)_LIBPATH.$(bld_type))\
|
---|
947 | $(TOOL_$(tool)_LIBPATH)
|
---|
948 | dirdep := $(call DIRDEP,$(dir $(out)))
|
---|
949 | ## @todo fix dependencies
|
---|
950 | deps := $($(target)_DEPS)
|
---|
951 |
|
---|
952 | ## @todo this stuff can't be working.
|
---|
953 | custom_pre := $(strip $(firstword \
|
---|
954 | $($(target)_CUSTOM_PRE.$(bld_trg).$(bld_type))\
|
---|
955 | $($(target)_CUSTOM_PRE.$(bld_trg))\
|
---|
956 | $($(target)_CUSTOM_PRE.$(bld_type))\
|
---|
957 | $($(target)_CUSTOM_PRE)\
|
---|
958 | $(CUSTOM_PRE.$(bld_trg).$(bld_type))\
|
---|
959 | $(CUSTOM_PRE.$(bld_trg))\
|
---|
960 | $(CUSTOM_PRE.$(bld_type))\
|
---|
961 | $(CUSTOM_PRE)\
|
---|
962 | ))
|
---|
963 | custom_post := $(strip $(firstword \
|
---|
964 | $($(target)_CUSTOM_POST.$(bld_trg).$(bld_type))\
|
---|
965 | $($(target)_CUSTOM_POST.$(bld_trg))\
|
---|
966 | $($(target)_CUSTOM_POST.$(bld_type))\
|
---|
967 | $($(target)_CUSTOM_POST)\
|
---|
968 | $(CUSTOM_POST.$(bld_trg).$(bld_type))\
|
---|
969 | $(CUSTOM_POST.$(bld_trg))\
|
---|
970 | $(CUSTOM_POST.$(bld_type))\
|
---|
971 | $(CUSTOM_POST)\
|
---|
972 | ))
|
---|
973 |
|
---|
974 | # installation targets
|
---|
975 | ifndef $(target)_NOINST
|
---|
976 | INSTARGET_$(target) := $(patsubst %/,%/$(notdir $(out)), \
|
---|
977 | $(if $($(target)_INST), $(addprefix $(PATH_INS)/,$($(target)_INST)), $(definst)/))
|
---|
978 | ifdef KBUILD_DO_AUTO_INSTALL
|
---|
979 | $(typevar) += $(INSTARGET_$(target))
|
---|
980 | else
|
---|
981 | $(typevar) += $(out)
|
---|
982 | endif
|
---|
983 | # generate the install rule
|
---|
984 | $(eval $(def_link_install_rule))
|
---|
985 |
|
---|
986 | else # NOINST
|
---|
987 | INSTARGET_$(target) :=
|
---|
988 | $(typevar) += $(out)
|
---|
989 | endif # NOINST
|
---|
990 |
|
---|
991 | endef
|
---|
992 |
|
---|
993 |
|
---|
994 | ##
|
---|
995 | # Typical link epilog.
|
---|
996 | #
|
---|
997 | # @param $(target) Normalized target name.
|
---|
998 | # @param $(out) The output file.
|
---|
999 | define def_link_epilog
|
---|
1000 |
|
---|
1001 | _INSTALLS += $(INSTARGET_$(target))
|
---|
1002 | _OBJS += $($(target)_OBJS_)
|
---|
1003 | _OUT_FILES += $(out)
|
---|
1004 | _CLEAN_FILES += $($(target)_CLEAN)
|
---|
1005 |
|
---|
1006 | endef
|
---|
1007 |
|
---|
1008 |
|
---|
1009 | #
|
---|
1010 | # BLDPROGS
|
---|
1011 | #
|
---|
1012 |
|
---|
1013 | ## Build program (one).
|
---|
1014 | # @param $(target) Normalized target (program) name.
|
---|
1015 | define def_bldprog
|
---|
1016 |
|
---|
1017 | # set NOINST if not forced installation.
|
---|
1018 | ifndef $(target)_INST
|
---|
1019 | $(target)_NOINST := 1
|
---|
1020 | endif
|
---|
1021 |
|
---|
1022 | # prolog
|
---|
1023 | $(eval $(value def_link_prolog))
|
---|
1024 |
|
---|
1025 | # body
|
---|
1026 | ifndef TOOL_$(tool)_LINK_PROGRAM
|
---|
1027 | $(warning kBuild: tools: \
|
---|
1028 | 1 $($(target)_$(source)TOOL.$(bld_trg)) \
|
---|
1029 | 2 $($(target)_$(source)TOOL) \
|
---|
1030 | 3 $($(target)_TOOL.$(bld_trg)) \
|
---|
1031 | 4 $($(target)_TOOL) \
|
---|
1032 | 5 $(TOOL.$(bld_trg)) \
|
---|
1033 | 6 $(TOOL) )
|
---|
1034 | $(error kBuild: TOOL_$(tool)_LINK_PROGRAM is not defined. target=$(target) )
|
---|
1035 | endif
|
---|
1036 | $(eval $(TOOL_$(tool)_LINK_PROGRAM))
|
---|
1037 |
|
---|
1038 | # epilog
|
---|
1039 | $(eval $(value def_link_epilog))
|
---|
1040 |
|
---|
1041 | endef
|
---|
1042 |
|
---|
1043 | # Process build programs.
|
---|
1044 | EXT := EXE
|
---|
1045 | EXTPRE := HOST
|
---|
1046 | definst := $(PATH_BIN)
|
---|
1047 | typevar := _BLDPROGS
|
---|
1048 | bld_trg_base_var := PLATFORM
|
---|
1049 | $(foreach target, $(BLDPROGS) $(BLDPROGS.$(BUILD_PLATFORM)), $(eval $(value def_bldprog)))
|
---|
1050 |
|
---|
1051 |
|
---|
1052 |
|
---|
1053 | #
|
---|
1054 | # DLLS
|
---|
1055 | #
|
---|
1056 |
|
---|
1057 | ## DLL (one).
|
---|
1058 | # @param $(target) Normalized target (program) name.
|
---|
1059 | define def_dll
|
---|
1060 |
|
---|
1061 | # prolog
|
---|
1062 | $(eval $(value def_link_prolog))
|
---|
1063 |
|
---|
1064 | # body
|
---|
1065 | ifndef TOOL_$(tool)_LINK_DLL
|
---|
1066 | $(warning kBuild: tools: \
|
---|
1067 | 1 $($(target)_$(source)TOOL.$(bld_trg)) \
|
---|
1068 | 2 $($(target)_$(source)TOOL) \
|
---|
1069 | 3 $($(target)_TOOL.$(bld_trg)) \
|
---|
1070 | 4 $($(target)_TOOL) \
|
---|
1071 | 5 $($(source)TOOL) \
|
---|
1072 | 6 $($(source)TOOL.$(bld_trg)) \
|
---|
1073 | 7 $(TOOL.$(bld_trg)) \
|
---|
1074 | 8 $(TOOL) )
|
---|
1075 | $(error kBuild: TOOL_$(tool)_LINK_DLL is not defined. target=$(target) )
|
---|
1076 | endif
|
---|
1077 | $(eval $(TOOL_$(tool)_LINK_DLL))
|
---|
1078 |
|
---|
1079 | # epilog
|
---|
1080 | $(eval $(value def_link_epilog))
|
---|
1081 |
|
---|
1082 | endef
|
---|
1083 |
|
---|
1084 | # Process dlls
|
---|
1085 | EXT := DLL
|
---|
1086 | EXTPRE :=
|
---|
1087 | definst := $(PATH_DLL)
|
---|
1088 | typevar := _DLLS
|
---|
1089 | bld_trg_base_var := TARGET
|
---|
1090 | $(foreach target, $(DLLS) $(DLLS.$(BUILD_TARGET)), $(eval $(value def_dll)))
|
---|
1091 |
|
---|
1092 |
|
---|
1093 |
|
---|
1094 | #
|
---|
1095 | # Process import libraries.
|
---|
1096 | #
|
---|
1097 | # - On OS/2 and windows these are libraries.
|
---|
1098 | # - On other platforms they are fake DLLs.
|
---|
1099 | ifeq ($(subst win32,os2,$(BUILD_TARGET)),os2)
|
---|
1100 | $(foreach target, $(IMPORT_LIBS) $(IMPORT_LIBS.$(BUILD_TARGET)), $(eval $(value def_lib)))
|
---|
1101 | else
|
---|
1102 | $(foreach target, $(IMPORT_LIBS) $(IMPORT_LIBS.$(BUILD_TARGET)), $(eval $(value def_dll)))
|
---|
1103 | endif
|
---|
1104 | $(foreach target, $(IMPORT_LIBS) $(IMPORT_LIBS.$(BUILD_TARGET)), \
|
---|
1105 | $(eval _IMPORT_LIBS += $(if $(INSTARGET_$(target)),$(INSTARGET_$(target)), $(TARGET_$(target)))))
|
---|
1106 |
|
---|
1107 |
|
---|
1108 | #
|
---|
1109 | # PROGRAMS
|
---|
1110 | #
|
---|
1111 |
|
---|
1112 | ## Program (one).
|
---|
1113 | # @param $(target) Normalized target (program) name.
|
---|
1114 | define def_program
|
---|
1115 |
|
---|
1116 | # prolog
|
---|
1117 | $(eval $(value def_link_prolog))
|
---|
1118 |
|
---|
1119 | # body
|
---|
1120 | ifndef TOOL_$(tool)_LINK_PROGRAM
|
---|
1121 | $(warning kBuild: tools: \
|
---|
1122 | 1 $($(target)_$(source)TOOL.$(bld_trg)) \
|
---|
1123 | 2 $($(target)_$(source)TOOL) \
|
---|
1124 | 3 $($(target)_TOOL.$(bld_trg)) \
|
---|
1125 | 4 $($(target)_TOOL) \
|
---|
1126 | 5 $($(source)TOOL) \
|
---|
1127 | 6 $($(source)TOOL.$(bld_trg)) \
|
---|
1128 | 7 $(TOOL.$(bld_trg)) \
|
---|
1129 | 8 $(TOOL) )
|
---|
1130 | $(error kBuild: TOOL_$(tool)_LINK_PROGRAM is not defined. target=$(target) )
|
---|
1131 | endif
|
---|
1132 | $(eval $(TOOL_$(tool)_LINK_PROGRAM))
|
---|
1133 |
|
---|
1134 | # epilog
|
---|
1135 | $(eval $(value def_link_epilog))
|
---|
1136 |
|
---|
1137 | endef
|
---|
1138 |
|
---|
1139 | # Process programs
|
---|
1140 | EXT := EXE
|
---|
1141 | EXTPRE :=
|
---|
1142 | definst := $(PATH_BIN)
|
---|
1143 | typevar := _PROGRAMS
|
---|
1144 | bld_trg_base_var := TARGET
|
---|
1145 | $(foreach target, $(PROGRAMS) $(PROGRAMS.$(BUILD_TARGET)), $(eval $(value def_program)))
|
---|
1146 |
|
---|
1147 |
|
---|
1148 |
|
---|
1149 | #
|
---|
1150 | # SYSMODS
|
---|
1151 | #
|
---|
1152 |
|
---|
1153 | ## System module (one).
|
---|
1154 | # @param $(target) Normalized target (program) name.
|
---|
1155 | define def_sysmod
|
---|
1156 |
|
---|
1157 | # prolog
|
---|
1158 | $(eval $(value def_link_prolog))
|
---|
1159 |
|
---|
1160 | # body
|
---|
1161 | ifndef TOOL_$(tool)_LINK_SYSMOD
|
---|
1162 | $(warning kBuild: tools: \
|
---|
1163 | 1 $($(target)_$(source)TOOL.$(bld_trg)) \
|
---|
1164 | 2 $($(target)_$(source)TOOL) \
|
---|
1165 | 3 $($(target)_TOOL.$(bld_trg)) \
|
---|
1166 | 4 $($(target)_TOOL) \
|
---|
1167 | 5 $($(source)TOOL) \
|
---|
1168 | 6 $($(source)TOOL.$(bld_trg)) \
|
---|
1169 | 7 $(TOOL.$(bld_trg)) \
|
---|
1170 | 8 $(TOOL) )
|
---|
1171 | $(error kBuild: TOOL_$(tool)_LINK_SYSMOD is not defined. target=$(target) )
|
---|
1172 | endif
|
---|
1173 | $(eval $(TOOL_$(tool)_LINK_SYSMOD))
|
---|
1174 |
|
---|
1175 | # epilog
|
---|
1176 | $(eval $(value def_link_epilog))
|
---|
1177 |
|
---|
1178 | endef
|
---|
1179 |
|
---|
1180 | # Process sysmods
|
---|
1181 | EXT := SYS
|
---|
1182 | EXTPRE :=
|
---|
1183 | definst := $(PATH_SYS)
|
---|
1184 | typevar := _SYSMODS
|
---|
1185 | bld_trg_base_var := TARGET
|
---|
1186 | $(foreach target, $(SYSMODS) $(SYSMODS.$(BUILD_TARGET)), $(eval $(value def_sysmod)))
|
---|
1187 |
|
---|
1188 |
|
---|
1189 | #
|
---|
1190 | # OTHERS
|
---|
1191 | #
|
---|
1192 | _OTHERS = $(OTHERS) $(OTHERS.$(BUILD_TARGET))
|
---|
1193 |
|
---|
1194 |
|
---|
1195 | #
|
---|
1196 | # INSTALLS
|
---|
1197 | #
|
---|
1198 |
|
---|
1199 | ## generate the install rule
|
---|
1200 | define def_install_src_rule
|
---|
1201 | # the install rule
|
---|
1202 | $(insdst) : $(srcsrc) | $(call DIRDEP,$(dir $(insdst)))
|
---|
1203 | $$(RM) -f $$@
|
---|
1204 | $(inscmd)
|
---|
1205 | endef
|
---|
1206 |
|
---|
1207 | ## install one file
|
---|
1208 | define def_install_src
|
---|
1209 |
|
---|
1210 | # deal with '=>' in the source file name.
|
---|
1211 | srcdst := $(subst =>, ,$(src))
|
---|
1212 | srcsrc := $(firstword $(srcdst))
|
---|
1213 | srcdst := $(word $(words $(srcdst)),$(srcdst))
|
---|
1214 |
|
---|
1215 | # _INSTFUN
|
---|
1216 | ifdef $(srcsrc)_INSTFUN
|
---|
1217 | instfun := $(srcsrc)_INSTFUN
|
---|
1218 | else
|
---|
1219 | ifdef $(target)_INSTFUN
|
---|
1220 | instfun := $(target)_INSTFUN
|
---|
1221 | else
|
---|
1222 | instfun := _INSTALL_FILE
|
---|
1223 | endif
|
---|
1224 | endif
|
---|
1225 |
|
---|
1226 | # _INST
|
---|
1227 | ifdef $(srcsrc)_INST
|
---|
1228 | inst = $(srcsrc)_INST
|
---|
1229 | else
|
---|
1230 | ifdef $(target)_INST
|
---|
1231 | inst = $(target)_INST
|
---|
1232 | else
|
---|
1233 | inst =
|
---|
1234 | endif
|
---|
1235 | endif
|
---|
1236 |
|
---|
1237 | # calc target
|
---|
1238 | insdst := $(call $(instfun),$(srcdst),$(target),$($(inst)),$(PATH_INS))
|
---|
1239 | #$(warning instfun=$(instfun) srcdst=$(srcdst) target=$(target) srcdst=$(srcsrc) inst=$(inst) => insdst=$(insdst))
|
---|
1240 |
|
---|
1241 | # create the command
|
---|
1242 | ifdef $(srcsrc)_INSTALLER
|
---|
1243 | inscmd := $(call $(srcsrc)_INSTALLER,$(srcsrc),$(insdst),$(target))
|
---|
1244 | else
|
---|
1245 | ifdef $(target)_INSTALLER
|
---|
1246 | inscmd := $(call $(target)_INSTALLER,$(srcsrc),$(insdst),$(target))
|
---|
1247 | else
|
---|
1248 | inscmd := $$(CP) $(srcsrc) $(insdst)
|
---|
1249 | endif
|
---|
1250 | endif
|
---|
1251 |
|
---|
1252 | # generate the rule (need double evaluation here)
|
---|
1253 | $(eval $(def_install_src_rule))
|
---|
1254 |
|
---|
1255 | INSTARGET_$(target) += $(insdst)
|
---|
1256 | endef
|
---|
1257 |
|
---|
1258 |
|
---|
1259 | ## generate the symlink rule
|
---|
1260 | define def_install_symlink_rule
|
---|
1261 | # the install rule
|
---|
1262 | $(insdst) : | $(call DIRDEP,$(dir $(insdst)))
|
---|
1263 | $$(RM) -f $$@
|
---|
1264 | $$(LN_SYMLINK) $(srcsrc) $(insdst)
|
---|
1265 | endef
|
---|
1266 |
|
---|
1267 | ## create one symlink
|
---|
1268 | define def_install_symlink
|
---|
1269 |
|
---|
1270 | # deal with '=>' in the source file name.
|
---|
1271 | srcdst := $(subst =>, ,$(src))
|
---|
1272 | srcsrc := $(firstword $(srcdst))
|
---|
1273 | srcdst := $(word $(words $(srcdst)),$(srcdst))
|
---|
1274 |
|
---|
1275 | # _INSTFUN
|
---|
1276 | ifdef $(srcsrc)_INSTFUN
|
---|
1277 | instfun := $(srcsrc)_INSTFUN
|
---|
1278 | else
|
---|
1279 | ifdef $(target)_INSTFUN
|
---|
1280 | instfun := $(target)_INSTFUN
|
---|
1281 | else
|
---|
1282 | instfun := _INSTALL_FILE
|
---|
1283 | endif
|
---|
1284 | endif
|
---|
1285 |
|
---|
1286 | # _INST
|
---|
1287 | ifdef $(srcsrc)_INST
|
---|
1288 | inst = $(srcsrc)_INST
|
---|
1289 | else
|
---|
1290 | ifdef $(target)_INST
|
---|
1291 | inst = $(target)_INST
|
---|
1292 | else
|
---|
1293 | inst =
|
---|
1294 | endif
|
---|
1295 | endif
|
---|
1296 |
|
---|
1297 | # calc target
|
---|
1298 | insdst := $(call $(instfun),$(srcdst),$(target),$(inst),$(PATH_INS))
|
---|
1299 | #$(warning srcsrc=$(srcsrc) srcdst=$(srcdst) insdst=$(insdst))
|
---|
1300 |
|
---|
1301 | # generate the rule (need double evaluation here)
|
---|
1302 | $(eval $(def_install_symlink_rule))
|
---|
1303 |
|
---|
1304 | INSTARGET_$(target) += $(insdst)
|
---|
1305 | endef
|
---|
1306 |
|
---|
1307 | ## process one install target.
|
---|
1308 | define def_install
|
---|
1309 | bld_type := $(firstword $($(target)_BLD_TYPE) $(BUILD_TYPE))
|
---|
1310 | bld_trg := $(firstword $($(target)_BLD_TRG) $(BUILD_TARGET))
|
---|
1311 | bld_trg_arch:= $(firstword $($(target)_BLD_TRG_ARCH) $(BUILD_TARGET_ARCH))
|
---|
1312 | bld_trg_cpu := $(firstword $($(target)_BLD_TRG_CPU) $(BUILD_TARGET_CPU))
|
---|
1313 |
|
---|
1314 | INSTARGET_$(target) :=
|
---|
1315 | $(foreach src,$($(target)_SOURCES) $($(target)_SOURCES.$(bld_trg)) $($(target)_SOURCES.$(bld_trg_arch)) $($(target)_SOURCES.$(bld_trg_cpu)) $($(target)_SOURCES.$(bld_type)), \
|
---|
1316 | $(eval $(value def_install_src)))
|
---|
1317 |
|
---|
1318 | $(foreach src,$($(target)_SYMLINKS) $($(target)_SYMLINKS.$(bld_trg)) $($(target)_SYMLINKS.$(bld_trg_arch)) $($(target)_SYMLINKS.$(bld_trg_cpu)) $($(target)_SYMLINKS.$(bld_type)), \
|
---|
1319 | $(eval $(value def_install_symlink)))
|
---|
1320 |
|
---|
1321 | _INSTALLS += $(INSTARGET_$(target))
|
---|
1322 | endef
|
---|
1323 |
|
---|
1324 | ## process all install targets
|
---|
1325 | $(foreach target, $(INSTALLS) $(INSTALLS.$(BUILD_TARGET)), \
|
---|
1326 | $(eval $(value def_install)))
|
---|
1327 |
|
---|
1328 |
|
---|
1329 | #
|
---|
1330 | # DOCS
|
---|
1331 | #
|
---|
1332 |
|
---|
1333 |
|
---|
1334 | #
|
---|
1335 | # PACKING
|
---|
1336 | #
|
---|
1337 | packing::
|
---|
1338 |
|
---|
1339 |
|
---|
1340 | #
|
---|
1341 | # DIRECTORIES
|
---|
1342 | #
|
---|
1343 | _DIR_ALL := $(sort $(addsuffix /,$(patsubst %/,%,$(_DIRS))) $(dir $(_OUT_FILES) $(_OBJS) $(_INSTALLS)))
|
---|
1344 |
|
---|
1345 | define def_mkdir_rule
|
---|
1346 | $(directory):
|
---|
1347 | $(call MSG_L1,Creating directory $$@)
|
---|
1348 | $(MKDIR) -p $$@
|
---|
1349 | endef
|
---|
1350 |
|
---|
1351 | $(foreach directory,$(_DIR_ALL),$(eval $(def_mkdir_rule)))
|
---|
1352 |
|
---|
1353 |
|
---|
1354 | #
|
---|
1355 | # NOTHING
|
---|
1356 | #
|
---|
1357 | do-nothing:
|
---|
1358 | $(call MSG_L1,Did nothing in $(CURDIR))
|
---|
1359 |
|
---|
1360 |
|
---|
1361 | #
|
---|
1362 | # CLEAN UP
|
---|
1363 | #
|
---|
1364 | do-clean:
|
---|
1365 | $(RM) -f $(_OUT_FILES) $(_OBJS) $(_DEPFILES) $(_CLEAN_FILES) $(OTHER_CLEAN)
|
---|
1366 |
|
---|
1367 |
|
---|
1368 | #
|
---|
1369 | # PASSES (including directory and makefile walking)
|
---|
1370 | #
|
---|
1371 |
|
---|
1372 | ## Subdir
|
---|
1373 | # @param $(pass) Lowercase pass name.
|
---|
1374 | # @param $(PASS) Uppercase pass name.
|
---|
1375 | # @param $(subdir) Subdirectory
|
---|
1376 | # @param $(tag) tag to attach to the rule name.
|
---|
1377 | define def_pass_subdir
|
---|
1378 | pass_$(pass)$(tag):: $(dep)
|
---|
1379 | + $(QUIET)$$(MAKE) -C $(subdir) -f $$(notdir $$(firstword $$(wildcard $$(addprefix $(subdir)/,$$(DEFAULT_MAKEFILE))))) pass_$(pass)
|
---|
1380 | endef
|
---|
1381 |
|
---|
1382 | ## Submakefile
|
---|
1383 | # @param $(pass) Lowercase pass name.
|
---|
1384 | # @param $(PASS) Uppercase pass name.
|
---|
1385 | # @param $(makefile) Makefile.
|
---|
1386 | # @param $(tag) tag to attach to the rule name.
|
---|
1387 | define def_pass_makefile
|
---|
1388 | pass_$(pass)$(tag):: $(dep)
|
---|
1389 | + $(QUIET)$$(MAKE) -C $(patsubst %/,%,$(dir $(makefile))) -f $(notdir $(makefile)) pass_$(pass)
|
---|
1390 | endef
|
---|
1391 |
|
---|
1392 | ## Execute a pass.
|
---|
1393 | # @param $(pass) Lowercase pass name.
|
---|
1394 | # @param $(PASS) Uppercase pass name.
|
---|
1395 | define def_pass_old
|
---|
1396 | $(eval SUBDIRS_$(PASS) ?= $(SUBDIRS) $(SUBDIRS.$(BUILD_TARGET)))
|
---|
1397 | $(eval SUBDIRS_AFTER_$(PASS) ?= $(SUBDIRS_AFTER) $(SUBDIRS_AFTER.$(BUILD_TARGET)))
|
---|
1398 | $(eval MAKEFILES_BEFORE_$(PASS) ?= $(MAKEFILES_BEFORE) $(MAKEFILES_BEFORE.$(BUILD_TARGET)))
|
---|
1399 | $(eval MAKEFILES_AFTER_$(PASS) ?= $(MAKEFILES_AFTER) $(MAKEFILES_AFTER.$(BUILD_TARGET)))
|
---|
1400 |
|
---|
1401 | $(eval tag:=_before)
|
---|
1402 | $(eval dep:=)
|
---|
1403 | $(foreach subdir,$(SUBDIRS_$(PASS)) $(SUBDIRS_$(PASS).$(BUILD_TARGET)) ,$(eval $(def_pass_subdir)))
|
---|
1404 | $(foreach makefile,$(MAKEFILES_BEFORE_$(PASS)) $(MAKEFILES_BEFORE_$(PASS).$(BUILD_TARGET)),$(eval $(def_pass_makefile)))
|
---|
1405 |
|
---|
1406 | $(eval tag:=_after)
|
---|
1407 | $(eval dep:=pass_$(pass)_doit)
|
---|
1408 | $(foreach subdir,$(SUBDIRS_AFTER_$(PASS)) $(SUBDIRS_AFTER_$(PASS).$(BUILD_TARGET)) ,$(eval $(def_pass_subdir)))
|
---|
1409 | $(foreach makefile,$(MAKEFILES_AFTER_$(PASS)) $(MAKEFILES_AFTER_$(PASS).$(BUILD_TARGET)) ,$(eval $(def_pass_makefile)))
|
---|
1410 |
|
---|
1411 | .NOTPARALLEL: pass_$(pass)_before pass_$(pass)_after
|
---|
1412 | .PHONY: pass_$(pass) pass_$(pass)_before pass_$(pass)_doit pass_$(pass)_after
|
---|
1413 | pass_$(pass)_doit: $(PASS_$(PASS)_trgs) $(foreach var,$(PASS_$(PASS)_vars),$(var))
|
---|
1414 | pass_$(pass)_this: pass_$(pass)_before
|
---|
1415 | + $(QUIET)$$(MAKE) -f $$(MAKEFILE) pass_$(pass)_doit
|
---|
1416 | pass_$(pass)_after:: pass_$(pass)_this
|
---|
1417 | pass_$(pass): pass_$(pass)_after
|
---|
1418 |
|
---|
1419 | endef
|
---|
1420 |
|
---|
1421 | define def_pass
|
---|
1422 | $(eval SUBDIRS_$(PASS) ?= $(SUBDIRS) $(SUBDIRS.$(BUILD_TARGET)))
|
---|
1423 | $(eval SUBDIRS_AFTER_$(PASS) ?= $(SUBDIRS_AFTER) $(SUBDIRS_AFTER.$(BUILD_TARGET)))
|
---|
1424 | $(eval MAKEFILES_BEFORE_$(PASS) ?= $(MAKEFILES_BEFORE) $(MAKEFILES_BEFORE.$(BUILD_TARGET)))
|
---|
1425 | $(eval MAKEFILES_AFTER_$(PASS) ?= $(MAKEFILES_AFTER) $(MAKEFILES_AFTER.$(BUILD_TARGET)))
|
---|
1426 |
|
---|
1427 | $(eval tag:=_before)
|
---|
1428 | $(eval dep:=)
|
---|
1429 | $(foreach subdir,$(SUBDIRS_$(PASS)) $(SUBDIRS_$(PASS).$(BUILD_TARGET)) ,$(eval $(def_pass_subdir)))
|
---|
1430 | $(foreach makefile,$(MAKEFILES_BEFORE_$(PASS)) $(MAKEFILES_BEFORE_$(PASS).$(BUILD_TARGET)),$(eval $(def_pass_makefile)))
|
---|
1431 |
|
---|
1432 | $(eval tag:=_after)
|
---|
1433 | $(eval dep:=pass_$(pass)_doit)
|
---|
1434 | $(foreach subdir,$(SUBDIRS_AFTER_$(PASS)) $(SUBDIRS_AFTER_$(PASS).$(BUILD_TARGET)) ,$(eval $(def_pass_subdir)))
|
---|
1435 | $(foreach makefile,$(MAKEFILES_AFTER_$(PASS)) $(MAKEFILES_AFTER_$(PASS).$(BUILD_TARGET)) ,$(eval $(def_pass_makefile)))
|
---|
1436 |
|
---|
1437 | ifdef KBUILD_SAFE_PARALLELL
|
---|
1438 | .NOTPARALLEL: pass_$(pass) pass_$(pass)_before pass_$(pass)_after pass_$(pass)_this
|
---|
1439 | .PHONY: pass_$(pass) pass_$(pass)_before pass_$(pass)_after pass_$(pass)_this pass_$(pass)_doit
|
---|
1440 | pass_$(pass)_doit: $(PASS_$(PASS)_trgs) $(foreach var,$(PASS_$(PASS)_vars),$(var))
|
---|
1441 | pass_$(pass)_this: pass_$(pass)_before
|
---|
1442 | + $(QUIET)$$(MAKE) -f $$(MAKEFILE) pass_$(pass)_doit
|
---|
1443 | pass_$(pass)_after:: pass_$(pass)_this
|
---|
1444 | pass_$(pass): pass_$(pass)_after
|
---|
1445 | else
|
---|
1446 | .NOTPARALLEL: pass_$(pass) pass_$(pass)_before pass_$(pass)_after
|
---|
1447 | .PHONY: pass_$(pass) pass_$(pass)_before pass_$(pass)_after pass_$(pass)_doit
|
---|
1448 | pass_$(pass)_doit: pass_$(pass)_before \
|
---|
1449 | $(PASS_$(PASS)_trgs) $(foreach var,$(PASS_$(PASS)_vars),$($(var)))
|
---|
1450 | pass_$(pass): \
|
---|
1451 | pass_$(pass)_before \
|
---|
1452 | pass_$(pass)_doit \
|
---|
1453 | pass_$(pass)_after
|
---|
1454 | endif
|
---|
1455 |
|
---|
1456 | #$ (warning pass=$(pass) PASS=$(PASS): $(PASS_$(PASS)_trgs) $(PASS_$(PASS)_trgs) $(foreach var,$(PASS_$(PASS)_vars),$($(var))))
|
---|
1457 | endef
|
---|
1458 |
|
---|
1459 | # Generate the defined passes.
|
---|
1460 | $(foreach PASS, $(PASSES), \
|
---|
1461 | $(eval pass := $(PASS_$(PASS)_pass)) \
|
---|
1462 | $(eval $(def_pass)))
|
---|
1463 |
|
---|
1464 | ## Pass order
|
---|
1465 | # @param $(pass) Current pass name.
|
---|
1466 | # @param $(prev_pass) The previous pass name.
|
---|
1467 | define def_pass_order
|
---|
1468 | ifdef KBUILD_SAFE_PARALLELL
|
---|
1469 | .NOTPARALLEL: pass_$(pass)_order
|
---|
1470 | .PHONY: pass_$(pass)_order
|
---|
1471 | pass_$(pass)_order: $(pass_prev)
|
---|
1472 | $(call MSG_L1,Pass - $(if $(PASS_$(PASS)),$(PASS_$(PASS)),$(pass)))
|
---|
1473 | + $(QUIET)$$(MAKE) -f $$(MAKEFILE) pass_$(pass)
|
---|
1474 | else
|
---|
1475 | .NOTPARALLEL: pass_$(pass)_order pass_$(pass)_banner
|
---|
1476 | .PHONY: pass_$(pass)_order pass_$(pass)_banner
|
---|
1477 | pass_$(pass)_banner:
|
---|
1478 | $(call MSG_L1,Pass - $(if $(PASS_$(PASS)),$(PASS_$(PASS)),$(pass)))
|
---|
1479 | pass_$(pass)_order: \
|
---|
1480 | $(pass_prev) \
|
---|
1481 | pass_$(pass)_banner \
|
---|
1482 | pass_$(pass)
|
---|
1483 | endif
|
---|
1484 | $(eval pass_prev := pass_$(pass)_order)
|
---|
1485 | endef
|
---|
1486 |
|
---|
1487 | ## PASS: order
|
---|
1488 | # Use dependencies to ensure correct pass order.
|
---|
1489 | pass_prev :=
|
---|
1490 | $(foreach PASS,$(DEFAULT_PASSES),\
|
---|
1491 | $(eval pass := $(PASS_$(PASS)_pass)) \
|
---|
1492 | $(eval $(def_pass_order)))
|
---|
1493 |
|
---|
1494 |
|
---|
1495 | #
|
---|
1496 | # THE MAIN RULES
|
---|
1497 | #
|
---|
1498 | all_recursive: $(pass_prev)
|
---|
1499 |
|
---|
1500 | rebuild: clean
|
---|
1501 | + $(MAKE) -f $(firstword $(MAKEFILE_LIST)) all_recursive
|
---|
1502 |
|
---|
1503 | uninstall:
|
---|
1504 | $(RM) -f $(_INSTALLS)
|
---|
1505 |
|
---|
1506 | # misc shortcuts.
|
---|
1507 | targets: bldprogs libraries dlls programs sysmods others install
|
---|
1508 | objects: $(_OBJS)
|
---|
1509 | bldprogs: $(_BLDPROGS)
|
---|
1510 | libraries: $(_LIBS) $(_IMPORT_LIBS) $(_OTHER_LIBRARIES)
|
---|
1511 | dlls: $(_DLLS)
|
---|
1512 | programs: $(_PROGRAMS)
|
---|
1513 | sysmods: $(_SYSMODS)
|
---|
1514 | others: $(_OTHERS)
|
---|
1515 | install: $(_INSTALLS)
|
---|
1516 |
|
---|
1517 |
|
---|
1518 | #
|
---|
1519 | # kBuild debugging stuff.
|
---|
1520 | #
|
---|
1521 | _SPACE := $(subst ., ,.)
|
---|
1522 | _TAB := $(subst ., ,.)
|
---|
1523 | define _NEWLINE
|
---|
1524 |
|
---|
1525 |
|
---|
1526 | endef
|
---|
1527 | NLTAB = $(_NEWLINE)$(TAB)
|
---|
1528 | show_targets:
|
---|
1529 | @$(foreach target, $(ALL_TARGETS),\
|
---|
1530 | @$(ECHO) "target: $(target)" $(NLTAB)\
|
---|
1531 | @$(ECHO) " PATH_$(target)=$(PATH_$(target))" $(NLTAB)\
|
---|
1532 | @$(ECHO) " TARGET_$(target)=$(TARGET_$(target))" $(NLTAB)\
|
---|
1533 | @$(ECHO) " INSTARGET_$(target)=$(INSTARGET_$(target))" $(NLTAB)\
|
---|
1534 | $(foreach prop,$(PROPS_SINGLE) $(PROPS_ACCUMULATE) OBJS_, \
|
---|
1535 | $(eval _tmp:=$(firstword $($(target)_BLD_TRG) $(BUILD_TARGET))) \
|
---|
1536 | $(if $($(target)_$(prop).$(_tmp)),\
|
---|
1537 | @$(ECHO) " $(target)_$(prop).$(_tmp)=$($(target)_$(prop).$(_tmp))" $(NLTAB)) \
|
---|
1538 | $(if $($(target)_$(prop)), $(NLTAB)@$(ECHO) " $(target)_$(prop)=$($(target)_$(prop))" $(NLTAB)) \
|
---|
1539 | )\
|
---|
1540 | $(foreach prop,$(PROPS_DEFERRED), \
|
---|
1541 | $(eval _tmp:=$(firstword $($(target)_BLD_TRG) $(BUILD_TARGET))) \
|
---|
1542 | $(if $(value $(target)_$(prop).$(_tmp)),\
|
---|
1543 | @$(ECHO) ' $(target)_$(prop).$(_tmp)=$(value $(TARGET)_$(prop).$(_tmp))' $(NLTAB)) \
|
---|
1544 | $(if $(value $(target)_$(prop)), $(NLTAB)@$(ECHO) ' $(target)_$(prop)=$(value $(target)_$(prop))' $(NLTAB)) \
|
---|
1545 | ))
|
---|
1546 |
|
---|
1547 |
|
---|
1548 |
|
---|
1549 | #
|
---|
1550 | # Include dependency files.
|
---|
1551 | #
|
---|
1552 | $(foreach dep,$(wildcard $(_DEPFILES)),$(eval include $(dep)))
|
---|
1553 |
|
---|
1554 |
|
---|
1555 | # end-of-file-content
|
---|
1556 | __footer_kmk__ := target
|
---|
1557 | endif # __footer_kmk__
|
---|