| 1 | # $Id: footer.kmk 3305 2020-01-14 15:11:48Z bird $
 | 
|---|
| 2 | ## @file
 | 
|---|
| 3 | # kBuild - File included at bottom of a makefile.
 | 
|---|
| 4 | #
 | 
|---|
| 5 | 
 | 
|---|
| 6 | #
 | 
|---|
| 7 | # Copyright (c) 2004-2017 knut st. osmundsen <bird-kBuild-spam-xviiv@anduin.net>
 | 
|---|
| 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
 | 
|---|
| 13 | # the Free Software Foundation; either version source of the License, or
 | 
|---|
| 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
 | 
|---|
| 23 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 | 
|---|
| 24 | #
 | 
|---|
| 25 | #
 | 
|---|
| 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 | #
 | 
|---|
| 33 | 
 | 
|---|
| 34 | ifndef __footer_kmk__
 | 
|---|
| 35 | # start-of-file-content
 | 
|---|
| 36 | ifdef KBUILD_PROFILE_SELF
 | 
|---|
| 37 |  $(evalcall def_profile_self, start of footer.kmk)
 | 
|---|
| 38 |  _KBUILD_TS_FOOTER_START := $(_KBUILD_TS_PREV)
 | 
|---|
| 39 | endif
 | 
|---|
| 40 | 
 | 
|---|
| 41 | #
 | 
|---|
| 42 | # Variables.
 | 
|---|
| 43 | # (Some of these need initialization before including definitions using them.)
 | 
|---|
| 44 | #
 | 
|---|
| 45 | 
 | 
|---|
| 46 | # All targets of each types.
 | 
|---|
| 47 | _ALL_BLDPROGS    := $(BLDPROGS)    $(BLDPROGS.$(KBUILD_HOST))        $(BLDPROGS.$(KBUILD_HOST).$(KBUILD_HOST_ARCH))            $(BLDPROGS.$(KBUILD_HOST_ARCH))      $(BLDPROGS.$(KBUILD_HOST_CPU))       $(BLDPROGS.$(KBUILD_TYPE))
 | 
|---|
| 48 | _ALL_LIBRARIES   := $(LIBRARIES)   $(LIBRARIES.$(KBUILD_TARGET))     $(LIBRARIES.$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH))       $(LIBRARIES.$(KBUILD_TARGET_ARCH))   $(LIBRARIES.$(KBUILD_TARGET_CPU))    $(LIBRARIES.$(KBUILD_TYPE))
 | 
|---|
| 49 | _ALL_IMPORT_LIBS := $(IMPORT_LIBS) $(IMPORT_LIBS.$(KBUILD_TARGET))   $(IMPORT_LIBS.$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH))     $(IMPORT_LIBS.$(KBUILD_TARGET_ARCH)) $(IMPORT_LIBS.$(KBUILD_TARGET_CPU))  $(IMPORT_LIBS.$(KBUILD_TYPE))
 | 
|---|
| 50 | _ALL_DLLS        := $(DLLS)        $(DLLS.$(KBUILD_TARGET))          $(DLLS.$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH))            $(DLLS.$(KBUILD_TARGET_ARCH))        $(DLLS.$(KBUILD_TARGET_CPU))         $(DLLS.$(KBUILD_TYPE))
 | 
|---|
| 51 | _ALL_PROGRAMS    := $(PROGRAMS)    $(PROGRAMS.$(KBUILD_TARGET))      $(PROGRAMS.$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH))        $(PROGRAMS.$(KBUILD_TARGET_ARCH))    $(PROGRAMS.$(KBUILD_TARGET_CPU))     $(PROGRAMS.$(KBUILD_TYPE))
 | 
|---|
| 52 | _ALL_SYSMODS     := $(SYSMODS)     $(SYSMODS.$(KBUILD_TARGET))       $(SYSMODS.$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH))         $(SYSMODS.$(KBUILD_TARGET_ARCH))     $(SYSMODS.$(KBUILD_TARGET_CPU))      $(SYSMODS.$(KBUILD_TYPE))
 | 
|---|
| 53 | _ALL_MISCBINS    := $(MISCBINS)    $(MISCBINS.$(KBUILD_TARGET))      $(MISCBINS.$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH))        $(MISCBINS.$(KBUILD_TARGET_ARCH))    $(MISCBINS.$(KBUILD_TARGET_CPU))     $(MISCBINS.$(KBUILD_TYPE))
 | 
|---|
| 54 | _ALL_OTHERS      := $(OTHERS)      $(OTHERS.$(KBUILD_TARGET))        $(OTHERS.$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH))          $(OTHERS.$(KBUILD_TARGET_ARCH))      $(OTHERS.$(KBUILD_TARGET_CPU))       $(OTHERS.$(KBUILD_TYPE))
 | 
