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