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