|---|
| 55 | _ALL_INSTALLS    := $(INSTALLS)    $(INSTALLS.$(KBUILD_TARGET))      $(INSTALLS.$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH))        $(INSTALLS.$(KBUILD_TARGET_ARCH))    $(INSTALLS.$(KBUILD_TARGET_CPU))     $(INSTALLS.$(KBUILD_TYPE))
 | 
|---|
| 56 | _ALL_FETCHES     := $(FETCHES)     $(FETCHES.$(KBUILD_TARGET))       $(FETCHES.$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH))         $(FETCHES.$(KBUILD_TARGET_ARCH))     $(FETCHES.$(KBUILD_TARGET_CPU))      $(FETCHES.$(KBUILD_TYPE))
 | 
|---|
| 57 | _ALL_PATCHES     := $(PATCHES)     $(PATCHES.$(KBUILD_TARGET))       $(PATCHES.$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH))         $(PATCHES.$(KBUILD_TARGET_ARCH))     $(PATCHES.$(KBUILD_TARGET_CPU))      $(PATCHES.$(KBUILD_TYPE))
 | 
|---|
| 58 | 
 | 
|---|
| 59 | # all targets.
 | 
|---|
| 60 | _ALL_TARGETS = \
 | 
|---|
| 61 |         $(_ALL_FETCHES) \
 | 
|---|
| 62 |         $(_ALL_PATCHES) \
 | 
|---|
| 63 |         $(_ALL_BLDPROGS) \
 | 
|---|
| 64 |         $(_ALL_LIBRARIES) \
 | 
|---|
| 65 |         $(_ALL_IMPORT_LIBS) \
 | 
|---|
| 66 |         $(_ALL_DLLS) \
 | 
|---|
| 67 |         $(_ALL_PROGRAMS) \
 | 
|---|
| 68 |         $(_ALL_SYSMODS) \
 | 
|---|
| 69 |         $(_ALL_MISCBINS) \
 | 
|---|
| 70 |         $(_ALL_INSTALLS) \
 | 
|---|
| 71 |         $(_ALL_OTHERS)
 | 
|---|
| 72 | 
 | 
|---|
| 73 | # all $(KBUILD_TARGET) targets.
 | 
|---|
| 74 | _ALL_TARGET_TARGETS = \
 | 
|---|
| 75 |         $(_ALL_FETCHES) \
 | 
|---|
| 76 |         $(_ALL_PATCHES) \
 | 
|---|
| 77 |         $(_ALL_LIBRARIES) \
 | 
|---|
| 78 |         $(_ALL_IMPORT_LIBS) \
 | 
|---|
| 79 |         $(_ALL_DLLS) \
 | 
|---|
| 80 |         $(_ALL_PROGRAMS) \
 | 
|---|
| 81 |         $(_ALL_SYSMODS) \
 | 
|---|
| 82 |         $(_ALL_MISCBINS) \
 | 
|---|
| 83 |         $(_ALL_INSTALLS) \
 | 
|---|
| 84 |         $(_ALL_OTHERS)
 | 
|---|
| 85 | 
 | 
|---|
| 86 | # all $(KBUILD_HOST) targets.
 | 
|---|
| 87 | _ALL_HOST_TARGETS = \
 | 
|---|
| 88 |         $(_ALL_BLDPROGS)
 | 
|---|
| 89 | 
 | 
|---|
| 90 | # all targets making use of srcname.
 | 
|---|
| 91 | _ALL_SRCNAME_TARGETS = \
 | 
|---|
| 92 |         $(_ALL_FETCHES) \
 | 
|---|
| 93 |         $(_ALL_PATCHES)
 | 
|---|
| 94 | 
 | 
|---|
| 95 | # Dependency files. (currently not on target level, only this global stuff)
 | 
|---|
| 96 | _DEPFILES        := $(DEPFILES)    $(DEPFILES.$(KBUILD_TARGET))      $(DEPFILES.$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH))        $(DEPFILES.$(KBUILD_TARGET_ARCH))    $(DEPFILES.$(KBUILD_TARGET_CPU))     $(DEPFILES.$(KBUILD_TYPE))
 | 
|---|
| 97 | 
 | 
|---|
| 98 | 
 | 
|---|
| 99 | # All kind of output files except for _OBJS and _DEPFILES.
 | 
|---|
| 100 | # Compiling or linking definition outputting other things that $@ and any
 | 
|---|
| 101 | # required dependency file must add those output files to this variable.
 | 
|---|
| 102 | _OUT_FILES :=
 | 
|---|
| 103 | 
 | 
|---|
| 104 | # Files which only requires cleaning up.
 | 
|---|
| 105 | _CLEAN_FILES :=
 | 
|---|
| 106 | 
 | 
|---|
| 107 | # all of a type
 | 
|---|
| 108 | _OBJS     :=
 | 
