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