source: trunk/kBuild/footer.kmk@ 827

Last change on this file since 827 was 827, checked in by bird, 18 years ago

New property 'ORDERDEPS' for listing order-only dependencies.

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