|---|
| 109 | _FETCHES  :=
 | 
|---|
| 110 | _DOWNLOADS:=
 | 
|---|
| 111 | _UNPACKS  :=
 | 
|---|
| 112 | _PATCHES  :=
 | 
|---|
| 113 | _UNFETCHES:=
 | 
|---|
| 114 | _BLDPROGS :=
 | 
|---|
| 115 | _LIBS     :=
 | 
|---|
| 116 | _DLLS     :=
 | 
|---|
| 117 | _PROGRAMS :=
 | 
|---|
| 118 | _SYSMODS  :=
 | 
|---|
| 119 | _MISCBINS :=
 | 
|---|
| 120 | _STAGE_FILES :=
 | 
|---|
| 121 | _STAGE_DIRS :=
 | 
|---|
| 122 | _INSTALLS :=
 | 
|---|
| 123 | _INSTALLS_FILES :=
 | 
|---|
| 124 | _INSTALLS_DIRS :=
 | 
|---|
| 125 | _DEBUG_STAGE_FILES :=
 | 
|---|
| 126 | _DEBUG_STAGE_DIRS :=
 | 
|---|
| 127 | _DEBUG_INSTALL_FILES :=
 | 
|---|
| 128 | _DEBUG_INSTALL_DIRS :=
 | 
|---|
| 129 | _OTHERS   :=
 | 
|---|
| 130 | _PACKING  :=
 | 
|---|
| 131 | _DIRS     := $(PATH_TARGET)/ $(PATH_TARGET) $(BLDDIRS)
 | 
|---|
| 132 | _IMPORT_LIBS :=
 | 
|---|
| 133 | 
 | 
|---|
| 134 | # Implicit targets added while processing other targets (usually by units).
 | 
|---|
| 135 | _ALL_INSTALLS_IMPLICIT :=
 | 
|---|
| 136 | 
 | 
|---|
| 137 | # misc
 | 
|---|
| 138 | pass_prev :=
 | 
|---|
| 139 | 
 | 
|---|
| 140 | 
 | 
|---|
| 141 | 
 | 
|---|
| 142 | #
 | 
|---|
| 143 | # Footer macros
 | 
|---|
| 144 | #
 | 
|---|
| 145 | 
 | 
|---|
| 146 | ## Figure out the tool for a target.
 | 
|---|
| 147 | # @param    $1           normalized target.
 | 
|---|
| 148 | # @param    $2           tooltype.
 | 
|---|
| 149 | # @param    bld_trg      build target.
 | 
|---|
| 150 | # @param    bld_trg_arch build target architecture.
 | 
|---|
| 151 | # @param    bld_type     build target type.
 | 
|---|
| 152 | if 0
 | 
|---|
| 153 | _TARGET_TOOL = $(strip $(firstword \
 | 
|---|
| 154 |         $($(1)_$(2)TOOL.$(bld_trg).$(bld_trg_arch)) \
 | 
|---|
| 155 |         $($(1)_$(2)TOOL.$(bld_trg)) \
 | 
|---|
| 156 |         $($(1)_$(2)TOOL) \
 | 
|---|
| 157 |         $($(1)_TOOL.$(bld_trg).$(bld_trg_arch)) \
 | 
|---|
| 158 |         $($(1)_TOOL.$(bld_trg)) \
 | 
|---|
| 159 |         $($(1)_TOOL) \
 | 
|---|
| 160 |         $($(2)TOOL.$(bld_trg).$(bld_trg_arch)) \
 | 
|---|
| 161 |         $($(2)TOOL.$(bld_trg)) \
 | 
|---|
| 162 |         $($(2)TOOL) \
 | 
|---|
| 163 |         $(TOOL.$(bld_trg).$(bld_trg_arch)) \
 | 
|---|
| 164 |         $(TOOL.$(bld_trg)) \
 | 
|---|
| 165 |         $(TOOL) \
 | 
|---|
| 166 | ))
 | 
|---|
| 167 | else
 | 
