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