| 1 | # $Id: footer.kmk 2011 2008-11-01 14:15:50Z bird $
|
|---|
| 2 | ## @file
|
|---|
| 3 | # kBuild - File included at top of makefile.
|
|---|
| 4 | #
|
|---|
| 5 |
|
|---|
| 6 | #
|
|---|
| 7 | # Copyright (c) 2004-2008 knut st. osmundsen <bird-kBuild-spam@anduin.net>
|
|---|
| 8 | #
|
|---|
| 9 | # This file is part of kBuild.
|
|---|
| 10 | #
|
|---|
| 11 | # kBuild is free software; you can redistribute it and/or modify
|
|---|
| 12 | # it under the terms of the GNU General Public License as published by
|
|---|
| 13 | # the Free Software Foundation; either version source of the License, or
|
|---|
| 14 | # (at your option) any later version.
|
|---|
| 15 | #
|
|---|
| 16 | # kBuild is distributed in the hope that it will be useful,
|
|---|
| 17 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|---|
| 18 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|---|
| 19 | # GNU General Public License for more details.
|
|---|
| 20 | #
|
|---|
| 21 | # You should have received a copy of the GNU General Public License
|
|---|
| 22 | # along with kBuild; if not, write to the Free Software
|
|---|
| 23 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|---|
| 24 | #
|
|---|
| 25 | #
|
|---|
| 26 | # As a special exception you are granted permission to include this file, via
|
|---|
| 27 | # the kmk include directive, as you wish without this in itself causing the
|
|---|
| 28 | # resulting makefile, program or whatever to be covered by the GPL license.
|
|---|
| 29 | # This exception does not however invalidate any other reasons why the makefile,
|
|---|
| 30 | # program, whatever should not be covered the GPL.
|
|---|
| 31 | #
|
|---|
| 32 | #
|
|---|
| 33 |
|
|---|
| 34 | ifndef __footer_kmk__
|
|---|
| 35 | # start-of-file-content
|
|---|
| 36 | ifdef KBUILD_PROFILE_SELF
|
|---|
| 37 | $(evalcall def_profile_self, start of footer.kmk)
|
|---|
| 38 | _KBUILD_TS_FOOTER_START := $(_KBUILD_TS_PREV)
|
|---|
| 39 | endif
|
|---|
| 40 |
|
|---|
| 41 | #
|
|---|
| 42 | # Variables.
|
|---|
| 43 | # (Some of these need initialization before including definitions using them.)
|
|---|
| 44 | #
|
|---|
| 45 |
|
|---|
| 46 | # All targets of each types.
|
|---|
| 47 | _ALL_BLDPROGS := $(BLDPROGS) $(BLDPROGS.$(KBUILD_HOST)) $(BLDPROGS.$(KBUILD_HOST).$(KBUILD_HOST_ARCH)) $(BLDPROGS.$(KBUILD_HOST_ARCH)) $(BLDPROGS.$(KBUILD_HOST_CPU)) $(BLDPROGS.$(KBUILD_TYPE))
|
|---|
| 48 | _ALL_LIBRARIES := $(LIBRARIES) $(LIBRARIES.$(KBUILD_TARGET)) $(LIBRARIES.$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)) $(LIBRARIES.$(KBUILD_TARGET_ARCH)) $(LIBRARIES.$(KBUILD_TARGET_CPU)) $(LIBRARIES.$(KBUILD_TYPE))
|
|---|
| 49 | _ALL_IMPORT_LIBS := $(IMPORT_LIBS) $(IMPORT_LIBS.$(KBUILD_TARGET)) $(IMPORT_LIBS.$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)) $(IMPORT_LIBS.$(KBUILD_TARGET_ARCH)) $(IMPORT_LIBS.$(KBUILD_TARGET_CPU)) $(IMPORT_LIBS.$(KBUILD_TYPE))
|
|---|
| 50 | _ALL_DLLS := $(DLLS) $(DLLS.$(KBUILD_TARGET)) $(DLLS.$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)) $(DLLS.$(KBUILD_TARGET_ARCH)) $(DLLS.$(KBUILD_TARGET_CPU)) $(DLLS.$(KBUILD_TYPE))
|
|---|
| 51 | _ALL_PROGRAMS := $(PROGRAMS) $(PROGRAMS.$(KBUILD_TARGET)) $(PROGRAMS.$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)) $(PROGRAMS.$(KBUILD_TARGET_ARCH)) $(PROGRAMS.$(KBUILD_TARGET_CPU)) $(PROGRAMS.$(KBUILD_TYPE))
|
|---|
| 52 | _ALL_SYSMODS := $(SYSMODS) $(SYSMODS.$(KBUILD_TARGET)) $(SYSMODS.$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)) $(SYSMODS.$(KBUILD_TARGET_ARCH)) $(SYSMODS.$(KBUILD_TARGET_CPU)) $(SYSMODS.$(KBUILD_TYPE))
|
|---|
| 53 | _ALL_OTHERS := $(OTHERS) $(OTHERS.$(KBUILD_TARGET)) $(OTHERS.$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)) $(OTHERS.$(KBUILD_TARGET_ARCH)) $(OTHERS.$(KBUILD_TARGET_CPU)) $(OTHERS.$(KBUILD_TYPE))
|
|---|
| 54 | _ALL_INSTALLS := $(INSTALLS) $(INSTALLS.$(KBUILD_TARGET)) $(INSTALLS.$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)) $(INSTALLS.$(KBUILD_TARGET_ARCH)) $(INSTALLS.$(KBUILD_TARGET_CPU)) $(INSTALLS.$(KBUILD_TYPE))
|
|---|
| 55 | _ALL_FETCHES := $(FETCHES) $(FETCHES.$(KBUILD_TARGET)) $(FETCHES.$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)) $(FETCHES.$(KBUILD_TARGET_ARCH)) $(FETCHES.$(KBUILD_TARGET_CPU)) $(FETCHES.$(KBUILD_TYPE))
|
|---|
| 56 | _ALL_PATCHES := $(PATCHES) $(PATCHES.$(KBUILD_TARGET)) $(PATCHES.$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)) $(PATCHES.$(KBUILD_TARGET_ARCH)) $(PATCHES.$(KBUILD_TARGET_CPU)) $(PATCHES.$(KBUILD_TYPE))
|
|---|
| 57 |
|
|---|
| 58 | # all targets.
|
|---|
| 59 | _ALL_TARGETS = \
|
|---|
| 60 | $(_ALL_FETCHES) \
|
|---|
| 61 | $(_ALL_PATCHES) \
|
|---|
| 62 | $(_ALL_BLDPROGS) \
|
|---|
| 63 | $(_ALL_LIBRARIES) \
|
|---|
| 64 | $(_ALL_IMPORT_LIBS) \
|
|---|
| 65 | $(_ALL_DLLS) \
|
|---|
| 66 | $(_ALL_PROGRAMS) \
|
|---|
| 67 | $(_ALL_SYSMODS) \
|
|---|
| 68 | $(_ALL_INSTALLS) \
|
|---|
| 69 | $(_ALL_OTHERS)
|
|---|
| 70 |
|
|---|
| 71 | # all $(KBUILD_TARGET) targets.
|
|---|
| 72 | _ALL_TARGET_TARGETS = \
|
|---|
| 73 | $(_ALL_FETCHES) \
|
|---|
| 74 | $(_ALL_PATCHES) \
|
|---|
| 75 | $(_ALL_LIBRARIES) \
|
|---|
| 76 | $(_ALL_IMPORT_LIBS) \
|
|---|
| 77 | $(_ALL_DLLS) \
|
|---|
| 78 | $(_ALL_PROGRAMS) \
|
|---|
| 79 | $(_ALL_SYSMODS) \
|
|---|
| 80 | $(_ALL_INSTALLS) \
|
|---|
| 81 | $(_ALL_OTHERS)
|
|---|
| 82 |
|
|---|
| 83 | # all $(KBUILD_HOST) targets.
|
|---|
| 84 | _ALL_HOST_TARGETS = \
|
|---|
| 85 | $(_ALL_BLDPROGS)
|
|---|
| 86 |
|
|---|
| 87 | # all targets making use of srcname.
|
|---|
| 88 | _ALL_SRCNAME_TARGETS = \
|
|---|
| 89 | $(_ALL_FETCHES) \
|
|---|
| 90 | $(_ALL_PATCHES)
|
|---|
| 91 |
|
|---|
| 92 | # Dependency files. (currently not on target level, only this global stuff)
|
|---|
| 93 | _DEPFILES := $(DEPFILES) $(DEPFILES.$(KBUILD_TARGET)) $(DEPFILES.$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)) $(DEPFILES.$(KBUILD_TARGET_ARCH)) $(DEPFILES.$(KBUILD_TARGET_CPU)) $(DEPFILES.$(KBUILD_TYPE))
|
|---|
| 94 |
|
|---|
| 95 | # included dependency files.
|
|---|
| 96 | _DEPFILES_INCLUDED :=
|
|---|
| 97 |
|
|---|
| 98 |
|
|---|
| 99 | # All kind of output files except for _OBJS and _DEPFILES.
|
|---|
| 100 | # Compiling or linking definition outputting other things that $@ and any
|
|---|
| 101 | # required dependency file must add those output files to this variable.
|
|---|
| 102 | _OUT_FILES :=
|
|---|
| 103 |
|
|---|
| 104 | # Files which only requires cleaning up.
|
|---|
| 105 | _CLEAN_FILES :=
|
|---|
| 106 |
|
|---|
| 107 | # all of a type
|
|---|
| 108 | _OBJS :=
|
|---|
| 109 | _FETCHES :=
|
|---|
| 110 | _DOWNLOADS:=
|
|---|
| 111 | _UNPACKS :=
|
|---|
| 112 | _PATCHES :=
|
|---|
| 113 | _UNFETCHES:=
|
|---|
| 114 | _BLDPROGS :=
|
|---|
| 115 | _LIBS :=
|
|---|
| 116 | _DLLS :=
|
|---|
| 117 | _PROGRAMS :=
|
|---|
| 118 | _SYSMODS :=
|
|---|
| 119 | _INSTALLS :=
|
|---|
| 120 | _INSTALLS_FILES :=
|
|---|
| 121 | _INSTALLS_DIRS :=
|
|---|
| 122 | _OTHERS :=
|
|---|
| 123 | _PACKING :=
|
|---|
| 124 | _DIRS := $(PATH_TARGET)/ $(PATH_TARGET) $(BLDDIRS)
|
|---|
| 125 | _IMPORT_LIBS :=
|
|---|
| 126 |
|
|---|
| 127 | # misc
|
|---|
| 128 | pass_prev :=
|
|---|
| 129 |
|
|---|
| 130 |
|
|---|
| 131 |
|
|---|
| 132 | #
|
|---|
| 133 | # Footer macros
|
|---|
| 134 | #
|
|---|
| 135 |
|
|---|
| 136 | ## Figure out the tool for a target.
|
|---|
| 137 | # @param $1 normalized target.
|
|---|
| 138 | # @param $2 tooltype.
|
|---|
| 139 | # @param bld_trg build target.
|
|---|
| 140 | # @param bld_trg_arch build target architecture.
|
|---|
| 141 | _TARGET_TOOL = $(strip $(firstword \
|
|---|
| 142 | $($(1)_$(2)TOOL.$(bld_trg).$(bld_trg_arch)) \
|
|---|
| 143 | $($(1)_$(2)TOOL.$(bld_trg)) \
|
|---|
| 144 | $($(1)_$(2)TOOL) \
|
|---|
| 145 | $($(1)_TOOL.$(bld_trg).$(bld_trg_arch)) \
|
|---|
| 146 | $($(1)_TOOL.$(bld_trg)) \
|
|---|
| 147 | $($(1)_TOOL) \
|
|---|
| 148 | $($(2)TOOL.$(bld_trg).$(bld_trg_arch)) \
|
|---|
| 149 | $($(2)TOOL.$(bld_trg)) \
|
|---|
| 150 | $($(2)TOOL) \
|
|---|
| 151 | $(TOOL.$(bld_trg).$(bld_trg_arch)) \
|
|---|
| 152 | $(TOOL.$(bld_trg)) \
|
|---|
| 153 | $(TOOL) \
|
|---|
| 154 | ))
|
|---|
| 155 |
|
|---|
| 156 | ## Figure out the actual name of an installed file.
|
|---|
| 157 | # @param $1 The file to install.
|
|---|
| 158 | # @param $2 The target name.
|
|---|
| 159 | # @param $3 The _INST value (can be empty).
|
|---|
| 160 | # @param $4 The default directory to use when $3 is empty.
|
|---|
| 161 | _INSTALL_FILE = $(patsubst %/,%/$(notdir $(1)),$(if $(3),$(PATH_INS)/$(3),$(4)/))
|
|---|
| 162 |
|
|---|
| 163 |
|
|---|
| 164 |
|
|---|
| 165 | ## Converts a variable from simple to recursive flavor.
|
|---|
| 166 | # This is used by def_inherit_template_one_accumulate_l and def_inherit_template_one_accumulate_r.
|
|---|
| 167 | # @param $1 The variable name.
|
|---|
| 168 | define def_simple_2_recursive
|
|---|
| 169 | $1_DEFERRED := $$($1)
|
|---|
| 170 | $1 = $$($1_DEFERRED)
|
|---|
| 171 | endef
|
|---|
| 172 |
|
|---|
| 173 |
|
|---|
| 174 | ## Inherit one keyword in a non-accumulative manner.
|
|---|
| 175 | # @param $(trg) Target object.
|
|---|
| 176 | # @param $(prop) The property.
|
|---|
| 177 | # @param $(src_key) Source keyword.
|
|---|
| 178 | # @param $(trg_key) Target keyword.
|
|---|
| 179 | define def_inherit_one_keyword
|
|---|
| 180 | ifdef $(trg)_$(prop).$(src_key)
|
|---|
| 181 | ifndef $(trg)_$(prop).$(trg_key)
|
|---|
| 182 | $(trg)_$(prop).$(trg_key) = $($(trg)_$(prop).$(src_key))
|
|---|
| 183 | endif
|
|---|
| 184 | endif
|
|---|
| 185 | endef
|
|---|
| 186 |
|
|---|
| 187 |
|
|---|
| 188 | # EXPAND_BY = overriding
|
|---|
| 189 |
|
|---|
| 190 | ## Inherit one keyword in a non-accumulative manner.
|
|---|
| 191 | # @param $(trg) Target object.
|
|---|
| 192 | # @param $(prop) The property.
|
|---|
| 193 | # @param $(src_key) Source keyword.
|
|---|
| 194 | # @param $(trg_key) Target keyword.
|
|---|
| 195 | define def_inherit_one_keyword_overriding_now_l
|
|---|
| 196 | ifdef $(trg)_$(prop).$(src_key)
|
|---|
| 197 | ifndef $(trg)_$(prop).$(trg_key)
|
|---|
| 198 | $(trg)_$(prop).$(trg_key) := $($(trg)_$(prop).$(src_key))
|
|---|
| 199 | endif
|
|---|
| 200 | endif
|
|---|
| 201 | endef
|
|---|
| 202 |
|
|---|
| 203 | ## @copydoc def_inherit_one_overriding_now_l
|
|---|
| 204 | define def_inherit_one_keyword_overriding_now_r
|
|---|
| 205 | ifdef $(trg)_$(prop).$(src_key)
|
|---|
| 206 | ifndef $(trg)_$(prop).$(trg_key)
|
|---|
| 207 | $(trg)_$(prop).$(trg_key) := $($(trg)_$(prop).$(src_key))
|
|---|
| 208 | endif
|
|---|
| 209 | endif
|
|---|
| 210 | endef
|
|---|
| 211 |
|
|---|
| 212 | ## Inherit one keyword in a non-accumulative manner, deferred expansion.
|
|---|
| 213 | # @param $(trg) Target object.
|
|---|
| 214 | # @param $(prop) The property.
|
|---|
| 215 | # @param $(src_key) Source keyword.
|
|---|
| 216 | # @param $(trg_key) Target keyword.
|
|---|
| 217 | # @remark This define relies on double evaluation
|
|---|
| 218 | define def_inherit_one_keyword_overriding_deferred
|
|---|
| 219 | ifdef $(trg)_$(prop).$(src_key)
|
|---|
| 220 | ifndef $(trg)_$(prop).$(trg_key)
|
|---|
| 221 | $(trg)_$(prop).$(trg_key) = $$($(trg)_$(prop).$(src_key))
|
|---|
| 222 | endif
|
|---|
| 223 | endif
|
|---|
| 224 | endef
|
|---|
| 225 |
|
|---|
| 226 | ## @copydoc def_inherit_one_overriding_deferred
|
|---|
| 227 | define def_inherit_one_keyword_overriding_deferred_l
|
|---|
| 228 | ifdef $(trg)_$(prop).$(src_key)
|
|---|
| 229 | ifndef $(trg)_$(prop).$(trg_key)
|
|---|
| 230 | $(trg)_$(prop).$(trg_key) = $$($(trg)_$(prop).$(src_key))
|
|---|
| 231 | endif
|
|---|
| 232 | endif
|
|---|
| 233 | endef
|
|---|
| 234 |
|
|---|
| 235 | ## @copydoc def_inherit_one_overriding_deferred
|
|---|
| 236 | define def_inherit_one_keyword_overriding_deferred_r
|
|---|
| 237 | ifdef $(trg)_$(prop).$(src_key)
|
|---|
| 238 | ifndef $(trg)_$(prop).$(trg_key)
|
|---|
| 239 | $(trg)_$(prop).$(trg_key) = $$($(trg)_$(prop).$(src_key))
|
|---|
| 240 | endif
|
|---|
| 241 | endif
|
|---|
| 242 | endef
|
|---|
| 243 |
|
|---|
| 244 |
|
|---|
| 245 | # EXPAND_BY = prepending
|
|---|
| 246 |
|
|---|
| 247 | ## Inherit one keyword in a prepending manner.
|
|---|
| 248 | # @param $(trg) Target object.
|
|---|
| 249 | # @param $(prop) The property.
|
|---|
| 250 | # @param $(src_key) Source keyword.
|
|---|
| 251 | # @param $(trg_key) Target keyword.
|
|---|
| 252 | define def_inherit_one_keyword_prepending_now_l
|
|---|
| 253 | ifdef $(trg)_$(prop).$(src_key)
|
|---|
| 254 | $(trg)_$(prop).$(trg_key) := $($(trg)_$(prop).$(src_key)) $($(trg)_$(prop).$(trg_key))
|
|---|
| 255 | endif
|
|---|
| 256 | endef
|
|---|
| 257 |
|
|---|
| 258 | ## @copydoc def_inherit_one_prepending_now_l
|
|---|
| 259 | define def_inherit_one_keyword_prepending_now_r
|
|---|
| 260 | ifdef $(trg)_$(prop).$(src_key)
|
|---|
| 261 | $(trg)_$(prop).$(trg_key) := $($(trg)_$(prop).$(trg_key)) $($(trg)_$(prop).$(src_key))
|
|---|
| 262 | endif
|
|---|
| 263 | endef
|
|---|
| 264 |
|
|---|
| 265 | ## Inherit one keyword in a non-accumulative manner, deferred expansion.
|
|---|
| 266 | # @param $(trg) Target object.
|
|---|
| 267 | # @param $(prop) The property.
|
|---|
| 268 | # @param $(src_key) Source keyword.
|
|---|
| 269 | # @param $(trg_key) Target keyword.
|
|---|
| 270 | # @remark This define relies on double evaluation
|
|---|
| 271 | define def_inherit_one_keyword_prepending_deferred
|
|---|
| 272 | ifdef $(trg)_$(prop).$(src_key)
|
|---|
| 273 | ifndef $(trg)_$(prop).$(trg_key)
|
|---|
| 274 | $(trg)_$(prop).$(trg_key) = $$($(trg)_$(prop).$(src_key))
|
|---|
| 275 | endif
|
|---|
| 276 | endif
|
|---|
| 277 | endef
|
|---|
| 278 |
|
|---|
| 279 | ## Inherit one keyword in a prepending manner, deferred expansion.
|
|---|
| 280 | # @param $(trg) Target object.
|
|---|
| 281 | # @param $(prop) The property.
|
|---|
| 282 | # @param $(src_key) Source keyword.
|
|---|
| 283 | # @param $(trg_key) Target keyword.
|
|---|
| 284 | define def_inherit_one_keyword_prepending_deferred_l
|
|---|
| 285 | ifdef $(trg)_$(prop).$(src_key)
|
|---|
| 286 | ifeq ($$(flavor $(trg)_$(prop).$(trg_key)),simple)
|
|---|
| 287 | $$(evalcall2 def_simple_2_recursive,$(trg)_$(prop).$(trg_key))
|
|---|
| 288 | endif
|
|---|
| 289 | $(trg)_$(prop).$(trg_key) <= $$($(trg)_$(prop).$(src_key))
|
|---|
| 290 | endif
|
|---|
| 291 | endef
|
|---|
| 292 |
|
|---|
| 293 | ## @copydoc def_inherit_one_prepending_deferred_l
|
|---|
| 294 | define def_inherit_one_keyword_prepending_deferred_r
|
|---|
| 295 | ifdef $(trg)_$(prop).$(src_key)
|
|---|
| 296 | ifeq ($$(flavor $(trg)_$(prop).$(trg_key)),simple)
|
|---|
| 297 | $$(evalcall2 def_simple_2_recursive,$(trg)_$(prop).$(trg_key))
|
|---|
| 298 | endif
|
|---|
| 299 | $(trg)_$(prop).$(trg_key) += $$($(trg)_$(prop).$(src_key))
|
|---|
| 300 | endif
|
|---|
| 301 | endef
|
|---|
| 302 |
|
|---|
| 303 |
|
|---|
| 304 | # EXPAND_BY = appending
|
|---|
| 305 |
|
|---|
| 306 | ## Inherit one keyword in an appending manner.
|
|---|
| 307 | # @param $(trg) Target object.
|
|---|
| 308 | # @param $(prop) The property.
|
|---|
| 309 | # @param $(src_key) Source keyword.
|
|---|
| 310 | # @param $(trg_key) Target keyword.
|
|---|
| 311 | define def_inherit_one_keyword_appending_now_l
|
|---|
| 312 | ifdef $(trg)_$(prop).$(src_key)
|
|---|
| 313 | $(trg)_$(prop).$(trg_key) := $($(trg)_$(prop).$(trg_key)) $($(trg)_$(prop).$(src_key))
|
|---|
| 314 | endif
|
|---|
| 315 | endef
|
|---|
| 316 |
|
|---|
| 317 | ## @copydoc def_inherit_one_appending_now_l
|
|---|
| 318 | define def_inherit_one_keyword_appending_now_r
|
|---|
| 319 | ifdef $(trg)_$(prop).$(src_key)
|
|---|
| 320 | $(trg)_$(prop).$(trg_key) := $($(trg)_$(prop).$(src_key)) $($(trg)_$(prop).$(trg_key))
|
|---|
| 321 | endif
|
|---|
| 322 | endef
|
|---|
| 323 |
|
|---|
| 324 | ## Inherit one keyword in a non-accumulative manner, deferred expansion.
|
|---|
| 325 | # @param $(trg) Target object.
|
|---|
| 326 | # @param $(prop) The property.
|
|---|
| 327 | # @param $(src_key) Source keyword.
|
|---|
| 328 | # @param $(trg_key) Target keyword.
|
|---|
| 329 | # @remark This define relies on double evaluation
|
|---|
| 330 | define def_inherit_one_keyword_appending_deferred
|
|---|
| 331 | ifdef $(trg)_$(prop).$(src_key)
|
|---|
| 332 | ifndef $(trg)_$(prop).$(trg_key)
|
|---|
| 333 | $(trg)_$(prop).$(trg_key) = $$($(trg)_$(prop).$(src_key))
|
|---|
| 334 | endif
|
|---|
| 335 | endif
|
|---|
| 336 | endef
|
|---|
| 337 |
|
|---|
| 338 | ## Inherit one keyword in an appending manner, deferred expansion.
|
|---|
| 339 | # @param $(trg) Target object.
|
|---|
| 340 | # @param $(prop) The property.
|
|---|
| 341 | # @param $(src_key) Source keyword.
|
|---|
| 342 | # @param $(trg_key) Target keyword.
|
|---|
| 343 | define def_inherit_one_keyword_appending_deferred_l
|
|---|
| 344 | ifdef $(trg)_$(prop).$(src_key)
|
|---|
| 345 | ifeq ($$(flavor $(trg)_$(prop).$(trg_key)),simple)
|
|---|
| 346 | $$(evalcall2 def_simple_2_recursive,$(trg)_$(prop).$(trg_key))
|
|---|
| 347 | endif
|
|---|
| 348 | $(trg)_$(prop).$(trg_key) += $$($(trg)_$(prop).$(src_key))
|
|---|
| 349 | endif
|
|---|
| 350 | endef
|
|---|
| 351 |
|
|---|
| 352 | ## @copydoc def_inherit_one_appending_deferred_l
|
|---|
| 353 | define def_inherit_one_keyword_appending_deferred_r
|
|---|
| 354 | ifdef $(trg)_$(prop).$(src_key)
|
|---|
| 355 | ifeq ($$(flavor $(trg)_$(prop).$(trg_key)),simple)
|
|---|
| 356 | $$(evalcall2 def_simple_2_recursive,$(trg)_$(prop).$(trg_key))
|
|---|
| 357 | endif
|
|---|
| 358 | $(trg)_$(prop).$(trg_key) <= $$($(trg)_$(prop).$(src_key))
|
|---|
| 359 | endif
|
|---|
| 360 | endef
|
|---|
| 361 |
|
|---|
| 362 |
|
|---|
| 363 | ## Worker for def_inherit that deals with one keyword that makes
|
|---|
| 364 | # use of inheritance.
|
|---|
| 365 | # @param prefix_keyword key_prefix:keyword. The cool join/split game as usual.
|
|---|
| 366 | # @param trg Object to consider for inheriting.
|
|---|
| 367 | # @param properties List of the properties with straight expansion.
|
|---|
| 368 | # @param properties_now_l List of the properties with immediate expansion, accumulating on the left side.
|
|---|
| 369 | # @param properties_now_r List of the properties with immediate expansion, accumulating on the right side.
|
|---|
| 370 | # @param properties_deferred List of the properties with deferred expansion (e.g. function), non-accumulative .
|
|---|
| 371 | # @param properties_deferred_l List of the properties with deferred expansion (e.g. function), accumulating on the left side.
|
|---|
| 372 | # @param properties_deferred_r List of the properties with deferred expansion (e.g. function), accumulating on the right side.
|
|---|
| 373 | define def_inherit_keyword
|
|---|
| 374 | local prefix := $(word 1,$(subst :, ,$(prefix_keyword)))
|
|---|
| 375 | local trg_key := $(word 2,$(subst :, ,$(prefix_keyword)))
|
|---|
| 376 | local src_key := $($(prefix)_$(trg_key)_EXTENDS)
|
|---|
| 377 | local by := $($(prefix)_$(trg_key)_EXTENDS_BY)
|
|---|
| 378 |
|
|---|
| 379 | # Inherit the properties.
|
|---|
| 380 | $(foreach prop, $(properties), $(eval $(def_inherit_one_keyword)))
|
|---|
| 381 | $(foreach prop, $(properties_now_l), $(eval $(def_inherit_one_keyword_$(by)_now_l)))
|
|---|
| 382 | $(foreach prop, $(properties_now_r), $(eval $(def_inherit_one_keyword_$(by)_now_r)))
|
|---|
| 383 | $(foreach prop, $(properties_deferred), $(eval $(def_inherit_one_keyword_$(by)_deferred)))
|
|---|
| 384 | $(foreach prop, $(properties_deferred_l), $(eval $(def_inherit_one_keyword_$(by)_deferred_l)))
|
|---|
| 385 | $(foreach prop, $(properties_deferred_r), $(eval $(def_inherit_one_keyword_$(by)_deferred_r)))
|
|---|
| 386 |
|
|---|
| 387 | endef # def_inherit_keyword
|
|---|
| 388 |
|
|---|
| 389 |
|
|---|
| 390 | ## Inherit one template property in a non-accumulative manner.
|
|---|
| 391 | # @param $(prop) Property name
|
|---|
| 392 | # @param $(src) Source (parent) object.
|
|---|
| 393 | # @param $(trg) Target (child) object.
|
|---|
| 394 | define def_inherit_one
|
|---|
| 395 | ifdef $(src)_$(prop)
|
|---|
| 396 | ifndef $(trg)_$(prop)
|
|---|
| 397 | $(trg)_$(prop) = $($(src)_$(prop))
|
|---|
| 398 | endif
|
|---|
| 399 | endif
|
|---|
| 400 | endef
|
|---|
| 401 |
|
|---|
| 402 |
|
|---|
| 403 | # EXPAND_BY = overriding
|
|---|
| 404 |
|
|---|
| 405 | ## Inherit one template property in a non-accumulative manner.
|
|---|
| 406 | # @param $(prop) Property name
|
|---|
| 407 | # @param $(src) Source (parent) object.
|
|---|
| 408 | # @param $(trg) Target (child) object.
|
|---|
| 409 | define def_inherit_one_overriding_now_l
|
|---|
| 410 | ifdef $(src)_$(prop)
|
|---|
| 411 | ifndef $(trg)_$(prop)
|
|---|
| 412 | $(trg)_$(prop) := $($(src)_$(prop))
|
|---|
| 413 | endif
|
|---|
| 414 | endif
|
|---|
| 415 | endef
|
|---|
| 416 |
|
|---|
| 417 | ## @copydoc def_inherit_one_overriding_now_l
|
|---|
| 418 | define def_inherit_one_overriding_now_r
|
|---|
| 419 | ifdef $(src)_$(prop)
|
|---|
| 420 | ifndef $(trg)_$(prop)
|
|---|
| 421 | $(trg)_$(prop) := $($(src)_$(prop))
|
|---|
| 422 | endif
|
|---|
| 423 | endif
|
|---|
| 424 | endef
|
|---|
| 425 |
|
|---|
| 426 | ## Inherit one template property in a non-accumulative manner, deferred expansion.
|
|---|
| 427 | # @param $(prop) Property name
|
|---|
| 428 | # @param $(src) Source
|
|---|
| 429 | # @param $(trg) Target
|
|---|
| 430 | # @remark This define relies on double evaluation
|
|---|
| 431 | define def_inherit_one_overriding_deferred
|
|---|
| 432 | ifdef $(src)_$(prop)
|
|---|
| 433 | ifndef $(trg)_$(prop)
|
|---|
| 434 | $(trg)_$(prop) = $$($(src)_$(prop))
|
|---|
| 435 | endif
|
|---|
| 436 | endif
|
|---|
| 437 | endef
|
|---|
| 438 |
|
|---|
| 439 | ## @copydoc def_inherit_one_overriding_deferred
|
|---|
| 440 | define def_inherit_one_overriding_deferred_l
|
|---|
| 441 | ifdef $(src)_$(prop)
|
|---|
| 442 | ifndef $(trg)_$(prop)
|
|---|
| 443 | $(trg)_$(prop) = $$($(src)_$(prop))
|
|---|
| 444 | endif
|
|---|
| 445 | endif
|
|---|
| 446 | endef
|
|---|
| 447 |
|
|---|
| 448 | ## @copydoc def_inherit_one_overriding_deferred
|
|---|
| 449 | define def_inherit_one_overriding_deferred_r
|
|---|
| 450 | ifdef $(src)_$(prop)
|
|---|
| 451 | ifndef $(trg)_$(prop)
|
|---|
| 452 | $(trg)_$(prop) = $$($(src)_$(prop))
|
|---|
| 453 | endif
|
|---|
| 454 | endif
|
|---|
| 455 | endef
|
|---|
| 456 |
|
|---|
| 457 |
|
|---|
| 458 | # EXPAND_BY = prepending
|
|---|
| 459 |
|
|---|
| 460 | ## Inherit one template property in a prepending manner.
|
|---|
| 461 | # @param $(prop) Property name
|
|---|
| 462 | # @param $(src) Source (parent) object.
|
|---|
| 463 | # @param $(trg) Target (child) object.
|
|---|
| 464 | define def_inherit_one_prepending_now_l
|
|---|
| 465 | ifdef $(src)_$(prop)
|
|---|
| 466 | $(trg)_$(prop) := $($(src)_$(prop)) $($(trg)_$(prop))
|
|---|
| 467 | endif
|
|---|
| 468 | endef
|
|---|
| 469 |
|
|---|
| 470 | ## @copydoc def_inherit_one_prepending_now_l
|
|---|
| 471 | define def_inherit_one_prepending_now_r
|
|---|
| 472 | ifdef $(src)_$(prop)
|
|---|
| 473 | $(trg)_$(prop) := $($(trg)_$(prop)) $($(src)_$(prop))
|
|---|
| 474 | endif
|
|---|
| 475 | endef
|
|---|
| 476 |
|
|---|
| 477 | ## Inherit one template property in a non-accumulative manner, deferred expansion.
|
|---|
| 478 | # @param $(prop) Property name
|
|---|
| 479 | # @param $(src) Source
|
|---|
| 480 | # @param $(trg) Target
|
|---|
| 481 | # @remark This define relies on double evaluation
|
|---|
| 482 | define def_inherit_one_prepending_deferred
|
|---|
| 483 | ifdef $(src)_$(prop)
|
|---|
| 484 | ifndef $(trg)_$(prop)
|
|---|
| 485 | $(trg)_$(prop) = $$($(src)_$(prop))
|
|---|
| 486 | endif
|
|---|
| 487 | endif
|
|---|
| 488 | endef
|
|---|
| 489 |
|
|---|
| 490 | ## Inherit one template property in a prepending manner, deferred expansion.
|
|---|
| 491 | # @param $(prop) Property name
|
|---|
| 492 | # @param $(src) Source (parent) object.
|
|---|
| 493 | # @param $(trg) Target (child) object.
|
|---|
| 494 | define def_inherit_one_prepending_deferred_l
|
|---|
| 495 | ifdef $(src)_$(prop)
|
|---|
| 496 | ifeq ($$(flavor $(trg)_$(prop)),simple)
|
|---|
| 497 | $$(evalcall2 def_simple_2_recursive,$(trg)_$(prop))
|
|---|
| 498 | endif
|
|---|
| 499 | $(trg)_$(prop) <= $$($(src)_$(prop))
|
|---|
| 500 | endif
|
|---|
| 501 | endef
|
|---|
| 502 |
|
|---|
| 503 | ## @copydoc def_inherit_one_prepending_deferred_l
|
|---|
| 504 | define def_inherit_one_prepending_deferred_r
|
|---|
| 505 | ifdef $(src)_$(prop)
|
|---|
| 506 | ifeq ($$(flavor $(trg)_$(prop)),simple)
|
|---|
| 507 | $$(evalcall2 def_simple_2_recursive,$(trg)_$(prop))
|
|---|
| 508 | endif
|
|---|
| 509 | $(trg)_$(prop) += $$($(src)_$(prop))
|
|---|
| 510 | endif
|
|---|
| 511 | endef
|
|---|
| 512 |
|
|---|
| 513 |
|
|---|
| 514 | # EXPAND_BY = appending
|
|---|
| 515 |
|
|---|
| 516 | ## Inherit one template property in an appending manner.
|
|---|
| 517 | # @param $(prop) Property name
|
|---|
| 518 | # @param $(src) Source (parent) object.
|
|---|
| 519 | # @param $(trg) Target (child) object.
|
|---|
| 520 | define def_inherit_one_appending_now_l
|
|---|
| 521 | ifdef $(src)_$(prop)
|
|---|
| 522 | $(trg)_$(prop) := $($(trg)_$(prop)) $($(src)_$(prop))
|
|---|
| 523 | endif
|
|---|
| 524 | endef
|
|---|
| 525 |
|
|---|
| 526 | ## @copydoc def_inherit_one_appending_now_l
|
|---|
| 527 | define def_inherit_one_appending_now_r
|
|---|
| 528 | ifdef $(src)_$(prop)
|
|---|
| 529 | $(trg)_$(prop) := $($(src)_$(prop)) $($(trg)_$(prop))
|
|---|
| 530 | endif
|
|---|
| 531 | endef
|
|---|
| 532 |
|
|---|
| 533 | ## Inherit one template property in a non-accumulative manner, deferred expansion.
|
|---|
| 534 | # @param $(prop) Property name
|
|---|
| 535 | # @param $(src) Source
|
|---|
| 536 | # @param $(trg) Target
|
|---|
| 537 | # @remark This define relies on double evaluation
|
|---|
| 538 | define def_inherit_one_appending_deferred
|
|---|
| 539 | ifdef $(src)_$(prop)
|
|---|
| 540 | ifndef $(trg)_$(prop)
|
|---|
| 541 | $(trg)_$(prop) = $$($(src)_$(prop))
|
|---|
| 542 | endif
|
|---|
| 543 | endif
|
|---|
| 544 | endef
|
|---|
| 545 |
|
|---|
| 546 | ## Inherit one template property in an appending manner, deferred expansion.
|
|---|
| 547 | # @param $(prop) Property name
|
|---|
| 548 | # @param $(src) Source (parent) object.
|
|---|
| 549 | # @param $(trg) Target (child) object.
|
|---|
| 550 | define def_inherit_one_appending_deferred_l
|
|---|
| 551 | ifdef $(src)_$(prop)
|
|---|
| 552 | ifeq ($$(flavor $(trg)_$(prop)),simple)
|
|---|
| 553 | $$(evalcall2 def_simple_2_recursive,$(trg)_$(prop))
|
|---|
| 554 | endif
|
|---|
| 555 | $(trg)_$(prop) += $$($(src)_$(prop))
|
|---|
| 556 | endif
|
|---|
| 557 | endef
|
|---|
| 558 |
|
|---|
| 559 | ## @copydoc def_inherit_one_appending_deferred_l
|
|---|
| 560 | define def_inherit_one_appending_deferred_r
|
|---|
| 561 | ifdef $(src)_$(prop)
|
|---|
| 562 | ifeq ($$(flavor $(trg)_$(prop)),simple)
|
|---|
| 563 | $$(evalcall2 def_simple_2_recursive,$(trg)_$(prop))
|
|---|
| 564 | endif
|
|---|
| 565 | $(trg)_$(prop) <= $$($(src)_$(prop))
|
|---|
| 566 | endif
|
|---|
| 567 | endef
|
|---|
| 568 |
|
|---|
| 569 |
|
|---|
| 570 | ## combines the specified properties $(1) with the $(_KEYWORDS) list.
|
|---|
| 571 | _INHERIT_JOIN_KEYWORDS = $(1) $(foreach keyword,$(_KEYWORDS), $(addsuffix .$(keyword), $(1)))
|
|---|
| 572 |
|
|---|
| 573 |
|
|---|
| 574 | ## Generic inheritance for use with targets templates and tools.
|
|---|
| 575 | # @param trg Object to consider for inheriting.
|
|---|
| 576 | # @param src_prefix What to prefix the value found in EXTENDS with to get the object.
|
|---|
| 577 | # @param load_function Load function for stuff that needs
|
|---|
| 578 | # @param properties List of the properties with straight expansion.
|
|---|
| 579 | # @param properties_now_l List of the properties with immediate expansion, accumulating on the left side.
|
|---|
| 580 | # @param properties_now_r List of the properties with immediate expansion, accumulating on the right side.
|
|---|
| 581 | # @param properties_deferred List of the properties with deferred expansion (e.g. function), non-accumulative .
|
|---|
| 582 | # @param properties_deferred_l List of the properties with deferred expansion (e.g. function), accumulating on the left side.
|
|---|
| 583 | # @param properties_deferred_r List of the properties with deferred expansion (e.g. function), accumulating on the right side.
|
|---|
| 584 | define def_inherit
|
|---|
| 585 |
|
|---|
| 586 | # Load it - loading is a mess, fix.
|
|---|
| 587 | ifneq ($(load_function),)
|
|---|
| 588 | local loading := $(patsubst $(src_prefix)%,%,$(trg))
|
|---|
| 589 | $(evalvalctx $(load_function))
|
|---|
| 590 | endif
|
|---|
| 591 |
|
|---|
| 592 | local src := $(strip $($(trg)_EXTENDS))
|
|---|
| 593 | ifneq ($(src),)
|
|---|
| 594 | ifndef $(trg)_EXTENDS_STATUS_
|
|---|
| 595 | $(trg)_EXTENDS_STATUS_ := 0
|
|---|
| 596 |
|
|---|
| 597 | # Load the source.
|
|---|
| 598 | ifneq ($(load_function),)
|
|---|
| 599 | local loading := $(src)
|
|---|
| 600 | $(evalvalctx $(load_function))
|
|---|
| 601 | endif
|
|---|
| 602 |
|
|---|
| 603 | # less typing.
|
|---|
| 604 | local src := $(src_prefix)$(src)
|
|---|
| 605 |
|
|---|
| 606 | # Recursivly process the parent (src) if it's inherting from somebody too.
|
|---|
| 607 | ifdef $(src)_EXTENDS
|
|---|
| 608 | ifneq ($($(src)_EXTENDS_STATUS_),42)
|
|---|
| 609 | # 'foreach' will create 'trg' in a new variable context hiding
|
|---|
| 610 | # out current variable. 'src' OTOH will be overwritten.
|
|---|
| 611 | $(foreach trg, $(src), $(evalval def_inherit))
|
|---|
| 612 | local src := $(src_prefix)$(strip $($(trg)_EXTENDS))
|
|---|
| 613 | endif
|
|---|
| 614 | endif
|
|---|
| 615 |
|
|---|
| 616 | # Get & check EXTENDS_BY.
|
|---|
| 617 | local by = $(strip $($(trg)_EXTENDS_BY))
|
|---|
| 618 | ifeq ($(by),)
|
|---|
| 619 | local by = overriding
|
|---|
| 620 | else ifn1of ($(by), overriding appending prepending)
|
|---|
| 621 | $(error kBuild: Invalid EXTENDS_BY value '$(by)' on '$(trg)'!)
|
|---|
| 622 | endif
|
|---|
| 623 |
|
|---|
| 624 | # Inherit the properties.
|
|---|
| 625 | $(foreach prop, $(call _INHERIT_JOIN_KEYWORDS,$(properties)), $(eval $(def_inherit_one)))
|
|---|
| 626 | $(foreach prop, $(call _INHERIT_JOIN_KEYWORDS,$(properties_now_l)), $(eval $(def_inherit_one_$(by)_now_l)))
|
|---|
| 627 | $(foreach prop, $(call _INHERIT_JOIN_KEYWORDS,$(properties_now_r)), $(eval $(def_inherit_one_$(by)_now_r)))
|
|---|
| 628 | $(foreach prop, $(call _INHERIT_JOIN_KEYWORDS,$(properties_deferred)), $(eval $(def_inherit_one_$(by)_deferred)))
|
|---|
| 629 | $(foreach prop, $(call _INHERIT_JOIN_KEYWORDS,$(properties_deferred_l)), $(eval $(def_inherit_one_$(by)_deferred_l)))
|
|---|
| 630 | $(foreach prop, $(call _INHERIT_JOIN_KEYWORDS,$(properties_deferred_r)), $(eval $(def_inherit_one_$(by)_deferred_r)))
|
|---|
| 631 |
|
|---|
| 632 | # Mark the target as done.
|
|---|
| 633 | $(trg)_EXTENDS_STATUS_ := 42
|
|---|
| 634 | else
|
|---|
| 635 | # Check for inheritance loops.
|
|---|
| 636 | ifneq ($($(trg)_EXTENDS_STATUS_),42)
|
|---|
| 637 | $(error kBuild: Target inheritance loop! target=$(trg) $(trg)_EXTENDS_STATUS_=$($(trg)_EXTENDS_STATUS_))
|
|---|
| 638 | endif
|
|---|
| 639 | endif
|
|---|
| 640 | endif
|
|---|
| 641 |
|
|---|
| 642 | # Keyword inheritance.
|
|---|
| 643 | $(foreach prefix_keyword, $(join $(_KEYWORDS_PREFIX), $(addprefix :,$(_KEYWORDS_EXTENDS))), $(evalval def_inherit_keyword))
|
|---|
| 644 |
|
|---|
| 645 | endef # def_inherit
|
|---|
| 646 |
|
|---|
| 647 |
|
|---|
| 648 | #
|
|---|
| 649 | # Load global units before doing any inheriting so they can add new properties.
|
|---|
| 650 | #
|
|---|
| 651 | # This only applies to the guys listed in the global USES since there is
|
|---|
| 652 | # no reliable way to deal with things on a target level without first
|
|---|
| 653 | # applying templates. So, to avoid having USES mess up all targets,
|
|---|
| 654 | # we'll make the global and per-target USES property work differently:
|
|---|
| 655 | # The global USES does not apply to targets, just globally.
|
|---|
| 656 | #
|
|---|
| 657 |
|
|---|
| 658 | ## Unit load function.
|
|---|
| 659 | # @param loading The unit name
|
|---|
| 660 | define def_unit_load_function
|
|---|
| 661 | ifndef UNIT_$(loading)
|
|---|
| 662 | UNIT_$(loading)_KMK_FILE := $(firstword $(foreach path, $(KBUILD_UNIT_PATHS) $(KBUILD_PATH)/units $(KBUILD_DEFAULT_PATHS), $(wildcard $(path)/$(loading).kmk)))
|
|---|
| 663 | ifeq ($(UNIT_$(loading)_KMK_FILE),)
|
|---|
| 664 | $(error kBuild: Cannot find include file for the unit '$(loading)'! Searched: $(KBUILD_UNIT_PATHS) $(KBUILD_PATH)/units $(KBUILD_DEFAULT_PATHS))
|
|---|
| 665 | endif
|
|---|
| 666 | include $(UNIT_$(loading)_KMK_FILE)
|
|---|
| 667 | ifndef UNIT_$(loading)
|
|---|
| 668 | $(warning kBuild: UNIT_$(loading) was not defined by $(UNIT_$(loading)_KMK_FILE)!)
|
|---|
| 669 | endif
|
|---|
| 670 | endif
|
|---|
| 671 | endef # def_unit_load_function
|
|---|
| 672 |
|
|---|
| 673 | $(foreach loading, \
|
|---|
| 674 | $(USES.$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)) \
|
|---|
| 675 | $(USES.$(KBUILD_TARGET_CPU)) \
|
|---|
| 676 | $(USES.$(KBUILD_TARGET_ARCH)) \
|
|---|
| 677 | $(USES.$(KBUILD_TARGET)) \
|
|---|
| 678 | $(USES.$(KBUILD_HOST).$(KBUILD_HOST_ARCH)) \
|
|---|
| 679 | $(USES.$(KBUILD_HOST_CPU)) \
|
|---|
| 680 | $(USES.$(KBUILD_HOST_ARCH)) \
|
|---|
| 681 | $(USES.$(KBUILD_TARGET)) \
|
|---|
| 682 | $(USES.$(KBUILD_TYPE)) \
|
|---|
| 683 | $(USES),$(evalval def_unit_load_function))
|
|---|
| 684 |
|
|---|
| 685 |
|
|---|
| 686 | #
|
|---|
| 687 | # Determin all the templates that is being used and make
|
|---|
| 688 | # sure they are present before we try collect keywords.
|
|---|
| 689 | #
|
|---|
| 690 | _TEMPLATES := $(TEMPLATE)
|
|---|
| 691 | define def_templates
|
|---|
| 692 | ifdef $(target)_TEMPLATE
|
|---|
| 693 | ifneq ("$($(target)_TEMPLATE)","$(strip $($(target)_TEMPLATE))")
|
|---|
| 694 | $$(error kBuild: The template name of target '$(target)' contains tabs ($($(target)_TEMPLATE))). Please remove them)
|
|---|
| 695 | endif
|
|---|
| 696 | _TEMPLATES += $($(target)_TEMPLATE)
|
|---|
| 697 | endif
|
|---|
| 698 | endef # def_templates
|
|---|
| 699 | $(foreach target, $(_ALL_TARGETS), $(eval $(def_templates)))
|
|---|
| 700 | _TEMPLATES := $(sort $(_TEMPLATES))
|
|---|
| 701 |
|
|---|
| 702 | ## Template load function.
|
|---|
| 703 | # @param loading The template name. This is prefixed.
|
|---|
| 704 | define def_templates_load_function
|
|---|
| 705 | ifndef TEMPLATE_$(loading)
|
|---|
| 706 | TEMPLATE_$(loading)_KMK_FILE := $(firstword $(foreach path, $(KBUILD_TEMPLATE_PATHS) $(KBUILD_PATH)/templates $(KBUILD_DEFAULT_PATHS), $(wildcard $(path)/$(loading).kmk)))
|
|---|
| 707 | ifeq ($(TEMPLATE_$(loading)_KMK_FILE),)
|
|---|
| 708 | $(error kBuild: Cannot find include file for the template '$(loading)'! Searched: $(KBUILD_TEMPLATE_PATHS) $(KBUILD_PATH)/templates $(KBUILD_DEFAULT_PATHS))
|
|---|
| 709 | endif
|
|---|
| 710 | include $(TEMPLATE_$(loading)_KMK_FILE)
|
|---|
| 711 | ifndef TEMPLATE_$(loading)
|
|---|
| 712 | $(warning kBuild: TEMPLATE_$(loading) was not defined by $(TEMPLATE_$(loading)_KMK_FILE)!)
|
|---|
| 713 | endif
|
|---|
| 714 | endif
|
|---|
| 715 | endef # def_templates_load_function
|
|---|
| 716 | $(foreach loading, $(_TEMPLATES), $(evalval def_templates_load_function))
|
|---|
| 717 |
|
|---|
| 718 |
|
|---|
| 719 | #
|
|---|
| 720 | # Determin the keywords required for correct inherting and setup keyword inheritance.
|
|---|
| 721 | #
|
|---|
| 722 | # This means walking all the lists of immediate template and targets and
|
|---|
| 723 | # pick up all the BLD_T* keywords. Since templates that are referenced
|
|---|
| 724 | # indirectly in the inheritance hierarchy, the result from this exercise
|
|---|
| 725 | # might not be 100% accurate... :-/
|
|---|
| 726 | #
|
|---|
| 727 | _BLD_TYPES := $(KBUILD_TYPE)
|
|---|
| 728 | _BLD_TARGETS := $(KBUILD_TARGET) $(KBUILD_HOSTS)
|
|---|
| 729 | _BLD_ARCHES := $(KBUILD_TARGET_ARCH) $(KBUILD_HOST_ARCH)
|
|---|
| 730 | _BLD_CPUS := $(KBUILD_TARGET_CPU) $(KBUILD_HOST_CPU)
|
|---|
| 731 |
|
|---|
| 732 | define def_collect_bld_xyz
|
|---|
| 733 | ifdef $(src)_BLD_TYPE
|
|---|
| 734 | ifn1of ($($(src)_BLD_TYPE), $(KBUILD_BLD_TYPES))
|
|---|
| 735 | $(error kBuild: $(src)_BLD_TYPE=$($(src)_BLD_TYPE) not in KBUILD_BLD_TYPES={$(KBUILD_BLD_TYPES)}!)
|
|---|
| 736 | endif
|
|---|
| 737 | _BLD_TYPES += $($(src)_BLD_TYPE)
|
|---|
| 738 | endif
|
|---|
| 739 | ifdef $(src)_BLD_TRG
|
|---|
| 740 | ifn1of ($($(src)_BLD_TRG), $(KBUILD_OSES))
|
|---|
| 741 | $(error kBuild: $(src)_BLD_TRG=$($(src)_BLD_TRG) not in KBUILD_OSES={$(KBUILD_OSES)}!)
|
|---|
| 742 | endif
|
|---|
| 743 | _BLD_TARGETS += $($(src)_BLD_TRG)
|
|---|
| 744 | endif
|
|---|
| 745 | ifdef $(src)_BLD_TRG_ARCH
|
|---|
| 746 | ifn1of ($($(src)_BLD_TRG_ARCH), $(KBUILD_ARCHES))
|
|---|
| 747 | $(error kBuild: $(src)_BLD_TRG_ARCH=$($(src)_BLD_TRG_ARCH) not in KBUILD_ARCHES={$(KBUILD_ARCHES)}!)
|
|---|
| 748 | endif
|
|---|
| 749 | _BLD_ARCHES += $($(src)_BLD_TRG_ARCH)
|
|---|
| 750 | endif
|
|---|
| 751 | ifdef $(src)_BLD_TRG_CPU
|
|---|
| 752 | if1of ($($(src)_BLD_CPU), $(KBUILD_ARCHES) $(KBUILD_OSES) $(KBUILD_BLD_TYPES))
|
|---|
| 753 | $(error kBuild: $(src)_BLD_TRG_CPU=$($(src)_BLD_TRG_CPU) found in KBUILD_ARCHES, KBUILD_OSES or KBUILD_BLD_TYPES!)
|
|---|
| 754 | endif
|
|---|
| 755 | _BLD_CPUS += $($(src)_BLD_TRG_CPU)
|
|---|
| 756 | endif
|
|---|
| 757 | endef # def_collect_bld_xyz
|
|---|
| 758 | $(foreach src, $(addprefix TEMPLATE_, $(_TEMPLATES)) $(_ALL_TARGETS) \
|
|---|
| 759 | ,$(evalval def_collect_bld_xyz))
|
|---|
| 760 |
|
|---|
| 761 | # Drop duplicate values.
|
|---|
| 762 | # WARNING! These list might not include keywords only involved in inheritance.
|
|---|
| 763 | _BLD_TYPES := $(sort $(_BLD_TYPES))
|
|---|
| 764 | _BLD_TARGETS := $(sort $(_BLD_TARGETS))
|
|---|
| 765 | _BLD_ARCHES := $(sort $(_BLD_ARCHES))
|
|---|
| 766 | _BLD_CPUS := $(sort $(_BLD_CPUS))
|
|---|
| 767 |
|
|---|
| 768 | ## Look for keywords which extends others and order them.
|
|---|
| 769 | # @param keyword
|
|---|
| 770 | # @param prefix
|
|---|
| 771 | # @param valid
|
|---|
| 772 | define def_keyword_ordering
|
|---|
| 773 | # Check for EXTENDS, fix and validate it if found.
|
|---|
| 774 | local src := $(strip $($(prefix)_$(keyword)_EXTENDS))
|
|---|
| 775 | ifneq ($(src),)
|
|---|
| 776 | ifndef $(prefix)_$(keyword)_EXTENDS_STATUS_
|
|---|
| 777 | ifn1of ($(src), $(valid))
|
|---|
| 778 | $(error kBuild: $(keyword) tries to extend unknown keyword '$(src)'! (known = $(valid)))
|
|---|
| 779 | endif
|
|---|
| 780 |
|
|---|
| 781 | # Recursivly process the parent (src).
|
|---|
| 782 | ifneq ($($(prefix)_$(src)_EXTENDS_STATUS_),42)
|
|---|
| 783 | $(prefix)_$(keyword)_EXTENDS_STATUS_ := 0
|
|---|
| 784 | # 'foreach' will create 'keyword' in a new variable context hiding
|
|---|
| 785 | # out current variable. 'src' OTOH will be overwritten.
|
|---|
| 786 | $(foreach keyword, $(src), $(evalval def_keyword_ordering))
|
|---|
| 787 | local src := $(strip $($(prefix)_$(keyword)_EXTENDS))
|
|---|
| 788 | endif
|
|---|
| 789 |
|
|---|
| 790 | # Check and strip EXTENDS_BY.
|
|---|
| 791 | local by = $(strip $($(prefix)_$(keyword)_EXTENDS_BY))
|
|---|
| 792 | ifeq ($(by),)
|
|---|
| 793 | local by = overriding
|
|---|
| 794 | else ifn1of ($(by), overriding appending prepending)
|
|---|
| 795 | $(error kBuild: Invalid EXTENDS_BY value '$(by)' on '$(keyword)'!)
|
|---|
| 796 | endif
|
|---|
| 797 |
|
|---|
| 798 | # Update the attributes with stripped
|
|---|
| 799 | $(prefix)_$(keyword)_EXTENDS_BY := $(by)
|
|---|
| 800 | $(prefix)_$(keyword)_EXTENDS := $(src)
|
|---|
| 801 |
|
|---|
| 802 | # Add it to the list and mark it as done.
|
|---|
| 803 | _KEYWORDS_EXTENDS += $(keyword)
|
|---|
| 804 | _KEYWORDS_PREFIX += $(prefix)
|
|---|
| 805 | $(prefix)_$(keyword)_EXTENDS_STATUS_ := 42
|
|---|
| 806 | else
|
|---|
| 807 | # Check for inheritance loops.
|
|---|
| 808 | ifneq ($($(trg)_EXTENDS_STATUS_),42)
|
|---|
| 809 | $(error kBuild: Keyword inheritance loop! keyword=$(keyword) $(prefix)_$(keyword)_EXTENDS_STATUS_=$($(prefix)_$(keyword)_EXTENDS_STATUS_))
|
|---|
| 810 | endif
|
|---|
| 811 | endif
|
|---|
| 812 | else
|
|---|
| 813 | # Add it to the ordered list and mark it as done.
|
|---|
| 814 | _KEYWORDS_ORDERED += $(keyword)
|
|---|
| 815 | $(prefix)_$(src)_EXTENDS_STATUS_ := 42
|
|---|
| 816 | endif
|
|---|
| 817 | endef # def_keyword_ordering
|
|---|
| 818 | $(eval-opt-var def_keyword_ordering)
|
|---|
| 819 |
|
|---|
| 820 | # Look for keywords which extends others and their parents, and from this
|
|---|
| 821 | # construct two lists.
|
|---|
| 822 | _KEYWORDS_ORDERED :=
|
|---|
| 823 | _KEYWORDS_EXTENDS :=
|
|---|
| 824 | _KEYWORDS_PREFIX :=
|
|---|
| 825 |
|
|---|
| 826 | prefix := BLD_TYPE
|
|---|
| 827 | valid := $(KBUILD_BLD_TYPES)
|
|---|
| 828 | $(foreach keyword, $(_BLD_TYPES) , $(evalval def_keyword_ordering))
|
|---|
| 829 |
|
|---|
| 830 | prefix := BLD_TRG
|
|---|
| 831 | valid := $(KBUILD_OSES)
|
|---|
| 832 | $(foreach keyword, $(_BLD_TARGETS), $(evalval def_keyword_ordering))
|
|---|
| 833 |
|
|---|
| 834 | prefix := BLD_ARCH
|
|---|
| 835 | valid := $(KBUILD_ARCHES)
|
|---|
| 836 | $(foreach keyword, $(_BLD_ARCHES) , $(evalval def_keyword_ordering))
|
|---|
| 837 |
|
|---|
| 838 | prefix := BLD_CPU
|
|---|
| 839 | valid := $(KBUILD_CPUS)
|
|---|
| 840 | $(foreach keyword, $(_BLD_CPUS) , $(evalval def_keyword_ordering))
|
|---|
| 841 |
|
|---|
| 842 | ## @todo Inherit bld_trg.bld_arch for too?
|
|---|
| 843 |
|
|---|
| 844 | # Construct all the possible keywords.
|
|---|
| 845 | _KEYWORDS := $(_KEYWORDS_ORDERED) $(_KEYWORDS_EXTENDS) \
|
|---|
| 846 | $(foreach bld_trg,$(_BLD_TARGETS),$(addprefix $(bld_trg).,$(_BLD_ARCHES)))
|
|---|
| 847 |
|
|---|
| 848 | ifdef KBUILD_PROFILE_SELF
|
|---|
| 849 | $(evalcall def_profile_self, done keywords)
|
|---|
| 850 | endif
|
|---|
| 851 |
|
|---|
| 852 |
|
|---|
| 853 | #
|
|---|
| 854 | # Target inheritance.
|
|---|
| 855 | #
|
|---|
| 856 | # This has to be done on a per target list basis as to avoid adding
|
|---|
| 857 | # incorrect properties that will wast memory, time, and may confuse
|
|---|
| 858 | # later strictness checks. This also has to be done *before* templates
|
|---|
| 859 | # are applied to the targets. Since we're doing that part rather
|
|---|
| 860 | # early on, the target inheritance feature is a bit restricted at
|
|---|
| 861 | # the moment. However, this will be addressed in a little(?) while.
|
|---|
| 862 | #
|
|---|
| 863 |
|
|---|
| 864 | src_prefix :=
|
|---|
| 865 | load_function :=
|
|---|
| 866 | properties_deferred_l :=
|
|---|
| 867 | properties_deferred_r :=
|
|---|
| 868 |
|
|---|
| 869 | # Fetches.
|
|---|
| 870 | properties := $(PROPS_FETCHES_SINGLE)
|
|---|
| 871 | properties_now_l := $(PROPS_FETCHES_ACCUMULATE_L)
|
|---|
| 872 | properties_now_r := $(PROPS_FETCHES_ACCUMULATE_R)
|
|---|
| 873 | properties_deferred := $(PROPS_FETCHES_DEFERRED)
|
|---|
| 874 | $(foreach trg, $(_ALL_FETCHES),$(evalval def_inherit))
|
|---|
| 875 |
|
|---|
| 876 | ## Patches. - not implemented yet.
|
|---|
| 877 | #properties := $(PROPS_PATCHES_SINGLE)
|
|---|
| 878 | #properties_now_l := $(PROPS_PATCHES_ACCUMULATE_L)
|
|---|
| 879 | #properties_now_r := $(PROPS_PATCHES_ACCUMULATE_R)
|
|---|
| 880 | #properties_deferred := $(PROPS_PATCHES_DEFERRED)
|
|---|
| 881 | #$(foreach trg, $(_ALL_PATCHES),$(evalval def_inherit))
|
|---|
| 882 |
|
|---|
| 883 | # Programs and build programs.
|
|---|
| 884 | properties := $(PROPS_PROGRAMS_SINGLE)
|
|---|
| 885 | properties_now_l := $(PROPS_PROGRAMS_ACCUMULATE_L)
|
|---|
| 886 | properties_now_r := $(PROPS_PROGRAMS_ACCUMULATE_R)
|
|---|
| 887 | properties_deferred := $(PROPS_PROGRAMS_DEFERRED)
|
|---|
| 888 | $(foreach trg, $(_ALL_BLDPROGS) $(_ALL_PROGRAMS),$(evalval def_inherit))
|
|---|
| 889 |
|
|---|
| 890 | # Libraries and import libraries.
|
|---|
| 891 | properties := $(PROPS_LIBRARIES_SINGLE)
|
|---|
| 892 | properties_now_l := $(PROPS_LIBRARIES_ACCUMULATE_L)
|
|---|
| 893 | properties_now_r := $(PROPS_LIBRARIES_ACCUMULATE_R)
|
|---|
| 894 | properties_deferred := $(PROPS_LIBRARIES_DEFERRED)
|
|---|
| 895 | if1of ($(KBUILD_TARGET), nt os2 win)
|
|---|
| 896 | $(foreach trg, $(_ALL_LIBRARIES) $(_ALL_IMPORT_LIBS),$(evalval def_inherit))
|
|---|
| 897 | else
|
|---|
| 898 | $(foreach trg, $(_ALL_LIBRARIES),$(evalval def_inherit))
|
|---|
| 899 | endif
|
|---|
| 900 |
|
|---|
| 901 | # DLLs.
|
|---|
| 902 | properties := $(PROPS_DLLS_SINGLE)
|
|---|
| 903 | properties_now_l := $(PROPS_DLLS_ACCUMULATE_L)
|
|---|
| 904 | properties_now_r := $(PROPS_DLLS_ACCUMULATE_R)
|
|---|
| 905 | properties_deferred := $(PROPS_DLLS_DEFERRED)
|
|---|
| 906 | if1of ($(KBUILD_TARGET), nt os2 win)
|
|---|
| 907 | $(foreach trg, $(_ALL_DLLS),$(evalval def_inherit))
|
|---|
| 908 | else
|
|---|
| 909 | $(foreach trg, $(_ALL_DLLS) $(_ALL_IMPORT_LIBS),$(evalval def_inherit))
|
|---|
| 910 | endif
|
|---|
| 911 |
|
|---|
| 912 | # System modules.
|
|---|
| 913 | properties := $(PROPS_SYSMODS_SINGLE)
|
|---|
| 914 | properties_now_l := $(PROPS_SYSMODS_ACCUMULATE_L)
|
|---|
| 915 | properties_now_r := $(PROPS_SYSMODS_ACCUMULATE_R)
|
|---|
| 916 | properties_deferred := $(PROPS_SYSMODS_DEFERRED)
|
|---|
| 917 | $(foreach trg, $(_ALL_SYSMODS),$(evalval def_inherit))
|
|---|
| 918 |
|
|---|
| 919 | # Installs.
|
|---|
| 920 | properties := $(PROPS_INSTALLS_SINGLE)
|
|---|
| 921 | properties_now_l := $(PROPS_INSTALLS_ACCUMULATE_L)
|
|---|
| 922 | properties_now_r := $(PROPS_INSTALLS_ACCUMULATE_R)
|
|---|
| 923 | properties_deferred := $(PROPS_INSTALLS_DEFERRED)
|
|---|
| 924 | $(foreach trg, $(_ALL_INSTALLS),$(evalval def_inherit))
|
|---|
| 925 |
|
|---|
| 926 | ifdef KBUILD_PROFILE_SELF
|
|---|
| 927 | $(evalcall def_profile_self, done target inheritance)
|
|---|
| 928 | endif
|
|---|
| 929 |
|
|---|
| 930 |
|
|---|
| 931 | #
|
|---|
| 932 | # Template Inheritance.
|
|---|
| 933 | #
|
|---|
| 934 | # This is much the same as with target inheritance, except we cannot
|
|---|
| 935 | # restrict the properties involved since we haven't got a clue which
|
|---|
| 936 | # target platforms/archs are using them. But, we can drop the instance
|
|---|
| 937 | # expansion we're doing for targets since there won't be any more
|
|---|
| 938 | # changes to either the source nor the target templates beyond this
|
|---|
| 939 | # exercise.
|
|---|
| 940 | #
|
|---|
| 941 |
|
|---|
| 942 | src_prefix := TEMPLATE_
|
|---|
| 943 | load_function := def_templates_load_function
|
|---|
| 944 | properties :=
|
|---|
| 945 | properties_now_l :=
|
|---|
| 946 | properties_now_r :=
|
|---|
| 947 | properties_deferred := $(PROPS_SINGLE) $(PROPS_DEFERRED)
|
|---|
| 948 | properties_deferred_l := $(PROPS_ACCUMULATE_L)
|
|---|
| 949 | properties_deferred_r := $(PROPS_ACCUMULATE_R)
|
|---|
| 950 | $(foreach trg, $(addprefix TEMPLATE_,$(_TEMPLATES)),$(evalval def_inherit))
|
|---|
| 951 |
|
|---|
| 952 | # done inheriting.
|
|---|
| 953 | src_prefix :=
|
|---|
| 954 | load_function :=
|
|---|
| 955 | properties :=
|
|---|
| 956 | properties_now_l :=
|
|---|
| 957 | properties_now_r :=
|
|---|
| 958 | properties_deferred :=
|
|---|
| 959 | properties_deferred_l :=
|
|---|
| 960 | properties_deferred_r :=
|
|---|
| 961 |
|
|---|
| 962 | ifdef KBUILD_PROFILE_SELF
|
|---|
| 963 | $(evalcall def_profile_self, done template inheritance)
|
|---|
| 964 | endif
|
|---|
| 965 |
|
|---|
| 966 |
|
|---|
| 967 |
|
|---|
| 968 |
|
|---|
| 969 | #
|
|---|
| 970 | # Template/Target Expansion.
|
|---|
| 971 | #
|
|---|
| 972 | # Extend all targets with the values from the template. Doing this up front
|
|---|
| 973 | # allows more generic code and less mess down in the pass 2 target handling.
|
|---|
| 974 | # However it does eat a good deal of memory.
|
|---|
| 975 | #
|
|---|
| 976 |
|
|---|
| 977 | if1of ($(KMK_FEATURES), kb-exp-tmpl)
|
|---|
| 978 | $(kb-exp-tmpl 1,$(_ALL_TARGET_TARGETS),$(KBUILD_TARGET),$(KBUILD_TARGET_ARCH),$(KBUILD_TARGET_CPU),$(KBUILD_TYPE))
|
|---|
| 979 | $(kb-exp-tmpl 1,$(_ALL_HOST_TARGETS),$(KBUILD_HOST),$(KBUILD_HOST_ARCH),$(KBUILD_HOST_CPU),$(KBUILD_TYPE))
|
|---|
| 980 |
|
|---|
| 981 | else # !kb-exp-tmpl
|
|---|
| 982 |
|
|---|
| 983 | ## Inherit one template property in a non-accumulative manner.
|
|---|
| 984 | # @param $(prop) Property name
|
|---|
| 985 | # @param $(target) Target name
|
|---|
| 986 | # @todo fix the precedence order for some properties.
|
|---|
| 987 | define def_inherit_template_one
|
|---|
| 988 | ifdef TEMPLATE_$($(target)_TEMPLATE)_$(prop)
|
|---|
| 989 | ifndef $(target)_$(prop)
|
|---|
| 990 | $(target)_$(prop) := $(TEMPLATE_$($(target)_TEMPLATE)_$(prop))
|
|---|
| 991 | endif
|
|---|
| 992 | endif
|
|---|
| 993 | ifdef TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg)
|
|---|
| 994 | ifndef $(target)_$(prop).$(bld_trg)
|
|---|
| 995 | $(target)_$(prop).$(bld_trg) := $(TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg))
|
|---|
| 996 | endif
|
|---|
| 997 | endif
|
|---|
| 998 | ifdef TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg).$(bld_trg_arch)
|
|---|
| 999 | ifndef $(target)_$(prop).$(bld_trg).$(bld_trg_arch)
|
|---|
| 1000 | $(target)_$(prop).$(bld_trg).$(bld_trg_arch) := $(TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg).$(bld_trg_arch))
|
|---|
| 1001 | endif
|
|---|
| 1002 | endif
|
|---|
| 1003 | ifdef TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg_arch)
|
|---|
| 1004 | ifndef $(target)_$(prop).$(bld_trg_arch)
|
|---|
| 1005 | $(target)_$(prop).$(bld_trg_arch) := $(TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg_arch))
|
|---|
| 1006 | endif
|
|---|
| 1007 | endif
|
|---|
| 1008 | ifdef TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg_cpu)
|
|---|
| 1009 | ifndef $(target)_$(prop).$(bld_trg_cpu)
|
|---|
| 1010 | $(target)_$(prop).$(bld_trg_cpu) := $(TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg_cpu))
|
|---|
| 1011 | endif
|
|---|
| 1012 | endif
|
|---|
| 1013 | endef
|
|---|
| 1014 |
|
|---|
| 1015 | ## Inherit one template property in a non-accumulative manner, deferred expansion.
|
|---|
| 1016 | # @param 1: $(prop) Property name
|
|---|
| 1017 | # @param 2: $(target) Target name
|
|---|
| 1018 | # @todo fix the precedence order for some properties.
|
|---|
| 1019 | # @remark this define relies on double evaluation
|
|---|
| 1020 | define def_inherit_template_one_deferred
|
|---|
| 1021 | ifdef TEMPLATE_$($(target)_TEMPLATE)_$(prop)
|
|---|
| 1022 | ifndef $(target)_$(prop)
|
|---|
| 1023 | $(target)_$(prop) = $$(TEMPLATE_$($(target)_TEMPLATE)_$(prop))
|
|---|
| 1024 | endif
|
|---|
| 1025 | endif
|
|---|
| 1026 | ifdef TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg)
|
|---|
| 1027 | ifndef $(target)_$(prop).$(bld_trg)
|
|---|
| 1028 | $(target)_$(prop).$(bld_trg) = $$(TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg))
|
|---|
| 1029 | endif
|
|---|
| 1030 | endif
|
|---|
| 1031 | ifdef TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg).$(bld_trg_arch)
|
|---|
| 1032 | ifndef $(target)_$(prop).$(bld_trg).$(bld_trg_arch)
|
|---|
| 1033 | $(target)_$(prop).$(bld_trg).$(bld_trg_arch) = $$(TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg).$(bld_trg_arch))
|
|---|
| 1034 | endif
|
|---|
| 1035 | endif
|
|---|
| 1036 | ifdef TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg_arch)
|
|---|
| 1037 | ifndef $(target)_$(prop).$(bld_trg_arch)
|
|---|
| 1038 | $(target)_$(prop).$(bld_trg_arch) = $$(TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg_arch))
|
|---|
| 1039 | endif
|
|---|
| 1040 | endif
|
|---|
| 1041 | ifdef TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg_cpu)
|
|---|
| 1042 | ifndef $(target)_$(prop).$(bld_trg_cpu)
|
|---|
| 1043 | $(target)_$(prop).$(bld_trg_cpu) = $$(TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg_cpu))
|
|---|
| 1044 | endif
|
|---|
| 1045 | endif
|
|---|
| 1046 | endef
|
|---|
| 1047 |
|
|---|
| 1048 | ## Inherit one acculumlative template property where the 'most significant' items are at the left end.
|
|---|
| 1049 | # @param $(prop) Property name
|
|---|
| 1050 | # @param $(target) Target name
|
|---|
| 1051 | define def_inherit_template_one_accumulate_l
|
|---|
| 1052 | ifdef TEMPLATE_$($(target)_TEMPLATE)_$(prop)
|
|---|
| 1053 | ifeq ($$(flavor $(target)_$(prop)),simple)
|
|---|
| 1054 | $$(evalcall2 def_simple_2_recursive,$(target)_$(prop))
|
|---|
| 1055 | endif
|
|---|
| 1056 | $(target)_$(prop) += $$(TEMPLATE_$($(target)_TEMPLATE)_$(prop))
|
|---|
| 1057 | endif
|
|---|
| 1058 | ifdef TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(KBUILD_TYPE)
|
|---|
| 1059 | ifeq ($$(flavor $(target)_$(prop).$(KBUILD_TYPE)),simple)
|
|---|
| 1060 | $$(evalcall2 def_simple_2_recursive,$(target)_$(prop).$(KBUILD_TYPE))
|
|---|
| 1061 | endif
|
|---|
| 1062 | $(target)_$(prop).$(KBUILD_TYPE) += $$(TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(KBUILD_TYPE))
|
|---|
| 1063 | endif
|
|---|
| 1064 | ifdef TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg)
|
|---|
| 1065 | ifeq ($$(flavor $(target)_$(prop).$(bld_trg)),simple)
|
|---|
| 1066 | $$(evalcall2 def_simple_2_recursive,$(target)_$(prop).$(bld_trg))
|
|---|
| 1067 | endif
|
|---|
| 1068 | $(target)_$(prop).$(bld_trg) += $$(TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg))
|
|---|
| 1069 | endif
|
|---|
| 1070 | ifdef TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg).$(bld_trg_arch)
|
|---|
| 1071 | ifeq ($$(flavor $(target)_$(prop).$(bld_trg).$(bld_trg_arch)),simple)
|
|---|
| 1072 | $$(evalcall2 def_simple_2_recursive,$(target)_$(prop).$(bld_trg).$(bld_trg_arch))
|
|---|
| 1073 | endif
|
|---|
| 1074 | $(target)_$(prop).$(bld_trg).$(bld_trg_arch) += $$(TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg).$(bld_trg_arch))
|
|---|
| 1075 | endif
|
|---|
| 1076 | ifdef TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg_cpu)
|
|---|
| 1077 | ifeq ($$(flavor $(target)_$(prop).$(bld_trg_cpu)),simple)
|
|---|
| 1078 | $$(evalcall2 def_simple_2_recursive,$(target)_$(prop).$(bld_trg_cpu))
|
|---|
| 1079 | endif
|
|---|
| 1080 | $(target)_$(prop).$(bld_trg_cpu) += $$(TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg_cpu))
|
|---|
| 1081 | endif
|
|---|
| 1082 | ifdef TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg_arch)
|
|---|
| 1083 | ifeq ($$(flavor $(target)_$(prop).$(bld_trg_arch)),simple)
|
|---|
| 1084 | $$(evalcall2 def_simple_2_recursive,$(target)_$(prop).$(bld_trg_arch))
|
|---|
| 1085 | endif
|
|---|
| 1086 | $(target)_$(prop).$(bld_trg_arch) += $$(TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg_arch))
|
|---|
| 1087 | endif
|
|---|
| 1088 | endef
|
|---|
| 1089 |
|
|---|
| 1090 | ## Inherit one acculumlative template property where the 'most significant' items are at the right end.
|
|---|
| 1091 | # @param $(prop) Property name
|
|---|
| 1092 | # @param $(target) Target name
|
|---|
| 1093 | define def_inherit_template_one_accumulate_r
|
|---|
| 1094 | ifdef TEMPLATE_$($(target)_TEMPLATE)_$(prop)
|
|---|
| 1095 | ifeq ($$(flavor $(target)_$(prop)),simple)
|
|---|
| 1096 | $$(evalcall2 def_simple_2_recursive,$(target)_$(prop))
|
|---|
| 1097 | endif
|
|---|
| 1098 | $(target)_$(prop) <=$$(TEMPLATE_$($(target)_TEMPLATE)_$(prop))
|
|---|
| 1099 | endif
|
|---|
| 1100 | ifdef TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(KBUILD_TYPE)
|
|---|
| 1101 | ifeq ($$(flavor $(target)_$(prop).$(KBUILD_TYPE)),simple)
|
|---|
| 1102 | $$(evalcall2 def_simple_2_recursive,$(target)_$(prop).$(KBUILD_TYPE))
|
|---|
| 1103 | endif
|
|---|
| 1104 | $(target)_$(prop).$(KBUILD_TYPE) <=$$(TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(KBUILD_TYPE))
|
|---|
| 1105 | endif
|
|---|
| 1106 | ifdef TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg)
|
|---|
| 1107 | ifeq ($$(flavor $(target)_$(prop).$(bld_trg)),simple)
|
|---|
| 1108 | $$(evalcall2 def_simple_2_recursive,$(target)_$(prop).$(bld_trg))
|
|---|
| 1109 | endif
|
|---|
| 1110 | $(target)_$(prop).$(bld_trg) <=$$(TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg))
|
|---|
| 1111 | endif
|
|---|
| 1112 | ifdef TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg).$(bld_trg_arch)
|
|---|
| 1113 | ifeq ($$(flavor $(target)_$(prop).$(bld_trg).$(bld_trg_arch)),simple)
|
|---|
| 1114 | $$(evalcall2 def_simple_2_recursive,$(target)_$(prop).$(bld_trg).$(bld_trg_arch))
|
|---|
| 1115 | endif
|
|---|
| 1116 | $(target)_$(prop).$(bld_trg).$(bld_trg_arch) <=$$(TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg).$(bld_trg_arch))
|
|---|
| 1117 | endif
|
|---|
| 1118 | ifdef TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg_cpu)
|
|---|
| 1119 | ifeq ($$(flavor $(target)_$(prop).$(bld_trg_cpu)),simple)
|
|---|
| 1120 | $$(evalcall2 def_simple_2_recursive,$(target)_$(prop).$(bld_trg_cpu))
|
|---|
| 1121 | endif
|
|---|
| 1122 | $(target)_$(prop).$(bld_trg_cpu) <=$$(TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg_cpu))
|
|---|
| 1123 | endif
|
|---|
| 1124 | ifdef TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg_arch)
|
|---|
| 1125 | ifeq ($$(flavor $(target)_$(prop).$(bld_trg_arch)),simple)
|
|---|
| 1126 | $$(evalcall2 def_simple_2_recursive,$(target)_$(prop).$(bld_trg_arch))
|
|---|
| 1127 | endif
|
|---|
| 1128 | $(target)_$(prop).$(bld_trg_arch) <=$$(TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg_arch))
|
|---|
| 1129 | endif
|
|---|
| 1130 | endef
|
|---|
| 1131 |
|
|---|
| 1132 |
|
|---|
| 1133 | ## Inherit template properties for on target.
|
|---|
| 1134 | # @param $(target) Target name.
|
|---|
| 1135 | define def_inherit_template
|
|---|
| 1136 | # sanity check.
|
|---|
| 1137 | ifdef _$(target)_ALREADY_PROCESSED
|
|---|
| 1138 | $(error kBuild: The target $(target) appears more than once in the target lists! Please correct the makefile(s))
|
|---|
| 1139 | endif
|
|---|
| 1140 | _$(target)_ALREADY_PROCESSED := 1
|
|---|
| 1141 |
|
|---|
| 1142 | # Inherit any default template.
|
|---|
| 1143 | ifdef TEMPLATE
|
|---|
| 1144 | ifeq ($($(target)_TEMPLATE),)
|
|---|
| 1145 | $(eval $(target)_TEMPLATE:=$(TEMPLATE))
|
|---|
| 1146 | endif
|
|---|
| 1147 | endif
|
|---|
| 1148 | # Expand the template if specified.
|
|---|
| 1149 | ifneq ($($(target)_TEMPLATE),)
|
|---|
| 1150 | $(foreach prop,$(PROPS_SINGLE),$(evalval def_inherit_template_one))
|
|---|
| 1151 | $(foreach prop,$(PROPS_DEFERRED),$(eval $(def_inherit_template_one_deferred))) # exploits the 2 evaluation, so no value!
|
|---|
| 1152 | $(foreach prop,$(PROPS_ACCUMULATE_L),$(eval $(def_inherit_template_one_accumulate_l))) # += works fine without value
|
|---|
| 1153 | $(foreach prop,$(PROPS_ACCUMULATE_R),$(eval $(def_inherit_template_one_accumulate_r))) # use <= (kmk addition)
|
|---|
| 1154 | endif
|
|---|
| 1155 | endef
|
|---|
| 1156 | $(eval-opt-var def_inherit_template)
|
|---|
| 1157 |
|
|---|
| 1158 | # Inherit template properties
|
|---|
| 1159 | bld_trg := $(KBUILD_TARGET)
|
|---|
| 1160 | bld_trg_arch := $(KBUILD_TARGET_ARCH)
|
|---|
| 1161 | bld_trg_cpu := $(KBUILD_TARGET_CPU)
|
|---|
| 1162 | $(foreach target, $(_ALL_TARGET_TARGETS),$(evalval def_inherit_template))
|
|---|
| 1163 |
|
|---|
| 1164 | bld_trg := $(KBUILD_HOST)
|
|---|
| 1165 | bld_trg_arch := $(KBUILD_HOST_ARCH)
|
|---|
| 1166 | bld_trg_cpu := $(KBUILD_HOST_CPU)
|
|---|
| 1167 | $(foreach target, $(_ALL_HOST_TARGETS),$(evalval def_inherit_template))
|
|---|
| 1168 |
|
|---|
| 1169 | endif # !kb-exp-tmpl
|
|---|
| 1170 | ifdef KBUILD_PROFILE_SELF
|
|---|
| 1171 | $(evalcall def_profile_self, done template/target expansion)
|
|---|
| 1172 | endif
|
|---|
| 1173 |
|
|---|
| 1174 |
|
|---|
| 1175 | #
|
|---|
| 1176 | # Include tools, sdks and units.
|
|---|
| 1177 | #
|
|---|
| 1178 | # The first part of this exercise is to figure out which TOOLS and SDKS
|
|---|
| 1179 | # that should be included.
|
|---|
| 1180 | #
|
|---|
| 1181 | _TOOLS := $(TOOL.$(KBUILD_TARGET)) $(TOOL.$(KBUILD_TARGET_ARCH)) $(TOOL.$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)) \
|
|---|
| 1182 | $(TOOL.$(KBUILD_HOST)) $(TOOL.$(KBUILD_HOST_ARCH)) $(TOOL.$(KBUILD_HOST).$(KBUILD_HOST_ARCH)) \
|
|---|
| 1183 | $(TOOL)
|
|---|
| 1184 | _SDKS := $(SDKS.$(KBUILD_TARGET)) $(SDKS.$(KBUILD_TARGET_ARCH)) $(SDKS.$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)) \
|
|---|
| 1185 | $(SDKS.$(KBUILD_HOST)) $(SDKS.$(KBUILD_HOST_ARCH)) $(SDKS.$(KBUILD_HOST).$(KBUILD_HOST_ARCH)) \
|
|---|
| 1186 | $(SDKS.$(KBUILD_TYPE)) \
|
|---|
| 1187 | $(SDKS)
|
|---|
| 1188 | _USES := $(USES.$(KBUILD_TARGET)) $(USES.$(KBUILD_TARGET_ARCH)) $(USES.$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)) \
|
|---|
| 1189 | $(USES.$(KBUILD_HOST)) $(USES.$(KBUILD_HOST_ARCH)) $(USES.$(KBUILD_HOST).$(KBUILD_HOST_ARCH)) \
|
|---|
| 1190 | $(USES.$(KBUILD_TYPE)) \
|
|---|
| 1191 | $(USES)
|
|---|
| 1192 | define def_tools_sdks_target_source
|
|---|
| 1193 | $(eval _TOOLS += $(foreach prop, $(PROPS_TOOLS), \
|
|---|
| 1194 | $($(source)_$(prop).$(_bld_trg)) \
|
|---|
| 1195 | $($(target)_$(source)_$(prop).$(_bld_trg)) \
|
|---|
| 1196 | $($(source)_$(prop).$(_bld_trg).$(_bld_trg_arch)) \
|
|---|
| 1197 | $($(target)_$(source)_$(prop).$(_bld_trg).$(_bld_trg_arch)) \
|
|---|
| 1198 | $($(source)_$(prop).$(_bld_trg_arch)) \
|
|---|
| 1199 | $($(target)_$(source)_$(prop).$(_bld_trg_arch)) \
|
|---|
| 1200 | $($(source)_$(prop)) \
|
|---|
| 1201 | $($(target)_$(source)_$(prop))))
|
|---|
| 1202 | $(eval _SDKS += \
|
|---|
| 1203 | $($(source)_SDKS.$(_bld_trg)) \
|
|---|
| 1204 | $($(target)_$(source)_SDKS.$(_bld_trg)) \
|
|---|
| 1205 | $($(source)_SDKS.$(_bld_trg).$(_bld_trg_arch)) \
|
|---|
| 1206 | $($(target)_$(source)_SDKS.$(_bld_trg).$(_bld_trg_arch)) \
|
|---|
| 1207 | $($(source)_SDKS.$(_bld_trg_arch)) \
|
|---|
| 1208 | $($(target)_$(source)_SDKS.$(_bld_trg_arch)) \
|
|---|
| 1209 | $($(source)_SDKS.$(KBUILD_TYPE)) \
|
|---|
| 1210 | $($(target)_$(source)_SDKS.$(KBUILD_TYPE)) \
|
|---|
| 1211 | $($(source)_SDKS) \
|
|---|
| 1212 | $($(target)_$(source)_SDKS))
|
|---|
| 1213 | $(eval _USES += \
|
|---|
| 1214 | $($(source)_USES.$(_bld_trg)) \
|
|---|
| 1215 | $($(target)_$(source)_USES.$(_bld_trg)) \
|
|---|
| 1216 | $($(source)_USES.$(_bld_trg).$(_bld_trg_arch)) \
|
|---|
| 1217 | $($(target)_$(source)_USES.$(_bld_trg).$(_bld_trg_arch)) \
|
|---|
| 1218 | $($(source)_USES.$(_bld_trg_arch)) \
|
|---|
| 1219 | $($(target)_$(source)_USES.$(_bld_trg_arch)) \
|
|---|
| 1220 | $($(source)_USES.$(KBUILD_TYPE)) \
|
|---|
| 1221 | $($(target)_$(source)_USES.$(KBUILD_TYPE)) \
|
|---|
| 1222 | $($(source)_USES) \
|
|---|
| 1223 | $($(target)_$(source)_USES))
|
|---|
| 1224 | endef # def_tools_sdks_target_source
|
|---|
| 1225 | $(eval-opt-var def_tools_sdks_target_source)
|
|---|
| 1226 |
|
|---|
| 1227 | define def_tools_sdks_target
|
|---|
| 1228 | local _bld_type := $(firstword $($(target)_BLD_TYPE) $(KBUILD_TYPE))
|
|---|
| 1229 | local _bld_trg := $(firstword $($(target)_BLD_TRG) $(bld_trg))
|
|---|
| 1230 | local _bld_trg_arch := $(firstword $($(target)_BLD_TRG_ARCH) $(bld_trg_arch))
|
|---|
| 1231 | local _bld_trg_cpu := $(firstword $($(target)_BLD_TRG_CPU) $(bld_trg_cpu))
|
|---|
| 1232 |
|
|---|
| 1233 | $(eval _TOOLS += $(foreach prop, $(PROPS_TOOLS), \
|
|---|
| 1234 | $($(target)_$(prop).$(_bld_trg)) \
|
|---|
| 1235 | $($(target)_$(prop).$(_bld_trg_arch)) \
|
|---|
| 1236 | $($(target)_$(prop).$(_bld_trg).$(_bld_trg_arch)) \
|
|---|
| 1237 | $($(target)_$(prop))))
|
|---|
| 1238 | $(eval _SDKS += \
|
|---|
| 1239 | $($(target)_SDKS.$(_bld_trg)) \
|
|---|
| 1240 | $($(target)_SDKS.$(_bld_trg_arch)) \
|
|---|
| 1241 | $($(target)_SDKS.$(_bld_trg).$(_bld_trg_arch)) \
|
|---|
| 1242 | $($(target)_SDKS))
|
|---|
| 1243 | $(eval _USES += \
|
|---|
| 1244 | $($(target)_USES.$(_bld_trg)) \
|
|---|
| 1245 | $($(target)_USES.$(_bld_trg_arch)) \
|
|---|
| 1246 | $($(target)_USES.$(_bld_trg).$(_bld_trg_arch)) \
|
|---|
| 1247 | $($(target)_USES))
|
|---|
| 1248 | $(foreach source, \
|
|---|
| 1249 | $($(target)_SOURCES.$(_bld_trg)) \
|
|---|
| 1250 | $($(target)_SOURCES.$(_bld_trg_arch)) \
|
|---|
| 1251 | $($(target)_SOURCES.$(_bld_trg).$(_bld_trg_arch)) \
|
|---|
| 1252 | $($(target)_SOURCES.$(_bld_trg_cpu)) \
|
|---|
| 1253 | $($(target)_SOURCES.$(_bld_type)) \
|
|---|
| 1254 | $($(target)_SOURCES) \
|
|---|
| 1255 | , $(evalval def_tools_sdks_target_source))
|
|---|
| 1256 | endef # def_tools_sdks_target
|
|---|
| 1257 | $(eval-opt-var def_tools_sdks_target)
|
|---|
| 1258 |
|
|---|
| 1259 | define def_tools_srcname_target
|
|---|
| 1260 | local _bld_type := $(firstword $($(target)_BLD_TYPE) $(KBUILD_TYPE))
|
|---|
| 1261 | local _bld_trg := $(firstword $($(target)_BLD_TRG) $(bld_trg))
|
|---|
| 1262 | local _bld_trg_arch := $(firstword $($(target)_BLD_TRG_ARCH) $(bld_trg_arch))
|
|---|
| 1263 | local _bld_trg_cpu := $(firstword $($(target)_BLD_TRG_CPU) $(bld_trg_cpu))
|
|---|
| 1264 |
|
|---|
| 1265 | $(foreach source, $(notdir\
|
|---|
| 1266 | $($(target)_SOURCES.$(_bld_trg)) \
|
|---|
| 1267 | $($(target)_SOURCES.$(_bld_trg_arch)) \
|
|---|
| 1268 | $($(target)_SOURCES.$(_bld_trg).$(_bld_trg_arch)) \
|
|---|
| 1269 | $($(target)_SOURCES.$(_bld_trg_cpu)) \
|
|---|
| 1270 | $($(target)_SOURCES.$(_bld_type)) \
|
|---|
| 1271 | $($(target)_SOURCES) \
|
|---|
| 1272 | ), $(evalval def_tools_sdks_target_source))
|
|---|
| 1273 | endef # def_tools_srcname_target
|
|---|
| 1274 | $(eval-opt-var def_tools_srcname_target)
|
|---|
| 1275 |
|
|---|
| 1276 | bld_trg := $(KBUILD_TARGET)
|
|---|
| 1277 | bld_trg_arch := $(KBUILD_TARGET_ARCH)
|
|---|
| 1278 | bld_trg_cpu := $(KBUILD_TARGET_CPU)
|
|---|
| 1279 | $(foreach target, $(_ALL_TARGET_TARGETS), $(evalval def_tools_sdks_target))
|
|---|
| 1280 | $(foreach target, $(_ALL_SRCNAME_TARGETS), $(evalval def_tools_srcname_target))
|
|---|
| 1281 |
|
|---|
| 1282 | bld_trg := $(KBUILD_HOST)
|
|---|
| 1283 | bld_trg_arch := $(KBUILD_HOST_ARCH)
|
|---|
| 1284 | bld_trg_cpu := $(KBUILD_HOST_CPU)
|
|---|
| 1285 | $(foreach target, $(_ALL_HOST_TARGETS), $(evalval def_tools_sdks_target))
|
|---|
| 1286 |
|
|---|
| 1287 | _TOOLS := $(sort $(_TOOLS))
|
|---|
| 1288 | _SDKS := $(sort $(_SDKS))
|
|---|
| 1289 |
|
|---|
| 1290 | ## Tool load function.
|
|---|
| 1291 | # @param loading The tool name
|
|---|
| 1292 | define def_tools_load_function
|
|---|
| 1293 | ifndef TOOL_$(loading)
|
|---|
| 1294 | TOOL_$(loading)_KMK_FILE := $(firstword $(foreach path, $(KBUILD_TOOL_PATHS) $(KBUILD_PATH)/tools $(KBUILD_DEFAULT_PATHS), $(wildcard $(path)/$(loading).kmk)))
|
|---|
| 1295 | ifeq ($(TOOL_$(loading)_KMK_FILE),)
|
|---|
| 1296 | $(error kBuild: Cannot find include file for the tool '$(loading)'! Searched: $(KBUILD_TOOL_PATHS) $(KBUILD_PATH)/tools $(KBUILD_DEFAULT_PATHS))
|
|---|
| 1297 | endif
|
|---|
| 1298 | include $(TOOL_$(loading)_KMK_FILE)
|
|---|
| 1299 | ifndef TOOL_$(loading)
|
|---|
| 1300 | $(warning kBuild: TOOL_$(loading) was not defined by $(TOOL_$(loading)_KMK_FILE)!)
|
|---|
| 1301 | endif
|
|---|
| 1302 | endif
|
|---|
| 1303 | endef # def_tools_include
|
|---|
| 1304 |
|
|---|
| 1305 | ## SDK load function.
|
|---|
| 1306 | # @param loading The tool name
|
|---|
| 1307 | define def_sdk_load_function
|
|---|
| 1308 | ifndef SDK_$(loading)
|
|---|
| 1309 | SDK_$(loading)_KMK_FILE := $(firstword $(foreach path, $(KBUILD_SDK_PATHS) $(KBUILD_PATH)/sdks $(KBUILD_DEFAULT_PATHS), $(wildcard $(path)/$(loading).kmk)))
|
|---|
| 1310 | ifeq ($(SDK_$(loading)_KMK_FILE),)
|
|---|
| 1311 | $(error kBuild: Cannot find include file for the SDK '$(loading)'! Searched: $(KBUILD_SDK_PATHS) $(KBUILD_PATH)/sdks $(KBUILD_DEFAULT_PATHS))
|
|---|
| 1312 | endif
|
|---|
| 1313 | include $(SDK_$(loading)_KMK_FILE)
|
|---|
| 1314 | ifndef SDK_$(loading)
|
|---|
| 1315 | $(warning kBuild: SDK_$(loading) was not defined by $(SDK_$(loading)_KMK_FILE)!)
|
|---|
| 1316 | endif
|
|---|
| 1317 | endif
|
|---|
| 1318 | endef # def_sdk_load_function
|
|---|
| 1319 |
|
|---|
| 1320 |
|
|---|
| 1321 | properties :=
|
|---|
| 1322 | properties_now_l :=
|
|---|
| 1323 | properties_now_r :=
|
|---|
| 1324 | properties_deferred := $(PROPS_SINGLE) $(PROPS_DEFERRED)
|
|---|
| 1325 | properties_deferred_l := $(PROPS_ACCUMULATE_L)
|
|---|
| 1326 | properties_deferred_r := $(PROPS_ACCUMULATE_R)
|
|---|
| 1327 |
|
|---|
| 1328 | src_prefix := TOOL_
|
|---|
| 1329 | load_function := def_tools_load_function
|
|---|
| 1330 | $(foreach trg, $(addprefix TOOL_,$(_TOOLS)), $(evalval def_inherit))
|
|---|
| 1331 |
|
|---|
| 1332 | src_prefix := SDK_
|
|---|
| 1333 | load_function := def_sdk_load_function
|
|---|
| 1334 | $(foreach trg, $(addprefix SDK_,$(_SDKS)), $(evalval def_inherit))
|
|---|
| 1335 |
|
|---|
| 1336 | # done inheriting.
|
|---|
| 1337 | src_prefix :=
|
|---|
| 1338 | load_function :=
|
|---|
| 1339 | properties :=
|
|---|
| 1340 | properties_now_l :=
|
|---|
| 1341 | properties_now_r :=
|
|---|
| 1342 | properties_deferred :=
|
|---|
| 1343 | properties_deferred_l :=
|
|---|
| 1344 | properties_deferred_r :=
|
|---|
| 1345 |
|
|---|
| 1346 | # No inheriting for the uses, they're just global 'code'.
|
|---|
| 1347 | $(foreach loading, $(_USES), $(evalval def_unit_load_function))
|
|---|
| 1348 |
|
|---|
| 1349 |
|
|---|
| 1350 | ifdef KBUILD_PROFILE_SELF
|
|---|
| 1351 | $(evalcall def_profile_self, done tools + sdks + units)
|
|---|
| 1352 | endif
|
|---|
| 1353 |
|
|---|
| 1354 |
|
|---|
| 1355 |
|
|---|
| 1356 | #
|
|---|
| 1357 | #
|
|---|
| 1358 | # Target lists - Pass 1
|
|---|
| 1359 | #
|
|---|
| 1360 | # This pass is for defining variables that might be referenced in
|
|---|
| 1361 | # properties of other targets.
|
|---|
| 1362 | #
|
|---|
| 1363 | #
|
|---|
| 1364 |
|
|---|
| 1365 | # Don't do anything for fetch targets (yet).
|
|---|
| 1366 |
|
|---|
| 1367 | ##
|
|---|
| 1368 | # Link prolog for Pass 1.
|
|---|
| 1369 | #
|
|---|
| 1370 | # @param $(target) Normalized target name.
|
|---|
| 1371 | # @param $(EXT) EXE,DLL,SYS,LIB.
|
|---|
| 1372 | # @param $(EXTPRE) HOST or nothing.
|
|---|
| 1373 | # @param $(definst) The default _INST value.
|
|---|
| 1374 | # @param $(tool_prefix) LD or AR.
|
|---|
| 1375 | # @param $(bld_trg_base_var) TARGET or PLATFORM.
|
|---|
| 1376 | define def_pass1_link_common
|
|---|
| 1377 |
|
|---|
| 1378 | local bld_type := $(firstword $($(target)_BLD_TYPE) $(KBUILD_TYPE))
|
|---|
| 1379 | local bld_trg := $(firstword $($(target)_BLD_TRG) $(BUILD_$(bld_trg_base_var)))
|
|---|
| 1380 | local bld_trg_arch:= $(firstword $($(target)_BLD_TRG_ARCH) $(BUILD_$(bld_trg_base_var)_ARCH))
|
|---|
| 1381 | local bld_trg_cpu := $(firstword $($(target)_BLD_TRG_CPU) $(BUILD_$(bld_trg_base_var)_CPU))
|
|---|
| 1382 |
|
|---|
| 1383 | local tool := $(call _TARGET_TOOL,$(target),$(tool_prefix))
|
|---|
| 1384 | local name := $(firstword\
|
|---|
| 1385 | $($(target)_NAME.$(bld_trg).$(bld_trg_arch))\
|
|---|
| 1386 | $($(target)_NAME.$(bld_trg_arch))\
|
|---|
| 1387 | $($(target)_NAME.$(bld_trg))\
|
|---|
| 1388 | $($(target)_NAME.$(bld_type))\
|
|---|
| 1389 | $($(target)_NAME)\
|
|---|
| 1390 | $(target))
|
|---|
| 1391 | local outbase := $(call TARGET_BASE,$(name),$(target))
|
|---|
| 1392 | ifndef PATH_$(target)
|
|---|
| 1393 | PATH_$(target) := $(patsubst %/,%,$(dir $(outbase)))
|
|---|
| 1394 | else ifneq ($(PATH_$(target)),$(patsubst %/,%,$(dir $(outbase))))
|
|---|
| 1395 | $(error kBuild internal error: PATH_$(target)=$(PATH_$(target)) expected $(patsubst %/,%,$(dir $(outbase))))
|
|---|
| 1396 | endif
|
|---|
| 1397 | ifeq ($(tool_prefix),AR) ## @todo fix this mess!
|
|---|
| 1398 | local suff := $(firstword\
|
|---|
| 1399 | $($(target)_$(EXT)SUFF.$(bld_trg).$(bld_trg_arch))\
|
|---|
| 1400 | $($(target)_$(EXT)SUFF.$(bld_trg))\
|
|---|
| 1401 | $($(target)_$(EXT)SUFF)\
|
|---|
| 1402 | $(TOOL_$(tool)_$(tool_prefix)$(EXT)SUFF.$(bld_trg).$(bld_trg_arch))\
|
|---|
| 1403 | $(TOOL_$(tool)_$(tool_prefix)$(EXT)SUFF.$(bld_trg))\
|
|---|
| 1404 | $(TOOL_$(tool)_$(tool_prefix)$(EXT)SUFF)\
|
|---|
| 1405 | $(SUFF_LIB))
|
|---|
| 1406 | else
|
|---|
| 1407 | local suff := $(firstword \
|
|---|
| 1408 | $($(target)_$(EXT)SUFF) \
|
|---|
| 1409 | $($(target)_$(EXT)SUFF) \
|
|---|
| 1410 | $(TOOL_$(tool)_$(tool_prefix)$(EXT)SUFF) \
|
|---|
| 1411 | $($(EXTPRE)SUFF_$(EXT)))
|
|---|
| 1412 | endif
|
|---|
| 1413 | local out := $(outbase)$(suff)
|
|---|
| 1414 |
|
|---|
| 1415 | # TARGET_*
|
|---|
| 1416 | TARGET_$(target) := $(out)
|
|---|
| 1417 |
|
|---|
| 1418 | # INSTARGET_*
|
|---|
| 1419 | ifeq ($(strip $($(target)_NOINST) $($(target)_NOINST.$(bld_trg)) $($(target)_NOINST.$(bld_trg).$(bld_trg_arch)) $($(target)_NOINST.$(bld_trg).$(bld_trg_arch).$(bld_type)) $($(target)_NOINST.$(bld_trg_arch)) $($(target)_NOINST.$(bld_trg_cpu)) $($(target)_NOINST.$(bld_trg_type))),)
|
|---|
| 1420 | ifneq ($(strip $($(target)_INST.$(bld_trg).$(bld_trg_arch).$(bld_type))),)
|
|---|
| 1421 | local inst := $(addprefix $(PATH_INS)/,$($(target)_INST.$(bld_trg).$(bld_trg_arch).$(bld_type)))
|
|---|
| 1422 | else ifneq ($(strip $($(target)_INST.$(bld_trg).$(bld_trg_arch))),)
|
|---|
| 1423 | local inst := $(addprefix $(PATH_INS)/,$($(target)_INST.$(bld_trg).$(bld_trg_arch)))
|
|---|
| 1424 | else ifneq ($(strip $($(target)_INST.$(bld_trg).$(bld_type))),)
|
|---|
| 1425 | local inst := $(addprefix $(PATH_INS)/,$($(target)_INST.$(bld_trg).$(bld_type)))
|
|---|
| 1426 | else ifneq ($(strip $($(target)_INST.$(bld_trg_arch))),)
|
|---|
| 1427 | local inst := $(addprefix $(PATH_INS)/,$($(target)_INST.$(bld_trg_arch)))
|
|---|
| 1428 | else ifneq ($(strip $($(target)_INST.$(bld_trg))),)
|
|---|
| 1429 | local inst := $(addprefix $(PATH_INS)/,$($(target)_INST.$(bld_trg)))
|
|---|
| 1430 | else ifneq ($(strip $($(target)_INST.$(bld_type))),)
|
|---|
| 1431 | local inst := $(addprefix $(PATH_INS)/,$($(target)_INST.$(bld_type)))
|
|---|
| 1432 | else ifneq ($(strip $($(target)_INST)),)
|
|---|
| 1433 | local inst := $(addprefix $(PATH_INS)/,$($(target)_INST))
|
|---|
| 1434 | else
|
|---|
| 1435 | local inst := $(definst)/
|
|---|
| 1436 | endif
|
|---|
| 1437 | INSTARGET_$(target) := $(patsubst %/,%/$(notdir $(out)),$(inst))
|
|---|
| 1438 |
|
|---|
| 1439 | else # NOINST
|
|---|
| 1440 | INSTARGET_$(target) :=
|
|---|
| 1441 | endif # NOINST
|
|---|
| 1442 |
|
|---|
| 1443 | endef
|
|---|
| 1444 | $(eval-opt-var def_pass1_link_common)
|
|---|
| 1445 |
|
|---|
| 1446 |
|
|---|
| 1447 | #
|
|---|
| 1448 | # BLDPROGS (Pass 1)
|
|---|
| 1449 | #
|
|---|
| 1450 | define def_pass1_bldprog
|
|---|
| 1451 | # set NOINST if not forced installation before doing the usual stuff.
|
|---|
| 1452 | ifndef $(target)_INST
|
|---|
| 1453 | $(target)_NOINST := 1
|
|---|
| 1454 | endif
|
|---|
| 1455 | $(evalval def_pass1_link_common)
|
|---|
| 1456 | endef
|
|---|
| 1457 |
|
|---|
| 1458 | EXT := EXE
|
|---|
| 1459 | EXTPRE := HOST
|
|---|
| 1460 | definst := $(PATH_BIN)
|
|---|
| 1461 | tool_prefix := LD
|
|---|
| 1462 | bld_trg_base_var := PLATFORM
|
|---|
| 1463 | $(foreach target, $(_ALL_BLDPROGS), \
|
|---|
| 1464 | $(evalval def_pass1_bldprog))
|
|---|
| 1465 |
|
|---|
| 1466 |
|
|---|
| 1467 | #
|
|---|
| 1468 | # LIBRARIES (Pass 1)
|
|---|
| 1469 | #
|
|---|
| 1470 | EXT := LIB
|
|---|
| 1471 | EXTPRE :=
|
|---|
| 1472 | definst := $(PATH_LIB)
|
|---|
| 1473 | tool_prefix := AR
|
|---|
| 1474 | bld_trg_base_var := TARGET
|
|---|
| 1475 | $(foreach target, $(_ALL_LIBRARIES), \
|
|---|
| 1476 | $(evalval def_pass1_link_common))
|
|---|
| 1477 |
|
|---|
| 1478 |
|
|---|
| 1479 | #
|
|---|
| 1480 | # DLLS (Pass 1)
|
|---|
| 1481 | #
|
|---|
| 1482 | EXT := DLL
|
|---|
| 1483 | EXTPRE :=
|
|---|
| 1484 | definst := $(PATH_DLL)
|
|---|
| 1485 | tool_prefix := LD
|
|---|
| 1486 | bld_trg_base_var := TARGET
|
|---|
| 1487 | $(foreach target, $(_ALL_DLLS), \
|
|---|
| 1488 | $(evalval def_pass1_link_common))
|
|---|
| 1489 |
|
|---|
| 1490 |
|
|---|
| 1491 | #
|
|---|
| 1492 | # IMPORT LIBRARIES (Pass 1)
|
|---|
| 1493 | #
|
|---|
| 1494 | # - On OS/2 and windows these are libraries.
|
|---|
| 1495 | # - On other platforms they are fake DLLs.
|
|---|
| 1496 | #
|
|---|
| 1497 | if1of ($(KBUILD_TARGET), nt os2 win win64 win32)
|
|---|
| 1498 | EXT := LIB
|
|---|
| 1499 | EXTPRE :=
|
|---|
| 1500 | definst := $(PATH_LIB)
|
|---|
| 1501 | tool_prefix := AR
|
|---|
| 1502 | bld_trg_base_var := TARGET
|
|---|
| 1503 | $(foreach target, $(_ALL_IMPORT_LIBS), \
|
|---|
| 1504 | $(evalval def_pass1_link_common))
|
|---|
| 1505 | else
|
|---|
| 1506 | EXT := DLL
|
|---|
| 1507 | EXTPRE :=
|
|---|
| 1508 | definst := $(PATH_DLL)
|
|---|
| 1509 | tool_prefix := LD
|
|---|
| 1510 | bld_trg_base_var := TARGET
|
|---|
| 1511 | $(foreach target, $(_ALL_IMPORT_LIBS), \
|
|---|
| 1512 | $(evalval def_pass1_link_common))
|
|---|
| 1513 | endif
|
|---|
| 1514 |
|
|---|
| 1515 |
|
|---|
| 1516 | #
|
|---|
| 1517 | # PROGRAMS (Pass 1)
|
|---|
| 1518 | #
|
|---|
| 1519 | EXT := EXE
|
|---|
| 1520 | EXTPRE :=
|
|---|
| 1521 | definst := $(PATH_BIN)
|
|---|
| 1522 | tool_prefix := LD
|
|---|
| 1523 | bld_trg_base_var := TARGET
|
|---|
| 1524 | $(foreach target, $(_ALL_PROGRAMS), \
|
|---|
| 1525 | $(evalval def_pass1_link_common))
|
|---|
| 1526 |
|
|---|
| 1527 |
|
|---|
| 1528 | #
|
|---|
| 1529 | # SYSMODS (Pass 1)
|
|---|
| 1530 | #
|
|---|
| 1531 | EXT := SYS
|
|---|
| 1532 | EXTPRE :=
|
|---|
| 1533 | definst := $(PATH_SYS)
|
|---|
| 1534 | tool_prefix := LD
|
|---|
| 1535 | bld_trg_base_var := TARGET
|
|---|
| 1536 | $(foreach target, $(_ALL_SYSMODS), \
|
|---|
| 1537 | $(evalval def_pass1_link_common))
|
|---|
| 1538 |
|
|---|
| 1539 |
|
|---|
| 1540 | #
|
|---|
| 1541 | # INSTALLS (Pass 1)
|
|---|
| 1542 | # Note! INSTARGET_* for INSTALLS aren't available until later.
|
|---|
| 1543 | #
|
|---|
| 1544 | define def_pass1_install
|
|---|
| 1545 | local bld_type := $(firstword $($(target)_BLD_TYPE) $(KBUILD_TYPE))
|
|---|
| 1546 | local bld_trg := $(firstword $($(target)_BLD_TRG) $(KBUILD_TARGET))
|
|---|
| 1547 | local bld_trg_arch:= $(firstword $($(target)_BLD_TRG_ARCH) $(KBUILD_TARGET_ARCH))
|
|---|
| 1548 | local bld_trg_cpu := $(firstword $($(target)_BLD_TRG_CPU) $(KBUILD_TARGET_CPU))
|
|---|
| 1549 | # TARGET_*
|
|---|
| 1550 | TARGET_$(target) := $(PATH_TARGET)/$(target).ins
|
|---|
| 1551 | # INSTARGET_ later.
|
|---|
| 1552 | # PATH_*
|
|---|
| 1553 | local outbase := $(call TARGET_BASE,$(target),$(target))
|
|---|
| 1554 | PATH_$(target) := $(patsubst %/,%,$(dir $(outbase)))
|
|---|
| 1555 | endef # def_pass1_install
|
|---|
| 1556 | $(eval-opt-var def_pass1_install)
|
|---|
| 1557 | $(foreach target, $(_ALL_INSTALLS), \
|
|---|
| 1558 | $(evalval def_pass1_install))
|
|---|
| 1559 |
|
|---|
| 1560 | ifdef KBUILD_PROFILE_SELF
|
|---|
| 1561 | $(evalcall def_profile_self, done pass 1)
|
|---|
| 1562 | endif
|
|---|
| 1563 |
|
|---|
| 1564 |
|
|---|
| 1565 |
|
|---|
| 1566 |
|
|---|
| 1567 | #
|
|---|
| 1568 | #
|
|---|
| 1569 | # Target lists - Pass 2
|
|---|
| 1570 | #
|
|---|
| 1571 | #
|
|---|
| 1572 |
|
|---|
| 1573 |
|
|---|
| 1574 | ## @page pg_fetches Fetching Tools, Sources and Similar.
|
|---|
| 1575 | #
|
|---|
| 1576 | # The targets listed in the the FETCHES target list have the following attributes:
|
|---|
| 1577 | # SOURCES
|
|---|
| 1578 | # INST
|
|---|
| 1579 | # FETCHTOOL
|
|---|
| 1580 | # FETCHFLAGS
|
|---|
| 1581 | # FETCHDIR
|
|---|
| 1582 | # UNPACKTOOL
|
|---|
| 1583 | # UNPACKFLAGS
|
|---|
| 1584 | #
|
|---|
| 1585 | # As usual the target name is an alias for 'creating' the target. Other
|
|---|
| 1586 | # aliases are:
|
|---|
| 1587 | # pass_fetches
|
|---|
| 1588 | # fetch
|
|---|
| 1589 | # unfetch
|
|---|
| 1590 | # download
|
|---|
| 1591 | # unpack
|
|---|
| 1592 | #
|
|---|
| 1593 | # @remark
|
|---|
| 1594 | #
|
|---|
| 1595 | # This is a little bit complex because we must guarantee that if a source file
|
|---|
| 1596 | # changes only sligtly we must refetch it and to a proper unpacking of it. It
|
|---|
| 1597 | # is also a desire that fetched archives and unpacked files can be deleted to
|
|---|
| 1598 | # save space.
|
|---|
| 1599 | #
|
|---|
| 1600 | # Thus, we must be able to cleanup what we've unpacked should any of the
|
|---|
| 1601 | # sources be removed. We do this by maintaining a file listing the files
|
|---|
| 1602 | # and directories that was unpacked. This operation is named 'unfetch'.
|
|---|
| 1603 | #
|
|---|
| 1604 | # We make use of the SIZE and MD5 attributes for each of the sources to
|
|---|
| 1605 | # create a digest that is stored in the primary target file. Subsequent
|
|---|
| 1606 | # runswill compare their digest with it to decide if a refetch is required.
|
|---|
| 1607 | # When a refetch is found necessary, an 'unfetch' is performed first to
|
|---|
| 1608 | # clean out old files and directores. Note even changes in source order
|
|---|
| 1609 | # will cause a refetch due to the way the digest is constructed and
|
|---|
| 1610 | # evaluated.
|
|---|
| 1611 | #
|
|---|
| 1612 | # By not depending directly on the archives (nor on any unpacked files)
|
|---|
| 1613 | # but on a goal made up from the archive name, size and md5, we allow
|
|---|
| 1614 | # the user to delete the archives. Naturally, this means we'll have to
|
|---|
| 1615 | # check and fetch missing archives before attempting to unpack them.
|
|---|
| 1616 | #
|
|---|
| 1617 | # @remark
|
|---|
| 1618 | #
|
|---|
| 1619 | # This feature will *NOT* work correctly with vanilla GNU make becuase
|
|---|
| 1620 | # it makes use of includedep to avoid too many unnecessary files.
|
|---|
| 1621 | #
|
|---|
| 1622 | # @todo
|
|---|
| 1623 | # 1. Download corruption / continuation.
|
|---|
| 1624 | # 2. It's quite possible that there is one too many indirect dependency now...
|
|---|
| 1625 | #
|
|---|
| 1626 |
|
|---|
| 1627 | ## generates the fetch rule
|
|---|
| 1628 | define def_fetch_src_fetch_rule
|
|---|
| 1629 | # Indirect goal for downloading something.
|
|---|
| 1630 | .PRECIOUS: $(out)
|
|---|
| 1631 | $(out) + $($(target)_$(srcname)_FETCH_OUTPUT_) +| $($(target)_$(srcname)_FETCH_OUTPUT_MAYBE_) : \
|
|---|
| 1632 | | $($(target)_$(srcname)_FETCH_DEPORD_)
|
|---|
| 1633 | %$$(call MSG_FETCH_DL,$(target),$(source),$(out))
|
|---|
| 1634 | @## @todo do fancy stuff like download continuation.
|
|---|
| 1635 | $$(QUIET)$$(RM) -f -- $(out)
|
|---|
| 1636 | $($(target)_$(srcname)_FETCH_CMDS_)
|
|---|
| 1637 | $$(QUIET)$(if $(md5),$$(MD5SUM_EXT) -b -C $(md5) $(out))
|
|---|
| 1638 |
|
|---|
| 1639 |
|
|---|
| 1640 |
|
|---|
| 1641 | # Intermediate goal for making sure the md5 and size matches. it will (re) fetch the archive if necessary.
|
|---|
| 1642 | $(out).checked_$(md5)_$(size): $($(target)_$(srcname)_FETCH_DEPEND_) | $($(target)_$(srcname)_FETCH_DEPORD_)
|
|---|
| 1643 | %$$(call MSG_FETCH_CHK,$(target),$(source),$(out))
|
|---|
| 1644 | $$(QUIET)$$(RM) -f -- $$@
|
|---|
| 1645 | @# (re)fetch the file if it doesn't exist or if it doesn't matches the md5.
|
|---|
| 1646 | @## @todo do fancy stuff like download continuation.
|
|---|
| 1647 | $$(QUIET)( test -f $(out) && $(if $(md5),$$(MD5SUM_EXT) -b -C $(md5) $(out), true) ) \
|
|---|
| 1648 | || ( $$(RM_EXT) -f $(out) \
|
|---|
| 1649 | && $$(MAKE) $(out) -f $(MAKEFILE) --no-print-directory )
|
|---|
| 1650 | $$(QUIET2)$$(APPEND) $$@
|
|---|
| 1651 |
|
|---|
| 1652 | _TARGET_$(target)_FETCHED += $(out) $(out).checked_$(md5)_$(size)
|
|---|
| 1653 |
|
|---|
| 1654 | # Just a little precaution.
|
|---|
| 1655 | .NOTPARALLEL: $(out) $(out).checked_$(md5)_$(size)
|
|---|
| 1656 |
|
|---|
| 1657 | endef # def_fetch_src_fetch_rule
|
|---|
| 1658 | $(eval-opt-var def_fetch_src_fetch_rule)
|
|---|
| 1659 |
|
|---|
| 1660 | ## generates the unpack rule
|
|---|
| 1661 | define def_fetch_src_unpack_rule
|
|---|
| 1662 | # This is the unpack rule. it has an order-only dependency on the download check.
|
|---|
| 1663 | $(out) + $($(target)_$(srcname)_UNPACK_OUTPUT_) +| $($(target)_$(srcname)_UNPACK_OUTPUT_MAYBE_) : \
|
|---|
| 1664 | $($(target)_$(srcname)_UNPACK_DEPEND_) \
|
|---|
| 1665 | | $($(target)_$(srcname)_UNPACK_DEPORD_) $(archive).checked_$(md5)_$(size)
|
|---|
| 1666 | %$$(call MSG_FETCH_UP,$(target),$(archive),$(inst))
|
|---|
| 1667 | $$(QUIET)$$(RM) -f -- $(out)
|
|---|
| 1668 | @# if the source archive doesn't exist fetch it (can have been deleted to save space).
|
|---|
| 1669 | $$(QUIET)test -f $(archive) \
|
|---|
| 1670 | || ( $$(RM_EXT) -f $(archive).checked_$(md5)_$(size) \
|
|---|
| 1671 | && $$(MAKE) $(archive).checked_$(md5)_$(size) -f $(MAKEFILE) --no-print-directory )
|
|---|
| 1672 | $($(target)_$(srcname)_UNPACK_CMDS_)
|
|---|
| 1673 | $$(QUIET2)$$(APPEND) $(out) $(notdir $(archive).checked_$(md5)_$(size))
|
|---|
| 1674 | $$(QUIET2)$$(APPEND) $(out) $(notdir $(out))
|
|---|
| 1675 |
|
|---|
| 1676 | $(eval _TARGET_$(target)_UNPACKED += $(out))
|
|---|
| 1677 | _TARGET_$(target)_DIGEST := $(_TARGET_$(target)_DIGEST)-$(srcname)_$(md5)_$(size)
|
|---|
| 1678 |
|
|---|
| 1679 | .NOTPARALLEL: $(out)
|
|---|
| 1680 |
|
|---|
| 1681 | endef # def_fetch_src_unpack_rule
|
|---|
| 1682 | $(eval-opt-var def_fetch_src_unpack_rule)
|
|---|
| 1683 |
|
|---|
| 1684 | ## Processes a fetch source
|
|---|
| 1685 | #
|
|---|
| 1686 | define def_fetch_src
|
|---|
| 1687 | #$ (warning dbg: def_fetch_src: source='$(source)' target='$(target)')
|
|---|
| 1688 |
|
|---|
| 1689 | # common
|
|---|
| 1690 | local srcname := $(notdir $(source))
|
|---|
| 1691 | local inst := $(firstword \
|
|---|
| 1692 | $($(target)_$(source)_INST)\
|
|---|
| 1693 | $($(target)_$(srcname)_INST)\
|
|---|
| 1694 | $($(source)_INST)\
|
|---|
| 1695 | $($(srcname)_INST)\
|
|---|
| 1696 | $($(target)_INST)\
|
|---|
| 1697 | )
|
|---|
| 1698 | ifneq ($(patsubst %/,ok,$(inst)),ok)
|
|---|
| 1699 | $(error kBuild: Bad or missing INST property for source '$(source)' in target '$(target)': $(inst))
|
|---|
| 1700 | endif
|
|---|
| 1701 | INSTARGET_$(target)_$(srcname) := $(inst)
|
|---|
| 1702 | local fetchdir := $(firstword \
|
|---|
| 1703 | $($(target)_$(source)_FETCHDIR)\
|
|---|
| 1704 | $($(target)_$(srcname)_FETCHDIR)\
|
|---|
| 1705 | $($(source)_FETCHDIR)\
|
|---|
| 1706 | $($(srcname)_FETCHDIR)\
|
|---|
| 1707 | $($(target)_FETCHDIR)\
|
|---|
| 1708 | $(FETCHDIR)\
|
|---|
| 1709 | $(PATH_TARGET)\
|
|---|
| 1710 | )
|
|---|
| 1711 | local deps := \
|
|---|
| 1712 | $($(target)_$(source)_DEPS)\
|
|---|
| 1713 | $($(target)_$(srcname)_DEPS)\
|
|---|
| 1714 | $($(source)_DEPS)\
|
|---|
| 1715 | $($(srcname)_DEPS)\
|
|---|
| 1716 | $($(target)_DEPS)
|
|---|
| 1717 | local orderdeps := \
|
|---|
| 1718 | $($(target)_$(source)_ORDERDEPS)\
|
|---|
| 1719 | $($(target)_$(srcname)_ORDERDEPS)\
|
|---|
| 1720 | $($(source)_ORDERDEPS)\
|
|---|
| 1721 | $($(srcname)_ORDERDEPS)\
|
|---|
| 1722 | $($(target)_ORDERDEPS)
|
|---|
| 1723 | local md5 := $(firstword \
|
|---|
| 1724 | $($(target)_$(source)_MD5)\
|
|---|
| 1725 | $($(target)_$(srcname)_MD5)\
|
|---|
| 1726 | $($(source)_MD5)\
|
|---|
| 1727 | $($(srcname)_MD5)\
|
|---|
| 1728 | $($(target)_MD5)\
|
|---|
| 1729 | )
|
|---|
| 1730 | local size := $(firstword \
|
|---|
| 1731 | $($(target)_$(source)_SIZE)\
|
|---|
| 1732 | $($(target)_$(srcname)_SIZE)\
|
|---|
| 1733 | $($(source)_SIZE)\
|
|---|
| 1734 | $($(srcname)_SIZE)\
|
|---|
| 1735 | $($(target)_SIZE)\
|
|---|
| 1736 | )
|
|---|
| 1737 | clean_files += \
|
|---|
| 1738 | $($(target)_$(source)_CLEAN)\
|
|---|
| 1739 | $($(target)_$(srcname)_CLEAN)\
|
|---|
| 1740 | $($(source)_CLEAN)\
|
|---|
| 1741 | $($(srcname)_CLEAN)
|
|---|
| 1742 | local dep := # not legal for fetch and unpack tools
|
|---|
| 1743 |
|
|---|
| 1744 |
|
|---|
| 1745 | #
|
|---|
| 1746 | # The fetching.
|
|---|
| 1747 | #
|
|---|
| 1748 | local out := $(fetchdir)/$(srcname)
|
|---|
| 1749 | local archive := $(out)
|
|---|
| 1750 | TARGET_$(target)_$(srcname) := $(out)
|
|---|
| 1751 | local dirdep := $(call DIRDEP,$(fetchdir))
|
|---|
| 1752 | local tool := $(firstword \
|
|---|
| 1753 | $($(target)_$(source)_FETCHTOOL)\
|
|---|
| 1754 | $($(target)_$(srcname)_FETCHTOOL)\
|
|---|
| 1755 | $($(target)_$(source)_TOOL)\
|
|---|
| 1756 | $($(target)_$(srcname)_TOOL)\
|
|---|
| 1757 | $($(source)_FETCHTOOL)\
|
|---|
| 1758 | $($(srcname)_FETCHTOOL)\
|
|---|
| 1759 | $($(source)_TOOL)\
|
|---|
| 1760 | $($(srcname)_TOOL)\
|
|---|
| 1761 | $($(target)_FETCHTOOL)\
|
|---|
| 1762 | $($(target)_TOOL)\
|
|---|
| 1763 | )
|
|---|
| 1764 | local flags :=\
|
|---|
| 1765 | $(TOOL_$(tool)_FETCHFLAGS)\
|
|---|
| 1766 | $(FETCHFLAGS)\
|
|---|
| 1767 | $($(target)_FETCHFLAGS)\
|
|---|
| 1768 | $($(srcname)_FETCHFLAGS)\
|
|---|
| 1769 | $($(source)_FETCHFLAGS)\
|
|---|
| 1770 | $($(target)_$(srcname)_FETCHFLAGS)\
|
|---|
| 1771 | $($(target)_$(source)_FETCHFLAGS)
|
|---|
| 1772 |
|
|---|
| 1773 | #$ (warning dbg: target=$(target) source=$(source) $(srcname)=$(srcname) tool=$(tool) out=$(out) flags=$(flags) dirdep=$(dirdep) fetchdir=$(fetchdir) md5=$(md5) size=$(size))
|
|---|
| 1774 |
|
|---|
| 1775 | ifndef TOOL_$(tool)_FETCH_CMDS
|
|---|
| 1776 | $(warning kBuild: tools: \
|
|---|
| 1777 | 1 $($(target)_$(source)_FETCHTOOL)\
|
|---|
| 1778 | 2 $($(target)_$(srcname)_FETCHTOOL)\
|
|---|
| 1779 | 3 $($(target)_$(source)_TOOL)\
|
|---|
| 1780 | 4 $($(target)_$(srcname)_TOOL)\
|
|---|
| 1781 | 5 $($(source)_FETCHTOOL)\
|
|---|
| 1782 | 6 $($(srcname)_FETCHTOOL)\
|
|---|
| 1783 | 7 $($(source)_TOOL)\
|
|---|
| 1784 | 8 $($(srcname)_TOOL)\
|
|---|
| 1785 | 9 $($(target)_FETCHTOOL)\
|
|---|
| 1786 | 10 $($(target)_TOOL) )
|
|---|
| 1787 | $(error kBuild: TOOL_$(tool)_FETCH_CMDS is not defined. source=$(source) target=$(target) )
|
|---|
| 1788 | endif
|
|---|
| 1789 |
|
|---|
| 1790 | # call the tool
|
|---|
| 1791 | $(target)_$(srcname)_FETCH_CMDS_ := $(TOOL_$(tool)_FETCH_CMDS)
|
|---|
| 1792 | $(target)_$(srcname)_FETCH_OUTPUT_ := $(TOOL_$(tool)_FETCH_OUTPUT)
|
|---|
| 1793 | $(target)_$(srcname)_FETCH_OUTPUT_MAYBE_ := $(TOOL_$(tool)_FETCH_OUTPUT_MAYBE)
|
|---|
| 1794 | $(target)_$(srcname)_FETCH_DEPEND_ := $(TOOL_$(tool)_FETCH_DEPEND) $(deps)
|
|---|
| 1795 | $(target)_$(srcname)_FETCH_DEPORD_ := $(TOOL_$(tool)_FETCH_DEPORD) $(dirdep) $(orderdeps)
|
|---|
| 1796 |
|
|---|
| 1797 | # generate the fetch rule.
|
|---|
| 1798 | $(eval $(def_fetch_src_fetch_rule))
|
|---|
| 1799 |
|
|---|
| 1800 |
|
|---|
| 1801 | #
|
|---|
| 1802 | # The unpacking / installing.
|
|---|
| 1803 | #
|
|---|
| 1804 | local out := $(inst)_kBuild_$(target)_$(srcname)_unpacked.lst
|
|---|
| 1805 | local dirdep := $(call DIRDEP,$(inst))
|
|---|
| 1806 | local tool := $(firstword \
|
|---|
| 1807 | $($(target)_$(source)_UNPACKTOOL)\
|
|---|
| 1808 | $($(target)_$(srcname)_UNPACKTOOL)\
|
|---|
| 1809 | $($(target)_$(source)_TOOL)\
|
|---|
| 1810 | $($(target)_$(srcname)_TOOL)\
|
|---|
| 1811 | $($(source)_UNPACKTOOL)\
|
|---|
| 1812 | $($(srcname)_UNPACKTOOL)\
|
|---|
| 1813 | $($(source)_TOOL)\
|
|---|
| 1814 | $($(srcname)_TOOL)\
|
|---|
| 1815 | $($(target)_UNPACKTOOL)\
|
|---|
| 1816 | $($(target)_TOOL) \
|
|---|
| 1817 | )
|
|---|
| 1818 | ifeq ($(tool),)
|
|---|
| 1819 | local tool := $(toupper $(subst .,,$(suffix $(subst tar.,TAR,$(srcname)))))
|
|---|
| 1820 | $(evalval def_tools_include)
|
|---|
| 1821 | endif
|
|---|
| 1822 | local flags :=\
|
|---|
| 1823 | $(TOOL_$(tool)_UNPACKFLAGS)\
|
|---|
| 1824 | $(UNPACKFLAGS)\
|
|---|
| 1825 | $($(target)_UNPACKFLAGS)\
|
|---|
| 1826 | $($(srcname)_UNPACKFLAGS)\
|
|---|
| 1827 | $($(source)_UNPACKFLAGS)\
|
|---|
| 1828 | $($(target)_$(srcname)_UNPACKFLAGS)\
|
|---|
| 1829 | $($(target)_$(source)_UNPACKFLAGS)
|
|---|
| 1830 |
|
|---|
| 1831 | #$ (warning dbg: target=$(target) source=$(source) $(srcname)=$(srcname) tool=$(tool) out=$(out) flags=$(flags) dirdep=$(dirdep) inst=$(inst) md5=$(md5) size=$(size))
|
|---|
| 1832 | ifndef TOOL_$(tool)_UNPACK_CMDS
|
|---|
| 1833 | $(warning kBuild: tools: \
|
|---|
| 1834 | 1 $($(target)_$(source)_UNPACKTOOL)\
|
|---|
| 1835 | 2 $($(target)_$(srcname)_UNPACKTOOL)\
|
|---|
| 1836 | 3 $($(target)_$(source)_TOOL)\
|
|---|
| 1837 | 4 $($(target)_$(srcname)_TOOL)\
|
|---|
| 1838 | 5 $($(source)_UNPACKTOOL)\
|
|---|
| 1839 | 6 $($(srcname)_UNPACKTOOL)\
|
|---|
| 1840 | 7 $($(source)_TOOL)\
|
|---|
| 1841 | 8 $($(srcname)_TOOL)\
|
|---|
| 1842 | 9 $($(target)_UNPACKTOOL)\
|
|---|
| 1843 | 10 $($(target)_TOOL) \
|
|---|
| 1844 | 11 $(toupper $(subst tar.,TAR,$(ext $(srcname)))) \
|
|---|
| 1845 | )
|
|---|
| 1846 | $(error kBuild: TOOL_$(tool)_UNPACK_CMDS is not defined. source=$(source) target=$(target) )
|
|---|
| 1847 | endif
|
|---|
| 1848 |
|
|---|
| 1849 | # call the tool
|
|---|
| 1850 | $(target)_$(srcname)_UNPACK_CMDS_ := $(TOOL_$(tool)_UNPACK_CMDS)
|
|---|
| 1851 | $(target)_$(srcname)_UNPACK_OUTPUT_ := $(TOOL_$(tool)_UNPACK_OUTPUT)
|
|---|
| 1852 | $(target)_$(srcname)_UNPACK_OUTPUT_MAYBE_ := $(TOOL_$(tool)_UNPACK_OUTPUT_MAYBE)
|
|---|
| 1853 | $(target)_$(srcname)_UNPACK_DEPEND_ := $(TOOL_$(tool)_UNPACK_DEPEND) $(deps)
|
|---|
| 1854 | $(target)_$(srcname)_UNPACK_DEPORD_ := $(TOOL_$(tool)_UNPACK_DEPORD) $(dirdep) $(orderdeps)
|
|---|
| 1855 |
|
|---|
| 1856 | # generate the fetch rule.
|
|---|
| 1857 | $(eval $(def_fetch_src_unpack_rule))
|
|---|
| 1858 |
|
|---|
| 1859 | _DIRS += $(inst) $(fetchdir)
|
|---|
| 1860 |
|
|---|
| 1861 | endef # def_fetch_src
|
|---|
| 1862 | $(eval-opt-var def_fetch_src)
|
|---|
| 1863 |
|
|---|
| 1864 |
|
|---|
| 1865 | ##
|
|---|
| 1866 | # Define the target level rules for a fetch.
|
|---|
| 1867 | # @param target
|
|---|
| 1868 | # @param out
|
|---|
| 1869 | # @param inst
|
|---|
| 1870 | # @param _TARGET_$(target)_UNPACKED
|
|---|
| 1871 | # @param _TARGET_$(target)_DIGEST
|
|---|
| 1872 | # @param bld_trg
|
|---|
| 1873 | # @param bld_trg_arch
|
|---|
| 1874 | define def_fetch_rules
|
|---|
| 1875 |
|
|---|
| 1876 | $(out).lst: $(_TARGET_$(target)_UNPACKED) | $(call DIRDEP,$(inst))
|
|---|
| 1877 | %$$(call MSG_FETCH_OK,$(target))
|
|---|
| 1878 | $$(QUIET)$$(RM) -f -- $$@ $$@.tmp
|
|---|
| 1879 | $$(QUIET2)$$(APPEND) $$@.tmp '$(notdir $(out))'
|
|---|
| 1880 | $$(QUIET)$(if $(_TARGET_$(target)_UNPACKED),$$(CAT_EXT) $(_TARGET_$(target)_UNPACKED) >> $$@.tmp)
|
|---|
| 1881 | $$(QUIET)$$(MV) -f -- $$@.tmp $$@
|
|---|
| 1882 |
|
|---|
| 1883 | $(out)_unfetched:
|
|---|
| 1884 | %$$(call MSG_UNFETCH,$(target))
|
|---|
| 1885 | $$(QUIET)$$(RM) -f -- $$(addprefix $(inst),$$(shell $$(CAT_EXT) $(out).lst 2> /dev/null | $$(SED) -e '/\/$$$$/d'))
|
|---|
| 1886 | $$(QUIET)$$(RMDIR) -p --ignore-fail-on-non-empty --ignore-fail-on-not-exist -- $$(dir $$@) \
|
|---|
| 1887 | $$(addprefix $(inst),$$(sort $$(dir $$(shell $$(CAT_EXT) $(out).lst 2> /dev/null))))
|
|---|
| 1888 | $$(QUIET)$$(RM) -f -- $(out).lst $(out)
|
|---|
| 1889 | $$(QUIET)$$(RMDIR) -p --ignore-fail-on-non-empty --ignore-fail-on-not-exist -- $$(dir $$@)
|
|---|
| 1890 |
|
|---|
| 1891 | $(out): $(comp-vars _TARGET_$(target)_DIGEST_PREV,_TARGET_$(target)_DIGEST,FORCE) | $(call DIRDEP,$(inst))
|
|---|
| 1892 | $$(QUIET)$$(RM) -f -- $$@
|
|---|
| 1893 | %$$(if $$(_TARGET_$(target)_DIGEST),$$(if $$(wildcard $(out).lst)\
|
|---|
| 1894 | ,$$(call MSG_REFETCH,$(target)),$$(call MSG_FETCH,$(target))),$$(call MSG_UNFETCH,$(target)))
|
|---|
| 1895 | $$(QUIET)$$(if $$(wildcard $(out).lst ),$$(MAKE) -f $(MAKEFILE) --no-print-directory $(out)_unfetched)
|
|---|
| 1896 | $$(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 $$@))
|
|---|
| 1897 | $$(QUIET2)$$(if $$(_TARGET_$(target)_DIGEST),$$(APPEND) $$@ "_TARGET_$(target)_DIGEST_PREV := $(_TARGET_$(target)_DIGEST)")
|
|---|
| 1898 |
|
|---|
| 1899 | .NOTPARALLEL: $(out).lst $(out)_unfetched $(out)
|
|---|
| 1900 |
|
|---|
| 1901 | endef
|
|---|
| 1902 |
|
|---|
| 1903 |
|
|---|
| 1904 | ##
|
|---|
| 1905 | # Deal with one fetch target.
|
|---|
| 1906 | # @param target
|
|---|
| 1907 | # @param bld_trg
|
|---|
| 1908 | # @param bld_trg_arch
|
|---|
| 1909 | define def_fetch
|
|---|
| 1910 | # common
|
|---|
| 1911 | INSTARGET_$(target) := $($(target)_INST)
|
|---|
| 1912 | ifneq ($(patsubst %/,ok,$(INSTARGET_$(target))),ok)
|
|---|
| 1913 | $(error kBuild: Bad or missing INST property for target '$(target)'. \
|
|---|
| 1914 | $(target)_INST='$($(target)_INST)' ($(origin $(target)_INST)))
|
|---|
| 1915 | endif
|
|---|
| 1916 | _TARGET_$(target)_FETCHED :=
|
|---|
| 1917 | _TARGET_$(target)_UNPACKED :=
|
|---|
| 1918 | _TARGET_$(target)_DIGEST :=
|
|---|
| 1919 | local clean_files := $($(target)_CLEAN) $($(target)_CLEAN.$(bld_trg)) $($(target)_CLEAN.$(bld_trg).$(bld_trg_arch)) $($(target)_CLEAN.$(bld_trg_arch)) $($(target)_CLEAN.$(KBUILD_TYPE))
|
|---|
| 1920 |
|
|---|
| 1921 | # The 'sources'.
|
|---|
| 1922 | #$ (warning dbg fetch: target=$(target) sources=$($(target)_SOURCES) $($(target)_SOURCES.$(KBUILD_TYPE)) $($(target)_SOURCES.$(KBUILD_TARGET)) $($(target)_SOURCES.$(bld_trg_arch)) $($(target)_SOURCES.$(KBUILD_TARGET).$(bld_trg_arch)))
|
|---|
| 1923 | $(foreach source,$($(target)_SOURCES) $($(target)_SOURCES.$(KBUILD_TYPE)) $($(target)_SOURCES.$(bld_trg)) $($(target)_SOURCES.$(bld_trg_arch)) $($(target)_SOURCES.$(bld_trg).$(bld_trg_arch)),\
|
|---|
| 1924 | $(evalval def_fetch_src))
|
|---|
| 1925 |
|
|---|
| 1926 | # The target.
|
|---|
| 1927 | local inst := $(INSTARGET_$(target))
|
|---|
| 1928 | local out := $(inst)_kBuild_fetch_$(target)
|
|---|
| 1929 |
|
|---|
| 1930 | $(eval includedep $(out))
|
|---|
| 1931 |
|
|---|
| 1932 | $(eval $(def_fetch_rules))
|
|---|
| 1933 |
|
|---|
| 1934 | # Define the aliases here (doesn't work if defined in def_fetch_rules, just like includedep).
|
|---|
| 1935 | $(target): $(out)
|
|---|
| 1936 | $(target)_unfetch: $(out)_unfetched
|
|---|
| 1937 |
|
|---|
| 1938 | _FETCHES += $(out)
|
|---|
| 1939 | _DOWNLOADS += $(_TARGET_$(target)_FETCHED)
|
|---|
| 1940 | _UNPACKS += $(_TARGET_$(target)_UNPACKED)
|
|---|
| 1941 | _UNFETCHES += $(out)_unfetched
|
|---|
| 1942 | _DIRS += $(inst)
|
|---|
| 1943 | _CLEAN_FILES += $(clean_files)
|
|---|
| 1944 |
|
|---|
| 1945 | endef
|
|---|
| 1946 | $(eval-opt-var def_fetch)
|
|---|
| 1947 |
|
|---|
| 1948 | # Walk the FETCH target lists.
|
|---|
| 1949 | bld_trg := $(KBUILD_TARGET)
|
|---|
| 1950 | bld_trg_arch := $(KBUILD_TARGET_ARCH)
|
|---|
| 1951 | $(foreach target, $(_ALL_FETCHES), \
|
|---|
| 1952 | $(evalvalctx def_fetch))
|
|---|
| 1953 |
|
|---|
| 1954 | # some aliases.
|
|---|
| 1955 | download: $(_DOWNLOADS)
|
|---|
| 1956 | unpack: $(_UNPACKS)
|
|---|
| 1957 | fetch: $(_FETCHES)
|
|---|
| 1958 | unfetch: $(_UNFETCHES)
|
|---|
| 1959 |
|
|---|
| 1960 | ifdef KBUILD_PROFILE_SELF
|
|---|
| 1961 | $(evalcall def_profile_self, done fetching targets)
|
|---|
| 1962 | endif
|
|---|
| 1963 |
|
|---|
| 1964 |
|
|---|
| 1965 |
|
|---|
| 1966 | ##
|
|---|
| 1967 | ## Patching.
|
|---|
| 1968 | ##
|
|---|
| 1969 | ##
|
|---|
| 1970 | #define def_patch_src
|
|---|
| 1971 | #
|
|---|
| 1972 | #endef
|
|---|
| 1973 | #
|
|---|
| 1974 | #
|
|---|
| 1975 | ## Deal with one patch target.
|
|---|
| 1976 | #define def_patch
|
|---|
| 1977 | #
|
|---|
| 1978 | #$(foreach source,$($(target)_SOURCES) $($(target)_SOURCES.$(KBUILD_TYPE)) $($(target)_SOURCES.$(KBUILD_TARGET)) $($(target)_SOURCES.$(KBUILD_TARGET_ARCH)) $($(target)_SOURCES.$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)),\
|
|---|
| 1979 | # $(evalval def_patch_src))
|
|---|
| 1980 | #
|
|---|
| 1981 | #_PATCHES +=
|
|---|
| 1982 | #endef
|
|---|
| 1983 | #
|
|---|
| 1984 | #$(foreach target, $(_ALL_PATCHES), \
|
|---|
| 1985 | # $(evalval def_patch))
|
|---|
| 1986 | #
|
|---|
| 1987 |
|
|---|
| 1988 |
|
|---|
| 1989 | #
|
|---|
| 1990 | # Object processing.
|
|---|
| 1991 | #
|
|---|
| 1992 |
|
|---|
| 1993 | ## wrapper the compile command dependency check.
|
|---|
| 1994 | ifndef NO_COMPILE_CMDS_DEPS
|
|---|
| 1995 | _DEP_COMPILE_CMDS = $$(comp-cmds-ex $$($(target)_$(subst :,_,$(source))_CMDS_PREV_),$$(commands $(obj)),FORCE)
|
|---|
| 1996 | else
|
|---|
| 1997 | _DEP_COMPILE_CMDS =
|
|---|
| 1998 | endif
|
|---|
| 1999 |
|
|---|
| 2000 | ## Generates the rules for building a specific object, and the aliases
|
|---|
| 2001 | # for building a source file.
|
|---|
| 2002 | # @param $(obj) The object file.
|
|---|
| 2003 | define def_target_source_rule
|
|---|
| 2004 | ifdef TOOL_$(tool)_COMPILE_$(type)_USES_KOBJCACHE
|
|---|
| 2005 | $(outbase).koc +| $(obj) $($(target)_$(source)_OUTPUT_) $($(target)_$(source)_OUTPUT_MAYBE_) : \
|
|---|
| 2006 | $($(target)_$(source)_DEPEND_) \
|
|---|
| 2007 | $(value _DEP_COMPILE_CMDS) \
|
|---|
| 2008 | | \
|
|---|
| 2009 | $($(target)_$(source)_DEPORD_) \
|
|---|
| 2010 | $$$$($(target)_INTERMEDIATES)
|
|---|
| 2011 | %$$(call MSG_COMPILE,$(target),$(source),$$@,$(type))
|
|---|
| 2012 | else
|
|---|
| 2013 | $(obj) + $($(target)_$(source)_OUTPUT_) +| $($(target)_$(source)_OUTPUT_MAYBE_) : \
|
|---|
| 2014 | $($(target)_$(source)_DEPEND_) \
|
|---|
| 2015 | $(value _DEP_COMPILE_CMDS) \
|
|---|
| 2016 | | \
|
|---|
| 2017 | $($(target)_$(source)_DEPORD_) \
|
|---|
| 2018 | $$$$($(target)_INTERMEDIATES)
|
|---|
| 2019 | %$$(call MSG_COMPILE,$(target),$(source),$$@,$(type))
|
|---|
| 2020 | ifdef TOOL_$(tool)_COMPILE_$(type)_DONT_PURGE_OUTPUT
|
|---|
| 2021 | $$(QUIET)$$(RM) -f -- $(dep) $(obj) $($(target)_$(source)_OUTPUT_) $($(target)_OUTPUT_MAYBE_)
|
|---|
| 2022 | endif
|
|---|
| 2023 | endif
|
|---|
| 2024 |
|
|---|
| 2025 | $($(target)_$(source)_CMDS_)
|
|---|
| 2026 |
|
|---|
| 2027 | ifndef NO_COMPILE_CMDS_DEPS
|
|---|
| 2028 | %$$(QUIET2)$$(APPEND) '$(dep)'
|
|---|
| 2029 | %$$(QUIET2)$$(APPEND) '$(dep)' 'define $(target)_$(subst :,_,$(source))_CMDS_PREV_'
|
|---|
| 2030 | %$$(QUIET2)$$(APPEND) -c '$(dep)' '$(obj)'
|
|---|
| 2031 | %$$(QUIET2)$$(APPEND) '$(dep)' 'endef'
|
|---|
| 2032 | endif
|
|---|
| 2033 |
|
|---|
| 2034 | $(basename $(notdir $(obj))).o: $(obj)
|
|---|
| 2035 | $(basename $(notdir $(obj))).obj: $(obj)
|
|---|
| 2036 |
|
|---|
| 2037 | ## @todo make this 'local cmds' in 0.2.x or when a new kb-src-one is added.
|
|---|
| 2038 | $(target)_$(source)_CMDS_ :=
|
|---|
| 2039 | endef # def_target_source_rule
|
|---|
| 2040 | $(eval-opt-var def_target_source_rule)
|
|---|
| 2041 |
|
|---|
| 2042 |
|
|---|
| 2043 | ## wrapper the link command dependency check.
|
|---|
| 2044 | ifndef NO_LINK_CMDS_DEPS
|
|---|
| 2045 | _DEP_LINK_CMDS = $$(comp-cmds-ex $$($(target)_CMDS_PREV_),$$(commands $(out)),FORCE)
|
|---|
| 2046 | else
|
|---|
| 2047 | _DEP_LINK_CMDS =
|
|---|
| 2048 | endif
|
|---|
| 2049 |
|
|---|
| 2050 | ## Generate the link rule for a target.
|
|---|
| 2051 | # @param $(target) The normalized target name.
|
|---|
| 2052 | # @param $(dirdep) Directories we depend upon begin created before linking.
|
|---|
| 2053 | # @param $(dep) The name of the dependency file.
|
|---|
| 2054 | # @param $(out)
|
|---|
| 2055 | # @param $($(target)_OUTPUT_) Output files from the link.
|
|---|
| 2056 | # @param $($(target)_OUTPUT_MAYBE_) Output files that the link may perhaps create.
|
|---|
| 2057 | # @param $($(target)_DEPEND_) Dependencies.
|
|---|
| 2058 | # @param $($(target)_DEPORD_) Dependencies which should only affect build order.
|
|---|
| 2059 | # @param $(cmds) The link commands.
|
|---|
| 2060 | # @param $($(target)_CMDS_PREV_) The link commands from the previous run.
|
|---|
| 2061 | define def_link_rule
|
|---|
| 2062 | $(out) + $($(target)_OUTPUT_) +| $($(target)_OUTPUT_MAYBE_) : \
|
|---|
| 2063 | $$$$($(target)_DEPEND_) \
|
|---|
| 2064 | $(value _DEP_LINK_CMDS) \
|
|---|
| 2065 | | \
|
|---|
| 2066 | $$$$($(target)_DEPORD_)
|
|---|
| 2067 | %$$(call MSG_LINK,$(target),$$@,$(tool_do))
|
|---|
| 2068 | $$(QUIET)$$(RM) -f -- $(dep) $(out) $($(target)_OUTPUT_) $($(target)_OUTPUT_MAYBE_)
|
|---|
| 2069 |
|
|---|
| 2070 | $(cmds)
|
|---|
| 2071 |
|
|---|
| 2072 | ifndef NO_LINK_CMDS_DEPS
|
|---|
| 2073 | %$$(QUIET2)$$(APPEND) '$(dep)' 'define $(target)_CMDS_PREV_'
|
|---|
| 2074 | %$$(QUIET2)$$(APPEND) -c '$(dep)' '$(out)'
|
|---|
| 2075 | %$$(QUIET2)$$(APPEND) '$(dep)' 'endef'
|
|---|
| 2076 | endif
|
|---|
| 2077 |
|
|---|
| 2078 | $(basename $(notdir $(out))):: $(out)
|
|---|
| 2079 |
|
|---|
| 2080 | endef # def_link_rule
|
|---|
| 2081 | $(eval-opt-var def_link_rule)
|
|---|
| 2082 |
|
|---|
| 2083 |
|
|---|
| 2084 | ## Generate the link & lib install rule
|
|---|
| 2085 | # @param $(target) Normalized target name.
|
|---|
| 2086 | # @param $(out) The build target.
|
|---|
| 2087 | # @param $(INSTARGET_$(target)) The installation targets.
|
|---|
| 2088 | # @param $(mode) The file mode (optional)
|
|---|
| 2089 | define def_link_install_rule
|
|---|
| 2090 | $(INSTARGET_$(target)) : $(out) | $(call DIRDEP,$(dir $(INSTARGET_$(target))))
|
|---|
| 2091 | %$$(call MSG_INST_TRG,$(target),$(out),$$@)
|
|---|
| 2092 | $$(QUIET)$$(INSTALL) $$(if $(mode),-m $(mode)) -- $(out) $$@
|
|---|
| 2093 |
|
|---|
| 2094 | ifdef KBUILD_DO_AUTO_INSTALL
|
|---|
| 2095 | $(basename $(notdir $(out))):: $(INSTARGET_$(target))
|
|---|
| 2096 | endif
|
|---|
| 2097 | endef # def_link_install_rule
|
|---|
| 2098 |
|
|---|
| 2099 |
|
|---|
| 2100 | ## def_src_handler_*
|
|---|
| 2101 | #
|
|---|
| 2102 | # @{
|
|---|
| 2103 | define def_src_handler_c
|
|---|
| 2104 | local type := C
|
|---|
| 2105 | $(kb-src-one 2)
|
|---|
| 2106 | endef
|
|---|
| 2107 |
|
|---|
| 2108 | define def_src_handler_cxx
|
|---|
| 2109 | local type := CXX
|
|---|
| 2110 | $(kb-src-one 2)
|
|---|
| 2111 | endef
|
|---|
| 2112 |
|
|---|
| 2113 | define def_src_handler_objc
|
|---|
| 2114 | local type := OBJC
|
|---|
| 2115 | $(kb-src-one 2)
|
|---|
| 2116 | endef
|
|---|
| 2117 |
|
|---|
| 2118 | define def_src_handler_asm
|
|---|
| 2119 | local type := AS
|
|---|
| 2120 | $(kb-src-one 2)
|
|---|
| 2121 | endef
|
|---|
| 2122 |
|
|---|
| 2123 | define def_src_handler_rc
|
|---|
| 2124 | local type := RC
|
|---|
| 2125 | $(kb-src-one 2)
|
|---|
| 2126 | endef
|
|---|
| 2127 |
|
|---|
| 2128 | define def_src_handler_obj
|
|---|
| 2129 | ifeq ($(defpath),)
|
|---|
| 2130 | $(target)_OBJS_ += $(source)
|
|---|
| 2131 | else
|
|---|
| 2132 | $(target)_OBJS_ += $(abspathex $(source), $(defpath))
|
|---|
| 2133 | endif
|
|---|
| 2134 | endef
|
|---|
| 2135 | ## @}
|
|---|
| 2136 |
|
|---|
| 2137 | ## Handle one source.
|
|---|
| 2138 | # .
|
|---|
| 2139 | define def_src_handler_one
|
|---|
| 2140 | local suff := $(suffix $(source))
|
|---|
| 2141 | local src_handler := $(firstword $(filter $(suff):%, $($(target)_$(source)_SRC_HANDLERS) $($(source)_SRC_HANDLERS) $(target_src_handlers) ))
|
|---|
| 2142 | local handler := $(patsubst $(suff):%,%,$(src_handler))
|
|---|
| 2143 | ifneq ($(handler),)
|
|---|
| 2144 | $(evalvalctx $(handler))
|
|---|
| 2145 | else
|
|---|
| 2146 | othersrc += $(source)
|
|---|
| 2147 | endif
|
|---|
| 2148 | endef
|
|---|
| 2149 |
|
|---|
| 2150 | ## Generic macro for processing all target sources.
|
|---|
| 2151 | # @param $(target) Normalized target name.
|
|---|
| 2152 | # @param $(defpath)
|
|---|
| 2153 | # @param much-more...
|
|---|
| 2154 | # @returns othersrc, $(target)_OBJS_, ++
|
|---|
| 2155 | define def_target_sources
|
|---|
| 2156 | local target_src_handlers := $($(target)_SRC_HANDLERS) $(KBUILD_SRC_HANDLERS)
|
|---|
| 2157 | $(foreach source,\
|
|---|
| 2158 | $($(target)_SOURCES)\
|
|---|
| 2159 | $($(target)_SOURCES.$(bld_trg))\
|
|---|
| 2160 | $($(target)_SOURCES.$(bld_trg).$(bld_trg_arch))\
|
|---|
| 2161 | $($(target)_SOURCES.$(bld_trg_arch))\
|
|---|
| 2162 | $($(target)_SOURCES.$(bld_trg_cpu))\
|
|---|
| 2163 | $($(target)_SOURCES.$(bld_type))\
|
|---|
| 2164 | ,$(evalval def_src_handler_one) )
|
|---|
| 2165 |
|
|---|
| 2166 | $(foreach source,\
|
|---|
| 2167 | $($(target)_GEN_SOURCES_)\
|
|---|
| 2168 | $($(target)_GEN_SOURCES_.$(bld_trg))\
|
|---|
| 2169 | $($(target)_GEN_SOURCES_.$(bld_trg).$(bld_trg_arch))\
|
|---|
| 2170 | $($(target)_GEN_SOURCES_.$(bld_trg_arch))\
|
|---|
| 2171 | $($(target)_GEN_SOURCES_.$(bld_trg_cpu))\
|
|---|
| 2172 | $($(target)_GEN_SOURCES_.$(bld_type))\
|
|---|
| 2173 | ,$(evalval def_src_handler_one) )
|
|---|
| 2174 | endef # def_target_sources
|
|---|
| 2175 | $(eval-opt-var def_target_sources)
|
|---|
| 2176 |
|
|---|
| 2177 |
|
|---|
| 2178 |
|
|---|
| 2179 | ## Generic macro for generating the install rule(s) for a target
|
|---|
| 2180 | # and update the globals with default out.
|
|---|
| 2181 | #
|
|---|
| 2182 | # @param $(target) Normalized target name.
|
|---|
| 2183 | # @param $(out) The output file.
|
|---|
| 2184 | # @param $(definst) The default _INST value.
|
|---|
| 2185 | # @param $(typevar) The name of the variable with all the root targets of its type.
|
|---|
| 2186 | # @remark Only library uses this now.
|
|---|
| 2187 | define def_target_install_pluss
|
|---|
| 2188 | ifeq ($(strip $($(target)_NOINST) $($(target)_NOINST.$(bld_trg)) $($(target)_NOINST.$(bld_trg).$(bld_trg_arch)) $($(target)_NOINST.$(bld_trg).$(bld_trg_arch).$(bld_type)) $($(target)_NOINST.$(bld_trg_arch)) $($(target)_NOINST.$(bld_trg_cpu)) $($(target)_NOINST.$(bld_trg_type))),)
|
|---|
| 2189 | ifneq ($(strip $($(target)_INST.$(bld_trg).$(bld_trg_arch).$(bld_type))),)
|
|---|
| 2190 | local inst := $(addprefix $(PATH_INS)/,$($(target)_INST.$(bld_trg).$(bld_trg_arch).$(bld_type)))
|
|---|
| 2191 | else ifneq ($(strip $($(target)_INST.$(bld_trg).$(bld_trg_arch))),)
|
|---|
| 2192 | local inst := $(addprefix $(PATH_INS)/,$($(target)_INST.$(bld_trg).$(bld_trg_arch)))
|
|---|
| 2193 | else ifneq ($(strip $($(target)_INST.$(bld_trg).$(bld_type))),)
|
|---|
| 2194 | local inst := $(addprefix $(PATH_INS)/,$($(target)_INST.$(bld_trg).$(bld_type)))
|
|---|
| 2195 | else ifneq ($(strip $($(target)_INST.$(bld_trg_arch))),)
|
|---|
| 2196 | local inst := $(addprefix $(PATH_INS)/,$($(target)_INST.$(bld_trg_arch)))
|
|---|
| 2197 | else ifneq ($(strip $($(target)_INST.$(bld_trg))),)
|
|---|
| 2198 | local inst := $(addprefix $(PATH_INS)/,$($(target)_INST.$(bld_trg)))
|
|---|
| 2199 | else ifneq ($(strip $($(target)_INST.$(bld_type))),)
|
|---|
| 2200 | local inst := $(addprefix $(PATH_INS)/,$($(target)_INST.$(bld_type)))
|
|---|
| 2201 | else ifneq ($(strip $($(target)_INST)),)
|
|---|
| 2202 | local inst := $(addprefix $(PATH_INS)/,$($(target)_INST))
|
|---|
| 2203 | else
|
|---|
| 2204 | local inst := $(definst)/
|
|---|
| 2205 | endif
|
|---|
| 2206 | INSTARGET_$(target) := $(patsubst %/,%/$(notdir $(out)),$(inst))
|
|---|
| 2207 |
|
|---|
| 2208 | $(eval $(def_link_install_rule))
|
|---|
| 2209 |
|
|---|
| 2210 | _INSTALLS_FILES += $(INSTARGET_$(target))
|
|---|
| 2211 |
|
|---|
| 2212 | ifdef KBUILD_DO_AUTO_INSTALL
|
|---|
| 2213 | $(typevar) += $(INSTARGET_$(target))
|
|---|
| 2214 | else
|
|---|
| 2215 | $(typevar) += $(out)
|
|---|
| 2216 | endif
|
|---|
| 2217 | else # _NOINST
|
|---|
| 2218 | $(typevar) += $(out)
|
|---|
| 2219 | endif
|
|---|
| 2220 |
|
|---|
| 2221 | _OUT_FILES += $($(target)_OUTPUT_) $($(target)_OUTPUT_MAYBE_) $(out)
|
|---|
| 2222 | _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))
|
|---|
| 2223 | _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))
|
|---|
| 2224 | _OBJS += $($(target)_OBJS_)
|
|---|
| 2225 |
|
|---|
| 2226 | endef # def_target_install_pluss
|
|---|
| 2227 |
|
|---|
| 2228 |
|
|---|
| 2229 |
|
|---|
| 2230 | #
|
|---|
| 2231 | # LIBRARIES
|
|---|
| 2232 | #
|
|---|
| 2233 |
|
|---|
| 2234 | ## Library (one).
|
|---|
| 2235 | # @param $(target) Normalized library (target) name.
|
|---|
| 2236 | define def_lib
|
|---|
| 2237 | # library basics
|
|---|
| 2238 | ## @todo prefix
|
|---|
| 2239 | local bld_type := $(firstword $($(target)_BLD_TYPE) $(KBUILD_TYPE))
|
|---|
| 2240 | local bld_trg := $(firstword $($(target)_BLD_TRG) $(KBUILD_TARGET))
|
|---|
| 2241 | local bld_trg_arch:= $(firstword $($(target)_BLD_TRG_ARCH) $(KBUILD_TARGET_ARCH))
|
|---|
| 2242 | local bld_trg_cpu := $(firstword $($(target)_BLD_TRG_CPU) $(KBUILD_TARGET_CPU))
|
|---|
| 2243 | local tool := $(call _TARGET_TOOL,$(target),AR)
|
|---|
| 2244 | ifeq ($(tool),)
|
|---|
| 2245 | $(error kBuild: Library target $(target) does not have a tool defined!)
|
|---|
| 2246 | endif
|
|---|
| 2247 | local name := $(firstword\
|
|---|
| 2248 | $($(target)_NAME.$(bld_trg).$(bld_trg_arch))\
|
|---|
| 2249 | $($(target)_NAME.$(bld_trg_arch))\
|
|---|
| 2250 | $($(target)_NAME.$(bld_trg))\
|
|---|
| 2251 | $($(target)_NAME.$(bld_type))\
|
|---|
| 2252 | $($(target)_NAME)\
|
|---|
| 2253 | $(target))
|
|---|
| 2254 | local outbase := $(call TARGET_BASE,$(name),$(target))
|
|---|
| 2255 | ifndef PATH_$(target)
|
|---|
| 2256 | PATH_$(target) := $(patsubst %/,%,$(dir $(outbase)))
|
|---|
| 2257 | else ifneq ($(PATH_$(target)),$(patsubst %/,%,$(dir $(outbase))))
|
|---|
| 2258 | $(error kBuild internal error: PATH_$(target)=$(PATH_$(target)) expected $(patsubst %/,%,$(dir $(outbase))))
|
|---|
| 2259 | endif
|
|---|
| 2260 | local suff := $(firstword\
|
|---|
| 2261 | $($(target)_LIBSUFF.$(bld_trg).$(bld_trg_arch))\
|
|---|
| 2262 | $($(target)_LIBSUFF.$(bld_trg))\
|
|---|
| 2263 | $($(target)_LIBSUFF)\
|
|---|
| 2264 | $(TOOL_$(tool)_ARLIBSUFF.$(bld_trg).$(bld_trg_arch))\
|
|---|
| 2265 | $(TOOL_$(tool)_ARLIBSUFF.$(bld_trg))\
|
|---|
| 2266 | $(TOOL_$(tool)_ARLIBSUFF)\
|
|---|
| 2267 | $(SUFF_LIB))
|
|---|
| 2268 | local out := $(outbase)$(suff)
|
|---|
| 2269 | local defpath := $(firstword $($(target)_PATH) $($(target)_DEFPATH))
|
|---|
| 2270 | TARGET_$(target) := $(out)
|
|---|
| 2271 | # no local here - must be writable across some foreachs.
|
|---|
| 2272 | othersrc :=
|
|---|
| 2273 | $(target)_OBJS_ :=
|
|---|
| 2274 |
|
|---|
| 2275 | # Do units pre source callouts.
|
|---|
| 2276 | local units := \
|
|---|
| 2277 | $($(target)_USES.$(bld_trg).$(bld_trg_arch))\
|
|---|
| 2278 | $($(target)_USES.$(bld_trg_arch))\
|
|---|
| 2279 | $($(target)_USES.$(bld_trg))\
|
|---|
| 2280 | $($(target)_USES.$(bld_type))\
|
|---|
| 2281 | $($(target)_USES)
|
|---|
| 2282 | $(foreach unit,$(units),$(evalval def_unit_$(unit)_target_pre))
|
|---|
| 2283 |
|
|---|
| 2284 | # source -> object
|
|---|
| 2285 | $(evalval def_target_sources)
|
|---|
| 2286 |
|
|---|
| 2287 | # library linking
|
|---|
| 2288 | local tool := $(call _TARGET_TOOL,$(target),AR)
|
|---|
| 2289 | local name := $(firstword\
|
|---|
| 2290 | $($(target)_NAME.$(bld_trg).$(bld_trg_arch))\
|
|---|
| 2291 | $($(target)_NAME.$(bld_trg_arch))\
|
|---|
| 2292 | $($(target)_NAME.$(bld_trg))\
|
|---|
| 2293 | $($(target)_NAME.$(bld_type))\
|
|---|
| 2294 | $($(target)_NAME)\
|
|---|
| 2295 | $(target))
|
|---|
| 2296 | local outbase := $(call TARGET_BASE,$(name),$(target))
|
|---|
| 2297 | local flags :=\
|
|---|
| 2298 | $(TOOL_$(tool)_ARFLAGS)\
|
|---|
| 2299 | $(TOOL_$(tool)_ARFLAGS.$(bld_type))\
|
|---|
| 2300 | $(ARFLAGS)\
|
|---|
| 2301 | $(ARFLAGS.$(bld_type))\
|
|---|
| 2302 | $($(target)_ARFLAGS)\
|
|---|
| 2303 | $($(target)_ARFLAGS.$(bld_type)) \
|
|---|
| 2304 | $($(target)_ARFLAGS.$(bld_trg)) \
|
|---|
| 2305 | $($(target)_ARFLAGS.$(bld_trg_arch)) \
|
|---|
| 2306 | $($(target)_ARFLAGS.$(bld_trg).$(bld_trg_arch)) \
|
|---|
| 2307 | $($(target)_ARFLAGS.$(bld_trg_cpu))
|
|---|
| 2308 | local dirdep := $(call DIRDEP,$(dir $(out)))
|
|---|
| 2309 | local deps := \
|
|---|
| 2310 | $($(target)_DEPS.$(bld_trg_cpu)) \
|
|---|
| 2311 | $($(target)_DEPS.$(bld_trg).$(bld_trg_arch).$(bld_type)) \
|
|---|
| 2312 | $($(target)_DEPS.$(bld_trg).$(bld_trg_arch)) \
|
|---|
| 2313 | $($(target)_DEPS.$(bld_trg).$(bld_type)) \
|
|---|
| 2314 | $($(target)_DEPS.$(bld_trg_arch)) \
|
|---|
| 2315 | $($(target)_DEPS.$(bld_trg)) \
|
|---|
| 2316 | $($(target)_DEPS.$(bld_type)) \
|
|---|
| 2317 | $($(target)_DEPS) \
|
|---|
| 2318 | $($(target)_LNK_DEPS.$(bld_trg_cpu)) \
|
|---|
| 2319 | $($(target)_LNK_DEPS.$(bld_trg).$(bld_trg_arch).$(bld_type)) \
|
|---|
| 2320 | $($(target)_LNK_DEPS.$(bld_trg).$(bld_trg_arch)) \
|
|---|
| 2321 | $($(target)_LNK_DEPS.$(bld_trg).$(bld_type)) \
|
|---|
| 2322 | $($(target)_LNK_DEPS.$(bld_trg_arch)) \
|
|---|
| 2323 | $($(target)_LNK_DEPS.$(bld_trg)) \
|
|---|
| 2324 | $($(target)_LNK_DEPS.$(bld_type)) \
|
|---|
| 2325 | $($(target)_LNK_DEPS)
|
|---|
| 2326 | local orderdeps := \
|
|---|
| 2327 | $($(target)_ORDERDEPS.$(bld_trg_cpu)) \
|
|---|
| 2328 | $($(target)_ORDERDEPS.$(bld_trg).$(bld_trg_arch).$(bld_type)) \
|
|---|
| 2329 | $($(target)_ORDERDEPS.$(bld_trg).$(bld_trg_arch)) \
|
|---|
| 2330 | $($(target)_ORDERDEPS.$(bld_trg).$(bld_type)) \
|
|---|
| 2331 | $($(target)_ORDERDEPS.$(bld_trg_arch)) \
|
|---|
| 2332 | $($(target)_ORDERDEPS.$(bld_trg)) \
|
|---|
| 2333 | $($(target)_ORDERDEPS.$(bld_type)) \
|
|---|
| 2334 | $($(target)_ORDERDEPS) \
|
|---|
| 2335 | $($(target)_LNK_ORDERDEPS.$(bld_trg_cpu)) \
|
|---|
| 2336 | $($(target)_LNK_ORDERDEPS.$(bld_trg).$(bld_trg_arch).$(bld_type)) \
|
|---|
| 2337 | $($(target)_LNK_ORDERDEPS.$(bld_trg).$(bld_trg_arch)) \
|
|---|
| 2338 | $($(target)_LNK_ORDERDEPS.$(bld_trg).$(bld_type)) \
|
|---|
| 2339 | $($(target)_LNK_ORDERDEPS.$(bld_trg_arch)) \
|
|---|
| 2340 | $($(target)_LNK_ORDERDEPS.$(bld_trg)) \
|
|---|
| 2341 | $($(target)_LNK_ORDERDEPS.$(bld_type)) \
|
|---|
| 2342 | $($(target)_LNK_ORDERDEPS)
|
|---|
| 2343 |
|
|---|
| 2344 | # Adjust paths if we got a default path.
|
|---|
| 2345 | ifneq ($(defpath),)
|
|---|
| 2346 | $(target)_OBJS_ := $(abspathex $($(target)_OBJS_),$(defpath))
|
|---|
| 2347 | local deps := $(abspathex $(deps),$(defpath))
|
|---|
| 2348 | local orderdeps := $(abspathex $(orderdeps),$(defpath))
|
|---|
| 2349 | othersrc := $(abspathex $(othersrc),$(defpath))
|
|---|
| 2350 | endif
|
|---|
| 2351 |
|
|---|
| 2352 |
|
|---|
| 2353 | # Custom pre-link actions.
|
|---|
| 2354 | ## @todo bld_trg_cpu is missing here.
|
|---|
| 2355 | ifdef $(target)_PRE_CMDS.$(bld_trg).$(bld_trg_arch).$(bld_type)
|
|---|
| 2356 | local pre_cmds := $($(target)_PRE_CMDS.$(bld_trg).$(bld_trg_arch).$(bld_type))
|
|---|
| 2357 | else ifdef $(target)_PRE_CMDS.$(bld_trg).$(bld_trg_arch)
|
|---|
| 2358 | local pre_cmds := $($(target)_PRE_CMDS.$(bld_trg).$(bld_trg_arch))
|
|---|
| 2359 | else ifdef $(target)_PRE_CMDS.$(bld_trg).$(bld_type)
|
|---|
| 2360 | local pre_cmds := $($(target)_PRE_CMDS.$(bld_trg).$(bld_type))
|
|---|
| 2361 | else ifdef $(target)_PRE_CMDS.$(bld_trg_arch)
|
|---|
| 2362 | local pre_cmds := $($(target)_PRE_CMDS.$(bld_trg_arch))
|
|---|
| 2363 | else ifdef $(target)_PRE_CMDS.$(bld_trg)
|
|---|
| 2364 | local pre_cmds := $($(target)_PRE_CMDS.$(bld_trg))
|
|---|
| 2365 | else ifdef $(target)_PRE_CMDS.$(bld_type)
|
|---|
| 2366 | local pre_cmds := $($(target)_PRE_CMDS.$(bld_type))
|
|---|
| 2367 | else ifdef $(target)_PRE_CMDS
|
|---|
| 2368 | local pre_cmds := $($(target)_PRE_CMDS)
|
|---|
| 2369 | else ifdef PRE_CMDS.$(bld_trg).$(bld_trg_arch).$(bld_type)
|
|---|
| 2370 | local pre_cmds := $(PRE_CMDS.$(bld_trg).$(bld_trg_arch).$(bld_type))
|
|---|
| 2371 | else ifdef PRE_CMDS.$(bld_trg).$(bld_trg_arch)
|
|---|
| 2372 | local pre_cmds := $(PRE_CMDS.$(bld_trg).$(bld_trg_arch))
|
|---|
| 2373 | else ifdef PRE_CMDS.$(bld_trg).$(bld_type)
|
|---|
| 2374 | local pre_cmds := $(PRE_CMDS.$(bld_trg).$(bld_type))
|
|---|
| 2375 | else ifdef PRE_CMDS.$(bld_trg_arch)
|
|---|
| 2376 | local pre_cmds := $(PRE_CMDS.$(bld_trg_arch))
|
|---|
| 2377 | else ifdef PRE_CMDS.$(bld_trg)
|
|---|
| 2378 | local pre_cmds := $(PRE_CMDS.$(bld_trg))
|
|---|
| 2379 | else ifdef PRE_CMDS.$(bld_type)
|
|---|
| 2380 | local pre_cmds := $(PRE_CMDS.$(bld_type))
|
|---|
| 2381 | else
|
|---|
| 2382 | local pre_cmds := $(PRE_CMDS)
|
|---|
| 2383 | endif
|
|---|
| 2384 |
|
|---|
| 2385 | # Custom post-link actions.
|
|---|
| 2386 | ifdef $(target)_POST_CMDS.$(bld_trg).$(bld_trg_arch).$(bld_type)
|
|---|
| 2387 | local post_cmds := $($(target)_POST_CMDS.$(bld_trg).$(bld_trg_arch).$(bld_type))
|
|---|
| 2388 | else ifdef $(target)_POST_CMDS.$(bld_trg).$(bld_trg_arch)
|
|---|
| 2389 | local post_cmds := $($(target)_POST_CMDS.$(bld_trg).$(bld_trg_arch))
|
|---|
| 2390 | else ifdef $(target)_POST_CMDS.$(bld_trg).$(bld_type)
|
|---|
| 2391 | local post_cmds := $($(target)_POST_CMDS.$(bld_trg).$(bld_type))
|
|---|
| 2392 | else ifdef $(target)_POST_CMDS.$(bld_trg_arch)
|
|---|
| 2393 | local post_cmds := $($(target)_POST_CMDS.$(bld_trg_arch))
|
|---|
| 2394 | else ifdef $(target)_POST_CMDS.$(bld_trg)
|
|---|
| 2395 | local post_cmds := $($(target)_POST_CMDS.$(bld_trg))
|
|---|
| 2396 | else ifdef $(target)_POST_CMDS.$(bld_type)
|
|---|
| 2397 | local post_cmds := $($(target)_POST_CMDS.$(bld_type))
|
|---|
| 2398 | else ifdef $(target)_POST_CMDS
|
|---|
| 2399 | local post_cmds := $($(target)_POST_CMDS)
|
|---|
| 2400 | else ifdef POST_CMDS.$(bld_trg).$(bld_trg_arch).$(bld_type)
|
|---|
| 2401 | local post_cmds := $(POST_CMDS.$(bld_trg).$(bld_trg_arch).$(bld_type))
|
|---|
| 2402 | else ifdef POST_CMDS.$(bld_trg).$(bld_trg_arch)
|
|---|
| 2403 | local post_cmds := $(POST_CMDS.$(bld_trg).$(bld_trg_arch))
|
|---|
| 2404 | else ifdef POST_CMDS.$(bld_trg).$(bld_type)
|
|---|
| 2405 | local post_cmds := $(POST_CMDS.$(bld_trg).$(bld_type))
|
|---|
| 2406 | else ifdef POST_CMDS.$(bld_trg_arch)
|
|---|
| 2407 | local post_cmds := $(POST_CMDS.$(bld_trg_arch))
|
|---|
| 2408 | else ifdef POST_CMDS.$(bld_trg)
|
|---|
| 2409 | local post_cmds := $(POST_CMDS.$(bld_trg))
|
|---|
| 2410 | else ifdef POST_CMDS.$(bld_type)
|
|---|
| 2411 | local post_cmds := $(POST_CMDS.$(bld_type))
|
|---|
| 2412 | else
|
|---|
| 2413 | local post_cmds := $(POST_CMDS)
|
|---|
| 2414 | endif
|
|---|
| 2415 |
|
|---|
| 2416 | # eliminate this guy?
|
|---|
| 2417 | local objs = $($(target)_OBJS_)
|
|---|
| 2418 |
|
|---|
| 2419 | # dependency file
|
|---|
| 2420 | local dep := $(out)$(SUFF_DEP)
|
|---|
| 2421 | ifndef NO_LINK_CMDS_DEPS
|
|---|
| 2422 | _DEPFILES_INCLUDED += $(dep)
|
|---|
| 2423 | ifdef KB_HAVE_INCLUDEDEP_QUEUE
|
|---|
| 2424 | includedep-queue $(dep)
|
|---|
| 2425 | else
|
|---|
| 2426 | includedep $(dep)
|
|---|
| 2427 | endif
|
|---|
| 2428 | endif
|
|---|
| 2429 |
|
|---|
| 2430 | # check that the tool is defined.
|
|---|
| 2431 | ifndef TOOL_$(tool)_LINK_LIBRARY_CMDS
|
|---|
| 2432 | $(warning kBuild: tools: \
|
|---|
| 2433 | 1 $($(target)_$(source)TOOL.$(bld_trg).$(bld_trg_arch)) \
|
|---|
| 2434 | 2 $($(target)_$(source)TOOL.$(bld_trg)) \
|
|---|
| 2435 | 3 $($(target)_$(source)TOOL) \
|
|---|
| 2436 | 4 $($(target)_TOOL.$(bld_trg).$(bld_trg_arch)) \
|
|---|
| 2437 | 5 $($(target)_TOOL.$(bld_trg)) \
|
|---|
| 2438 | 6 $($(target)_TOOL) \
|
|---|
| 2439 | 7 $($(source)TOOL) \
|
|---|
| 2440 | 8 $($(source)TOOL.$(bld_trg).$(bld_trg_arch)) \
|
|---|
| 2441 | 9 $($(source)TOOL.$(bld_trg)) \
|
|---|
| 2442 | 10 $(TOOL.$(bld_trg).$(bld_trg_arch)) \
|
|---|
| 2443 | 11 $(TOOL.$(bld_trg)) \
|
|---|
| 2444 | 12 $(TOOL) )
|
|---|
| 2445 | $(error kBuild: TOOL_$(tool)_LINK_LIBRARY_CMDS isn't defined! target=$(target) )
|
|---|
| 2446 | endif
|
|---|
| 2447 |
|
|---|
| 2448 | # call the tool
|
|---|
| 2449 | local cmds := $(TOOL_$(tool)_LINK_LIBRARY_CMDS)
|
|---|
| 2450 | ifneq ($(pre_cmds),)
|
|---|
| 2451 | local cmds := $(TAB)$(pre_cmds)$(NL)$(TAB)$(cmds)
|
|---|
| 2452 | endif
|
|---|
| 2453 | ifneq ($(post_cmds),)
|
|---|
| 2454 | local cmds := $(cmds)$(NL)$(TAB)$(post_cmds)
|
|---|
| 2455 | endif
|
|---|
| 2456 | $(target)_OUTPUT_ := $(TOOL_$(tool)_LINK_LIBRARY_OUTPUT)
|
|---|
| 2457 | $(target)_OUTPUT_MAYBE_ := $(TOOL_$(tool)_LINK_LIBRARY_OUTPUT_MAYBE)
|
|---|
| 2458 | $(target)_DEPEND_ := $(TOOL_$(tool)_LINK_LIBRARY_DEPEND) $(deps) $($(target)_OBJS_)
|
|---|
| 2459 | $(target)_DEPORD_ := $(TOOL_$(tool)_LINK_LIBRARY_DEPORD) $(dirdep) $(orderdeps)
|
|---|
| 2460 |
|
|---|
| 2461 | # generate the link rule.
|
|---|
| 2462 | $(eval $(def_link_rule))
|
|---|
| 2463 |
|
|---|
| 2464 | # installing and globals
|
|---|
| 2465 | $(evalval def_target_install_pluss)
|
|---|
| 2466 | endef
|
|---|
| 2467 | $(eval-opt-var def_lib)
|
|---|
| 2468 |
|
|---|
| 2469 | # Process libraries
|
|---|
| 2470 | definst := $(PATH_LIB)
|
|---|
| 2471 | typevar := _LIBS
|
|---|
| 2472 | tool_do := LINK_LIBRARY
|
|---|
| 2473 | mode := 0644
|
|---|
| 2474 | $(foreach target, $(_ALL_LIBRARIES), $(evalval def_lib))
|
|---|
| 2475 |
|
|---|
| 2476 | ifdef KBUILD_PROFILE_SELF
|
|---|
| 2477 | $(evalcall def_profile_self, done library targets)
|
|---|
| 2478 | endif
|
|---|
| 2479 |
|
|---|
| 2480 |
|
|---|
| 2481 | #
|
|---|
| 2482 | # Link operations.
|
|---|
| 2483 | #
|
|---|
| 2484 |
|
|---|
| 2485 | ##
|
|---|
| 2486 | # Link prolog
|
|---|
| 2487 | #
|
|---|
| 2488 | # @param $(target) Normalized target name.
|
|---|
| 2489 | # @param $(EXT) EXE,DLL,SYS.
|
|---|
| 2490 | # @param $(definst) The default _INST value.
|
|---|
| 2491 | # @param $(typevar) The name of the variable with all the root targets of its type.
|
|---|
| 2492 | define def_link_common
|
|---|
| 2493 | # basics
|
|---|
| 2494 | local bld_type := $(firstword $($(target)_BLD_TYPE) $(KBUILD_TYPE))
|
|---|
| 2495 | local bld_trg := $(firstword $($(target)_BLD_TRG) $(BUILD_$(bld_trg_base_var)))
|
|---|
| 2496 | local bld_trg_arch:= $(firstword $($(target)_BLD_TRG_ARCH) $(BUILD_$(bld_trg_base_var)_ARCH))
|
|---|
| 2497 | local bld_trg_cpu := $(firstword $($(target)_BLD_TRG_CPU) $(BUILD_$(bld_trg_base_var)_CPU))
|
|---|
| 2498 |
|
|---|
| 2499 | local tool := $(call _TARGET_TOOL,$(target),LD)
|
|---|
| 2500 | local name := $(firstword\
|
|---|
| 2501 | $($(target)_NAME.$(bld_trg).$(bld_trg_arch))\
|
|---|
| 2502 | $($(target)_NAME.$(bld_trg_arch))\
|
|---|
| 2503 | $($(target)_NAME.$(bld_trg))\
|
|---|
| 2504 | $($(target)_NAME.$(bld_type))\
|
|---|
| 2505 | $($(target)_NAME)\
|
|---|
| 2506 | $(target))
|
|---|
| 2507 | local outbase := $(call TARGET_BASE,$(name),$(target))
|
|---|
| 2508 | ifndef PATH_$(target)
|
|---|
| 2509 | PATH_$(target) := $(patsubst %/,%,$(dir $(outbase)))
|
|---|
| 2510 | else ifneq ($(PATH_$(target)),$(patsubst %/,%,$(dir $(outbase))))
|
|---|
| 2511 | $(error kBuild internal error: PATH_$(target)=$(PATH_$(target)) expected $(patsubst %/,%,$(dir $(outbase))))
|
|---|
| 2512 | endif
|
|---|
| 2513 | local suff := $(firstword \
|
|---|
| 2514 | $($(target)_$(EXT)SUFF) \
|
|---|
| 2515 | $($(target)_$(EXT)SUFF) \
|
|---|
| 2516 | $(TOOL_$(tool)_LD$(EXT)SUFF) \
|
|---|
| 2517 | $($(EXTPRE)SUFF_$(EXT)))
|
|---|
| 2518 | local out := $(outbase)$(suff)
|
|---|
| 2519 | TARGET_$(target) := $(out)
|
|---|
| 2520 | local defpath := $(firstword $($(target)_PATH) $($(target)_DEFPATH))
|
|---|
| 2521 | # no local here - must be writable across some foreachs.
|
|---|
| 2522 | othersrc :=
|
|---|
| 2523 | $(target)_OBJS_ :=
|
|---|
| 2524 |
|
|---|
| 2525 | # Do units pre source callouts.
|
|---|
| 2526 | local units := \
|
|---|
| 2527 | $($(target)_USES.$(bld_trg).$(bld_trg_arch))\
|
|---|
| 2528 | $($(target)_USES.$(bld_trg_arch))\
|
|---|
| 2529 | $($(target)_USES.$(bld_trg))\
|
|---|
| 2530 | $($(target)_USES.$(bld_type))\
|
|---|
| 2531 | $($(target)_USES)
|
|---|
| 2532 | $(foreach unit,$(units),$(evalval def_unit_$(unit)_target_pre))
|
|---|
| 2533 |
|
|---|
| 2534 | # source -> object
|
|---|
| 2535 | $(evalval def_target_sources)
|
|---|
| 2536 |
|
|---|
| 2537 | # more link stuff.
|
|---|
| 2538 | local tool := $(call _TARGET_TOOL,$(target),LD)
|
|---|
| 2539 | local name := $(firstword\
|
|---|
| 2540 | $($(target)_NAME.$(bld_trg).$(bld_trg_arch))\
|
|---|
| 2541 | $($(target)_NAME.$(bld_trg_arch))\
|
|---|
| 2542 | $($(target)_NAME.$(bld_trg))\
|
|---|
| 2543 | $($(target)_NAME.$(bld_type))\
|
|---|
| 2544 | $($(target)_NAME)\
|
|---|
| 2545 | $(target))
|
|---|
| 2546 | local outbase := $(call TARGET_BASE,$(name),$(target))
|
|---|
| 2547 | local flags :=\
|
|---|
| 2548 | $(TOOL_$(tool)_LDFLAGS)\
|
|---|
| 2549 | $(TOOL_$(tool)_LDFLAGS.$(bld_type))\
|
|---|
| 2550 | $(TOOL_$(tool)_LDFLAGS.$(bld_trg))\
|
|---|
| 2551 | $(TOOL_$(tool)_LDFLAGS.$(bld_trg_arch))\
|
|---|
| 2552 | $(TOOL_$(tool)_LDFLAGS.$(bld_trg).$(bld_trg_arch))\
|
|---|
| 2553 | $(TOOL_$(tool)_LDFLAGS.$(bld_trg_cpu))\
|
|---|
| 2554 | $(foreach sdk, $(SDKS) \
|
|---|
| 2555 | $(SDKS.$(bld_type)) \
|
|---|
| 2556 | $(SDKS.$(bld_trg)) \
|
|---|
| 2557 | $(SDKS.$(bld_trg_arch)) \
|
|---|
| 2558 | $(SDKS.$(bld_trg).$(bld_trg_arch)),\
|
|---|
| 2559 | $(SDK_$(sdk)_LDFLAGS)\
|
|---|
| 2560 | $(SDK_$(sdk)_LDFLAGS.$(bld_type))\
|
|---|
| 2561 | $(SDK_$(sdk)_LDFLAGS.$(bld_trg))\
|
|---|
| 2562 | $(SDK_$(sdk)_LDFLAGS.$(bld_trg_arch))\
|
|---|
| 2563 | $(SDK_$(sdk)_LDFLAGS.$(bld_trg).$(bld_trg_arch))\
|
|---|
| 2564 | $(SDK_$(sdk)_LDFLAGS.$(bld_trg_cpu)))\
|
|---|
| 2565 | $(LDFLAGS)\
|
|---|
| 2566 | $(LDFLAGS.$(bld_type))\
|
|---|
| 2567 | $(LDFLAGS.$(bld_trg))\
|
|---|
| 2568 | $(LDFLAGS.$(bld_trg_arch))\
|
|---|
| 2569 | $(LDFLAGS.$(bld_trg).$(bld_trg_arch))\
|
|---|
| 2570 | $(LDFLAGS.$(bld_trg_cpu))\
|
|---|
| 2571 | $(foreach sdk, $($(target)_SDKS) \
|
|---|
| 2572 | $($(target)_SDKS.$(bld_type)) \
|
|---|
| 2573 | $($(target)_SDKS.$(bld_trg)) \
|
|---|
| 2574 | $($(target)_SDKS.$(bld_trg_arch)) \
|
|---|
| 2575 | $($(target)_SDKS.$(bld_trg).$(bld_trg_arch)),\
|
|---|
| 2576 | $(SDK_$(sdk)_LDFLAGS)\
|
|---|
| 2577 | $(SDK_$(sdk)_LDFLAGS.$(bld_type))\
|
|---|
| 2578 | $(SDK_$(sdk)_LDFLAGS.$(bld_trg))\
|
|---|
| 2579 | $(SDK_$(sdk)_LDFLAGS.$(bld_trg_arch))\
|
|---|
| 2580 | $(SDK_$(sdk)_LDFLAGS.$(bld_trg).$(bld_trg_arch))\
|
|---|
| 2581 | $(SDK_$(sdk)_LDFLAGS.$(bld_trg_cpu)))\
|
|---|
| 2582 | $($(target)_LDFLAGS)\
|
|---|
| 2583 | $($(target)_LDFLAGS.$(bld_type))\
|
|---|
| 2584 | $($(target)_LDFLAGS.$(bld_trg))\
|
|---|
| 2585 | $($(target)_LDFLAGS.$(bld_trg_arch))\
|
|---|
| 2586 | $($(target)_LDFLAGS.$(bld_trg).$(bld_trg_arch))\
|
|---|
| 2587 | $($(target)_LDFLAGS.$(bld_trg_cpu))
|
|---|
| 2588 | local libs :=\
|
|---|
| 2589 | $($(target)_LIBS.$(bld_trg_cpu))\
|
|---|
| 2590 | $($(target)_LIBS.$(bld_trg).$(bld_trg_arch))\
|
|---|
| 2591 | $($(target)_LIBS.$(bld_trg_arch))\
|
|---|
| 2592 | $($(target)_LIBS.$(bld_trg))\
|
|---|
| 2593 | $($(target)_LIBS.$(bld_type))\
|
|---|
| 2594 | $($(target)_LIBS)\
|
|---|
| 2595 | $(foreach sdk, $($(target)_SDKS.$(bld_trg).$(bld_trg_arch)) \
|
|---|
| 2596 | $($(target)_SDKS.$(bld_trg_arch)) \
|
|---|
| 2597 | $($(target)_SDKS.$(bld_trg)) \
|
|---|
| 2598 | $($(target)_SDKS.$(bld_type)) \
|
|---|
| 2599 | $($(target)_SDKS),\
|
|---|
| 2600 | $(SDK_$(sdk)_LIBS.$(bld_trg_cpu))\
|
|---|
| 2601 | $(SDK_$(sdk)_LIBS.$(bld_trg).$(bld_trg_arch))\
|
|---|
| 2602 | $(SDK_$(sdk)_LIBS.$(bld_trg_arch))\
|
|---|
| 2603 | $(SDK_$(sdk)_LIBS.$(bld_trg))\
|
|---|
| 2604 | $(SDK_$(sdk)_LIBS.$(bld_type))\
|
|---|
| 2605 | $(SDK_$(sdk)_LIBS))\
|
|---|
| 2606 | $(LIBS.$(bld_trg_cpu))\
|
|---|
| 2607 | $(LIBS.$(bld_trg).$(bld_trg_arch))\
|
|---|
| 2608 | $(LIBS.$(bld_trg_arch))\
|
|---|
| 2609 | $(LIBS.$(bld_trg))\
|
|---|
| 2610 | $(LIBS.$(bld_type))\
|
|---|
| 2611 | $(LIBS)\
|
|---|
| 2612 | $(foreach sdk, $(SDKS.$(bld_trg).$(bld_trg_arch)) \
|
|---|
| 2613 | $(SDKS.$(bld_trg_arch)) \
|
|---|
| 2614 | $(SDKS.$(bld_trg)) \
|
|---|
| 2615 | $(SDKS.$(bld_type)) \
|
|---|
| 2616 | $(SDKS),\
|
|---|
| 2617 | $(SDK_$(sdk)_LIBS.$(bld_trg_cpu))\
|
|---|
| 2618 | $(SDK_$(sdk)_LIBS.$(bld_trg).$(bld_trg_arch))\
|
|---|
| 2619 | $(SDK_$(sdk)_LIBS.$(bld_trg_arch))\
|
|---|
| 2620 | $(SDK_$(sdk)_LIBS.$(bld_trg))\
|
|---|
| 2621 | $(SDK_$(sdk)_LIBS.$(bld_type))\
|
|---|
| 2622 | $(SDK_$(sdk)_LIBS))\
|
|---|
| 2623 | $(TOOL_$(tool)_LIBS.$(bld_trg_cpu))\
|
|---|
| 2624 | $(TOOL_$(tool)_LIBS.$(bld_trg).$(bld_trg_arch))\
|
|---|
| 2625 | $(TOOL_$(tool)_LIBS.$(bld_trg_arch))\
|
|---|
| 2626 | $(TOOL_$(tool)_LIBS.$(bld_trg))\
|
|---|
| 2627 | $(TOOL_$(tool)_LIBS.$(bld_type))\
|
|---|
| 2628 | $(TOOL_$(tool)_LIBS)
|
|---|
| 2629 | local libpath :=\
|
|---|
| 2630 | $($(target)_LIBPATH.$(bld_trg_cpu))\
|
|---|
| 2631 | $($(target)_LIBPATH.$(bld_trg).$(bld_trg_arch))\
|
|---|
| 2632 | $($(target)_LIBPATH.$(bld_trg_arch))\
|
|---|
| 2633 | $($(target)_LIBPATH.$(bld_trg))\
|
|---|
| 2634 | $($(target)_LIBPATH.$(bld_type))\
|
|---|
| 2635 | $($(target)_LIBPATH)\
|
|---|
| 2636 | $(foreach sdk, $($(target)_SDKS.$(bld_trg).$(bld_trg_arch)) \
|
|---|
| 2637 | $($(target)_SDKS.$(bld_trg_arch)) \
|
|---|
| 2638 | $($(target)_SDKS.$(bld_trg)) \
|
|---|
| 2639 | $($(target)_SDKS.$(bld_type)) \
|
|---|
| 2640 | $($(target)_SDKS),\
|
|---|
| 2641 | $(SDK_$(sdk)_LIBPATH.$(bld_trg_cpu))\
|
|---|
| 2642 | $(SDK_$(sdk)_LIBPATH.$(bld_trg).$(bld_trg_arch))\
|
|---|
| 2643 | $(SDK_$(sdk)_LIBPATH.$(bld_trg_arch))\
|
|---|
| 2644 | $(SDK_$(sdk)_LIBPATH.$(bld_trg))\
|
|---|
| 2645 | $(SDK_$(sdk)_LIBPATH.$(bld_type))\
|
|---|
| 2646 | $(SDK_$(sdk)_LIBPATH))\
|
|---|
| 2647 | $(LIBPATH.$(bld_trg_cpu))\
|
|---|
| 2648 | $(LIBPATH.$(bld_trg).$(bld_trg_arch))\
|
|---|
| 2649 | $(LIBPATH.$(bld_trg_arch))\
|
|---|
| 2650 | $(LIBPATH.$(bld_trg))\
|
|---|
| 2651 | $(LIBPATH.$(bld_type))\
|
|---|
| 2652 | $(LIBPATH)\
|
|---|
| 2653 | $(foreach sdk, $(SDKS.$(bld_trg).$(bld_trg_arch)) \
|
|---|
| 2654 | $(SDKS.$(bld_trg_arch)) \
|
|---|
| 2655 | $(SDKS.$(bld_trg)) \
|
|---|
| 2656 | $(SDKS.$(bld_type)) \
|
|---|
| 2657 | $(SDKS),\
|
|---|
| 2658 | $(SDK_$(sdk)_LIBPATH.$(bld_trg_cpu))\
|
|---|
| 2659 | $(SDK_$(sdk)_LIBPATH.$(bld_trg).$(bld_trg_arch))\
|
|---|
| 2660 | $(SDK_$(sdk)_LIBPATH.$(bld_trg_arch))\
|
|---|
| 2661 | $(SDK_$(sdk)_LIBPATH.$(bld_trg))\
|
|---|
| 2662 | $(SDK_$(sdk)_LIBPATH.$(bld_type))\
|
|---|
| 2663 | $(SDK_$(sdk)_LIBPATH))\
|
|---|
| 2664 | $(TOOL_$(tool)_LIBPATH.$(bld_trg_cpu))\
|
|---|
| 2665 | $(TOOL_$(tool)_LIBPATH.$(bld_trg).$(bld_trg_arch))\
|
|---|
| 2666 | $(TOOL_$(tool)_LIBPATH.$(bld_trg_arch))\
|
|---|
| 2667 | $(TOOL_$(tool)_LIBPATH.$(bld_trg))\
|
|---|
| 2668 | $(TOOL_$(tool)_LIBPATH.$(bld_type))\
|
|---|
| 2669 | $(TOOL_$(tool)_LIBPATH)
|
|---|
| 2670 | local dirdep := $(call DIRDEP,$(dir $(out)))
|
|---|
| 2671 | local deps := \
|
|---|
| 2672 | $($(target)_DEPS.$(bld_trg_cpu)) \
|
|---|
| 2673 | $($(target)_DEPS.$(bld_trg).$(bld_trg_arch).$(bld_type)) \
|
|---|
| 2674 | $($(target)_DEPS.$(bld_trg).$(bld_trg_arch)) \
|
|---|
| 2675 | $($(target)_DEPS.$(bld_trg).$(bld_type)) \
|
|---|
| 2676 | $($(target)_DEPS.$(bld_trg_arch)) \
|
|---|
| 2677 | $($(target)_DEPS.$(bld_trg)) \
|
|---|
| 2678 | $($(target)_DEPS.$(bld_type)) \
|
|---|
| 2679 | $($(target)_DEPS) \
|
|---|
| 2680 | $($(target)_LNK_DEPS.$(bld_trg_cpu)) \
|
|---|
| 2681 | $($(target)_LNK_DEPS.$(bld_trg).$(bld_trg_arch).$(bld_type)) \
|
|---|
| 2682 | $($(target)_LNK_DEPS.$(bld_trg).$(bld_trg_arch)) \
|
|---|
| 2683 | $($(target)_LNK_DEPS.$(bld_trg).$(bld_type)) \
|
|---|
| 2684 | $($(target)_LNK_DEPS.$(bld_trg_arch)) \
|
|---|
| 2685 | $($(target)_LNK_DEPS.$(bld_trg)) \
|
|---|
| 2686 | $($(target)_LNK_DEPS.$(bld_type)) \
|
|---|
| 2687 | $($(target)_LNK_DEPS)
|
|---|
| 2688 | local orderdeps := \
|
|---|
| 2689 | $($(target)_ORDERDEPS.$(bld_trg_cpu)) \
|
|---|
| 2690 | $($(target)_ORDERDEPS.$(bld_trg).$(bld_trg_arch).$(bld_type)) \
|
|---|
| 2691 | $($(target)_ORDERDEPS.$(bld_trg).$(bld_trg_arch)) \
|
|---|
| 2692 | $($(target)_ORDERDEPS.$(bld_trg).$(bld_type)) \
|
|---|
| 2693 | $($(target)_ORDERDEPS.$(bld_trg_arch)) \
|
|---|
| 2694 | $($(target)_ORDERDEPS.$(bld_trg)) \
|
|---|
| 2695 | $($(target)_ORDERDEPS.$(bld_type)) \
|
|---|
| 2696 | $($(target)_ORDERDEPS) \
|
|---|
| 2697 | $($(target)_LNK_ORDERDEPS.$(bld_trg_cpu)) \
|
|---|
| 2698 | $($(target)_LNK_ORDERDEPS.$(bld_trg).$(bld_trg_arch).$(bld_type)) \
|
|---|
| 2699 | $($(target)_LNK_ORDERDEPS.$(bld_trg).$(bld_trg_arch)) \
|
|---|
| 2700 | $($(target)_LNK_ORDERDEPS.$(bld_trg).$(bld_type)) \
|
|---|
| 2701 | $($(target)_LNK_ORDERDEPS.$(bld_trg_arch)) \
|
|---|
| 2702 | $($(target)_LNK_ORDERDEPS.$(bld_trg)) \
|
|---|
| 2703 | $($(target)_LNK_ORDERDEPS.$(bld_type)) \
|
|---|
| 2704 | $($(target)_LNK_ORDERDEPS)
|
|---|
| 2705 |
|
|---|
| 2706 | # Adjust paths if we got a default path.
|
|---|
| 2707 | ifneq ($(defpath),)
|
|---|
| 2708 | local libpath := $(abspathex $(libpath),$(defpath))
|
|---|
| 2709 | $(target)_OBJS_ := $(abspathex $($(target)_OBJS_),$(defpath))
|
|---|
| 2710 | local deps := $(abspathex $(deps),$(defpath))
|
|---|
| 2711 | local orderdeps := $(abspathex $(orderdeps),$(defpath))
|
|---|
| 2712 | othersrc := $(abspathex $(othersrc),$(defpath))
|
|---|
| 2713 | # libs are not subject to this because of the the -l<lib> stuff. Use $(<target>_DEFPATH)/lib if relative to current dir!
|
|---|
| 2714 | endif
|
|---|
| 2715 |
|
|---|
| 2716 | # Custom pre-link actions.
|
|---|
| 2717 | ifdef $(target)_PRE_CMDS.$(bld_trg).$(bld_trg_arch).$(bld_type)
|
|---|
| 2718 | local pre_cmds := $($(target)_PRE_CMDS.$(bld_trg).$(bld_trg_arch).$(bld_type))
|
|---|
| 2719 | else ifdef $(target)_PRE_CMDS.$(bld_trg).$(bld_trg_arch)
|
|---|
| 2720 | local pre_cmds := $($(target)_PRE_CMDS.$(bld_trg).$(bld_trg_arch))
|
|---|
| 2721 | else ifdef $(target)_PRE_CMDS.$(bld_trg).$(bld_type)
|
|---|
| 2722 | local pre_cmds := $($(target)_PRE_CMDS.$(bld_trg).$(bld_type))
|
|---|
| 2723 | else ifdef $(target)_PRE_CMDS.$(bld_trg_arch)
|
|---|
| 2724 | local pre_cmds := $($(target)_PRE_CMDS.$(bld_trg_arch))
|
|---|
| 2725 | else ifdef $(target)_PRE_CMDS.$(bld_trg)
|
|---|
| 2726 | local pre_cmds := $($(target)_PRE_CMDS.$(bld_trg))
|
|---|
| 2727 | else ifdef $(target)_PRE_CMDS.$(bld_type)
|
|---|
| 2728 | local pre_cmds := $($(target)_PRE_CMDS.$(bld_type))
|
|---|
| 2729 | else ifdef $(target)_PRE_CMDS
|
|---|
| 2730 | local pre_cmds := $($(target)_PRE_CMDS)
|
|---|
| 2731 | else ifdef PRE_CMDS.$(bld_trg).$(bld_trg_arch).$(bld_type)
|
|---|
| 2732 | local pre_cmds := $(PRE_CMDS.$(bld_trg).$(bld_trg_arch).$(bld_type))
|
|---|
| 2733 | else ifdef PRE_CMDS.$(bld_trg).$(bld_trg_arch)
|
|---|
| 2734 | local pre_cmds := $(PRE_CMDS.$(bld_trg).$(bld_trg_arch))
|
|---|
| 2735 | else ifdef PRE_CMDS.$(bld_trg).$(bld_type)
|
|---|
| 2736 | local pre_cmds := $(PRE_CMDS.$(bld_trg).$(bld_type))
|
|---|
| 2737 | else ifdef PRE_CMDS.$(bld_trg_arch)
|
|---|
| 2738 | local pre_cmds := $(PRE_CMDS.$(bld_trg_arch))
|
|---|
| 2739 | else ifdef PRE_CMDS.$(bld_trg)
|
|---|
| 2740 | local pre_cmds := $(PRE_CMDS.$(bld_trg))
|
|---|
| 2741 | else ifdef PRE_CMDS.$(bld_type)
|
|---|
| 2742 | local pre_cmds := $(PRE_CMDS.$(bld_type))
|
|---|
| 2743 | else
|
|---|
| 2744 | local pre_cmds := $(PRE_CMDS)
|
|---|
| 2745 | endif
|
|---|
| 2746 |
|
|---|
| 2747 | # Custom post-link actions.
|
|---|
| 2748 | ifdef $(target)_POST_CMDS.$(bld_trg).$(bld_trg_arch).$(bld_type)
|
|---|
| 2749 | local post_cmds := $($(target)_POST_CMDS.$(bld_trg).$(bld_trg_arch).$(bld_type))
|
|---|
| 2750 | else ifdef $(target)_POST_CMDS.$(bld_trg).$(bld_trg_arch)
|
|---|
| 2751 | local post_cmds := $($(target)_POST_CMDS.$(bld_trg).$(bld_trg_arch))
|
|---|
| 2752 | else ifdef $(target)_POST_CMDS.$(bld_trg).$(bld_type)
|
|---|
| 2753 | local post_cmds := $($(target)_POST_CMDS.$(bld_trg).$(bld_type))
|
|---|
| 2754 | else ifdef $(target)_POST_CMDS.$(bld_trg_arch)
|
|---|
| 2755 | local post_cmds := $($(target)_POST_CMDS.$(bld_trg_arch))
|
|---|
| 2756 | else ifdef $(target)_POST_CMDS.$(bld_trg)
|
|---|
| 2757 | local post_cmds := $($(target)_POST_CMDS.$(bld_trg))
|
|---|
| 2758 | else ifdef $(target)_POST_CMDS.$(bld_type)
|
|---|
| 2759 | local post_cmds := $($(target)_POST_CMDS.$(bld_type))
|
|---|
| 2760 | else ifdef $(target)_POST_CMDS
|
|---|
| 2761 | local post_cmds := $($(target)_POST_CMDS)
|
|---|
| 2762 | else ifdef POST_CMDS.$(bld_trg).$(bld_trg_arch).$(bld_type)
|
|---|
| 2763 | local post_cmds := $(POST_CMDS.$(bld_trg).$(bld_trg_arch).$(bld_type))
|
|---|
| 2764 | else ifdef POST_CMDS.$(bld_trg).$(bld_trg_arch)
|
|---|
| 2765 | local post_cmds := $(POST_CMDS.$(bld_trg).$(bld_trg_arch))
|
|---|
| 2766 | else ifdef POST_CMDS.$(bld_trg).$(bld_type)
|
|---|
| 2767 | local post_cmds := $(POST_CMDS.$(bld_trg).$(bld_type))
|
|---|
| 2768 | else ifdef POST_CMDS.$(bld_trg_arch)
|
|---|
| 2769 | local post_cmds := $(POST_CMDS.$(bld_trg_arch))
|
|---|
| 2770 | else ifdef POST_CMDS.$(bld_trg)
|
|---|
| 2771 | local post_cmds := $(POST_CMDS.$(bld_trg))
|
|---|
| 2772 | else ifdef POST_CMDS.$(bld_type)
|
|---|
| 2773 | local post_cmds := $(POST_CMDS.$(bld_type))
|
|---|
| 2774 | else
|
|---|
| 2775 | local post_cmds := $(POST_CMDS)
|
|---|
| 2776 | endif
|
|---|
| 2777 |
|
|---|
| 2778 | # eliminate this guy?
|
|---|
| 2779 | local objs = $($(target)_OBJS_)
|
|---|
| 2780 |
|
|---|
| 2781 | # installation targets
|
|---|
| 2782 | ifeq ($(strip $($(target)_NOINST) $($(target)_NOINST.$(bld_trg)) $($(target)_NOINST.$(bld_trg).$(bld_trg_arch)) $($(target)_NOINST.$(bld_trg).$(bld_trg_arch).$(bld_type)) $($(target)_NOINST.$(bld_trg_arch)) $($(target)_NOINST.$(bld_trg_cpu)) $($(target)_NOINST.$(bld_trg_type))),)
|
|---|
| 2783 | ifneq ($(strip $($(target)_INST.$(bld_trg).$(bld_trg_arch).$(bld_type))),)
|
|---|
| 2784 | local inst := $(addprefix $(PATH_INS)/,$($(target)_INST.$(bld_trg).$(bld_trg_arch).$(bld_type)))
|
|---|
| 2785 | else ifneq ($(strip $($(target)_INST.$(bld_trg).$(bld_trg_arch))),)
|
|---|
| 2786 | local inst := $(addprefix $(PATH_INS)/,$($(target)_INST.$(bld_trg).$(bld_trg_arch)))
|
|---|
| 2787 | else ifneq ($(strip $($(target)_INST.$(bld_trg).$(bld_type))),)
|
|---|
| 2788 | local inst := $(addprefix $(PATH_INS)/,$($(target)_INST.$(bld_trg).$(bld_type)))
|
|---|
| 2789 | else ifneq ($(strip $($(target)_INST.$(bld_trg_arch))),)
|
|---|
| 2790 | local inst := $(addprefix $(PATH_INS)/,$($(target)_INST.$(bld_trg_arch)))
|
|---|
| 2791 | else ifneq ($(strip $($(target)_INST.$(bld_trg))),)
|
|---|
| 2792 | local inst := $(addprefix $(PATH_INS)/,$($(target)_INST.$(bld_trg)))
|
|---|
| 2793 | else ifneq ($(strip $($(target)_INST.$(bld_type))),)
|
|---|
| 2794 | local inst := $(addprefix $(PATH_INS)/,$($(target)_INST.$(bld_type)))
|
|---|
| 2795 | else ifneq ($(strip $($(target)_INST)),)
|
|---|
| 2796 | local inst := $(addprefix $(PATH_INS)/,$($(target)_INST))
|
|---|
| 2797 | else
|
|---|
| 2798 | local inst := $(definst)/
|
|---|
| 2799 | endif
|
|---|
| 2800 | INSTARGET_$(target) := $(patsubst %/,%/$(notdir $(out)),$(inst))
|
|---|
| 2801 | ifdef KBUILD_DO_AUTO_INSTALL
|
|---|
| 2802 | $(typevar) += $(INSTARGET_$(target))
|
|---|
| 2803 | else
|
|---|
| 2804 | $(typevar) += $(out)
|
|---|
| 2805 | endif
|
|---|
| 2806 | # generate the install rule
|
|---|
| 2807 | $(eval $(def_link_install_rule))
|
|---|
| 2808 |
|
|---|
| 2809 | else # NOINST
|
|---|
| 2810 | INSTARGET_$(target) :=
|
|---|
| 2811 | $(typevar) += $(out)
|
|---|
| 2812 | endif # NOINST
|
|---|
| 2813 |
|
|---|
| 2814 | # dependency file
|
|---|
| 2815 | local dep := $(outbase)$(SUFF_DEP)
|
|---|
| 2816 | ifndef NO_LINK_CMDS_DEPS
|
|---|
| 2817 | ifdef KB_HAVE_INCLUDEDEP_QUEUE
|
|---|
| 2818 | includedep-queue $(dep)
|
|---|
| 2819 | else
|
|---|
| 2820 | includedep $(dep)
|
|---|
| 2821 | endif
|
|---|
| 2822 | endif
|
|---|
| 2823 |
|
|---|
| 2824 | # check that the tool is defined.
|
|---|
| 2825 | ifndef TOOL_$(tool)_$(tool_do)_CMDS
|
|---|
| 2826 | $(warning kBuild: tools: \
|
|---|
| 2827 | 1 $($(target)_$(source)TOOL.$(bld_trg).$(bld_trg_arch)) \
|
|---|
| 2828 | 2 $($(target)_$(source)TOOL.$(bld_trg)) \
|
|---|
| 2829 | 3 $($(target)_$(source)TOOL) \
|
|---|
| 2830 | 4 $($(target)_TOOL.$(bld_trg).$(bld_trg_arch)) \
|
|---|
| 2831 | 5 $($(target)_TOOL.$(bld_trg)) \
|
|---|
| 2832 | 6 $($(target)_TOOL) \
|
|---|
| 2833 | 7 $($(source)TOOL.$(bld_trg).$(bld_trg_arch)) \
|
|---|
| 2834 | 8 $($(source)TOOL.$(bld_trg)) \
|
|---|
| 2835 | 9 $($(source)TOOL) \
|
|---|
| 2836 | 10 $(TOOL.$(bld_trg).$(bld_trg_arch)) \
|
|---|
| 2837 | 11 $(TOOL.$(bld_trg)) \
|
|---|
| 2838 | 12 $(TOOL) )
|
|---|
| 2839 | $(error kBuild: TOOL_$(tool)_$(tool_do)_CMDS isn't defined! target=$(target) )
|
|---|
| 2840 | endif
|
|---|
| 2841 |
|
|---|
| 2842 | # call the tool
|
|---|
| 2843 | local cmds := $(TOOL_$(tool)_$(tool_do)_CMDS)
|
|---|
| 2844 | ifneq ($(pre_cmds),)
|
|---|
| 2845 | local cmds := $(TAB)$(pre_cmds)$(NL)$(TAB)$(cmds)
|
|---|
| 2846 | endif
|
|---|
| 2847 | ifneq ($(post_cmds),)
|
|---|
| 2848 | local cmds := $(cmds)$(NL)$(TAB)$(post_cmds)
|
|---|
| 2849 | endif
|
|---|
| 2850 | $(target)_OUTPUT_ := $(TOOL_$(tool)_$(tool_do)_OUTPUT)
|
|---|
| 2851 | $(target)_OUTPUT_MAYBE_ := $(TOOL_$(tool)_$(tool_do)_OUTPUT_MAYBE)
|
|---|
| 2852 | $(target)_DEPEND_ := $(TOOL_$(tool)_$(tool_do)_DEPEND) $(deps) $($(target)_OBJS_)
|
|---|
| 2853 | $(target)_DEPORD_ := $(TOOL_$(tool)_$(tool_do)_DEPORD) $(dirdep) $(orderdeps)
|
|---|
| 2854 |
|
|---|
| 2855 | # generate the link rule.
|
|---|
| 2856 | $(eval $(def_link_rule))
|
|---|
| 2857 |
|
|---|
| 2858 |
|
|---|
| 2859 | # Update globals.
|
|---|
| 2860 | _OBJS += $($(target)_OBJS_)
|
|---|
| 2861 | _OUT_FILES += $($(target)_OUTPUT_) $(out)
|
|---|
| 2862 | _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))
|
|---|
| 2863 | _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))
|
|---|
| 2864 | _INSTALLS_FILES += $(INSTARGET_$(target))
|
|---|
| 2865 |
|
|---|
| 2866 | endef # def_link_common
|
|---|
| 2867 | $(eval-opt-var def_link_common)
|
|---|
| 2868 |
|
|---|
| 2869 |
|
|---|
| 2870 | #
|
|---|
| 2871 | # BLDPROGS
|
|---|
| 2872 | #
|
|---|
| 2873 |
|
|---|
| 2874 | ## Build program (one).
|
|---|
| 2875 | # @param $(target) Normalized target (program) name.
|
|---|
| 2876 | define def_bldprog
|
|---|
| 2877 |
|
|---|
| 2878 | # set NOINST if not forced installation.
|
|---|
| 2879 | ifndef $(target)_INST
|
|---|
| 2880 | $(target)_NOINST := 1
|
|---|
| 2881 | endif
|
|---|
| 2882 |
|
|---|
| 2883 | # do the usual stuff.
|
|---|
| 2884 | $(evalval def_link_common)
|
|---|
| 2885 |
|
|---|
| 2886 | endef
|
|---|
| 2887 |
|
|---|
| 2888 | # Process build programs.
|
|---|
| 2889 | EXT := EXE
|
|---|
| 2890 | EXTPRE := HOST
|
|---|
| 2891 | tool_do := LINK_PROGRAM
|
|---|
| 2892 | definst := $(PATH_BIN)
|
|---|
| 2893 | typevar := _BLDPROGS
|
|---|
| 2894 | mode := 0755
|
|---|
| 2895 | bld_trg_base_var := PLATFORM
|
|---|
| 2896 | $(foreach target, $(_ALL_BLDPROGS), $(evalval def_bldprog))
|
|---|
| 2897 |
|
|---|
| 2898 | ifdef KBUILD_PROFILE_SELF
|
|---|
| 2899 | $(evalcall def_profile_self, done build program targets)
|
|---|
| 2900 | endif
|
|---|
| 2901 |
|
|---|
| 2902 |
|
|---|
| 2903 | #
|
|---|
| 2904 | # DLLS
|
|---|
| 2905 | #
|
|---|
| 2906 |
|
|---|
| 2907 | # Process dlls
|
|---|
| 2908 | EXT := DLL
|
|---|
| 2909 | EXTPRE :=
|
|---|
| 2910 | tool_do := LINK_DLL
|
|---|
| 2911 | definst := $(PATH_DLL)
|
|---|
| 2912 | typevar := _DLLS
|
|---|
| 2913 | mode := 0644
|
|---|
| 2914 | bld_trg_base_var := TARGET
|
|---|
| 2915 | $(foreach target, $(_ALL_DLLS), $(evalval def_link_common))
|
|---|
| 2916 |
|
|---|
| 2917 | ifdef KBUILD_PROFILE_SELF
|
|---|
| 2918 | $(evalcall def_profile_self, done dll targets)
|
|---|
| 2919 | endif
|
|---|
| 2920 |
|
|---|
| 2921 |
|
|---|
| 2922 | #
|
|---|
| 2923 | # IMPORT LIBRARIES
|
|---|
| 2924 | #
|
|---|
| 2925 | # - On OS/2 and windows these are libraries.
|
|---|
| 2926 | # - On other platforms they are fake DLLs.
|
|---|
| 2927 | #
|
|---|
| 2928 | EXTPRE :=
|
|---|
| 2929 | typevar := _IMPORT_LIBS
|
|---|
| 2930 | mode := 0644
|
|---|
| 2931 | bld_trg_base_var := TARGET
|
|---|
| 2932 | ifeq ($(filter-out nt os2 win win64 win32,$(KBUILD_TARGET)),)
|
|---|
| 2933 | EXT := LIB
|
|---|
| 2934 | tool_do := LINK_LIBRARY
|
|---|
| 2935 | definst := $(PATH_LIB)
|
|---|
| 2936 | $(foreach target, $(_ALL_IMPORT_LIBS), $(evalval def_lib))
|
|---|
| 2937 | else
|
|---|
| 2938 | EXT := DLL
|
|---|
| 2939 | tool_do := LINK_DLL
|
|---|
| 2940 | definst := $(PATH_DLL)
|
|---|
| 2941 | $(foreach target, $(_ALL_IMPORT_LIBS), $(evalval def_link_common))
|
|---|
| 2942 | endif
|
|---|
| 2943 |
|
|---|
| 2944 | ifdef KBUILD_PROFILE_SELF
|
|---|
| 2945 | $(evalcall def_profile_self, done import library targets)
|
|---|
| 2946 | endif
|
|---|
| 2947 |
|
|---|
| 2948 |
|
|---|
| 2949 | #
|
|---|
| 2950 | # PROGRAMS
|
|---|
| 2951 | #
|
|---|
| 2952 |
|
|---|
| 2953 | # Process programs
|
|---|
| 2954 | EXT := EXE
|
|---|
| 2955 | EXTPRE :=
|
|---|
| 2956 | tool_do := LINK_PROGRAM
|
|---|
| 2957 | definst := $(PATH_BIN)
|
|---|
| 2958 | typevar := _PROGRAMS
|
|---|
| 2959 | mode := 0755
|
|---|
| 2960 | bld_trg_base_var := TARGET
|
|---|
| 2961 | $(foreach target, $(_ALL_PROGRAMS), $(evalval def_link_common))
|
|---|
| 2962 |
|
|---|
| 2963 | ifdef KBUILD_PROFILE_SELF
|
|---|
| 2964 | $(evalcall def_profile_self, done program targets)
|
|---|
| 2965 | endif
|
|---|
| 2966 |
|
|---|
| 2967 |
|
|---|
| 2968 | #
|
|---|
| 2969 | # SYSMODS
|
|---|
| 2970 | #
|
|---|
| 2971 |
|
|---|
| 2972 | # Process sysmods
|
|---|
| 2973 | EXT := SYS
|
|---|
| 2974 | EXTPRE :=
|
|---|
| 2975 | tool_do := LINK_SYSMOD
|
|---|
| 2976 | definst := $(PATH_SYS)
|
|---|
| 2977 | typevar := _SYSMODS
|
|---|
| 2978 | mode := 0644
|
|---|
| 2979 | bld_trg_base_var := TARGET
|
|---|
| 2980 | $(foreach target, $(_ALL_SYSMODS), $(evalval def_link_common))
|
|---|
| 2981 |
|
|---|
| 2982 | ifdef KBUILD_PROFILE_SELF
|
|---|
| 2983 | $(evalcall def_profile_self, done sysmod targets)
|
|---|
| 2984 | endif
|
|---|
| 2985 |
|
|---|
| 2986 |
|
|---|
| 2987 | #
|
|---|
| 2988 | # OTHERS
|
|---|
| 2989 | #
|
|---|
| 2990 | _OTHERS = $(OTHERS) $(OTHERS.$(KBUILD_TARGET)) $(OTHERS.$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH))
|
|---|
| 2991 |
|
|---|
| 2992 |
|
|---|
| 2993 | #
|
|---|
| 2994 | # INSTALLS
|
|---|
| 2995 | #
|
|---|
| 2996 |
|
|---|
| 2997 | ## generate the install rule
|
|---|
| 2998 | define def_install_src_rule
|
|---|
| 2999 | # the install rule
|
|---|
| 3000 | $(insdst) : $(srcsrc) | $(call DIRDEP,$(dir $(insdst)))
|
|---|
| 3001 | %$$(call MSG_INST_FILE,$(srcsrc),$(insdst))
|
|---|
| 3002 | $$(QUIET)$(inscmd)
|
|---|
| 3003 | endef
|
|---|
| 3004 | $(eval-opt-var def_install_src_rule)
|
|---|
| 3005 |
|
|---|
| 3006 | ## install one file
|
|---|
| 3007 | define def_install_src
|
|---|
| 3008 |
|
|---|
| 3009 | # deal with '=>' in the source file name.
|
|---|
| 3010 | local srcdst := $(subst =>, ,$(src))
|
|---|
| 3011 | local srcsrc := $(firstword $(srcdst))
|
|---|
| 3012 | local srcdstdir := $(dir $(word 2,$(srcdst)))
|
|---|
| 3013 | local srcdst := $(word $(words $(srcdst)),$(srcdst))
|
|---|
| 3014 |
|
|---|
| 3015 | # _INSTFUN
|
|---|
| 3016 | ifdef $(srcsrc)_INSTFUN
|
|---|
| 3017 | local instfun := $(srcsrc)_INSTFUN
|
|---|
| 3018 | else ifdef $(target)_INSTFUN
|
|---|
| 3019 | local instfun := $(target)_INSTFUN
|
|---|
| 3020 | else
|
|---|
| 3021 | local instfun := _INSTALL_FILE
|
|---|
| 3022 | endif
|
|---|
| 3023 |
|
|---|
| 3024 | # _INST
|
|---|
| 3025 | ifdef $(srcsrc)_INST
|
|---|
| 3026 | local inst := $(patsubst %/,%,$($(srcsrc)_INST))/$(dir $(srcdstdir))
|
|---|
| 3027 | else ifdef $(target)_INST
|
|---|
| 3028 | local inst := $(patsubst %/,%,$($(target)_INST))/$(dir $(srcdstdir))
|
|---|
| 3029 | else
|
|---|
| 3030 | local inst := $(dir $(srcdstdir))
|
|---|
| 3031 | endif
|
|---|
| 3032 |
|
|---|
| 3033 | # calc target
|
|---|
| 3034 | local insdst := $(call $(instfun),$(srcdst),$(target),$(inst),$(PATH_INS))
|
|---|
| 3035 | #$(warning instfun=$(instfun) srcdst=$(srcdst) target=$(target) inst=$(inst) => insdst=$(insdst))
|
|---|
| 3036 |
|
|---|
| 3037 | # mode, uid and gid
|
|---|
| 3038 | local mode := $(firstword \
|
|---|
| 3039 | $($(target)_$(srcsrc)_MODE.$(bld_trg).$(bld_trg_arch)) \
|
|---|
| 3040 | $($(target)_$(srcsrc)_MODE.$(bld_trg)) \
|
|---|
| 3041 | $($(target)_$(srcsrc)_MODE) \
|
|---|
| 3042 | $($(target)_$(srcdst)_MODE.$(bld_trg).$(bld_trg_arch)) \
|
|---|
| 3043 | $($(target)_$(srcdst)_MODE.$(bld_trg)) \
|
|---|
| 3044 | $($(target)_$(srcdst)_MODE) \
|
|---|
| 3045 | $($(srcsrc)_MODE.$(bld_trg).$(bld_trg_arch)) \
|
|---|
| 3046 | $($(srcsrc)_MODE.$(bld_trg)) \
|
|---|
| 3047 | $($(srcsrc)_MODE) \
|
|---|
| 3048 | $($(srcdst)_MODE.$(bld_trg).$(bld_trg_arch)) \
|
|---|
| 3049 | $($(srcdst)_MODE.$(bld_trg)) \
|
|---|
| 3050 | $($(srcdst)_MODE) \
|
|---|
| 3051 | $($(target)_MODE.$(bld_trg).$(bld_trg_arch)) \
|
|---|
| 3052 | $($(target)_MODE.$(bld_trg)) \
|
|---|
| 3053 | $($(target)_MODE))
|
|---|
| 3054 | local uid := $(firstword \
|
|---|
| 3055 | $($(target)_$(srcsrc)_UID.$(bld_trg).$(bld_trg_arch)) \
|
|---|
| 3056 | $($(target)_$(srcsrc)_UID.$(bld_trg)) \
|
|---|
| 3057 | $($(target)_$(srcsrc)_UID) \
|
|---|
| 3058 | $($(target)_$(srcdst)_UID.$(bld_trg).$(bld_trg_arch)) \
|
|---|
| 3059 | $($(target)_$(srcdst)_UID.$(bld_trg)) \
|
|---|
| 3060 | $($(target)_$(srcdst)_UID) \
|
|---|
| 3061 | $($(srcsrc)_UID.$(bld_trg).$(bld_trg_arch)) \
|
|---|
| 3062 | $($(srcsrc)_UID.$(bld_trg)) \
|
|---|
| 3063 | $($(srcsrc)_UID) \
|
|---|
| 3064 | $($(srcdst)_UID.$(bld_trg).$(bld_trg_arch)) \
|
|---|
| 3065 | $($(srcdst)_UID.$(bld_trg)) \
|
|---|
| 3066 | $($(srcdst)_UID) \
|
|---|
| 3067 | $($(target)_UID.$(bld_trg).$(bld_trg_arch)) \
|
|---|
| 3068 | $($(target)_UID.$(bld_trg)) \
|
|---|
| 3069 | $($(target)_UID))
|
|---|
| 3070 | local gid := $(firstword \
|
|---|
| 3071 | $($(target)_$(srcsrc)_GID.$(bld_trg).$(bld_trg_arch)) \
|
|---|
| 3072 | $($(target)_$(srcsrc)_GID.$(bld_trg)) \
|
|---|
| 3073 | $($(target)_$(srcsrc)_GID) \
|
|---|
| 3074 | $($(target)_$(srcdst)_GID.$(bld_trg).$(bld_trg_arch)) \
|
|---|
| 3075 | $($(target)_$(srcdst)_GID.$(bld_trg)) \
|
|---|
| 3076 | $($(target)_$(srcdst)_GID) \
|
|---|
| 3077 | $($(srcsrc)_GID.$(bld_trg).$(bld_trg_arch)) \
|
|---|
| 3078 | $($(srcsrc)_GID.$(bld_trg)) \
|
|---|
| 3079 | $($(srcsrc)_GID) \
|
|---|
| 3080 | $($(srcdst)_GID.$(bld_trg).$(bld_trg_arch)) \
|
|---|
| 3081 | $($(srcdst)_GID.$(bld_trg)) \
|
|---|
| 3082 | $($(srcdst)_GID) \
|
|---|
| 3083 | $($(target)_GID.$(bld_trg).$(bld_trg_arch)) \
|
|---|
| 3084 | $($(target)_GID.$(bld_trg)) \
|
|---|
| 3085 | $($(target)_GID))
|
|---|
| 3086 | local flags := \
|
|---|
| 3087 | $($(target)_IFFLAGS) \
|
|---|
| 3088 | $($(target)_IFFLAGS.$(bld_trg)) \
|
|---|
| 3089 | $($(target)_IFFLAGS.$(bld_trg).$(bld_trg_arch)) \
|
|---|
| 3090 | $($(srcdst)_IFFLAGS) \
|
|---|
| 3091 | $($(srcdst)_IFFLAGS.$(bld_trg)) \
|
|---|
| 3092 | $($(srcdst)_IFFLAGS.$(bld_trg).$(bld_trg_arch)) \
|
|---|
| 3093 | $($(srcsrc)_IFFLAGS) \
|
|---|
| 3094 | $($(srcsrc)_IFFLAGS.$(bld_trg)) \
|
|---|
| 3095 | $($(srcsrc)_IFFLAGS.$(bld_trg).$(bld_trg_arch)) \
|
|---|
| 3096 | $($(target)_$(srcdst)_IFFLAGS) \
|
|---|
| 3097 | $($(target)_$(srcdst)_IFFLAGS.$(bld_trg)) \
|
|---|
| 3098 | $($(target)_$(srcdst)_IFFLAGS.$(bld_trg).$(bld_trg_arch)) \
|
|---|
| 3099 | $($(target)_$(srcsrc)_IFFLAGS) \
|
|---|
| 3100 | $($(target)_$(srcsrc)_IFFLAGS.$(bld_trg)) \
|
|---|
| 3101 | $($(target)_$(srcsrc)_IFFLAGS.$(bld_trg).$(bld_trg_arch))
|
|---|
| 3102 | clean_files += \
|
|---|
| 3103 | $($(srcdst)_CLEAN) \
|
|---|
| 3104 | $($(srcdst)_CLEAN.$(bld_trg)) \
|
|---|
| 3105 | $($(srcdst)_CLEAN.$(bld_trg).$(bld_trg_arch)) \
|
|---|
| 3106 | $($(srcsrc)_CLEAN) \
|
|---|
| 3107 | $($(srcsrc)_CLEAN.$(bld_trg)) \
|
|---|
| 3108 | $($(srcsrc)_CLEAN.$(bld_trg).$(bld_trg_arch)) \
|
|---|
| 3109 | $($(target)_$(srcdst)_CLEAN) \
|
|---|
| 3110 | $($(target)_$(srcdst)_CLEAN.$(bld_trg)) \
|
|---|
| 3111 | $($(target)_$(srcdst)_CLEAN.$(bld_trg).$(bld_trg_arch)) \
|
|---|
| 3112 | $($(target)_$(srcsrc)_CLEAN) \
|
|---|
| 3113 | $($(target)_$(srcsrc)_CLEAN.$(bld_trg)) \
|
|---|
| 3114 | $($(target)_$(srcsrc)_CLEAN.$(bld_trg).$(bld_trg_arch))
|
|---|
| 3115 |
|
|---|
| 3116 |
|
|---|
| 3117 | # Adjust the source if we got a default PATH. (This must be done this late!)
|
|---|
| 3118 | local defpath := $(firstword $($(target)_PATH) $($(target)_DEFPATH))
|
|---|
| 3119 | ifneq ($(defpath),)
|
|---|
| 3120 | local srcsrc := $(abspathex $(srcsrc),$(defpath))
|
|---|
| 3121 | endif
|
|---|
| 3122 |
|
|---|
| 3123 | # create the command
|
|---|
| 3124 | ifdef $(srcsrc)_INSTALLER
|
|---|
| 3125 | local inscmd := $(call $(srcsrc)_INSTALLER,$(srcsrc),$(insdst),$(target),$(flags))
|
|---|
| 3126 | else ifdef $(target)_INSTALLER
|
|---|
| 3127 | local inscmd := $(call $(target)_INSTALLER,$(srcsrc),$(insdst),$(target),$(flags))
|
|---|
| 3128 | else
|
|---|
| 3129 | local inscmd := $$(INSTALL)\
|
|---|
| 3130 | $(if $(uid),-o $(uid))\
|
|---|
| 3131 | $(if $(gid),-g $(gid))\
|
|---|
| 3132 | $(if $(mode),-m $(mode))\
|
|---|
| 3133 | $(flags) -- \
|
|---|
| 3134 | $(srcsrc) $(insdst)
|
|---|
| 3135 | endif
|
|---|
| 3136 |
|
|---|
| 3137 | # generate the rule (need double evaluation here)
|
|---|
| 3138 | $(eval $(def_install_src_rule))
|
|---|
| 3139 |
|
|---|
| 3140 | INSTARGET_$(target) += $(insdst)
|
|---|
| 3141 | endef # def_install_src
|
|---|
| 3142 | $(eval-opt-var def_install_src)
|
|---|
| 3143 |
|
|---|
| 3144 |
|
|---|
| 3145 | ## generate the symlink rule
|
|---|
| 3146 | define def_install_symlink_rule
|
|---|
| 3147 | # the install rule
|
|---|
| 3148 | $(insdst) : | $(call DIRDEP,$(dir $(insdst)))
|
|---|
| 3149 | %$$(call MSG_INST_SYM,$(insdst),$(symdst))
|
|---|
| 3150 | $$(QUIET)$$(RM) -f -- $$@
|
|---|
| 3151 | $$(QUIET)$$(LN_SYMLINK) $(symdst) $(insdst)
|
|---|
| 3152 | endef # def_install_symlink_rule
|
|---|
| 3153 | $(eval-opt-var def_install_symlink_rule)
|
|---|
| 3154 |
|
|---|
| 3155 | ## create one symlink
|
|---|
| 3156 | define def_install_symlink
|
|---|
| 3157 |
|
|---|
| 3158 | # deal with '=>' in the source file name.
|
|---|
| 3159 | local symdst := $(subst =>, ,$(src))
|
|---|
| 3160 | local symlnk := $(firstword $(symdst))
|
|---|
| 3161 | local symdst := $(word $(words $(symdst)),$(symdst))
|
|---|
| 3162 |
|
|---|
| 3163 | # _INSTFUN
|
|---|
| 3164 | ifdef $(symlnk)_INSTFUN
|
|---|
| 3165 | local instfun := $(symlnk)_INSTFUN
|
|---|
| 3166 | else ifdef $(target)_INSTFUN
|
|---|
| 3167 | local instfun := $(target)_INSTFUN
|
|---|
| 3168 | else
|
|---|
| 3169 | local instfun := _INSTALL_FILE
|
|---|
| 3170 | endif
|
|---|
| 3171 |
|
|---|
| 3172 | # _INST
|
|---|
| 3173 | ifdef $(symlnk)_INST
|
|---|
| 3174 | local inst := $(patsubst %/,%,$($(symlnk)_INST))/$(dir $(symlnk))
|
|---|
| 3175 | else ifdef $(target)_INST
|
|---|
| 3176 | local inst := $(patsubst %/,%,$($(target)_INST))/$(dir $(symlnk))
|
|---|
| 3177 | else
|
|---|
| 3178 | local inst := $(dir $(symlnk))
|
|---|
| 3179 | endif
|
|---|
| 3180 |
|
|---|
| 3181 | # calc target
|
|---|
| 3182 | local insdst := $(call $(instfun),$(symlnk),$(target),$(inst),$(PATH_INS))
|
|---|
| 3183 | #$(warning symlnk=$(symlnk) symdst=$(symdst) insdst=$(insdst) instfun=$(instfun) inst='$(inst)')
|
|---|
| 3184 |
|
|---|
| 3185 | # generate the rule (need double evaluation here)
|
|---|
| 3186 | $(eval $(def_install_symlink_rule))
|
|---|
| 3187 |
|
|---|
| 3188 | INSTARGET_$(target) += $(insdst)
|
|---|
| 3189 | endef # def_install_symlink
|
|---|
| 3190 | $(optmize def_install_symlink)
|
|---|
| 3191 |
|
|---|
| 3192 |
|
|---|
| 3193 | ## generate the install rule
|
|---|
| 3194 | define def_install_directory_rule
|
|---|
| 3195 | # the install rule
|
|---|
| 3196 | $(insdst):
|
|---|
| 3197 | %$$(call MSG_INST_DIR,$(insdst))
|
|---|
| 3198 | $$(QUIET)$$(INSTALL) -d \
|
|---|
| 3199 | $(if $(uid),-o $(uid))\
|
|---|
| 3200 | $(if $(gid),-g $(gid))\
|
|---|
| 3201 | $(if $(mode),-m $(mode))\
|
|---|
| 3202 | $(flags) -- \
|
|---|
| 3203 | $(insdst)
|
|---|
| 3204 |
|
|---|
| 3205 | .NOTPARALLEL: $(insdst)
|
|---|
| 3206 | endef # def_install_directory_rule
|
|---|
| 3207 | $(eval-opt-var def_install_directory_rule)
|
|---|
| 3208 |
|
|---|
| 3209 |
|
|---|
| 3210 | ## create one directory
|
|---|
| 3211 | define def_install_directory
|
|---|
| 3212 |
|
|---|
| 3213 | # _INST
|
|---|
| 3214 | ifdef $(directory)_INST
|
|---|
| 3215 | local inst := $(PATH_INS)/$(patsubst %/,%,$($(directory)_INST))
|
|---|
| 3216 | else ifdef $(target)_INST
|
|---|
| 3217 | local inst := $(PATH_INS)/$(patsubst %/,%,$($(target)_INST))
|
|---|
| 3218 | else
|
|---|
| 3219 | local inst := $(PATH_INS)
|
|---|
| 3220 | endif
|
|---|
| 3221 |
|
|---|
| 3222 | local mode := $(firstword \
|
|---|
| 3223 | $($(target)_$(directory)_MODE.$(bld_trg).$(bld_trg_arch)) \
|
|---|
| 3224 | $($(target)_$(directory)_MODE.$(bld_trg)) \
|
|---|
| 3225 | $($(target)_$(directory)_MODE) \
|
|---|
| 3226 | $($(directory)_MODE.$(bld_trg).$(bld_trg_arch)) \
|
|---|
| 3227 | $($(directory)_MODE.$(bld_trg)) \
|
|---|
| 3228 | $($(directory)_MODE) \
|
|---|
| 3229 | $($(target)_MODE.$(bld_trg).$(bld_trg_arch)) \
|
|---|
| 3230 | $($(target)_MODE.$(bld_trg)) \
|
|---|
| 3231 | $($(target)_MODE))
|
|---|
| 3232 | local uid := $(firstword \
|
|---|
| 3233 | $($(target)_$(directory)_UID.$(bld_trg).$(bld_trg_arch)) \
|
|---|
| 3234 | $($(target)_$(directory)_UID.$(bld_trg)) \
|
|---|
| 3235 | $($(target)_$(directory)_UID) \
|
|---|
| 3236 | $($(directory)_UID.$(bld_trg).$(bld_trg_arch)) \
|
|---|
| 3237 | $($(directory)_UID.$(bld_trg)) \
|
|---|
| 3238 | $($(directory)_UID) \
|
|---|
| 3239 | $($(target)_UID.$(bld_trg).$(bld_trg_arch)) \
|
|---|
| 3240 | $($(target)_UID.$(bld_trg)) \
|
|---|
| 3241 | $($(target)_UID))
|
|---|
| 3242 | local gid := $(firstword \
|
|---|
| 3243 | $($(target)_$(directory)_GID.$(bld_trg).$(bld_trg_arch)) \
|
|---|
| 3244 | $($(target)_$(directory)_GID.$(bld_trg)) \
|
|---|
| 3245 | $($(target)_$(directory)_GID) \
|
|---|
| 3246 | $($(directory)_GID.$(bld_trg).$(bld_trg_arch)) \
|
|---|
| 3247 | $($(directory)_GID.$(bld_trg)) \
|
|---|
| 3248 | $($(directory)_GID) \
|
|---|
| 3249 | $($(target)_GID.$(bld_trg).$(bld_trg_arch)) \
|
|---|
| 3250 | $($(target)_GID.$(bld_trg)) \
|
|---|
| 3251 | $($(target)_GID))
|
|---|
| 3252 | local flags := \
|
|---|
| 3253 | $($(target)_IDFLAGS)\
|
|---|
| 3254 | $($(target)_IDFLAGS.$(bld_trg)) \
|
|---|
| 3255 | $($(target)_IDFLAGS.$(bld_trg).$(bld_trg_arch)) \
|
|---|
| 3256 | $($(directory)_IDFLAGS) \
|
|---|
| 3257 | $($(directory)_IDFLAGS.$(bld_trg)) \
|
|---|
| 3258 | $($(directory)_IDFLAGS.$(bld_trg).$(bld_trg_arch)) \
|
|---|
| 3259 | $($(target)_$(directory)_IDFLAGS) \
|
|---|
| 3260 | $($(target)_$(directory)_IDFLAGS.$(bld_trg)) \
|
|---|
| 3261 | $($(target)_$(directory)_IDFLAGS.$(bld_trg).$(bld_trg_arch))
|
|---|
| 3262 |
|
|---|
| 3263 | local insdst := $(inst)/$(directory)/
|
|---|
| 3264 | #$(warning directory=$(directory) inst=$(inst) insdst=$(insdst) mode=$(mode) gid=$(gid) uid=$(uid))
|
|---|
| 3265 |
|
|---|
| 3266 | # generate the rule (need double evaluation here)
|
|---|
| 3267 | $(eval $(def_install_directory_rule))
|
|---|
| 3268 |
|
|---|
| 3269 | INSTARGET_DIRS_$(target) += $(insdst)
|
|---|
| 3270 | endef # def_install_directory
|
|---|
| 3271 | $(eval-opt-var def_install_directory)
|
|---|
| 3272 |
|
|---|
| 3273 |
|
|---|
| 3274 | ## process one install target.
|
|---|
| 3275 | define def_install
|
|---|
| 3276 | # the basics.
|
|---|
| 3277 | local bld_type := $(firstword $($(target)_BLD_TYPE) $(KBUILD_TYPE))
|
|---|
| 3278 | local bld_trg := $(firstword $($(target)_BLD_TRG) $(KBUILD_TARGET))
|
|---|
| 3279 | local bld_trg_arch:= $(firstword $($(target)_BLD_TRG_ARCH) $(KBUILD_TARGET_ARCH))
|
|---|
| 3280 | local bld_trg_cpu := $(firstword $($(target)_BLD_TRG_CPU) $(KBUILD_TARGET_CPU))
|
|---|
| 3281 |
|
|---|
| 3282 | INSTARGET_$(target) := $($(target)_GOALS)
|
|---|
| 3283 | INSTARGET_DIRS_$(target) :=
|
|---|
| 3284 | local outbase := $(call TARGET_BASE,$(target),$(target))
|
|---|
| 3285 | ifndef PATH_$(target)
|
|---|
| 3286 | PATH_$(target) := $(patsubst %/,%,$(dir $(outbase)))
|
|---|
| 3287 | else ifneq ($(PATH_$(target)),$(patsubst %/,%,$(dir $(outbase))))
|
|---|
| 3288 | $(error kBuild internal error: PATH_$(target)=$(PATH_$(target)) expected $(patsubst %/,%,$(dir $(outbase))))
|
|---|
| 3289 | endif
|
|---|
| 3290 |
|
|---|
| 3291 | local 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))
|
|---|
| 3292 |
|
|---|
| 3293 | $(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)), \
|
|---|
| 3294 | $(evalval def_install_directory))
|
|---|
| 3295 |
|
|---|
| 3296 | $(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)), \
|
|---|
| 3297 | $(evalval def_install_src))
|
|---|
| 3298 |
|
|---|
| 3299 | $(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)), \
|
|---|
| 3300 | $(evalval def_install_symlink))
|
|---|
| 3301 |
|
|---|
| 3302 | # the collection target
|
|---|
| 3303 | TARGET_$(target) := $(PATH_TARGET)/$(target).ins
|
|---|
| 3304 | $(TARGET_$(target)): $$(INSTARGET_$(target)) | $$(INSTARGET_DIRS_$(target)) $(call DIRDEP,$(PATH_TARGET))
|
|---|
| 3305 | @$(QUIET2)$(APPEND) $@
|
|---|
| 3306 |
|
|---|
| 3307 | $(target): $$(TARGET_$(target))
|
|---|
| 3308 |
|
|---|
| 3309 | _INSTALLS += $(TARGET_$(target))
|
|---|
| 3310 | _INSTALLS_FILES += $(INSTARGET_$(target))
|
|---|
| 3311 | _INSTALLS_DIRS += $(INSTARGET_DIRS_$(target))
|
|---|
| 3312 | _CLEAN_FILES += $(clean_files)
|
|---|
| 3313 | _DIRS += $(PATH_$(target)) $($(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))
|
|---|
| 3314 | endef # def_install
|
|---|
| 3315 | $(eval-opt-var def_install)
|
|---|
| 3316 |
|
|---|
| 3317 | ## process all install targets
|
|---|
| 3318 | $(foreach target, $(_ALL_INSTALLS), \
|
|---|
| 3319 | $(evalvalctx def_install))
|
|---|
| 3320 |
|
|---|
| 3321 | ifdef KBUILD_PROFILE_SELF
|
|---|
| 3322 | $(evalcall def_profile_self, done install targets)
|
|---|
| 3323 | endif
|
|---|
| 3324 |
|
|---|
| 3325 | #
|
|---|
| 3326 | # TESTING
|
|---|
| 3327 | #
|
|---|
| 3328 | _TESTING += $(TESTING) $(TESTING.$(KBUILD_TARGET)) $(TESTING.$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)) $(TESTING.$(KBUILD_TARGET_ARCH)) $(TESTING.$(KBUILD_TARGET_CPU))
|
|---|
| 3329 |
|
|---|
| 3330 |
|
|---|
| 3331 | #
|
|---|
| 3332 | # PACKING
|
|---|
| 3333 | #
|
|---|
| 3334 | _PACKING += $(PACKING) $(PACKING.$(KBUILD_TARGET)) $(PACKING.$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)) $(PACKING.$(KBUILD_TARGET_ARCH)) $(PACKING.$(KBUILD_TARGET_CPU))
|
|---|
| 3335 |
|
|---|
| 3336 |
|
|---|
| 3337 | #
|
|---|
| 3338 | # DOCS
|
|---|
| 3339 | #
|
|---|
| 3340 |
|
|---|
| 3341 |
|
|---|
| 3342 | #
|
|---|
| 3343 | # DIRECTORIES
|
|---|
| 3344 | #
|
|---|
| 3345 | _DIR_ALL := $(sort $(addsuffix /,$(patsubst %/,%,$(_DIRS))) $(dir $(_OUT_FILES) $(_OBJS) $(_INSTALLS_FILES)))
|
|---|
| 3346 | $(foreach directory,$(_INSTALLS_DIRS), $(eval _DIR_ALL := $(filter-out $(directory),$(_DIR_ALL))))
|
|---|
| 3347 |
|
|---|
| 3348 |
|
|---|
| 3349 | define def_mkdir_rule
|
|---|
| 3350 | $(directory):
|
|---|
| 3351 | %$$(call MSG_MKDIR,$$@)
|
|---|
| 3352 | $$(QUIET)$$(MKDIR) -p -- $$@
|
|---|
| 3353 | endef
|
|---|
| 3354 |
|
|---|
| 3355 | $(foreach directory,$(_DIR_ALL),$(eval $(def_mkdir_rule)))
|
|---|
| 3356 |
|
|---|
| 3357 | ifdef KBUILD_PROFILE_SELF
|
|---|
| 3358 | $(evalcall def_profile_self, done directories)
|
|---|
| 3359 | endif
|
|---|
| 3360 |
|
|---|
| 3361 |
|
|---|
| 3362 | #
|
|---|
| 3363 | # NOTHING
|
|---|
| 3364 | #
|
|---|
| 3365 | do-nothing:
|
|---|
| 3366 | %$(call MSG_NOTHING)
|
|---|
| 3367 | ifdef KBUILD_PROFILE_SELF
|
|---|
| 3368 | @$(ECHO) 'prof: $(call _KBUILD_FMT_ELAPSED_EX, $(nanots ), $(_KBUILD_TS_HEADER_START)) - $(call _KBUILD_FMT_ELAPSED_EX, $(nanots ), $(_KBUILD_TS_PREV)) - executing $@'
|
|---|
| 3369 | ifeq ($(KBUILD_PROFILE_SELF),2)
|
|---|
| 3370 | @$(ECHO) 'stat: $(make-stats )'
|
|---|
| 3371 | endif
|
|---|
| 3372 | endif
|
|---|
| 3373 |
|
|---|
| 3374 |
|
|---|
| 3375 | #
|
|---|
| 3376 | # CLEAN UP
|
|---|
| 3377 | #
|
|---|
| 3378 | do-clean:
|
|---|
| 3379 | %$(call MSG_CLEAN)
|
|---|
| 3380 | $(QUIET)$(RM) -f -- $(_OUT_FILES) $(_OBJS) $(_DEPFILES) $(_DEPFILES_INCLUDED) $(_CLEAN_FILES) $(OTHER_CLEAN)
|
|---|
| 3381 | $(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)))
|
|---|
| 3382 |
|
|---|
| 3383 |
|
|---|
| 3384 |
|
|---|
| 3385 | #
|
|---|
| 3386 | # PASSES (including directory and makefile walking)
|
|---|
| 3387 | #
|
|---|
| 3388 |
|
|---|
| 3389 | #
|
|---|
| 3390 | # First, check whether we need to order the passes explicitly or not.
|
|---|
| 3391 | # This depends on whether we're a leaf makefile or not. A leaf will
|
|---|
| 3392 | # know all its dependencies, while a recursive one relies on the
|
|---|
| 3393 | # order sub-directories and other makefiles are executed it.
|
|---|
| 3394 | #
|
|---|
| 3395 |
|
|---|
| 3396 | ## Setup a pass and check for optimizations.
|
|---|
| 3397 | # @param $(PASS) Uppercase pass name.
|
|---|
| 3398 | define def_pass_setup_and_optimize
|
|---|
| 3399 |
|
|---|
| 3400 | # The setup. ## @todo This is looks a bit weird...
|
|---|
| 3401 | ifndef SUBDIRS_$(PASS)
|
|---|
| 3402 | SUBDIRS_$(PASS) := $(SUBDIRS) $(SUBDIRS.$(KBUILD_TARGET)) $(SUBDIRS.$(KBUILD_TARGET.$(KBUILD_TARGET_ARCH)))
|
|---|
| 3403 | endif
|
|---|
| 3404 | ifndef SUBDIRS_AFTER_$(PASS)
|
|---|
| 3405 | SUBDIRS_AFTER_$(PASS) := $(SUBDIRS_AFTER) $(SUBDIRS_AFTER.$(KBUILD_TARGET)) $(SUBDIRS_AFTER.$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH))
|
|---|
| 3406 | endif
|
|---|
| 3407 | ifndef MAKEFILES_BEFORE_$(PASS)
|
|---|
| 3408 | MAKEFILES_BEFORE_$(PASS) := $(MAKEFILES_BEFORE) $(MAKEFILES_BEFORE.$(KBUILD_TARGET)) $(MAKEFILES_BEFORE.$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH))
|
|---|
| 3409 | endif
|
|---|
| 3410 | ifndef MAKEFILES_AFTER_$(PASS)
|
|---|
| 3411 | MAKEFILES_AFTER_$(PASS) := $(MAKEFILES_AFTER) $(MAKEFILES_AFTER.$(KBUILD_TARGET)) $(MAKEFILES_AFTER.$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH))
|
|---|
| 3412 | endif
|
|---|
| 3413 |
|
|---|
| 3414 | # The check.
|
|---|
| 3415 | ifeq ($(_KBUILD_STRICT_PASS_ORDER),nonstrict)
|
|---|
| 3416 | ifneq ($(strip \
|
|---|
| 3417 | $(SUBDIRS_$(PASS)) $(SUBDIRS_$(PASS).$(KBUILD_TARGET)) $(SUBDIRS_$(PASS).$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)) \
|
|---|
| 3418 | $(MAKEFILES_BEFORE_$(PASS)) $(MAKEFILES_BEFORE_$(PASS).$(KBUILD_TARGET)) $(MAKEFILES_BEFORE_$(PASS).$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)) \
|
|---|
| 3419 | $(SUBDIRS_AFTER_$(PASS)) $(SUBDIRS_AFTER_$(PASS).$(KBUILD_TARGET)) $(SUBDIRS_AFTER_$(PASS).$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)) \
|
|---|
| 3420 | $(MAKEFILES_AFTER_$(PASS)) $(MAKEFILES_AFTER_$(PASS).$(KBUILD_TARGET)) $(MAKEFILES_AFTER_$(PASS).$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)) \
|
|---|
| 3421 | ),)
|
|---|
| 3422 | _KBUILD_STRICT_PASS_ORDER := strict
|
|---|
| 3423 | endif
|
|---|
| 3424 | endif # _KBUILD_STRICT_PASS_ORDER == nonstrict
|
|---|
| 3425 | endef # def_pass_setup_and_optimize
|
|---|
| 3426 | $(eval-opt-var def_pass_setup_and_optimize)
|
|---|
| 3427 |
|
|---|
| 3428 | ## PASS: Setup & optimization.
|
|---|
| 3429 | # Check if we can apply the non-strict pass order optimzation (no SUBDIRS_* and MAKEFILES_*),
|
|---|
| 3430 | # and set up the pass specific variables as we go along.
|
|---|
| 3431 | _KBUILD_STRICT_PASS_ORDER := nonstrict
|
|---|
| 3432 | $(foreach PASS, $(PASSES), $(evalval def_pass_setup_and_optimize))
|
|---|
| 3433 | #$ (error _KBUILD_STRICT_PASS_ORDER=$(_KBUILD_STRICT_PASS_ORDER))
|
|---|
| 3434 |
|
|---|
| 3435 |
|
|---|
| 3436 | ## Subdir
|
|---|
| 3437 | # @param $(pass) Lowercase pass name.
|
|---|
| 3438 | # @param $(PASS) Uppercase pass name.
|
|---|
| 3439 | # @param $(subdir) Subdirectory
|
|---|
| 3440 | # @param $(tag) tag to attach to the rule name.
|
|---|
| 3441 | define def_pass_subdir
|
|---|
| 3442 | pass_$(pass)$(tag):: $(dep)
|
|---|
| 3443 | + $$(QUIET)$$(MAKE) -C $(subdir) -f $$(notdir $$(firstword $$(wildcard $$(addprefix $(subdir)/,$$(DEFAULT_MAKEFILE))))) pass_$(pass)
|
|---|
| 3444 | endef
|
|---|
| 3445 |
|
|---|
| 3446 | ## Submakefile
|
|---|
| 3447 | # @param $(pass) Lowercase pass name.
|
|---|
| 3448 | # @param $(PASS) Uppercase pass name.
|
|---|
| 3449 | # @param $(makefile) Makefile.
|
|---|
| 3450 | # @param $(tag) tag to attach to the rule name.
|
|---|
| 3451 | define def_pass_makefile
|
|---|
| 3452 | pass_$(pass)$(tag):: $(dep)
|
|---|
| 3453 | + $$(QUIET)$$(MAKE) -C $(patsubst %/,%,$(dir $(makefile))) -f $(notdir $(makefile)) pass_$(pass)
|
|---|
| 3454 | endef
|
|---|
| 3455 |
|
|---|
| 3456 | ## Execute a pass, strict order.
|
|---|
| 3457 | # @param $(pass) Lowercase pass name.
|
|---|
| 3458 | # @param $(PASS) Uppercase pass name.
|
|---|
| 3459 | define def_pass_strict
|
|---|
| 3460 | $(eval tag:=_before)
|
|---|
| 3461 | $(eval dep:=)
|
|---|
| 3462 | $(foreach subdir, $(SUBDIRS_$(PASS)) $(SUBDIRS_$(PASS).$(KBUILD_TARGET)) $(SUBDIRS_$(PASS).$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)) ,$(eval $(def_pass_subdir)))
|
|---|
| 3463 | $(foreach makefile,$(MAKEFILES_BEFORE_$(PASS)) $(MAKEFILES_BEFORE_$(PASS).$(KBUILD_TARGET)) $(MAKEFILES_BEFORE_$(PASS).$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)),$(eval $(def_pass_makefile)))
|
|---|
| 3464 |
|
|---|
| 3465 | $(eval tag:=_after)
|
|---|
| 3466 | $(eval dep:=pass_$(pass)_doit)
|
|---|
| 3467 | $(foreach subdir, $(SUBDIRS_AFTER_$(PASS)) $(SUBDIRS_AFTER_$(PASS).$(KBUILD_TARGET)) $(SUBDIRS_AFTER_$(PASS).$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)) ,$(eval $(def_pass_subdir)))
|
|---|
| 3468 | $(foreach makefile,$(MAKEFILES_AFTER_$(PASS)) $(MAKEFILES_AFTER_$(PASS).$(KBUILD_TARGET)) $(MAKEFILES_AFTER_$(PASS).$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)) ,$(eval $(def_pass_makefile)))
|
|---|
| 3469 |
|
|---|
| 3470 | ifdef KBUILD_SAFE_PARALLEL
|
|---|
| 3471 | .NOTPARALLEL: pass_$(pass) pass_$(pass)_before pass_$(pass)_after pass_$(pass)_this
|
|---|
| 3472 | .PHONY: pass_$(pass) pass_$(pass)_before pass_$(pass)_after pass_$(pass)_this pass_$(pass)_doit
|
|---|
| 3473 | pass_$(pass)_doit: $(PASS_$(PASS)_trgs) $(foreach var,$(PASS_$(PASS)_vars),$(var))
|
|---|
| 3474 | pass_$(pass)_this: pass_$(pass)_before
|
|---|
| 3475 | + $$(QUIET)$$(MAKE) -f $$(MAKEFILE) pass_$(pass)_doit
|
|---|
| 3476 | pass_$(pass)_after:: pass_$(pass)_this
|
|---|
| 3477 | pass_$(pass): pass_$(pass)_after
|
|---|
| 3478 | else # !KBUILD_SAFE_PARALLEL
|
|---|
| 3479 | .PHONY: pass_$(pass) pass_$(pass)_before pass_$(pass)_after pass_$(pass)_doit
|
|---|
| 3480 | .NOTPARALLEL: pass_$(pass) pass_$(pass)_before pass_$(pass)_after pass_$(pass)_doit
|
|---|
| 3481 | pass_$(pass)_doit: pass_$(pass)_before \
|
|---|
| 3482 | $(PASS_$(PASS)_trgs) $(foreach var,$(PASS_$(PASS)_vars),$($(var)))
|
|---|
| 3483 | pass_$(pass): \
|
|---|
| 3484 | pass_$(pass)_before \
|
|---|
| 3485 | pass_$(pass)_doit \
|
|---|
| 3486 | pass_$(pass)_after
|
|---|
| 3487 | endif # !KBUILD_SAFE_PARALLEL
|
|---|
| 3488 |
|
|---|
| 3489 | #$ (warning pass=$(pass) PASS=$(PASS): $(PASS_$(PASS)_trgs) $(PASS_$(PASS)_trgs) $(foreach var,$(PASS_$(PASS)_vars),$($(var))))
|
|---|
| 3490 | endef # def_pass_strict
|
|---|
| 3491 | $(eval-opt-var def_pass_strict)
|
|---|
| 3492 |
|
|---|
| 3493 | ## Execute a pass, non-strict pass ordering.
|
|---|
| 3494 | # @param $(pass) Lowercase pass name.
|
|---|
| 3495 | # @param $(PASS) Uppercase pass name.
|
|---|
| 3496 | define def_pass_nonstrict
|
|---|
| 3497 | .PHONY: pass_$(pass) pass_$(pass)_before pass_$(pass)_after pass_$(pass)_doit
|
|---|
| 3498 | pass_$(pass)_doit: $(PASS_$(PASS)_trgs) $(foreach var,$(PASS_$(PASS)_vars),$$$$($(var)))
|
|---|
| 3499 | pass_$(pass): pass_$(pass)_doit
|
|---|
| 3500 | endef # def_pass_nonstrict
|
|---|
| 3501 |
|
|---|
| 3502 | ## PASS: rules
|
|---|
| 3503 | # Generate the rules for the defined passes.
|
|---|
| 3504 | $(foreach PASS, $(PASSES), \
|
|---|
| 3505 | $(eval pass := $(PASS_$(PASS)_pass)) \
|
|---|
| 3506 | $(eval $(def_pass_$(_KBUILD_STRICT_PASS_ORDER))))
|
|---|
| 3507 |
|
|---|
| 3508 |
|
|---|
| 3509 | ## Pass order, strict.
|
|---|
| 3510 | # @param $(pass) Current pass name.
|
|---|
| 3511 | # @param $(prev_pass) The previous pass name.
|
|---|
| 3512 | define def_pass_order_strict
|
|---|
| 3513 | ifdef KBUILD_SAFE_PARALLEL
|
|---|
| 3514 | .PHONY: pass_$(pass)_order
|
|---|
| 3515 | .NOTPARALLEL: pass_$(pass)_order
|
|---|
| 3516 | pass_$(pass)_order: $(pass_prev)
|
|---|
| 3517 | %$$(call MSG_PASS,$$(if $$(PASS_$(PASS)),$$(PASS_$(PASS)),$(pass)))
|
|---|
| 3518 | + $$(QUIET)$$(MAKE) -f $$(MAKEFILE) pass_$(pass)
|
|---|
| 3519 | else # !KBUILD_SAFE_PARALLEL
|
|---|
| 3520 | .NOTPARALLEL: pass_$(pass)_order pass_$(pass)_banner
|
|---|
| 3521 | .PHONY: pass_$(pass)_order pass_$(pass)_banner
|
|---|
| 3522 | pass_$(pass)_banner:
|
|---|
| 3523 | %$$(call MSG_PASS,$$(if $$(PASS_$(PASS)),$$(PASS_$(PASS)),$(pass)))
|
|---|
| 3524 | pass_$(pass)_order: \
|
|---|
| 3525 | $(pass_prev) \
|
|---|
| 3526 | pass_$(pass)_banner \
|
|---|
| 3527 | pass_$(pass)
|
|---|
| 3528 | endif # !KBUILD_SAFE_PARALLEL
|
|---|
| 3529 | $(eval pass_prev := pass_$(pass)_order)
|
|---|
| 3530 | endef # def_pass_order_strict
|
|---|
| 3531 | $(eval-opt-var def_pass_order_strict)
|
|---|
| 3532 |
|
|---|
| 3533 | ## Pass order, non-strict.
|
|---|
| 3534 | # @param $(pass) Current pass name.
|
|---|
| 3535 | # @param $(prev_pass) The previous pass name.
|
|---|
| 3536 | define def_pass_order_nonstrict
|
|---|
| 3537 | .PHONY: pass_$(pass)_order pass_$(pass)_banner
|
|---|
| 3538 | pass_$(pass)_banner:
|
|---|
| 3539 | %$$(call MSG_PASS,$$(if $$(PASS_$(PASS)),$$(PASS_$(PASS)),$(pass)))
|
|---|
| 3540 | pass_$(pass)_order: \
|
|---|
| 3541 | $(pass_prev) \
|
|---|
| 3542 | pass_$(pass)_banner \
|
|---|
| 3543 | pass_$(pass)
|
|---|
| 3544 | $(eval pass_prev := pass_$(pass)_order)
|
|---|
| 3545 | endef # def_pass_order_nonstrict
|
|---|
| 3546 | $(eval-opt-var def_pass_order_nonstrict)
|
|---|
| 3547 |
|
|---|
| 3548 | ## PASS: order
|
|---|
| 3549 | # Use dependencies to ensure correct pass order.
|
|---|
| 3550 | pass_prev :=
|
|---|
| 3551 | $(foreach PASS,$(DEFAULT_PASSES),\
|
|---|
| 3552 | $(eval pass := $(PASS_$(PASS)_pass)) \
|
|---|
| 3553 | $(eval $(def_pass_order_$(_KBUILD_STRICT_PASS_ORDER))))
|
|---|
| 3554 |
|
|---|
| 3555 | ifdef KBUILD_PROFILE_SELF
|
|---|
| 3556 | $(evalcall def_profile_self, done passes)
|
|---|
| 3557 | endif
|
|---|
| 3558 |
|
|---|
| 3559 |
|
|---|
| 3560 | #
|
|---|
| 3561 | # THE MAIN RULES
|
|---|
| 3562 | #
|
|---|
| 3563 | all_recursive: $(pass_prev)
|
|---|
| 3564 |
|
|---|
| 3565 | rebuild: clean
|
|---|
| 3566 | + $(MAKE) -f $(firstword $(MAKEFILE_LIST)) all_recursive
|
|---|
| 3567 |
|
|---|
| 3568 | # @todo make this a non-default pass!
|
|---|
| 3569 | uninstall:
|
|---|
| 3570 | $(RM) -f -- $(_INSTALLS_FILES)
|
|---|
| 3571 |
|
|---|
| 3572 | install: pass_installs
|
|---|
| 3573 |
|
|---|
| 3574 | # misc shortcuts (use secondary expansion here to save strcache[file] space).
|
|---|
| 3575 | targets: bldprogs libraries dlls programs sysmods others installs
|
|---|
| 3576 | objects: $$(_OBJS)
|
|---|
| 3577 | bldprogs: $$(_BLDPROGS)
|
|---|
| 3578 | libraries: $$(_LIBS) $$(_IMPORT_LIBS) $$(_OTHER_LIBRARIES)
|
|---|
| 3579 | dlls: $$(_DLLS)
|
|---|
| 3580 | programs: $$(_PROGRAMS)
|
|---|
| 3581 | sysmods: $$(_SYSMODS)
|
|---|
| 3582 | others: $$(_OTHERS)
|
|---|
| 3583 | installs: $$(_INSTALLS) $$(_INSTALLS_DIRS) $$(_INSTALLS_FILES)
|
|---|
| 3584 |
|
|---|
| 3585 |
|
|---|
| 3586 |
|
|---|
| 3587 | #
|
|---|
| 3588 | # kBuild debugging stuff.
|
|---|
| 3589 | #
|
|---|
| 3590 | ## @todo this doesn't work. Move to a debug unit and expand it.
|
|---|
| 3591 | show_targets:
|
|---|
| 3592 | @$(foreach target, $(_ALL_TARGETS),\
|
|---|
| 3593 | @$(ECHO) "target: $(target)" $(NLTAB)\
|
|---|
| 3594 | @$(ECHO) " PATH_$(target)=$(PATH_$(target))" $(NLTAB)\
|
|---|
| 3595 | @$(ECHO) " TARGET_$(target)=$(TARGET_$(target))" $(NLTAB)\
|
|---|
| 3596 | @$(ECHO) " INSTARGET_$(target)=$(INSTARGET_$(target))" $(NLTAB)\
|
|---|
| 3597 | $(foreach prop,$(PROPS_SINGLE) $(PROPS_ACCUMULATE_L) $(PROPS_ACCUMULATE_R) OBJS_ CLEAN, \
|
|---|
| 3598 | $(eval _tmp:=$(firstword $($(target)_BLD_TRG) $(KBUILD_TARGET))) \
|
|---|
| 3599 | $(if $($(target)_$(prop).$(_tmp)),\
|
|---|
| 3600 | @$(ECHO) " $(target)_$(prop).$(_tmp)=$($(target)_$(prop).$(_tmp))" $(NLTAB)) \
|
|---|
| 3601 | $(if $($(target)_$(prop)), $(NLTAB)@$(ECHO) " $(target)_$(prop)=$($(target)_$(prop))" $(NLTAB)) \
|
|---|
| 3602 | )\
|
|---|
| 3603 | $(foreach prop,$(PROPS_DEFERRED), \
|
|---|
| 3604 | $(eval _tmp:=$(firstword $($(target)_BLD_TRG) $(KBUILD_TARGET))) \
|
|---|
| 3605 | $(if $(value $(target)_$(prop).$(_tmp)),\
|
|---|
| 3606 | @$(ECHO) ' $(target)_$(prop).$(_tmp)=$(value $(TARGET)_$(prop).$(_tmp))' $(NLTAB)) \
|
|---|
| 3607 | $(if $(value $(target)_$(prop)), $(NLTAB)@$(ECHO) ' $(target)_$(prop)=$(value $(target)_$(prop))' $(NLTAB)) \
|
|---|
| 3608 | ))
|
|---|
| 3609 |
|
|---|
| 3610 |
|
|---|
| 3611 |
|
|---|
| 3612 | #
|
|---|
| 3613 | # Include dependency files.
|
|---|
| 3614 | #
|
|---|
| 3615 | ifdef _DEPFILES
|
|---|
| 3616 | # TODO: first works the second doesn't, provided _KB_INCLUDE_DEPS is undefined:
|
|---|
| 3617 | # if "$(_KB_INCLUDE_DEPS)" == "1"
|
|---|
| 3618 | # if $(_KB_INCLUDE_DEPS) == "1"
|
|---|
| 3619 |
|
|---|
| 3620 | ifdef KB_HAVE_INCLUDEDEP_QUEUE
|
|---|
| 3621 | includedep-queue $(_DEPFILES)
|
|---|
| 3622 | else
|
|---|
| 3623 | $(foreach dep, $(_DEPFILES), $(eval includedep $(dep)))
|
|---|
| 3624 | endif
|
|---|
| 3625 | endif
|
|---|
| 3626 |
|
|---|
| 3627 |
|
|---|
| 3628 | ifdef KBUILD_PROFILE_SELF
|
|---|
| 3629 | $(evalcall def_profile_self, end of footer.kmk)
|
|---|
| 3630 | _KBUILD_TS_FOOTER_END := $(_KBUILD_TS_PREV)
|
|---|
| 3631 |
|
|---|
| 3632 | ifneq ($(KBUILD_PROFILE_SELF),0)
|
|---|
| 3633 | $(info prof: ALL=$(words $(_ALL_TARGETS)) BLDPROGS=$(words $(_ALL_BLDPROGS)) LIBRARIES=$(words $(_ALL_LIBRARIES)) IMPORT_LIBS=$(words $(IMPORT_LIBS)) DLLS=$(words $(DLLS)) PROGRAMS=$(words $(_ALL_PROGRAMS)) )
|
|---|
| 3634 | $(info prof: SYSMODS=$(words $(_ALL_SYSMODS)) OTHERS=$(words $(_ALL_OTHERS)) INSTALLS=$(words $(_ALL_INSTALLS)) FETCHES=$(words $(_ALL_FETCHES)) PACKING=$(words $(_PACKING)) TESTING=$(words $(TESTING)) )
|
|---|
| 3635 | $(info prof: DIRS=$(words $(_DIR_ALL)) TOOLS=$(words $(_TOOLS)) SDKS=$(words $(_SDKS)) USES=$(words $(_USES)) OUT_FILES=$(words $(_OUT_FILES)) OBJS=$(words $(_OBJS)) CLEAN_FILES=$(words $(CLEAN_FILES) $(OTHER_CLEAN)) )
|
|---|
| 3636 | $(info prof: DEPFILES_INCLUDED=$(words $(_DEPFILES_INCLUDED)) DEPFILES=$(words $(_DEPFILES)) MAKEFILES=$(words $(MAKEFILE_LIST)) )
|
|---|
| 3637 | endif
|
|---|
| 3638 | endif
|
|---|
| 3639 |
|
|---|
| 3640 |
|
|---|
| 3641 | # end-of-file-content
|
|---|
| 3642 | __footer_kmk__ := target
|
|---|
| 3643 | endif # __footer_kmk__
|
|---|
| 3644 |
|
|---|