|---|
| 168 | _TARGET_TOOL = $(strip $(firstword \
 | 
|---|
| 169 |         $($(1)_$(2)TOOL.$(bld_trg).$(bld_trg_arch).$(bld_type)) \
 | 
|---|
| 170 |         $($(1)_$(2)TOOL.$(bld_trg).$(bld_trg_arch)) \
 | 
|---|
| 171 |         $($(1)_$(2)TOOL.$(bld_trg).$(bld_type)) \
 | 
|---|
| 172 |         $($(1)_$(2)TOOL.$(bld_trg_arch)) \
 | 
|---|
| 173 |         $($(1)_$(2)TOOL.$(bld_trg)) \
 | 
|---|
| 174 |         $($(1)_$(2)TOOL.$(bld_type)) \
 | 
|---|
| 175 |         $($(1)_$(2)TOOL) \
 | 
|---|
| 176 |         $($(1)_TOOL.$(bld_trg).$(bld_trg_arch).$(bld_type)) \
 | 
|---|
| 177 |         $($(1)_TOOL.$(bld_trg).$(bld_trg_arch)) \
 | 
|---|
| 178 |         $($(1)_TOOL.$(bld_trg).$(bld_type)) \
 | 
|---|
| 179 |         $($(1)_TOOL.$(bld_trg_arch)) \
 | 
|---|
| 180 |         $($(1)_TOOL.$(bld_trg)) \
 | 
|---|
| 181 |         $($(1)_TOOL.$(bld_type)) \
 | 
|---|
| 182 |         $($(1)_TOOL) \
 | 
|---|
| 183 |         $($(2)TOOL.$(bld_trg).$(bld_trg_arch).$(bld_type)) \
 | 
|---|
| 184 |         $($(2)TOOL.$(bld_trg).$(bld_trg_arch)) \
 | 
|---|
| 185 |         $($(2)TOOL.$(bld_trg).$(bld_type)) \
 | 
|---|
| 186 |         $($(2)TOOL.$(bld_trg_arch)) \
 | 
|---|
| 187 |         $($(2)TOOL.$(bld_trg)) \
 | 
|---|
| 188 |         $($(2)TOOL.$(bld_type)) \
 | 
|---|
| 189 |         $($(2)TOOL) \
 | 
|---|
| 190 |         $(TOOL.$(bld_trg).$(bld_trg_arch).$(bld_type)) \
 | 
|---|
| 191 |         $(TOOL.$(bld_trg).$(bld_trg_arch)) \
 | 
|---|
| 192 |         $(TOOL.$(bld_trg).$(bld_type)) \
 | 
|---|
| 193 |         $(TOOL.$(bld_trg_arch)) \
 | 
|---|
| 194 |         $(TOOL.$(bld_trg)) \
 | 
|---|
| 195 |         $(TOOL.$(bld_type)) \
 | 
|---|
| 196 |         $(TOOL) \
 | 
|---|
| 197 | ))
 | 
|---|
| 198 | endif
 | 
|---|
| 199 | 
 | 
|---|
| 200 | ## Figure out the actual name of an installed file.
 | 
|---|
| 201 | # @param        $1              The file to install.
 | 
|---|
| 202 | # @param        $2              The target name.
 | 
|---|
| 203 | # @param        $3              The _INST value (can be empty).
 | 
|---|
| 204 | # @param        $4              The installation root directory.
 | 
|---|
| 205 | _INSTALL_FILE = $(patsubst %/,%/$(notdir $(1)),$(if $(3),$(4)/$(3),$(4)/))
 | 
|---|
| 206 | 
 | 
|---|
| 207 | 
 | 
|---|
| 208 | ##
 | 
|---|
| 209 | # Function for getting the first defined propert value.
 | 
|---|
| 210 | #
 | 
|---|
| 211 | # @param   1            The property name.
 | 
|---|
| 212 | # @param   2            The default property name, empty if none.
 | 
|---|
| 213 | # @param   3            What to return if all variables are empty. (optional)
 | 
|---|
| 214 | # @note    Implicit parameters: target, bld_trg, bld_trg_arch, bld_trg_cpu, bld_type.
 | 
|---|
| 215 | # @returns Expanded property value.
 | 
|---|
| 216 | #
 | 
|---|
| 217 | define def_fn_prop_get_first_defined
 | 
|---|
| 218 | local .RETURN := $(firstdefined \
 | 
|---|
| 219 |     $(target)_$(1).$(bld_trg).$(bld_trg_arch).$(bld_type) \
 | 
|---|
| 220 |     $(target)_$(1).$(bld_trg).$(bld_trg_arch) \
 | 
|---|
| 221 |     $(target)_$(1).$(bld_trg).$(bld_type) \
 | 
|---|
| 222 |     $(target)_$(1).$(bld_trg_cpu) \
 | 
|---|
| 223 |     $(target)_$(1).$(bld_trg_arch) \
 | 
|---|
| 224 |     $(target)_$(1).$(bld_trg) \
 | 
|---|
| 225 |     $(target)_$(1).$(bld_type) \
 | 
|---|
| 226 |     $(target)_$(1) \
 | 
|---|
| 227 | )
 | 
|---|
| 228 | ifeq ($(.RETURN),)
 | 
|---|
| 229 |  ifneq ($(2),)
 | 
