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