source: trunk/kBuild/footer.kmk@ 736

Last change on this file since 736 was 730, checked in by bird, 19 years ago

Added a variation on the $(comp-vars) function called $(comp-cmds) which compares command by command instead of the string as a whole ignoring spaces and job control chars.

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