|---|
| 230 |   local .RETURN := $(firstdefined \
 | 
|---|
| 231 |     $(2).$(bld_trg).$(bld_trg_arch).$(bld_type) \
 | 
|---|
| 232 |     $(2).$(bld_trg).$(bld_trg_arch) \
 | 
|---|
| 233 |     $(2).$(bld_trg).$(bld_type) \
 | 
|---|
| 234 |     $(2).$(bld_trg_cpu) \
 | 
|---|
| 235 |     $(2).$(bld_trg_arch) \
 | 
|---|
| 236 |     $(2).$(bld_trg) \
 | 
|---|
| 237 |     $(2).$(bld_type) \
 | 
|---|
| 238 |     $(2) \
 | 
|---|
| 239 |     3 \
 | 
|---|
| 240 |   )
 | 
|---|
| 241 |  else
 | 
|---|
| 242 |   local .RETURN := $(firstdefined \
 | 
|---|
| 243 |     kBuildGlobalDefaults_$(1).$(bld_trg).$(bld_trg_arch).$(bld_type) \
 | 
|---|
| 244 |     kBuildGlobalDefaults_$(1).$(bld_trg).$(bld_trg_arch) \
 | 
|---|
| 245 |     kBuildGlobalDefaults_$(1).$(bld_trg).$(bld_type) \
 | 
|---|
| 246 |     kBuildGlobalDefaults_$(1).$(bld_trg_cpu) \
 | 
|---|
| 247 |     kBuildGlobalDefaults_$(1).$(bld_trg_arch) \
 | 
|---|
| 248 |     kBuildGlobalDefaults_$(1).$(bld_trg) \
 | 
|---|
| 249 |     kBuildGlobalDefaults_$(1).$(bld_type) \
 | 
|---|
| 250 |     kBuildGlobalDefaults_$(1) \
 | 
|---|
| 251 |     3 \
 | 
|---|
| 252 |   )
 | 
|---|
| 253 |  endif
 | 
|---|
| 254 | endif
 | 
|---|
| 255 | local .RETURN := $(strip $($(.RETURN)))
 | 
|---|
| 256 | endef # def_fn_prop_get_first_defined
 | 
|---|
| 257 | 
 | 
|---|
| 258 | ##
 | 
|---|
| 259 | # Function for getting the first property value (ignoring empty defines).
 | 
|---|
| 260 | #
 | 
|---|
| 261 | # @param   1            The property name.
 | 
|---|
| 262 | # @param   2            The default property name, empty if none.
 | 
|---|
| 263 | # @param   3            What to return if all variables are empty. (optional)
 | 
|---|
| 264 | # @note    Implicit parameters: target, bld_trg, bld_trg_arch, bld_trg_cpu, bld_type.
 | 
|---|
| 265 | # @returns First word.
 | 
|---|
| 266 | #
 | 
|---|
| 267 | define def_fn_prop_get_first_word
 | 
|---|
| 268 | local .RETURN := $(firstword \
 | 
|---|
| 269 |     $($(target)_$(1).$(bld_trg).$(bld_trg_arch).$(bld_type)) \
 | 
|---|
| 270 |     $($(target)_$(1).$(bld_trg).$(bld_trg_arch)) \
 | 
|---|
| 271 |     $($(target)_$(1).$(bld_trg).$(bld_type)) \
 | 
|---|
| 272 |     $($(target)_$(1).$(bld_trg_cpu)) \
 | 
|---|
| 273 |     $($(target)_$(1).$(bld_trg_arch)) \
 | 
|---|
| 274 |     $($(target)_$(1).$(bld_trg)) \
 | 
|---|
| 275 |     $($(target)_$(1).$(bld_type)) \
 | 
|---|
| 276 |     $($(target)_$(1)) \
 | 
|---|
| 277 | )
 | 
|---|
| 278 | ifeq ($(.RETURN),)
 | 
|---|
| 279 |  ifneq ($(2),)
 | 
|---|
| 280 |   local .RETURN := $(firstword \
 | 
|---|
| 281 |     $($(2).$(bld_trg).$(bld_trg_arch).$(bld_type)) \
 | 
|---|
| 282 |     $($(2).$(bld_trg).$(bld_trg_arch)) \
 | 
|---|
| 283 |     $($(2).$(bld_trg).$(bld_type)) \
 | 
|---|
| 284 |     $($(2).$(bld_trg_cpu)) \
 | 
|---|
| 285 |     $($(2).$(bld_trg_arch)) \
 | 
|---|
| 286 |     $($(2).$(bld_trg)) \
 | 
|---|
| 287 |     $($(2).$(bld_type)) \
 | 
|---|
| 288 |     $($(2)) \
 | 
|---|
| 289 |     $(3) \
 | 
|---|
| 290 |   )
 | 
|---|
| 291 |  else
 | 
