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