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