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