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