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