|---|
| 292 |   local .RETURN := $(firstword \
 | 
|---|
| 293 |     $(kBuildGlobalDefaults_$(1).$(bld_trg).$(bld_trg_arch).$(bld_type)) \
 | 
|---|
| 294 |     $(kBuildGlobalDefaults_$(1).$(bld_trg).$(bld_trg_arch)) \
 | 
|---|
| 295 |     $(kBuildGlobalDefaults_$(1).$(bld_trg).$(bld_type)) \
 | 
|---|
| 296 |     $(kBuildGlobalDefaults_$(1).$(bld_trg_cpu)) \
 | 
|---|
| 297 |     $(kBuildGlobalDefaults_$(1).$(bld_trg_arch)) \
 | 
|---|
| 298 |     $(kBuildGlobalDefaults_$(1).$(bld_trg)) \
 | 
|---|
| 299 |     $(kBuildGlobalDefaults_$(1).$(bld_type)) \
 | 
|---|
| 300 |     $(kBuildGlobalDefaults_$(1)) \
 | 
|---|
| 301 |     $(3) \
 | 
|---|
| 302 |   )
 | 
|---|
| 303 |  endif
 | 
|---|
| 304 | endif
 | 
|---|
| 305 | endef # def_fn_prop_get_first_word
 | 
|---|
| 306 | 
 | 
|---|
| 307 | 
 | 
|---|
| 308 | ##
 | 
|---|
| 309 | # Function for collecting properties, priority ones last.
 | 
|---|
| 310 | #
 | 
|---|
| 311 | # @param   1            The property name.
 | 
|---|
| 312 | # @param   2            The default property name, empty if none.
 | 
|---|
| 313 | # @note    Implicit parameters: target, bld_trg, bld_trg_arch, bld_trg_cpu, bld_type.
 | 
|---|
| 314 | # @returns All properties.
 | 
|---|
| 315 | #
 | 
|---|
| 316 | define def_fn_prop_get_all_priority_last
 | 
|---|
| 317 | local .RETURN := \
 | 
|---|
| 318 |     $($(target)_$(1)) \
 | 
|---|
| 319 |     $($(target)_$(1).$(bld_type)) \
 | 
|---|
| 320 |     $($(target)_$(1).$(bld_trg)) \
 | 
|---|
| 321 |     $($(target)_$(1).$(bld_trg_arch)) \
 | 
|---|
| 322 |     $($(target)_$(1).$(bld_trg_cpu)) \
 | 
|---|
| 323 |     $($(target)_$(1).$(bld_trg).$(bld_type)) \
 | 
|---|
| 324 |     $($(target)_$(1).$(bld_trg).$(bld_trg_arch)) \
 | 
|---|
| 325 |     $($(target)_$(1).$(bld_trg).$(bld_trg_arch).$(bld_type))
 | 
|---|
| 326 | endef # def_fn_prop_get_all_priority_last
 | 
|---|
| 327 | 
 | 
|---|
| 328 | 
 | 
|---|
| 329 | ##
 | 
|---|
| 330 | # Function for collecting properties with prefixing, priority ones last.
 | 
|---|
| 331 | #
 | 
|---|
| 332 | # @param   1            The property name.
 | 
|---|
| 333 | # @param   2            Something like $(NLTAB).
 | 
|---|
| 334 | # @note    Implicit parameters: target, bld_trg, bld_trg_arch, bld_trg_cpu, bld_type.
 | 
|---|
| 335 | # @returns All properties.
 | 
|---|
| 336 | #
 | 
|---|
| 337 | define def_fn_prop_get_all_prefixed_priority_last
 | 
|---|
| 338 | local .RETURN := \
 | 
|---|
| 339 |     $(if $($(target)_$(1)),$(2),)$($(target)_$(1)) \
 | 
|---|
| 340 |     $(if $($(target)_$(1).$(bld_type)),$(2),)$($(target)_$(1).$(bld_type)) \
 | 
|---|
| 341 |     $(if $($(target)_$(1).$(bld_trg)),$(2),)$($(target)_$(1).$(bld_trg)) \
 | 
|---|
| 342 |     $(if $($(target)_$(1).$(bld_trg_arch)),$(2),)$($(target)_$(1).$(bld_trg_arch)) \
 | 
|---|
| 343 |     $(if $($(target)_$(1).$(bld_trg_cpu)),$(2),)$($(target)_$(1).$(bld_trg_cpu)) \
 | 
|---|
| 344 |     $(if $($(target)_$(1).$(bld_trg).$(bld_type)),$(2),)$($(target)_$(1).$(bld_trg).$(bld_type)) \
 | 
|---|
| 345 |     $(if $($(target)_$(1).$(bld_trg).$(bld_trg_arch)),$(2),)$($(target)_$(1).$(bld_trg).$(bld_trg_arch)) \
 | 
|---|
| 346 |     $(if $($(target)_$(1).$(bld_trg).$(bld_trg_arch).$(bld_type)),$(2),)$($(target)_$(1).$(bld_trg).$(bld_trg_arch).$(bld_type))
 | 
