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