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