|---|
| 347 | endef # def_fn_prop_get_all_prefixed_priority_last
 | 
|---|
| 348 | 
 | 
|---|
| 349 | 
 | 
|---|
| 350 | #
 | 
|---|
| 351 | # The main body.
 | 
|---|
| 352 | #
 | 
|---|
| 353 | include $(KBUILD_PATH)/footer-inherit-uses-tools.kmk
 | 
|---|
| 354 | include $(KBUILD_PATH)/footer-pass1.kmk
 | 
|---|
| 355 | include $(KBUILD_PATH)/footer-pass2-fetches.kmk
 | 
|---|
| 356 | include $(KBUILD_PATH)/footer-pass2-patches.kmk
 | 
|---|
| 357 | include $(KBUILD_PATH)/footer-pass2-compiling-targets.kmk
 | 
|---|
| 358 | include $(KBUILD_PATH)/footer-pass2-installs.kmk
 | 
|---|
| 359 | include $(KBUILD_PATH)/footer-misc.kmk
 | 
|---|
| 360 | include $(KBUILD_PATH)/footer-passes.kmk
 | 
|---|
| 361 | 
 | 
|---|
| 362 | 
 | 
|---|
| 363 | #
 | 
|---|
| 364 | # THE MAIN RULES
 | 
|---|
| 365 | #
 | 
|---|
| 366 | all_recursive: $(pass_prev)
 | 
|---|
| 367 | 
 | 
|---|
| 368 | rebuild: clean
 | 
|---|
| 369 |         + $(MAKE) -f $(firstword $(MAKEFILE_LIST)) all_recursive
 | 
|---|
| 370 | 
 | 
|---|
| 371 | # @todo make this a non-default pass!
 | 
|---|
| 372 | uninstall::
 | 
|---|
| 373 |         $(RM) -f -- $(_INSTALLS_FILES)
 | 
|---|
| 374 | 
 | 
|---|
| 375 | install:: pass_installs
 | 
|---|
| 376 | 
 | 
|---|
| 377 | # misc shortcuts (use secondary expansion here to save strcache[file] space).
 | 
|---|
| 378 | targets:   bldprogs libraries dlls programs sysmods miscbins others installs
 | 
|---|
| 379 | objects:   $$(_OBJS)
 | 
|---|
| 380 | bldprogs:  $$(_BLDPROGS)
 | 
|---|
| 381 | libraries: $$(_LIBS) $$(_IMPORT_LIBS) $$(_OTHER_LIBRARIES)
 | 
|---|
| 382 | dlls:      $$(_DLLS)
 | 
|---|
| 383 | programs:  $$(_PROGRAMS)
 | 
|---|
| 384 | sysmods:   $$(_SYSMODS)
 | 
|---|
| 385 | miscbins:  $$(_MISCBINS)
 | 
|---|
| 386 | others:    $$(_OTHERS)
 | 
|---|
| 387 | stagings:  $$(_INSTALLS) $$(_STAGE_DIRS) $$(_STAGE_FILES)
 | 
|---|
| 388 | installs:  $$(_INSTALLS_DIRS) $$(_INSTALLS_FILES)
 | 
|---|
| 389 | 
 | 
|---|
| 390 | install-debug:  $$(_DEBUG_INSTALL_DIRS) $$(_DEBUG_INSTALL_FILES)
 | 
|---|
| 391 | 
 | 
|---|
| 392 | 
 | 
|---|
| 393 | 
 | 
|---|
| 394 | #
 | 
|---|
| 395 | # kBuild debugging stuff.
 | 
|---|
| 396 | #
 | 
|---|
| 397 | ## @todo this doesn't work. Move to a debug unit and expand it.
 | 
|---|
| 398 | show_targets:
 | 
|---|
| 399 |         @$(foreach target, $(_ALL_TARGETS),\
 | 
|---|
| 400 |         @$(ECHO) "target: $(target)" $(NLTAB)\
 | 
|---|
| 401 |         @$(ECHO) "  $(target)_0_OUTDIR=$($(target)_0_OUTDIR)" $(NLTAB)\
 | 
|---|
| 402 |         @$(ECHO) "  $(target)_1_TARGET=$($(target)_1_TARGET)" $(NLTAB)\
 | 
|---|
| 403 |         @$(ECHO) "  INSTARGET_$(target)=$(INSTARGET_$(target))" $(NLTAB)\
 | 
|---|
| 404 | $(foreach prop,$(PROPS_SINGLE) $(PROPS_ACCUMULATE_L) $(PROPS_ACCUMULATE_R) 2_OBJS CLEAN, \
 | 
|---|
| 405 |         $(eval _tmp:=$(firstword $($(target)_BLD_TRG) $(KBUILD_TARGET))) \
 | 
|---|
| 406 |         $(if $($(target)_$(prop).$(_tmp)),\
 | 
|---|
| 407 |                 @$(ECHO) "  $(target)_$(prop).$(_tmp)=$($(target)_$(prop).$(_tmp))" $(NLTAB)) \
 | 
|---|
| 408 |         $(if $($(target)_$(prop)), $(NLTAB)@$(ECHO) "  $(target)_$(prop)=$($(target)_$(prop))" $(NLTAB)) \
 | 
|---|
| 409 | )\
 | 
|---|
| 410 | $(foreach prop,$(PROPS_DEFERRED), \
 | 
|---|
| 411 |         $(eval _tmp:=$(firstword $($(target)_BLD_TRG) $(KBUILD_TARGET))) \
 | 
|---|
| 412 |         $(if $(value $(target)_$(prop).$(_tmp)),\
 | 
|---|
| 413 |                 @$(ECHO) '  $(target)_$(prop).$(_tmp)=$(value $(TARGET)_$(prop).$(_tmp))' $(NLTAB)) \
 | 
|---|
| 414 |         $(if $(value $(target)_$(prop)), $(NLTAB)@$(ECHO) '  $(target)_$(prop)=$(value $(target)_$(prop))' $(NLTAB)) \
 | 
|---|
| 415 | ))
 | 
|---|
| 416 | 
 | 
|---|
| 417 | 
 | 
|---|
| 418 | 
 | 
|---|
| 419 | #
 | 
|---|
| 420 | # Include dependency files.
 | 
|---|
| 421 | #
 | 
|---|
| 422 | ifdef _DEPFILES
 | 
|---|
| 423 |  # TODO: first works the second doesn't, provided _KB_INCLUDE_DEPS is undefined:
 | 
|---|
| 424 |  #   if "$(_KB_INCLUDE_DEPS)" == "1"
 | 
|---|
| 425 |  #   if $(_KB_INCLUDE_DEPS) == "1"
 | 
|---|
| 426 | 
 | 
|---|
| 427 |  ifdef KB_HAVE_INCLUDEDEP_QUEUE
 | 
|---|
| 428 |   includedep-queue $(_DEPFILES)
 | 
|---|
| 429 |  else
 | 
|---|
| 430 |   $(foreach dep, $(_DEPFILES), $(eval includedep $(dep)))
 | 
|---|
| 431 |  endif
 | 
|---|
| 432 | endif
 | 
|---|
| 433 | 
 | 
|---|
| 434 | 
 | 
|---|
| 435 | ifdef KBUILD_PROFILE_SELF
 | 
|---|
| 436 |  $(evalcall def_profile_self, end of footer.kmk)
 | 
|---|
| 437 |  _KBUILD_TS_FOOTER_END := $(_KBUILD_TS_PREV)
 | 
|---|
| 438 | 
 | 
|---|
| 439 |  ifneq ($(KBUILD_PROFILE_SELF),0)
 | 
|---|
| 440 |   $(info prof: ALL=$(words $(_ALL_TARGETS)) BLDPROGS=$(words $(_ALL_BLDPROGS)) LIBRARIES=$(words $(_ALL_LIBRARIES)) IMPORT_LIBS=$(words $(IMPORT_LIBS)) DLLS=$(words $(DLLS)) PROGRAMS=$(words $(_ALL_PROGRAMS)) )
 | 
|---|
| 441 |   $(info prof: SYSMODS=$(words $(_ALL_SYSMODS)) MISCBINS=$(words $(_ALL_MISCBINS)) OTHERS=$(words $(_ALL_OTHERS)) INSTALLS=$(words $(_ALL_INSTALLS)) FETCHES=$(words $(_ALL_FETCHES)) PACKING=$(words $(_PACKING)) TESTING=$(words $(TESTING)) )
 | 
|---|
| 442 |   $(info prof: DIRS=$(words $(_DIR_ALL)) TOOLS=$(words $(_TOOLS)) SDKS=$(words $(_SDKS)) USES=$(words $(_USES)) OUT_FILES=$(words $(_OUT_FILES)) OBJS=$(words $(_OBJS)) CLEAN_FILES=$(words $(CLEAN_FILES) $(OTHER_CLEAN)) )
 | 
|---|
| 443 |   $(info prof: DEPFILES_INCLUDED=$(words $(_DEPFILES_INCLUDED)) DEPFILES=$(words $(_DEPFILES)) MAKEFILES=$(words $(MAKEFILE_LIST)) )
 | 
|---|
| 444 |  endif
 | 
|---|
| 445 | endif
 | 
|---|
| 446 | 
 | 
|---|
| 447 | 
 | 
|---|
| 448 | # end-of-file-content
 | 
|---|
| 449 | __footer_kmk__ := target
 | 
|---|
| 450 | endif # !defined(__footer_kmk__)
 | 
|---|
| 451 | 
 | 
|---|