| 1 | # $Id: header.kmk 3253 2019-01-02 00:23:15Z bird $
|
|---|
| 2 | ## @file
|
|---|
| 3 | # kBuild - File included at top 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 2 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 __header_kmk__
|
|---|
| 35 | # start-of-file-content
|
|---|
| 36 | ifdef KBUILD_PROFILE_SELF
|
|---|
| 37 | _KBUILD_TS_HEADER_START := $(nanots ) # just a dummy warm up query
|
|---|
| 38 | $(info prof: since start - since previous -- event description)
|
|---|
| 39 | ifeq ($(KBUILD_PROFILE_SELF),2)
|
|---|
| 40 | $(info stat: $(make-stats ))
|
|---|
| 41 | endif
|
|---|
| 42 | _KBUILD_TS_HEADER_START := $(nanots )
|
|---|
| 43 | _KBUILD_TS_PREV := $(_KBUILD_TS_HEADER_START)
|
|---|
| 44 |
|
|---|
| 45 | _KBUILD_FMT_ELAPSED_EX = $(int-div $(int-add $(int-sub $1, $2),500000),1000000)ms
|
|---|
| 46 | _KBUILD_FMT_ELAPSED = $(call _KBUILD_FMT_ELAPSED_EX,$(_KBUILD_TS_NOW),$1)
|
|---|
| 47 |
|
|---|
| 48 | define def_profile_self
|
|---|
| 49 | _KBUILD_TS_NOW := $(nanots )
|
|---|
| 50 | $(info prof: $(call _KBUILD_FMT_ELAPSED,$(_KBUILD_TS_HEADER_START)) - $(call _KBUILD_FMT_ELAPSED, $(_KBUILD_TS_PREV)) -- $(strip $1))
|
|---|
| 51 | ifeq ($(KBUILD_PROFILE_SELF),2)
|
|---|
| 52 | $(info stat: $(make-stats ))
|
|---|
| 53 | endif
|
|---|
| 54 | _KBUILD_TS_PREV := $(_KBUILD_TS_NOW)
|
|---|
| 55 | endef
|
|---|
| 56 |
|
|---|
| 57 | endif
|
|---|
| 58 |
|
|---|
| 59 |
|
|---|
| 60 | #
|
|---|
| 61 | # Check make version before we do anything else.
|
|---|
| 62 | #
|
|---|
| 63 | ifndef KMK_VERSION
|
|---|
| 64 | $(error kBuild: The kmk default variable KMK_VERSION isn't defined! Make sure you are using 'kmk' and not 'make', 'gmake', 'kmk_gmake', 'dmake' or any other make program)
|
|---|
| 65 | endif
|
|---|
| 66 | ifneq ($(KBUILD_VERSION_MAJOR).$(KBUILD_VERSION_MINOR),0.1)
|
|---|
| 67 | ifneq ($(KBUILD_VERSION_MAJOR),0)
|
|---|
| 68 | $(warning kBuild: kmk major version mismatch! Expected '0' but found '$(KBUILD_VERSION_MAJOR)'!)
|
|---|
| 69 | else
|
|---|
| 70 | $(warning kBuild: kmk minor version mismatch! Expected '1' but found '$(KBUILD_VERSION_MINOR)'!)
|
|---|
| 71 | endif
|
|---|
| 72 | else
|
|---|
| 73 | if $(KBUILD_VERSION_PATCH) < 999
|
|---|
| 74 | $(error kBuild: kmk version mismatch! Expected 0.1.999 or later. Actual version is $(KBUILD_VERSION).)
|
|---|
| 75 | endif
|
|---|
| 76 | endif
|
|---|
| 77 |
|
|---|
| 78 | #
|
|---|
| 79 | # The revision in which this file was last modified.
|
|---|
| 80 | # This can be useful when using development versions of kBuild.
|
|---|
| 81 | #
|
|---|
| 82 | KMK_REVISION := $(patsubst %:,, $Rev: 3253 $ )
|
|---|
| 83 |
|
|---|
| 84 |
|
|---|
| 85 | #
|
|---|
| 86 | # Define the default goal.
|
|---|
| 87 | #
|
|---|
| 88 | .PHONY: all all_recursive
|
|---|
| 89 | all: all_recursive
|
|---|
| 90 |
|
|---|
| 91 | #
|
|---|
| 92 | # The phony FORCE target.
|
|---|
| 93 | #
|
|---|
| 94 | .PHONY: FORCE
|
|---|
| 95 | FORCE:
|
|---|
| 96 |
|
|---|
| 97 |
|
|---|
| 98 | #
|
|---|
| 99 | # Enable delete on error and second expansion of prerequisites and targets.
|
|---|
| 100 | #
|
|---|
| 101 | .DELETE_ON_ERROR:
|
|---|
| 102 |
|
|---|
| 103 | .SECONDEXPANSION:
|
|---|
| 104 |
|
|---|
| 105 | .SECONDTARGETEXPANSION:
|
|---|
| 106 |
|
|---|
| 107 |
|
|---|
| 108 | #
|
|---|
| 109 | # General purpose macros.
|
|---|
| 110 | #
|
|---|
| 111 |
|
|---|
| 112 | ##
|
|---|
| 113 | # Newline character(s).
|
|---|
| 114 | define NL
|
|---|
| 115 |
|
|---|
| 116 |
|
|---|
| 117 | endef
|
|---|
| 118 |
|
|---|
| 119 | ##
|
|---|
| 120 | # Tab character.
|
|---|
| 121 | TAB := $(subst ., ,.)
|
|---|
| 122 |
|
|---|
| 123 | ##
|
|---|
| 124 | # Newline + tab characters (for generating commands).
|
|---|
| 125 | NLTAB = $(NL)$(TAB)
|
|---|
| 126 |
|
|---|
| 127 | ##
|
|---|
| 128 | # Space character.
|
|---|
| 129 | SP := $(subst ., ,.)
|
|---|
| 130 |
|
|---|
| 131 | ##
|
|---|
| 132 | # Hash character.
|
|---|
| 133 | define HASH
|
|---|
| 134 | #
|
|---|
| 135 | endef
|
|---|
| 136 |
|
|---|
| 137 | ##
|
|---|
| 138 | # Colon character.
|
|---|
| 139 | COLON := :
|
|---|
| 140 |
|
|---|
| 141 | ##
|
|---|
| 142 | # Semicolon character.
|
|---|
| 143 | SEMICOLON := ;
|
|---|
| 144 |
|
|---|
| 145 | ##
|
|---|
| 146 | # Comma character.
|
|---|
| 147 | COMMA := ,
|
|---|
| 148 |
|
|---|
| 149 | ##
|
|---|
| 150 | # Dot character.
|
|---|
| 151 | DOT := .
|
|---|
| 152 |
|
|---|
| 153 | ##
|
|---|
| 154 | # Dollar character.
|
|---|
| 155 | DOLLAR := $$
|
|---|
| 156 |
|
|---|
| 157 | ##
|
|---|
| 158 | # Equal character.
|
|---|
| 159 | EQUAL := =
|
|---|
| 160 |
|
|---|
| 161 | ##
|
|---|
| 162 | # Percent character.
|
|---|
| 163 | PERCENT := %
|
|---|
| 164 |
|
|---|
| 165 | ##
|
|---|
| 166 | # Single quote character.
|
|---|
| 167 | SQUOTE := '
|
|---|
| 168 |
|
|---|
| 169 | ##
|
|---|
| 170 | # Double quote character.
|
|---|
| 171 | DQUOTE := "
|
|---|
| 172 |
|
|---|
| 173 | ##
|
|---|
| 174 | # Opening parenthesis.
|
|---|
| 175 | OPENPAR := (
|
|---|
| 176 |
|
|---|
| 177 | ##
|
|---|
| 178 | # Closing parenthesis.
|
|---|
| 179 | CLOSEPAR := )
|
|---|
| 180 |
|
|---|
| 181 |
|
|---|
| 182 | #
|
|---|
| 183 | # The list of standard build types in kBuild.
|
|---|
| 184 | #
|
|---|
| 185 | # This list can be extended in Config.kmk and it's possible to extend
|
|---|
| 186 | # (inherit) another build type.
|
|---|
| 187 | #
|
|---|
| 188 | KBUILD_BLD_TYPES := release profile debug
|
|---|
| 189 |
|
|---|
| 190 |
|
|---|
| 191 | #
|
|---|
| 192 | # The OSes, Architectures and CPUs that kBuild recognizes.
|
|---|
| 193 | #
|
|---|
| 194 | # When kBuild is ported to a new OS or architecture a unique keyword needs
|
|---|
| 195 | # to be assigned to it and added here. This strictness is required because
|
|---|
| 196 | # this keyword namespace is shared between OSes, architectures, cpus and
|
|---|
| 197 | # build types. (PORTME)
|
|---|
| 198 | #
|
|---|
| 199 | KBUILD_OSES := darwin dos dragonfly freebsd gnuhurd gnukfbsd gnuknbsd haiku l4 linux netbsd nt openbsd os2 solaris win os-agnostic
|
|---|
| 200 | KBUILD_ARCHES := x86 amd64 noarch alpha arm32 arm64 hppa32 hppa64 ia64 m68k mips32 mips64 ppc32 ppc64 s390 s390x sh32 sh64 sparc32 sparc64 x32
|
|---|
| 201 | KBUILD_ARCHES_64 := amd64 alpha arm64 hppa64 ia64 mips64 ppc64 s390x sh64 sparc64 x32
|
|---|
| 202 | KBUILD_ARCHES_32 := x86 arm32 hppa32 m68k mips32 ppc32 s390 sh32 sparc32
|
|---|
| 203 |
|
|---|
| 204 |
|
|---|
| 205 |
|
|---|
| 206 | #
|
|---|
| 207 | # Mapping of kBuild OS + ARCH to GNU system type wildcards.
|
|---|
| 208 | # For use with the foreach/append/prepend and wildcard functions.
|
|---|
| 209 | #
|
|---|
| 210 | KBUILD_OSARCH_2_GNU_SYSTEM_TYPES.darwin.x86 = i?86-apple-darwin*
|
|---|
| 211 | KBUILD_OSARCH_2_GNU_SYSTEM_TYPES.darwin.amd64 = x86_64-apple-darwin* amd64-apple-darwin*
|
|---|
| 212 | KBUILD_OSARCH_2_GNU_SYSTEM_TYPES.freebsd.x86 = i?86-*freebsd*
|
|---|
| 213 | KBUILD_OSARCH_2_GNU_SYSTEM_TYPES.freebsd.amd64 = x86_64-*freebsd* amd64-*freebsd*
|
|---|
| 214 | KBUILD_OSARCH_2_GNU_SYSTEM_TYPES.linux.x86 = i?86-*linux-gnu
|
|---|
| 215 | KBUILD_OSARCH_2_GNU_SYSTEM_TYPES.linux.amd64 = x86_64-*linux-gnu amd64-*linux-gnu
|
|---|
| 216 | KBUILD_OSARCH_2_GNU_SYSTEM_TYPES.netbsd.x86 = i?86-*netbsd*
|
|---|
| 217 | KBUILD_OSARCH_2_GNU_SYSTEM_TYPES.netbsd.amd64 = x86_64-*netbsd* amd64-*netbsd*
|
|---|
| 218 | KBUILD_OSARCH_2_GNU_SYSTEM_TYPES.os2.x86 = i?86-*os2*
|
|---|
| 219 | KBUILD_OSARCH_2_GNU_SYSTEM_TYPES.solaris.x86 = i?86-*solaris2*
|
|---|
| 220 | KBUILD_OSARCH_2_GNU_SYSTEM_TYPES.solaris.amd64 = amd64-*solaris2* x86_64-*solaris2*
|
|---|
| 221 | KBUILD_OSARCH_2_GNU_SYSTEM_TYPES.solaris.sparc32 = sparc-*solaris2*
|
|---|
| 222 | KBUILD_OSARCH_2_GNU_SYSTEM_TYPES.solaris.sparc64 = sparc64-*solaris2* sparcv9-*solaris2*
|
|---|
| 223 | KBUILD_OSARCH_2_GNU_SYSTEM_TYPES.win.x86 = i?86-*mingw32* i?86-*msys* i?86-*cygwin*
|
|---|
| 224 | KBUILD_OSARCH_2_GNU_SYSTEM_TYPES.win.amd64 = x86_64-*mingw64* amd64-*mingw64* x86_64-*msys* amd64-*msys* x86_64-*cygwin* amd64-*cygwin*
|
|---|
| 225 |
|
|---|
| 226 |
|
|---|
| 227 | #
|
|---|
| 228 | # Set default build type.
|
|---|
| 229 | #
|
|---|
| 230 | ifndef KBUILD_TYPE
|
|---|
| 231 | ifdef BUILD_TYPE
|
|---|
| 232 | KBUILD_TYPE := $(BUILD_TYPE)
|
|---|
| 233 | endif
|
|---|
| 234 | else ifdef BUILD_TYPE
|
|---|
| 235 | ifneq ($(KBUILD_TYPE),$(BUILD_TYPE))
|
|---|
| 236 | ifeq ($(origin KBUILD_TYPE):$(origin BUILD_TYPE),environment:command line)
|
|---|
| 237 | KBUILD_TYPE := $(BUILD_TYPE)
|
|---|
| 238 | else ifneq ($(origin KBUILD_TYPE):$(origin BUILD_TYPE),command line:environment)
|
|---|
| 239 | $(error kBuild: KBUILD_TYPE and BUILD_TYPE disagree.)
|
|---|
| 240 | endif
|
|---|
| 241 | endif
|
|---|
| 242 | endif
|
|---|
| 243 | override BUILD_TYPE = $(KBUILD_TYPE)
|
|---|
| 244 |
|
|---|
| 245 | ifndef KBUILD_TYPE
|
|---|
| 246 | KBUILD_TYPE := release
|
|---|
| 247 | else
|
|---|
| 248 | if1of ($(KBUILD_TYPE), $(KBUILD_OSES) $(KBUILD_ARCHES))
|
|---|
| 249 | $(error kBuild: The KBUILD_TYPE value '$(KBUILD_TYPE)' is an OS or architecture!)
|
|---|
| 250 | endif
|
|---|
| 251 | ifneq (.$(words $(KBUILD_TYPE)).$(KBUILD_TYPE).,.1.$(strip $(KBUILD_TYPE)).)
|
|---|
| 252 | $(error kBuild: The KBUILD_TYPE value '$(KBUILD_TYPE)' contains spaces/tabs!)
|
|---|
| 253 | endif
|
|---|
| 254 | endif
|
|---|
| 255 |
|
|---|
| 256 |
|
|---|
| 257 | #
|
|---|
| 258 | # Host platform legacy
|
|---|
| 259 | # kmk deals with this, so this is only temporary until I've rebuilt everything.
|
|---|
| 260 | #
|
|---|
| 261 | ifndef KBUILD_HOST
|
|---|
| 262 | KBUILD_HOST := $(BUILD_PLATFORM)
|
|---|
| 263 | endif
|
|---|
| 264 | ifndef KBUILD_HOST_ARCH
|
|---|
| 265 | KBUILD_HOST_ARCH := $(BUILD_PLATFORM_ARCH)
|
|---|
| 266 | endif
|
|---|
| 267 | ifndef KBUILD_HOST_CPU
|
|---|
| 268 | KBUILD_HOST_CPU := $(BUILD_PLATFORM_CPU)
|
|---|
| 269 | endif
|
|---|
| 270 |
|
|---|
| 271 |
|
|---|
| 272 | #
|
|---|
| 273 | # Assert valid build platform variables.
|
|---|
| 274 | #
|
|---|
| 275 | # All these are set by kmk so they shouldn't be any trouble
|
|---|
| 276 | # unless the user starts messing about with environment variables.
|
|---|
| 277 | #
|
|---|
| 278 | ifneq (.$(words $(KBUILD_HOST)).$(KBUILD_HOST).,.1.$(strip $(KBUILD_HOST)).)
|
|---|
| 279 | $(error kBuild: The KBUILD_HOST value '$(KBUILD_HOST)' contains spaces/tabs!)
|
|---|
| 280 | endif
|
|---|
| 281 | ifneq ($(words $(filter $(KBUILD_HOST),$(KBUILD_OSES))),1)
|
|---|
| 282 | $(error kBuild: KBUILD_HOST value '$(KBUILD_HOST)' is not recognized (valid: $(KBUILD_OSES)))
|
|---|
| 283 | endif
|
|---|
| 284 |
|
|---|
| 285 | ifneq (.$(words $(KBUILD_HOST_ARCH)).$(KBUILD_HOST_ARCH).,.1.$(strip $(KBUILD_HOST_ARCH)).)
|
|---|
| 286 | $(error kBuild: The KBUILD_HOST_ARCH value '$(KBUILD_HOST_ARCH)' contains spaces/tabs!)
|
|---|
| 287 | endif
|
|---|
| 288 | ifneq ($(words $(filter $(KBUILD_HOST_ARCH),$(KBUILD_ARCHES))),1)
|
|---|
| 289 | $(error kBuild: KBUILD_HOST_ARCH value '$(KBUILD_HOST_ARCH)' is not recognized (valid: $(KBUILD_ARCHES)))
|
|---|
| 290 | endif
|
|---|
| 291 |
|
|---|
| 292 | ifeq ($(strip $(KBUILD_HOST_CPU)),)
|
|---|
| 293 | KBUILD_HOST_CPU := blend
|
|---|
| 294 | else
|
|---|
| 295 | ifneq (.$(words $(KBUILD_HOST_CPU)).$(KBUILD_HOST_CPU).,.1.$(strip $(KBUILD_HOST_CPU)).)
|
|---|
| 296 | $(error kBuild: The KBUILD_HOST_CPU value '$(KBUILD_HOST_CPU)' contains spaces/tabs!)
|
|---|
| 297 | endif
|
|---|
| 298 | if1of ($(KBUILD_HOST_CPU), $(KBUILD_OSES) $(KBUILD_ARCHES))
|
|---|
| 299 | $(error kBuild: The KBUILD_HOST_CPU value '$(KBUILD_HOST_CPU)' was found in the OS or architecture keywords!)
|
|---|
| 300 | endif
|
|---|
| 301 | ifeq ($(KBUILD_HOST_CPU),$(KBUILD_TYPE))
|
|---|
| 302 | $(error kBuild: The KBUILD_HOST_CPU value '$(KBUILD_HOST_CPU)' is the same as the KBUILD_TYPE!)
|
|---|
| 303 | endif
|
|---|
| 304 | endif
|
|---|
| 305 |
|
|---|
| 306 |
|
|---|
| 307 | #
|
|---|
| 308 | # Deal with target platform legacy.
|
|---|
| 309 | #
|
|---|
| 310 | ifndef KBUILD_TARGET
|
|---|
| 311 | ifdef BUILD_TARGET
|
|---|
| 312 | KBUILD_TARGET := $(BUILD_TARGET)
|
|---|
| 313 | endif
|
|---|
| 314 | else ifdef BUILD_TARGET
|
|---|
| 315 | ifneq ($(KBUILD_TARGET),$(BUILD_TARGET))
|
|---|
| 316 | ifeq ($(origin KBUILD_TARGET):$(origin BUILD_TARGET),environment:command line)
|
|---|
| 317 | KBUILD_TARGET := $(BUILD_TARGET)
|
|---|
| 318 | else ifneq ($(origin KBUILD_TARGET):$(origin BUILD_TARGET),command line:environment)
|
|---|
| 319 | $(error kBuild: KBUILD_TARGET and BUILD_TARGET disagree)
|
|---|
| 320 | endif
|
|---|
| 321 | endif
|
|---|
| 322 | endif
|
|---|
| 323 | override BUILD_TARGET = $(KBUILD_TARGET)
|
|---|
| 324 |
|
|---|
| 325 | ifndef KBUILD_TARGET_ARCH
|
|---|
| 326 | ifdef BUILD_TARGET_ARCH
|
|---|
| 327 | KBUILD_TARGET_ARCH := $(BUILD_TARGET_ARCH)
|
|---|
| 328 | endif
|
|---|
| 329 | else ifdef BUILD_TARGET_ARCH
|
|---|
| 330 | ifneq ($(KBUILD_TARGET_ARCH),$(BUILD_TARGET_ARCH))
|
|---|
| 331 | ifeq ($(origin KBUILD_TARGET_ARCH):$(origin BUILD_TARGET_ARCH),environment:command line)
|
|---|
| 332 | KBUILD_TARGET_ARCH := $(BUILD_TARGET_ARCH)
|
|---|
| 333 | else ifneq ($(origin KBUILD_TARGET_ARCH):$(origin BUILD_TARGET_ARCH),command line:environment)
|
|---|
| 334 | $(error kBuild: KBUILD_TARGET_ARCH and BUILD_TARGET_ARCH disagree)
|
|---|
| 335 | endif
|
|---|
| 336 | endif
|
|---|
| 337 | endif
|
|---|
| 338 | override BUILD_TARGET_ARCH = $(KBUILD_TARGET_ARCH)
|
|---|
| 339 |
|
|---|
| 340 | ifndef KBUILD_TARGET_CPU
|
|---|
| 341 | ifdef BUILD_TARGET_CPU
|
|---|
| 342 | KBUILD_TARGET_CPU := $(BUILD_TARGET_CPU)
|
|---|
| 343 | endif
|
|---|
| 344 | else ifdef BUILD_TARGET_CPU
|
|---|
| 345 | ifneq ($(KBUILD_TARGET_CPU),$(BUILD_TARGET_CPU))
|
|---|
| 346 | ifeq ($(origin KBUILD_TARGET_CPU):$(origin BUILD_TARGET_CPU),environment:command line)
|
|---|
| 347 | KBUILD_TARGET_CPU := $(BUILD_TARGET_CPU)
|
|---|
| 348 | else ifneq ($(origin KBUILD_TARGET_CPU):$(origin BUILD_TARGET_CPU),command line:environment)
|
|---|
| 349 | $(error kBuild: KBUILD_TARGET_CPU and BUILD_TARGET_CPU disagree)
|
|---|
| 350 | endif
|
|---|
| 351 | endif
|
|---|
| 352 | endif
|
|---|
| 353 | override BUILD_TARGET_CPU = $(KBUILD_TARGET_CPU)
|
|---|
| 354 |
|
|---|
| 355 |
|
|---|
| 356 | #
|
|---|
| 357 | # Assert or set default target platform.
|
|---|
| 358 | # When not defined use the corresponding KBUILD_HOST value.
|
|---|
| 359 | #
|
|---|
| 360 | ifndef KBUILD_TARGET
|
|---|
| 361 | KBUILD_TARGET := $(KBUILD_HOST)
|
|---|
| 362 | else
|
|---|
| 363 | ifneq (.$(words $(KBUILD_TARGET)).$(KBUILD_TARGET).,.1.$(strip $(KBUILD_TARGET)).)
|
|---|
| 364 | $(error kBuild: The KBUILD_TARGET value '$(KBUILD_TARGET)' contains spaces/tabs!)
|
|---|
| 365 | endif
|
|---|
| 366 | ifneq ($(words $(filter $(KBUILD_TARGET),$(KBUILD_OSES))),1)
|
|---|
| 367 | $(error kBuild: KBUILD_TARGET value '$(KBUILD_TARGET)' is not recognized (valid: $(KBUILD_OSES)))
|
|---|
| 368 | endif
|
|---|
| 369 | endif
|
|---|
| 370 |
|
|---|
| 371 | ifndef KBUILD_TARGET_ARCH
|
|---|
| 372 | KBUILD_TARGET_ARCH := $(KBUILD_HOST_ARCH)
|
|---|
| 373 | else
|
|---|
| 374 | ifneq (.$(words $(KBUILD_TARGET_ARCH)).$(KBUILD_TARGET_ARCH).,.1.$(strip $(KBUILD_TARGET_ARCH)).)
|
|---|
| 375 | $(error kBuild: The KBUILD_TARGET_ARCH value '$(KBUILD_TARGET_ARCH)' contains spaces/tabs!)
|
|---|
| 376 | endif
|
|---|
| 377 | ifneq ($(words $(filter $(KBUILD_TARGET_ARCH),$(KBUILD_ARCHES))),1)
|
|---|
| 378 | $(error kBuild: KBUILD_TARGET_ARCH value '$(KBUILD_TARGET_ARCH)' is not recognized (valid: $(KBUILD_ARCHES)))
|
|---|
| 379 | endif
|
|---|
| 380 | endif
|
|---|
| 381 |
|
|---|
| 382 | ifndef KBUILD_TARGET_CPU
|
|---|
| 383 | KBUILD_TARGET_CPU := $(KBUILD_HOST_CPU)
|
|---|
| 384 | else ifeq ($(strip $(KBUILD_TARGET_CPU)),)
|
|---|
| 385 | ifeq ($(KBUILD_TARGET_ARCH),$(KBUILD_HOST_ARCH))
|
|---|
| 386 | KBUILD_TARGET_CPU := $(KBUILD_HOST_CPU)
|
|---|
| 387 | else
|
|---|
| 388 | KBUILD_TARGET_CPU := blend
|
|---|
| 389 | endif
|
|---|
| 390 | else
|
|---|
| 391 | ifneq (.$(words $(KBUILD_TARGET_CPU)).$(KBUILD_TARGET_CPU).,.1.$(strip $(KBUILD_TARGET_CPU)).)
|
|---|
| 392 | $(error kBuild: The KBUILD_TARGET_CPU value '$(KBUILD_TARGET_CPU)' contains spaces/tabs!)
|
|---|
| 393 | endif
|
|---|
| 394 | if1of ($(KBUILD_TARGET_CPU), $(KBUILD_OSES) $(KBUILD_ARCHES))
|
|---|
| 395 | $(error kBuild: The KBUILD_TARGET_CPU value was found in the OS or architecture keywords!)
|
|---|
| 396 | endif
|
|---|
| 397 | ifeq ($(KBUILD_TARGET_CPU),$(KBUILD_TYPE))
|
|---|
| 398 | $(error kBuild: The KBUILD_TARGET_CPU value '$(KBUILD_TARGET_CPU)' is the same as the KBUILD_TYPE!)
|
|---|
| 399 | endif
|
|---|
| 400 | endif
|
|---|
| 401 |
|
|---|
| 402 | # Short hand for $(KBUILD_TARGET).$(KBUILD_TARGET_ARCH).
|
|---|
| 403 | KBUILD_TARGET_DOT_ARCH = $(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)
|
|---|
| 404 | KBUILD_HOST_DOT_ARCH = $(KBUILD_HOST).$(KBUILD_TARGET_ARCH)
|
|---|
| 405 |
|
|---|
| 406 |
|
|---|
| 407 | #
|
|---|
| 408 | # Paths and stuff.
|
|---|
| 409 | #
|
|---|
| 410 |
|
|---|
| 411 | # Adjust DEPTH first.
|
|---|
| 412 | DEPTH := $(strip $(DEPTH))
|
|---|
| 413 | ifeq ($(DEPTH),)
|
|---|
| 414 | DEPTH := .
|
|---|
| 415 | endif
|
|---|
| 416 |
|
|---|
| 417 | ## PATH_CURRENT is the current directory (getcwd).
|
|---|
| 418 | PATH_CURRENT := $(abspath $(CURDIR))
|
|---|
| 419 | ## PATH_SUB_CURRENT points to current directory of the current makefile.
|
|---|
| 420 | # Meaning that it will change value as we enter and exit sub-makefiles.
|
|---|
| 421 | PATH_SUB_CURRENT := $(PATH_CURRENT)
|
|---|
| 422 | ## PATH_ROOT points to the project root directory.
|
|---|
| 423 | PATH_ROOT := $(abspath $(PATH_CURRENT)/$(DEPTH))
|
|---|
| 424 | ## PATH_SUB_ROOT points to the directory of the top-level makefile.
|
|---|
| 425 | ifneq ($(strip $(SUB_DEPTH)),)
|
|---|
| 426 | SUB_DEPTH := $(strip $(SUB_DEPTH))
|
|---|
| 427 | PATH_SUB_ROOT := $(abspath $(PATH_CURRENT)/$(SUB_DEPTH))
|
|---|
| 428 | else
|
|---|
| 429 | PATH_SUB_ROOT := $(PATH_CURRENT)
|
|---|
| 430 | endif
|
|---|
| 431 |
|
|---|
| 432 | ## CURSUBDIR is PATH_SUB_ROOT described relative to PATH_ROOT.
|
|---|
| 433 | # This variable is used to determin where the object files and other output goes.
|
|---|
| 434 | ifneq ($(PATH_ROOT),$(PATH_SUB_ROOT))
|
|---|
| 435 | CURSUBDIR := $(patsubst $(PATH_ROOT)/%,%,$(PATH_SUB_ROOT))
|
|---|
| 436 | else
|
|---|
| 437 | CURSUBDIR := .
|
|---|
| 438 | endif
|
|---|
| 439 |
|
|---|
| 440 | # Install directory layout. Relative to PATH_INS.
|
|---|
| 441 | KBUILD_INST_PATHS := BIN DLL SYS LIB DOC DEBUG SBIN LIBEXEC SHARE
|
|---|
| 442 | INST_BIN = bin/
|
|---|
| 443 | if1of ($(KBUILD_TARGET), win)
|
|---|
| 444 | INST_DLL = bin/
|
|---|
| 445 | else
|
|---|
| 446 | INST_DLL = lib/
|
|---|
| 447 | endif
|
|---|
| 448 | if1of ($(KBUILD_TARGET), os2 win)
|
|---|
| 449 | INST_SYS = drivers/
|
|---|
| 450 | else
|
|---|
| 451 | INST_SYS = kernel/
|
|---|
| 452 | endif
|
|---|
| 453 | INST_LIB = lib/
|
|---|
| 454 | INST_DOC = share/doc/
|
|---|
| 455 | INST_DEBUG = debug/
|
|---|
| 456 | INST_SBIN = sbin/
|
|---|
| 457 | INST_LIBEXEC = libexec/
|
|---|
| 458 | INST_SHARE = share/
|
|---|
| 459 |
|
|---|
| 460 | # Staging directory layout. Relative to PATH_STAGE.
|
|---|
| 461 | STAGE_BIN = $(INST_BIN)
|
|---|
| 462 | STAGE_DLL = $(INST_DLL)
|
|---|
| 463 | STAGE_SYS = $(INST_SYS)
|
|---|
| 464 | STAGE_LIB = $(INST_LIB)
|
|---|
| 465 | STAGE_DOC = $(INST_DOC)
|
|---|
| 466 | STAGE_DEBUG = $(INST_DEBUG)
|
|---|
| 467 | STAGE_SBIN = $(INST_SBIN)
|
|---|
| 468 | STAGE_LIBEXEC = $(INST_LIBEXEC)
|
|---|
| 469 | STAGE_SHARE = $(INST_SHARE)
|
|---|
| 470 |
|
|---|
| 471 | # Install and staging directory paths.
|
|---|
| 472 | $(foreach path, $(KBUILD_INST_PATHS), \
|
|---|
| 473 | $(eval PATH_STAGE_$(path) = $$(patsubst %/,%,$$(PATH_STAGE)/$$(STAGE_$(path)))) \
|
|---|
| 474 | $(eval PATH_INST_$(path) = $$(patsubst %/,%,$$(PATH_INS)/$$(INST_$(path)))) \
|
|---|
| 475 | )
|
|---|
| 476 |
|
|---|
| 477 | # Output directories.
|
|---|
| 478 | ifndef PATH_OUT_BASE
|
|---|
| 479 | PATH_OUT_BASE := $(PATH_ROOT)/out
|
|---|
| 480 | endif
|
|---|
| 481 | ifndef PATH_OUT
|
|---|
| 482 | ifdef BUILD_TARGET_SUB # (BUILD_TARGET_SUB is not currently recognized by kBuild in any other places - obsolete)
|
|---|
| 483 | PATH_OUT = $(PATH_OUT_BASE)/$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH).$(BUILD_TARGET_SUB)/$(KBUILD_TYPE)
|
|---|
| 484 | else
|
|---|
| 485 | PATH_OUT = $(PATH_OUT_BASE)/$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)/$(KBUILD_TYPE)
|
|---|
| 486 | endif
|
|---|
| 487 | endif # !define PATH_OUT
|
|---|
| 488 | PATH_OBJCACHE = $(PATH_OUT_BASE)/kObjCache
|
|---|
| 489 | PATH_OBJ = $(PATH_OUT)/obj
|
|---|
| 490 | PATH_TARGET = $(PATH_OBJ)/$(CURSUBDIR)
|
|---|
| 491 | PATH_STAGE = $(PATH_OUT)/stage
|
|---|
| 492 | ifndef PATH_INS
|
|---|
| 493 | ifdef DESTROOT
|
|---|
| 494 | PATH_INS = $(DESTROOT)
|
|---|
| 495 | else
|
|---|
| 496 | PATH_INS = $(PATH_OUT)/dist
|
|---|
| 497 | endif
|
|---|
| 498 | endif
|
|---|
| 499 |
|
|---|
| 500 | # Tripwire obsolete PATH defines.
|
|---|
| 501 | PATH_BIN = $(error kBuild: PATH_BIN is obsoleted in kBuild 0.1.2. Use PATH_STAGE_BIN or PATH_INST_BIN instead)
|
|---|
| 502 | PATH_DLL = $(error kBuild: PATH_LIB is obsoleted in kBuild 0.1.2. Use PATH_STAGE_DLL or PATH_INST_DLL instead)
|
|---|
| 503 | PATH_LIB = $(error kBuild: PATH_LIB is obsoleted in kBuild 0.1.2. Use PATH_STAGE_LIB or PATH_INST_LIB instead)
|
|---|
| 504 | PATH_SYS = $(error kBuild: PATH_SYS is obsoleted in kBuild 0.1.2. Use PATH_STAGE_SYS or PATH_INST_SYS instead)
|
|---|
| 505 | PATH_DOC = $(error kBuild: PATH_DOC is obsoleted in kBuild 0.1.2. Use PATH_STAGE_DOC or PATH_INST_DOC instead)
|
|---|
| 506 |
|
|---|
| 507 | # Development tool tree.
|
|---|
| 508 | ifndef KBUILD_DEVTOOLS
|
|---|
| 509 | ifeq ($(PATH_DEVTOOLS),)
|
|---|
| 510 | KBUILD_DEVTOOLS = $(PATH_ROOT)/tools
|
|---|
| 511 | else
|
|---|
| 512 | KBUILD_DEVTOOLS := $(PATH_DEVTOOLS)
|
|---|
| 513 | endif
|
|---|
| 514 | endif
|
|---|
| 515 | KBUILD_DEVTOOLS_TRG ?= $(KBUILD_DEVTOOLS)/$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)
|
|---|
| 516 | KBUILD_DEVTOOLS_HST ?= $(KBUILD_DEVTOOLS)/$(KBUILD_HOST).$(KBUILD_HOST_ARCH)
|
|---|
| 517 |
|
|---|
| 518 | if1of ($(KBUILD_TARGET_ARCH), amd64 hppa64 mips64 ppc64 s390x sparc64)
|
|---|
| 519 | ifeq ($(KBUILD_TARGET_ARCH),amd64)
|
|---|
| 520 | KBUILD_DEVTOOLS_TRG_ALT ?= $(KBUILD_DEVTOOLS)/$(KBUILD_TARGET).x86
|
|---|
| 521 | else ifeq ($(KBUILD_TARGET_ARCH),hppa64)
|
|---|
| 522 | KBUILD_DEVTOOLS_TRG_ALT ?= $(KBUILD_DEVTOOLS)/$(KBUILD_TARGET).hppa32
|
|---|
| 523 | else ifeq ($(KBUILD_TARGET_ARCH),mips64)
|
|---|
| 524 | KBUILD_DEVTOOLS_TRG_ALT ?= $(KBUILD_DEVTOOLS)/$(KBUILD_TARGET).mips32
|
|---|
| 525 | else ifeq ($(KBUILD_TARGET_ARCH),ppc64)
|
|---|
| 526 | KBUILD_DEVTOOLS_TRG_ALT ?= $(KBUILD_DEVTOOLS)/$(KBUILD_TARGET).ppc32
|
|---|
| 527 | else ifeq ($(KBUILD_TARGET_ARCH),s390x)
|
|---|
| 528 | KBUILD_DEVTOOLS_TRG_ALT ?= $(KBUILD_DEVTOOLS)/$(KBUILD_TARGET).s390
|
|---|
| 529 | else ifeq ($(KBUILD_TARGET_ARCH),sparc64)
|
|---|
| 530 | KBUILD_DEVTOOLS_TRG_ALT ?= $(KBUILD_DEVTOOLS)/$(KBUILD_TARGET).sparc32
|
|---|
| 531 | endif
|
|---|
| 532 | endif
|
|---|
| 533 |
|
|---|
| 534 | if1of ($(KBUILD_HOST_ARCH), amd64 hppa64 mips64 ppc64 s390x sparc64)
|
|---|
| 535 | ifeq ($(KBUILD_HOST_ARCH),amd64)
|
|---|
| 536 | KBUILD_DEVTOOLS_HST_ALT ?= $(KBUILD_DEVTOOLS)/$(KBUILD_HOST).x86
|
|---|
| 537 | else ifeq ($(KBUILD_HOST_ARCH),hppa64)
|
|---|
| 538 | KBUILD_DEVTOOLS_HST_ALT ?= $(KBUILD_DEVTOOLS)/$(KBUILD_HOST).hppa32
|
|---|
| 539 | else ifeq ($(KBUILD_HOST_ARCH),mips64)
|
|---|
| 540 | KBUILD_DEVTOOLS_HST_ALT ?= $(KBUILD_DEVTOOLS)/$(KBUILD_HOST).mips32
|
|---|
| 541 | else ifeq ($(KBUILD_HOST_ARCH),ppc64)
|
|---|
| 542 | KBUILD_DEVTOOLS_HST_ALT ?= $(KBUILD_DEVTOOLS)/$(KBUILD_HOST).ppc32
|
|---|
| 543 | else ifeq ($(KBUILD_HOST_ARCH),s390x)
|
|---|
| 544 | KBUILD_DEVTOOLS_HST_ALT ?= $(KBUILD_DEVTOOLS)/$(KBUILD_HOST).s390
|
|---|
| 545 | else ifeq ($(KBUILD_HOST_ARCH),sparc64)
|
|---|
| 546 | KBUILD_DEVTOOLS_HST_ALT ?= $(KBUILD_DEVTOOLS)/$(KBUILD_HOST).sparc32
|
|---|
| 547 | endif
|
|---|
| 548 | endif
|
|---|
| 549 |
|
|---|
| 550 | # Deprecated legacy names.
|
|---|
| 551 | PATH_DEVTOOLS ?= $(KBUILD_DEVTOOLS)
|
|---|
| 552 | PATH_DEVTOOLS_TRG ?= $(KBUILD_DEVTOOLS_TRG)
|
|---|
| 553 | PATH_DEVTOOLS_BLD ?= $(KBUILD_DEVTOOLS_TRG)
|
|---|
| 554 | PATH_DEVTOOLS_TRG_ALT ?= $(KBUILD_DEVTOOLS_TRG_ALT)
|
|---|
| 555 | PATH_DEVTOOLS_HST ?= $(KBUILD_DEVTOOLS_HST)
|
|---|
| 556 | PATH_DEVTOOLS_HST_ALT ?= $(KBUILD_DEVTOOLS_HST_ALT)
|
|---|
| 557 |
|
|---|
| 558 | # KBUILD_PATH / PATH_KBUILD is determined by kmk.
|
|---|
| 559 | ifndef KBUILD_PATH
|
|---|
| 560 | KBUILD_PATH := $(PATH_KBUILD)
|
|---|
| 561 | endif
|
|---|
| 562 | ifeq ($(strip $(KBUILD_PATH)),)
|
|---|
| 563 | $(error kBuild: KBUILD_PATH is missing or empty! kmk is supposed to set it.)
|
|---|
| 564 | endif
|
|---|
| 565 | # KBUILD_BIN_PATH / PATH_KBUILD_BIN is determined by kmk.
|
|---|
| 566 | ifndef KBUILD_BIN_PATH
|
|---|
| 567 | KBUILD_BIN_PATH := $(PATH_KBUILD_BIN)
|
|---|
| 568 | endif
|
|---|
| 569 | ifeq ($(strip $(KBUILD_BIN_PATH)),)
|
|---|
| 570 | $(error kBuild: KBUILD_BIN_PATH is missing or empty! kmk is supposed to set it.)
|
|---|
| 571 | endif
|
|---|
| 572 |
|
|---|
| 573 | # kBuild files which might be of interest.
|
|---|
| 574 | FILE_KBUILD_HEADER := $(KBUILD_PATH)/header.kmk
|
|---|
| 575 | #FILE_KBUILD_CONFIG := $(KBUILD_PATH)/config.kmk
|
|---|
| 576 | FILE_KBUILD_FOOTER := $(KBUILD_PATH)/footer.kmk
|
|---|
| 577 | FILE_KBUILD_SUB_HEADER := $(KBUILD_PATH)/subheader.kmk
|
|---|
| 578 | FILE_KBUILD_SUB_FOOTER := $(KBUILD_PATH)/subfooter.kmk
|
|---|
| 579 |
|
|---|
| 580 | ## MAKEFILE is the name of the main makefile.
|
|---|
| 581 | MAKEFILE := $(firstword $(MAKEFILE_LIST))
|
|---|
| 582 | ## MAKEFILE_CURRENT is the name of the current makefile.
|
|---|
| 583 | # This is updated everything a sub-makefile is included.
|
|---|
| 584 | MAKEFILE_CURRENT := $(MAKEFILE)
|
|---|
| 585 |
|
|---|
| 586 |
|
|---|
| 587 | ## @todo this should be done via SUFF_XYZ.target/host...
|
|---|
| 588 |
|
|---|
| 589 | #
|
|---|
| 590 | # Build platform setup.
|
|---|
| 591 | # (PORTME)
|
|---|
| 592 | #
|
|---|
| 593 | if1of ($(KBUILD_HOST), win nt)
|
|---|
| 594 | # Win, Win32, Win64, NT.
|
|---|
| 595 | EXEC_X86_WIN32 :=
|
|---|
| 596 | HOSTSUFF_EXE := .exe
|
|---|
| 597 | HOST_PATH_SEP := $(SEMICOLON)
|
|---|
| 598 |
|
|---|
| 599 | # OS/2.
|
|---|
| 600 | else ifeq ($(KBUILD_HOST),os2)
|
|---|
| 601 | EXEC_X86_WIN32 := innopec.exe
|
|---|
| 602 | HOSTSUFF_EXE := .exe
|
|---|
| 603 | HOST_PATH_SEP := $(SEMICOLON)
|
|---|
| 604 |
|
|---|
| 605 | else if1of ($(KBUILD_HOST), dragonfly freebsd gnukfbsd gnuknbsd linux openbsd netbsd)
|
|---|
| 606 | # Unix (like) systems with wine.
|
|---|
| 607 | EXEC_X86_WIN32 := wine
|
|---|
| 608 | HOSTSUFF_EXE :=
|
|---|
| 609 | HOST_PATH_SEP := $(COLON)
|
|---|
| 610 |
|
|---|
| 611 | else
|
|---|
| 612 | # Unix (like) systems without wine.
|
|---|
| 613 | EXEC_X86_WIN32 := false
|
|---|
| 614 | HOSTSUFF_EXE :=
|
|---|
| 615 | HOST_PATH_SEP := $(COLON)
|
|---|
| 616 | endif
|
|---|
| 617 |
|
|---|
| 618 |
|
|---|
| 619 | #
|
|---|
| 620 | # Build target setup.
|
|---|
| 621 | # (PORTME)
|
|---|
| 622 | #
|
|---|
| 623 | SUFF_DEP := .dep
|
|---|
| 624 | SUFF_BIN :=
|
|---|
| 625 | if1of ($(KBUILD_TARGET), win nt os2)
|
|---|
| 626 | SUFF_OBJ := .obj
|
|---|
| 627 | SUFF_LIB := .lib
|
|---|
| 628 | SUFF_DLL := .dll
|
|---|
| 629 | SUFF_EXE := .exe
|
|---|
| 630 | SUFF_SYS := .sys
|
|---|
| 631 | SUFF_RES := .res
|
|---|
| 632 | else ifeq ($(KBUILD_TARGET),l4)
|
|---|
| 633 | SUFF_OBJ := .o
|
|---|
| 634 | SUFF_LIB := .a
|
|---|
| 635 | SUFF_DLL := .s.so
|
|---|
| 636 | SUFF_EXE :=
|
|---|
| 637 | SUFF_SYS := .a
|
|---|
| 638 | SUFF_RES :=
|
|---|
| 639 | else ifeq ($(KBUILD_TARGET),darwin)
|
|---|
| 640 | SUFF_OBJ := .o
|
|---|
| 641 | SUFF_LIB := .a
|
|---|
| 642 | SUFF_DLL := .dylib
|
|---|
| 643 | SUFF_EXE :=
|
|---|
| 644 | SUFF_SYS :=
|
|---|
| 645 | SUFF_RES :=
|
|---|
| 646 | else
|
|---|
| 647 | SUFF_OBJ := .o
|
|---|
| 648 | SUFF_LIB := .a
|
|---|
| 649 | SUFF_DLL := .so
|
|---|
| 650 | SUFF_EXE :=
|
|---|
| 651 | if1of ($(KBUILD_TARGET), dragonfly freebsd gnukfbsd gnuknbsd linux netbsd openbsd) ## @todo check netbsd, gnuknbsd and openbsd.
|
|---|
| 652 | SUFF_SYS := .ko
|
|---|
| 653 | else
|
|---|
| 654 | SUFF_SYS :=
|
|---|
| 655 | endif
|
|---|
| 656 | SUFF_RES :=
|
|---|
| 657 | endif
|
|---|
| 658 |
|
|---|
| 659 | #
|
|---|
| 660 | # Standard kBuild tools.
|
|---|
| 661 | #
|
|---|
| 662 | ifeq ($(KMK),kmk)
|
|---|
| 663 | KMK := $(KBUILD_BIN_PATH)/kmk$(HOSTSUFF_EXE)
|
|---|
| 664 | endif
|
|---|
| 665 | MAKE := $(KMK)
|
|---|
| 666 |
|
|---|
| 667 | GMAKE := $(KBUILD_BIN_PATH)/kmk_gmake$(HOSTSUFF_EXE)
|
|---|
| 668 |
|
|---|
| 669 | #DEP_EXT := $(KBUILD_BIN_PATH)/kDep$(HOSTSUFF_EXE)
|
|---|
| 670 | #DEP_INT := $(KBUILD_BIN_PATH)/kDep$(HOSTSUFF_EXE)
|
|---|
| 671 | #DEP := $(DEP_INT)
|
|---|
| 672 |
|
|---|
| 673 | DEP_IDB_EXT := $(KBUILD_BIN_PATH)/kDepIDB$(HOSTSUFF_EXE)
|
|---|
| 674 | DEP_IDB_INT := kmk_builtin_kDepIDB
|
|---|
| 675 | DEP_IDB := $(DEP_IDB_INT)
|
|---|
| 676 |
|
|---|
| 677 | DEP_OBJ_EXT := $(KBUILD_BIN_PATH)/kDepObj$(HOSTSUFF_EXE)
|
|---|
| 678 | DEP_OBJ_INT := kmk_builtin_kDepObj
|
|---|
| 679 | DEP_OBJ := $(DEP_OBJ_INT)
|
|---|
| 680 |
|
|---|
| 681 | DEP_PRE := $(KBUILD_BIN_PATH)/kDepPre$(HOSTSUFF_EXE)
|
|---|
| 682 |
|
|---|
| 683 | KOBJCACHE_EXT := $(KBUILD_BIN_PATH)/kObjCache$(HOSTSUFF_EXE)
|
|---|
| 684 | KOBJCACHE := $(KOBJCACHE_EXT)
|
|---|
| 685 |
|
|---|
| 686 | KLIBTWEAKER_EXT := $(KBUILD_BIN_PATH)/kLibTweaker$(HOSTSUFF_EXE)
|
|---|
| 687 | KLIBTWEAKER := $(KLIBTWEAKER_EXT)
|
|---|
| 688 |
|
|---|
| 689 | APPEND_EXT := $(KBUILD_BIN_PATH)/kmk_append$(HOSTSUFF_EXE)
|
|---|
| 690 | APPEND_INT := kmk_builtin_append
|
|---|
| 691 | APPEND := $(APPEND_INT)
|
|---|
| 692 |
|
|---|
| 693 | CAT_EXT := $(KBUILD_BIN_PATH)/kmk_cat$(HOSTSUFF_EXE)
|
|---|
| 694 | CAT_INT := kmk_builtin_cat
|
|---|
| 695 | CAT := $(CAT_INT)
|
|---|
| 696 |
|
|---|
| 697 | CHMOD_EXT := $(KBUILD_BIN_PATH)/kmk_chmod$(HOSTSUFF_EXE)
|
|---|
| 698 | CHMOD_INT := kmk_builtin_chmod
|
|---|
| 699 | CHMOD := $(CHMOD_INT)
|
|---|
| 700 |
|
|---|
| 701 | CMP_EXT := $(KBUILD_BIN_PATH)/kmk_cmp$(HOSTSUFF_EXE)
|
|---|
| 702 | CMP_INT := kmk_builtin_cmp
|
|---|
| 703 | CMP := $(CMP_INT)
|
|---|
| 704 |
|
|---|
| 705 | CP_EXT := $(KBUILD_BIN_PATH)/kmk_cp$(HOSTSUFF_EXE)
|
|---|
| 706 | CP_INT := kmk_builtin_cp
|
|---|
| 707 | CP := $(CP_INT)
|
|---|
| 708 |
|
|---|
| 709 | ECHO_EXT := $(KBUILD_BIN_PATH)/kmk_echo$(HOSTSUFF_EXE)
|
|---|
| 710 | ECHO_INT := kmk_builtin_echo
|
|---|
| 711 | ECHO := $(ECHO_INT)
|
|---|
| 712 |
|
|---|
| 713 | EXPR_EXT := $(KBUILD_BIN_PATH)/kmk_expr$(HOSTSUFF_EXE)
|
|---|
| 714 | EXPR_INT := kmk_builtin_expr
|
|---|
| 715 | EXPR := $(EXPR_INT)
|
|---|
| 716 |
|
|---|
| 717 | INSTALL_EXT := $(KBUILD_BIN_PATH)/kmk_install$(HOSTSUFF_EXE)
|
|---|
| 718 | INSTALL_INT := kmk_builtin_install
|
|---|
| 719 | INSTALL := $(INSTALL_INT)
|
|---|
| 720 |
|
|---|
| 721 | LN_EXT := $(KBUILD_BIN_PATH)/kmk_ln$(HOSTSUFF_EXE)
|
|---|
| 722 | LN_INT := kmk_builtin_ln
|
|---|
| 723 | LN := $(LN_INT)
|
|---|
| 724 |
|
|---|
| 725 | MD5SUM_EXT := $(KBUILD_BIN_PATH)/kmk_md5sum$(HOSTSUFF_EXE)
|
|---|
| 726 | MD5SUM_INT := kmk_builtin_md5sum
|
|---|
| 727 | MD5SUM := $(MD5SUM_INT)
|
|---|
| 728 |
|
|---|
| 729 | MKDIR_EXT := $(KBUILD_BIN_PATH)/kmk_mkdir$(HOSTSUFF_EXE)
|
|---|
| 730 | MKDIR_INT := kmk_builtin_mkdir
|
|---|
| 731 | MKDIR := $(MKDIR_INT)
|
|---|
| 732 |
|
|---|
| 733 | MV_EXT := $(KBUILD_BIN_PATH)/kmk_mv$(HOSTSUFF_EXE)
|
|---|
| 734 | MV_INT := kmk_builtin_mv
|
|---|
| 735 | MV := $(MV_INT)
|
|---|
| 736 |
|
|---|
| 737 | PRINTF_EXT := $(KBUILD_BIN_PATH)/kmk_printf$(HOSTSUFF_EXE)
|
|---|
| 738 | PRINTF_INT := kmk_builtin_printf
|
|---|
| 739 | PRINTF := $(PRINTF_INT)
|
|---|
| 740 |
|
|---|
| 741 | REDIRECT_EXT:= $(KBUILD_BIN_PATH)/kmk_redirect$(HOSTSUFF_EXE)
|
|---|
| 742 | if $(KBUILD_KMK_REVISION) > 2911
|
|---|
| 743 | REDIRECT_INT:= kmk_builtin_redirect
|
|---|
| 744 | else
|
|---|
| 745 | REDIRECT_INT:= $(REDIRECT_EXT)
|
|---|
| 746 | endif
|
|---|
| 747 | REDIRECT := $(REDIRECT_INT)
|
|---|
| 748 |
|
|---|
| 749 | RM_EXT := $(KBUILD_BIN_PATH)/kmk_rm$(HOSTSUFF_EXE)
|
|---|
| 750 | RM_INT := kmk_builtin_rm
|
|---|
| 751 | RM := $(RM_INT)
|
|---|
| 752 |
|
|---|
| 753 | RMDIR_EXT := $(KBUILD_BIN_PATH)/kmk_rmdir$(HOSTSUFF_EXE)
|
|---|
| 754 | RMDIR_INT := kmk_builtin_rmdir
|
|---|
| 755 | RMDIR := $(RMDIR_INT)
|
|---|
| 756 |
|
|---|
| 757 | SED_EXT := $(KBUILD_BIN_PATH)/kmk_sed$(HOSTSUFF_EXE)
|
|---|
| 758 | SED_INT := $(SED_EXT)
|
|---|
| 759 | SED := $(SED_EXT)
|
|---|
| 760 |
|
|---|
| 761 | SLEEP_INT := kmk_builtin_sleep
|
|---|
| 762 | SLEEP_EXT := $(KBUILD_BIN_PATH)/kmk_sleep$(HOSTSUFF_EXE)
|
|---|
| 763 | SLEEP := $(SLEEP_EXT)
|
|---|
| 764 |
|
|---|
| 765 | TEST_EXT := $(KBUILD_BIN_PATH)/kmk_test$(HOSTSUFF_EXE)
|
|---|
| 766 | TEST_INT := kmk_builtin_test
|
|---|
| 767 | TEST := $(TEST_INT)
|
|---|
| 768 |
|
|---|
| 769 | TIME_EXT := $(KBUILD_BIN_PATH)/kmk_time$(HOSTSUFF_EXE)
|
|---|
| 770 | TIME_INT := $(TIME_EXT)
|
|---|
| 771 | TIME := $(TIME_INT)
|
|---|
| 772 |
|
|---|
| 773 | TOUCH_EXT := $(KBUILD_BIN_PATH)/kmk_touch$(HOSTSUFF_EXE)
|
|---|
| 774 | if $(KBUILD_KMK_REVISION) >= 3060
|
|---|
| 775 | TOUCH_INT := kmk_builtin_touch
|
|---|
| 776 | else
|
|---|
| 777 | TOUCH_INT := $(TOUCH_EXT)
|
|---|
| 778 | endif
|
|---|
| 779 | TOUCH := $(TOUCH_INT)
|
|---|
| 780 |
|
|---|
| 781 | # Our default shell is the Almquist shell from *BSD.
|
|---|
| 782 | ASH := $(KBUILD_BIN_PATH)/kmk_ash$(HOSTSUFF_EXE)
|
|---|
| 783 | MAKESHELL := $(ASH)
|
|---|
| 784 | SHELL := $(ASH)
|
|---|
| 785 | export SHELL MAKESHELL
|
|---|
| 786 |
|
|---|
| 787 | # Symlinking is problematic on some platforms...
|
|---|
| 788 | LN_SYMLINK := $(LN) -s
|
|---|
| 789 |
|
|---|
| 790 | # When copying to the staging area, use hard links to save time and space.
|
|---|
| 791 | ifndef KBUILD_NO_HARD_LINKING
|
|---|
| 792 | INSTALL_STAGING := $(INSTALL) --hard-link-files-when-possible
|
|---|
| 793 | else
|
|---|
| 794 | INSTALL_STAGING := $(INSTALL)
|
|---|
| 795 | endif
|
|---|
| 796 |
|
|---|
| 797 |
|
|---|
| 798 | #
|
|---|
| 799 | # Some Functions.
|
|---|
| 800 | # The lower cased ones are either fallbacks or candidates for functions.c.
|
|---|
| 801 | #
|
|---|
| 802 |
|
|---|
| 803 | ## ABSPATH - make paths absolute.
|
|---|
| 804 | # This implementation is clumsy and doesn't resolve '..' and '.' components.
|
|---|
| 805 | #
|
|---|
| 806 | # @param $1 The paths to make absolute.
|
|---|
| 807 | # @obsolete Use the GNU make function $(abspath) directly now.
|
|---|
| 808 | ABSPATH = $(abspath $(1))$(warning ABSPATH is deprecated, use abspath directly!)
|
|---|
| 809 |
|
|---|
| 810 | ## DIRDEP - make create directory dependencies.
|
|---|
| 811 | #
|
|---|
| 812 | # @param $1 The paths to the directories which must be created.
|
|---|
| 813 | DIRDEP = $(foreach path,$(patsubst %/,%,$(1)),$(path)/)
|
|---|
| 814 |
|
|---|
| 815 | ## Cygwin kludge.
|
|---|
| 816 | # This converts /cygdrive/x/% to x:%.
|
|---|
| 817 | #
|
|---|
| 818 | # @param $1 The paths to make native.
|
|---|
| 819 | # @remark This macro is pretty much obsolete since we don't use cygwin base make.
|
|---|
| 820 | ifneq ($(patsubst /cygdrive/%,%,$(CURDIR)),$(CURDIR))
|
|---|
| 821 | CYGPATHMIXED = $(foreach path,$(1)\
|
|---|
| 822 | ,$(if $(patsubst /cygdrive/%,,$(path)),$(path),$(patsubst $(strip $(firstword $(subst /, ,$(patsubst /cygdrive/%,%,$(path)))))/%,$(strip $(firstword $(subst /, ,$(patsubst /cygdrive/%,%,$(path))))):/%,$(patsubst /cygdrive/%,%,$(path)))))
|
|---|
| 823 | else
|
|---|
| 824 | CYGPATHMIXED = $(1)
|
|---|
| 825 | endif
|
|---|
| 826 |
|
|---|
| 827 | ## Removes the drive letter from a path (if it has one)
|
|---|
| 828 | # @param $1 the path
|
|---|
| 829 | no-drive = $(word $(words $(subst :, ,$(1))),$(subst :, ,$(1)))
|
|---|
| 830 |
|
|---|
| 831 | ## Removes the root slash from a path (if it has one)
|
|---|
| 832 | # @param $1 the path
|
|---|
| 833 | no-root-slash = $(patsubst /%,%,$(1))
|
|---|
| 834 |
|
|---|
| 835 | ##
|
|---|
| 836 | # Similar to firstword, except it returns the value of first defined variable.
|
|---|
| 837 | # @param $1 list of variables to probe.
|
|---|
| 838 | define FIRST-DEFINED-VAR
|
|---|
| 839 | local .RETURN := $(strip $(firstdefined $1, value))
|
|---|
| 840 | endef
|
|---|
| 841 |
|
|---|
| 842 | ## Figure out where to put object files.
|
|---|
| 843 | # @param $1 real target name.
|
|---|
| 844 | # @param $2 normalized main target
|
|---|
| 845 | TARGET_BASE = $(PATH_TARGET)/$(2)/$(call no-root-slash,$(call no-drive,$(1)))
|
|---|
| 846 |
|
|---|
| 847 | ## Figure out where to put object files.
|
|---|
| 848 | # @param $1 normalized main target
|
|---|
| 849 | TARGET_PATH = $(PATH_TARGET)/$(1)
|
|---|
| 850 |
|
|---|
| 851 | ##
|
|---|
| 852 | # Checks if the specified short option ($1) is found in the flags ($2),
|
|---|
| 853 | # assuming getopt style options.
|
|---|
| 854 | #
|
|---|
| 855 | # @returns $3 if present, $4 not.
|
|---|
| 856 | #
|
|---|
| 857 | # @param $1 The option (single char!).
|
|---|
| 858 | # @param $2 The option arguments.
|
|---|
| 859 | # @param $3 Eval and return if present.
|
|---|
| 860 | # @param $4 Eval and return if not present.
|
|---|
| 861 | #
|
|---|
| 862 | # @todo May confuse option values starting with '-' for options.
|
|---|
| 863 | # @remarks Invoke like this: $(evalcall KB_FN_OPT_TEST_SHORT,d,$(flags),present,not-present)
|
|---|
| 864 | #
|
|---|
| 865 | define KB_FN_OPT_TEST_SHORT
|
|---|
| 866 | local options := $(translate $(strip $(filter -%,$(filter-out --%,$2))),$(SP)-,)
|
|---|
| 867 | local .RETURN := $(if-expr $(pos $1,$(options)) != 0,$3,$4)
|
|---|
| 868 | endef
|
|---|
| 869 |
|
|---|
| 870 | ##
|
|---|
| 871 | # Checks if the specified long option ($1) is found in the flags ($2),
|
|---|
| 872 | # assuming getopt style options.
|
|---|
| 873 | #
|
|---|
| 874 | # @returns $3 if present, $4 not.
|
|---|
| 875 | #
|
|---|
| 876 | # @param $1 The long option, dashes included. No % chars.
|
|---|
| 877 | # @param $2 The option arguments.
|
|---|
| 878 | # @param $3 Eval and return if present.
|
|---|
| 879 | # @param $4 Eval and return if not present.
|
|---|
| 880 | #
|
|---|
| 881 | # @todo May confuse option values starting with '--' for options.
|
|---|
| 882 | # @remarks Invoke like this: $(evalcall KBFN_OPT_TEST_SHORT,--defined,$(flags),present,not-present)
|
|---|
| 883 | #
|
|---|
| 884 | define KB_FN_OPT_TEST_LONG
|
|---|
| 885 | local options := $(filter-out =delete=%,$(subst :, =delete=,$(subst =, =delete=,$2)))
|
|---|
| 886 | local .RETURN := $(if-expr "$(filter $1,$(options))" != "",$3,$4)
|
|---|
| 887 | endef
|
|---|
| 888 |
|
|---|
| 889 | ##
|
|---|
| 890 | # Checks if the specified short ($1) or long ($2) option is found in the flags ($2),
|
|---|
| 891 | # assuming getopt style options.
|
|---|
| 892 | #
|
|---|
| 893 | # @returns $4 if present, $5 not.
|
|---|
| 894 | #
|
|---|
| 895 | # @param $1 The short option (single char!).
|
|---|
| 896 | # @param $2 The long option, dashes included. No % chars.
|
|---|
| 897 | # @param $3 The option arguments.
|
|---|
| 898 | # @param $4 Eval and return if present.
|
|---|
| 899 | # @param $5 Eval and return if not present.
|
|---|
| 900 | #
|
|---|
| 901 | # @todo May confuse option values starting with '--' for options.
|
|---|
| 902 | # @remarks Invoke like this: $(evalcall KB_FN_OPT_TEST_SHORT_LONG,d,--defined,$(flags),present,not-present)
|
|---|
| 903 | #
|
|---|
| 904 | define KB_FN_OPT_TEST_SHORT_LONG
|
|---|
| 905 | local short_options := $(translate $(strip $(filter -%,$(filter-out --%,$3))),$(SP)-,)
|
|---|
| 906 | local long_options := $(filter-out =delete=%,$(subst :, =delete=,$(subst =, =delete=,$3)))
|
|---|
| 907 | local .RETURN := $(if-expr $(pos $1,$(short_options)) != 0 || "$(filter $2,$(long_options))" != "",$4,$5)
|
|---|
| 908 | endef
|
|---|
| 909 |
|
|---|
| 910 | ##
|
|---|
| 911 | # Make an assignment to a deprecated variable.
|
|---|
| 912 | #
|
|---|
| 913 | # @param $1 The variable name.
|
|---|
| 914 | # @param $2 The value.
|
|---|
| 915 | # @param $3 The variable to use instead.
|
|---|
| 916 | #
|
|---|
| 917 | ifdef KBUILD_WITH_DEPREATED_AS_ERROR
|
|---|
| 918 | KB_FN_ASSIGN_DEPRECATED = $(eval $(subst :,$$(COLON),$1) = $2$$(error $1 is deprecated, use $3 instead))
|
|---|
| 919 | else
|
|---|
| 920 | KB_FN_ASSIGN_DEPRECATED = $(eval $(subst :,$$(COLON),$1) = $2$$(warning $1 is deprecated, use $3 instead))
|
|---|
| 921 | endif
|
|---|
| 922 |
|
|---|
| 923 | ##
|
|---|
| 924 | # Show an assertion message.
|
|---|
| 925 | #
|
|---|
| 926 | # @param $1 The assertion name.
|
|---|
| 927 | # @param $2 The details.
|
|---|
| 928 | #
|
|---|
| 929 | define KB_FN_ASSERT_MSG
|
|---|
| 930 | $(info !! kBuild $1 Assertion Failed !!)
|
|---|
| 931 | ifdef target
|
|---|
| 932 | $(info !! target: $(target))
|
|---|
| 933 | local varloc := $(where $(target))
|
|---|
| 934 | if "$(varloc)" == "undefined"
|
|---|
| 935 | local varloc := $(where $(target)_TEMPLATE)
|
|---|
| 936 | endif
|
|---|
| 937 | if "$(varloc)" == "undefined"
|
|---|
| 938 | local varloc := $(where $(target)_SOURCES)
|
|---|
| 939 | endif
|
|---|
| 940 | if "$(varloc)" == "undefined"
|
|---|
| 941 | local varloc := $(where $(target)_EXTENDS)
|
|---|
| 942 | endif
|
|---|
| 943 | if "$(varloc)" == "undefined"
|
|---|
| 944 | local varloc := $(where target)
|
|---|
| 945 | endif
|
|---|
| 946 | ifneq ($(varloc),)
|
|---|
| 947 | $(info !! location: $(varloc))
|
|---|
| 948 | else
|
|---|
| 949 | $(info !! probable location: $($(target)_DEFPATH)/Makefile.kmk)
|
|---|
| 950 | endif
|
|---|
| 951 | endif
|
|---|
| 952 | $(info !! $2)
|
|---|
| 953 | $(error fixme)
|
|---|
| 954 | endef
|
|---|
| 955 |
|
|---|
| 956 | ##
|
|---|
| 957 | # Throw an error if the given path $1 isn't absolute and assertions are enabled.
|
|---|
| 958 | #
|
|---|
| 959 | # @param $1 The name of the path variable to check.
|
|---|
| 960 | #
|
|---|
| 961 | ifdef KBUILD_INTERNAL_STRICT
|
|---|
| 962 | KB_FN_ASSERT_ABSPATH = $(if-expr "$(abspath $($(strip $1)))" != "$(strip $($(strip $1)))",\
|
|---|
| 963 | $(evalcall KB_FN_ASSERT_MSG,abspath,$1 is:$(NLTAB)'$($(strip $1))'$(NLTAB)expected:$(NLTAB)'$(abspath $($(strip $1)))'))
|
|---|
| 964 | else
|
|---|
| 965 | KB_FN_ASSERT_ABSPATH :=
|
|---|
| 966 | endif
|
|---|
| 967 |
|
|---|
| 968 |
|
|---|
| 969 | #
|
|---|
| 970 | # Somewhat simple solution for automatic command dependencies.
|
|---|
| 971 | #
|
|---|
| 972 |
|
|---|
| 973 | ## Temporary for the compile rule below.
|
|---|
| 974 | if "$(KBUILD_KMK_REVISION)" >= 3134
|
|---|
| 975 | KBUILD_HAVE_OPTIMIZED_APPEND := 1
|
|---|
| 976 | endif
|
|---|
| 977 |
|
|---|
| 978 | ##
|
|---|
| 979 | # Advanced version of KB_FN_AUTO_CMD_DEPS_COMMANDS_EX where you set
|
|---|
| 980 | # the dependency file name yourself.
|
|---|
| 981 | #
|
|---|
| 982 | # After or before the recipe do $(call KB_FN_AUTO_CMD_DEPS_EX,<recipe-target>,<dep-file>).
|
|---|
| 983 | #
|
|---|
| 984 | # @param 1 dep file.
|
|---|
| 985 | ifdef KBUILD_HAVE_OPTIMIZED_APPEND
|
|---|
| 986 | define KB_FN_AUTO_CMD_DEPS_COMMANDS_EX
|
|---|
| 987 | %$(QUIET2)$(APPEND) -tin "$1" \
|
|---|
| 988 | 'define AUTO_CMD_DEP_$(translate $@,:,_)_PREV_CMDS' \
|
|---|
| 989 | '--insert-command=$@' \
|
|---|
| 990 | 'endef'
|
|---|
| 991 | endef
|
|---|
| 992 | else
|
|---|
| 993 | define KB_FN_AUTO_CMD_DEPS_COMMANDS_EX
|
|---|
| 994 | %$(QUIET2)$(RM) -f -- "$1"
|
|---|
| 995 | %$(QUIET2)$(APPEND) "$1" 'define AUTO_CMD_DEP_$(translate $@,:,_)_PREV_CMDS'
|
|---|
| 996 | %$(QUIET2)$(APPEND) -c "$1" '$@'
|
|---|
| 997 | %$(QUIET2)$(APPEND) "$1" 'endef'
|
|---|
| 998 | endef
|
|---|
| 999 | endif
|
|---|
| 1000 |
|
|---|
| 1001 | ##
|
|---|
| 1002 | # Advanced version of KB_FN_AUTO_CMD_DEPS
|
|---|
| 1003 | #
|
|---|
| 1004 | # @param 1 recipe name
|
|---|
| 1005 | # @param 2 dep file.
|
|---|
| 1006 | KB_FN_AUTO_CMD_DEPS_EX = $(eval includedep $2)$(eval _DEPFILES_INCLUDED += $2)$1: .MUST_MAKE = $$(comp-cmds-ex $$(AUTO_CMD_DEP_$(translate $1,:,_)_PREV_CMDS),$$(commands $1),FORCE)
|
|---|
| 1007 |
|
|---|
| 1008 | ##
|
|---|
| 1009 | # $(call KB_FN_AUTO_CMD_DEPS_COMMANDS) as the first command in a recipe to
|
|---|
| 1010 | # automatically generate command dependencies.
|
|---|
| 1011 | # After or before the recipe do $(call KB_FN_AUTO_CMD_DEPS,<recipe-target>).
|
|---|
| 1012 | ifdef KBUILD_HAVE_OPTIMIZED_APPEND
|
|---|
| 1013 | define KB_FN_AUTO_CMD_DEPS_COMMANDS
|
|---|
| 1014 | %$(QUIET2)$(APPEND) -tni "$@.auto-dep" \
|
|---|
| 1015 | 'define AUTO_CMD_DEP_$(translate $@,:,_)_PREV_CMDS' \
|
|---|
| 1016 | '--insert-command=$@' \
|
|---|
| 1017 | 'endef'
|
|---|
| 1018 | endef
|
|---|
| 1019 | else
|
|---|
| 1020 | define KB_FN_AUTO_CMD_DEPS_COMMANDS
|
|---|
| 1021 | %$(QUIET2)$(RM) -f -- "$@.auto-dep"
|
|---|
| 1022 | %$(QUIET2)$(APPEND) "$@.auto-dep" 'define AUTO_CMD_DEP_$(translate $@,:,_)_PREV_CMDS'
|
|---|
| 1023 | %$(QUIET2)$(APPEND) -c "$@.auto-dep" '$@'
|
|---|
| 1024 | %$(QUIET2)$(APPEND) "$@.auto-dep" 'endef'
|
|---|
| 1025 | endef
|
|---|
| 1026 | endif
|
|---|
| 1027 |
|
|---|
| 1028 | ##
|
|---|
| 1029 | # Call before or after defining a recipe that you want automatic command
|
|---|
| 1030 | # dependencies on. The recipe must start off by $(call KB_FN_AUTO_CMD_DEPS_COMMANDS).
|
|---|
| 1031 | #
|
|---|
| 1032 | # @param 1 recipe name
|
|---|
| 1033 | KB_FN_AUTO_CMD_DEPS = $(call KB_FN_AUTO_CMD_DEPS_EX,$1,$1.auto-dep)
|
|---|
| 1034 |
|
|---|
| 1035 |
|
|---|
| 1036 | #
|
|---|
| 1037 | # Initialize some of the globals which the Config.kmk and
|
|---|
| 1038 | # others can add stuff to if they like for processing in the footer.
|
|---|
| 1039 | #
|
|---|
| 1040 |
|
|---|
| 1041 | ## KBUILD_TEMPLATE_PATHS
|
|---|
| 1042 | # List a paths (separated by space) where templates can be found.
|
|---|
| 1043 | KBUILD_TEMPLATE_PATHS :=
|
|---|
| 1044 |
|
|---|
| 1045 | ## KBUILD_TOOL_PATHS
|
|---|
| 1046 | # List of paths (separated by space) where tools can be found.
|
|---|
| 1047 | KBUILD_TOOL_PATHS :=
|
|---|
| 1048 |
|
|---|
| 1049 | ## KBUILD_SDK_PATHS
|
|---|
| 1050 | # List of paths (separated by space) where SDKs can be found.
|
|---|
| 1051 | KBUILD_SDK_PATHS :=
|
|---|
| 1052 |
|
|---|
| 1053 | ## KBUILD_UNIT_PATHS
|
|---|
| 1054 | # List of paths (separated by space) where units (USES) can be found.
|
|---|
| 1055 | KBUILD_UNIT_PATHS :=
|
|---|
| 1056 |
|
|---|
| 1057 | ## KBUILD_DEFAULT_PATHS
|
|---|
| 1058 | # List of paths (separated by space) to search for stuff as a last resort.
|
|---|
| 1059 | KBUILD_DEFAULT_PATHS :=
|
|---|
| 1060 |
|
|---|
| 1061 | ## Proritized list of the default makefile when walking subdirectories.
|
|---|
| 1062 | # The user can overload this list.
|
|---|
| 1063 | DEFAULT_MAKEFILE := Makefile.kmk makefile.kmk Makefile makefile
|
|---|
| 1064 |
|
|---|
| 1065 | ## KBUILD_SRC_HANDLERS
|
|---|
| 1066 | # The list of source handlers, pair of extension and handler.
|
|---|
| 1067 | # The user can overload this list to provide additional or custom
|
|---|
| 1068 | # handlers. On a per-target/template see SRC_HANDLERS.
|
|---|
| 1069 | KBUILD_SRC_HANDLERS := \
|
|---|
| 1070 | .c:def_src_handler_c \
|
|---|
| 1071 | .C:def_src_handler_c \
|
|---|
| 1072 | .cxx:def_src_handler_cxx \
|
|---|
| 1073 | .CXX:def_src_handler_cxx \
|
|---|
| 1074 | .cpp:def_src_handler_cxx \
|
|---|
| 1075 | .CPP:def_src_handler_cxx \
|
|---|
| 1076 | .cc:def_src_handler_cxx \
|
|---|
| 1077 | .CC:def_src_handler_cxx \
|
|---|
| 1078 | .m:def_src_handler_objc \
|
|---|
| 1079 | .M:def_src_handler_objcxx \
|
|---|
| 1080 | .mm:def_src_handler_objcxx \
|
|---|
| 1081 | .asm:def_src_handler_asm \
|
|---|
| 1082 | .ASM:def_src_handler_asm \
|
|---|
| 1083 | .s:def_src_handler_asm \
|
|---|
| 1084 | .S:def_src_handler_asm \
|
|---|
| 1085 | .rc:def_src_handler_rc \
|
|---|
| 1086 | .obj:def_src_handler_obj \
|
|---|
| 1087 | .o:def_src_handler_obj \
|
|---|
| 1088 | .res:def_src_handler_obj
|
|---|
| 1089 |
|
|---|
| 1090 | ## PROPS_TOOLS
|
|---|
| 1091 | # This is a subset of PROPS_SINGLE.
|
|---|
| 1092 | PROPS_TOOLS := TOOL CTOOL CXXTOOL PCHTOOL OBJCTOOL OBJCXXTOOL ASTOOL RCTOOL ARTOOL LDTOOL FETCHTOOL UNPACKTOOL PATCHTOOL
|
|---|
| 1093 |
|
|---|
| 1094 | ## PROPS_SINGLE
|
|---|
| 1095 | # The list of non-accumulative target properties.
|
|---|
| 1096 | # A Config.kmk file can add it's own properties to this list and kBuild
|
|---|
| 1097 | # will do the necessary inheritance for templates, sdks, tools and targets.
|
|---|
| 1098 | PROPS_SINGLE := $(PROPS_TOOLS) TEMPLATE INSTTYPE INST STAGE NOINST BLD_TYPE BLD_TRG BLD_TRG_ARCH BLD_TRG_CPU FETCHDIR \
|
|---|
| 1099 | OBJSUFF COBJSUFF CXXOBJSUFF PCHOBJSUFF OBJCOBJSUFF OBJCXXOBJSUFF ASOBJSUFF RCOBJSUFF SYSSUFF BINSUFF EXESUFF DLLSUFF LIBSUFF ARLIBSUFF \
|
|---|
| 1100 | MODE UID GID LD_DEBUG DEBUG_INSTTYPE DEBUG_INST DEBUG_STAGE PCH_HDR
|
|---|
| 1101 | ## PROPS_SINGLE_LNK
|
|---|
| 1102 | # Subset of PROPS_SINGLE which applies to all linkable targets.
|
|---|
| 1103 | PROPS_SINGLE_LNK := $(filter-out FETCHTOOL UNPACKTOOL PATCHTOOL FETCHDIR, $(PROPS_SINGLE))
|
|---|
| 1104 |
|
|---|
| 1105 | ## PROPS_DEFERRED
|
|---|
| 1106 | # This list of non-accumulative target properties which are or may be
|
|---|
| 1107 | # functions, and thus should not be expanded until the very last moment.
|
|---|
| 1108 | PROPS_DEFERRED := INSTFUN INSTALLER PRE_CMDS POST_CMDS PRE_INST_CMDS POST_INST_CMDS \
|
|---|
| 1109 | PRE_FILE_CMDS POST_FILE_CMDS PRE_SYMLINK_CMDS POST_SYMLINK_CMDS PRE_DIRECTORY_CMDS POST_DIRECTORY_CMDS \
|
|---|
| 1110 | NAME SONAME
|
|---|
| 1111 |
|
|---|
| 1112 | ## PROPS_ACCUMULATE_R
|
|---|
| 1113 | # The list of accumulative target properties where the right most value/flag
|
|---|
| 1114 | # is the 'most significant'.
|
|---|
| 1115 | # A Config.kmk file can add it's own properties to this list and kBuild
|
|---|
| 1116 | # will do the necessary inheritance from templates to targets.
|
|---|
| 1117 | PROPS_ACCUMULATE_R := \
|
|---|
| 1118 | DEPS LNK_DEPS ORDERDEPS LNK_ORDERDEPS DEFS \
|
|---|
| 1119 | ARFLAGS \
|
|---|
| 1120 | CFLAGS CDEFS \
|
|---|
| 1121 | CXXFLAGS CXXDEFS \
|
|---|
| 1122 | PCHFLAGS PCHDEFS \
|
|---|
| 1123 | OBJCFLAGS OBJCDEFS \
|
|---|
| 1124 | OBJCXXFLAGS OBJCXXDEFS \
|
|---|
| 1125 | ASFLAGS ASDEFS \
|
|---|
| 1126 | RCFLAGS RCDEFS \
|
|---|
| 1127 | LDFLAGS \
|
|---|
| 1128 | IDFLAGS IFFLAGS EXEC_IFFLAGS ISFLAGS \
|
|---|
| 1129 | FETCHFLAGS UNPACKFLAGS PATCHFLAGS
|
|---|
| 1130 | ## PROPS_ACCUMULATE_R_LNK
|
|---|
| 1131 | # Subset of PROPS_ACCUMULATE_R which applies to all linkable targets.
|
|---|
| 1132 | PROPS_ACCUMULATE_R_LNK := $(filter-out ARFLAGS LDFLAGS EXEC_IFFLAGS FETCHFLAGS UNPACKFLAGS PATCHFLAGS, $(PROPS_ACCUMULATE_R))
|
|---|
| 1133 |
|
|---|
| 1134 | ## PROPS_ACCUMULATE
|
|---|
| 1135 | # The list of accumulative target properties where the left most value/flag
|
|---|
| 1136 | # is the 'most significant'.
|
|---|
| 1137 | # A Config.kmk file can add it's own properties to this list and kBuild
|
|---|
| 1138 | # will do the necessary inheritance from templates to targets.
|
|---|
| 1139 | PROPS_ACCUMULATE_L := \
|
|---|
| 1140 | SDKS USES SOURCES EXEC_SOURCES SRC_HANDLERS INTERMEDIATES \
|
|---|
| 1141 | INCS CINCS CXXINCS PCHINCS OBJCINCS OBJCXXINCS ASINCS RCINCS \
|
|---|
| 1142 | LIBS LIBPATH \
|
|---|
| 1143 | DIRS BLDDIRS CLEAN
|
|---|
| 1144 | ## PROPS_ACCUMULATE_L_LNK
|
|---|
| 1145 | # Subset of PROPS_ACCUMULATE_L which applies to all linkable targets.
|
|---|
| 1146 | PROPS_ACCUMULATE_L_LNK := $(filter-out LIBS LIBPATH EXEC_SOURCES DIRS, $(PROPS_ACCUMULATE_L))
|
|---|
| 1147 |
|
|---|
| 1148 | ## PROPS_ALL
|
|---|
| 1149 | # List of all the properties.
|
|---|
| 1150 | PROPS_ALL = $(PROPS_SINGLE) $(PROPS_DEFERRED) $(PROPS_ACCUMULATE_L) $(PROPS_ACCUMULATE_R)
|
|---|
| 1151 |
|
|---|
| 1152 | ## @name Properties valid on programs (BLDPROGS and PROGRAMS)
|
|---|
| 1153 | ## @{
|
|---|
| 1154 | PROPS_PROGRAMS_SINGLE := $(PROPS_SINGLE_LNK) LDTOOL EXESUFF
|
|---|
| 1155 | PROPS_PROGRAMS_DEFERRED := $(PROPS_DEFERRED)
|
|---|
| 1156 | PROPS_PROGRAMS_ACCUMULATE_R := $(PROPS_ACCUMULATE_R_LNK) LDFLAGS
|
|---|
| 1157 | PROPS_PROGRAMS_ACCUMULATE_L := $(PROPS_ACCUMULATE_L_LNK) LIBS LIBPATH
|
|---|
| 1158 | ## @}
|
|---|
| 1159 |
|
|---|
| 1160 | ## @name Properties valid on libraries (LIBRARIES and IMPORT_LIBS)
|
|---|
| 1161 | ## @{
|
|---|
| 1162 | PROPS_LIBRARIES_SINGLE := $(PROPS_SINGLE_LNK) ARTOOL LIBSUFF ARLIBSUFF LIBSUFF
|
|---|
| 1163 | PROPS_LIBRARIES_DEFERRED := $(filter-out SONAME,$(PROPS_DEFERRED))
|
|---|
| 1164 | PROPS_LIBRARIES_ACCUMULATE_R := $(PROPS_ACCUMULATE_R_LNK) ARFLAGS
|
|---|
| 1165 | PROPS_LIBRARIES_ACCUMULATE_L := $(PROPS_ACCUMULATE_L_LNK)
|
|---|
| 1166 | ## @}
|
|---|
| 1167 |
|
|---|
| 1168 | ## @name Properties valid on dlls (DLLS)
|
|---|
| 1169 | ## @{
|
|---|
| 1170 | PROPS_DLLS_SINGLE := $(PROPS_SINGLE_LNK) LDTOOL DLLSUFF LIBSUFF
|
|---|
| 1171 | PROPS_DLLS_DEFERRED := $(PROPS_DEFERRED)
|
|---|
| 1172 | PROPS_DLLS_ACCUMULATE_R := $(PROPS_ACCUMULATE_R_LNK) LDFLAGS
|
|---|
| 1173 | PROPS_DLLS_ACCUMULATE_L := $(PROPS_ACCUMULATE_L_LNK) LIBS LIBPATH
|
|---|
| 1174 | ## @}
|
|---|
| 1175 |
|
|---|
| 1176 | ## @name Properties valid on system modules (SYSMODS)
|
|---|
| 1177 | ## @{
|
|---|
| 1178 | PROPS_SYSMODS_SINGLE := $(PROPS_SINGLE_LNK) LDTOOL SYSSUFF
|
|---|
| 1179 | PROPS_SYSMODS_DEFERRED := $(PROPS_DEFERRED)
|
|---|
| 1180 | PROPS_SYSMODS_ACCUMULATE_R := $(PROPS_ACCUMULATE_R_LNK) LDFLAGS
|
|---|
| 1181 | PROPS_SYSMODS_ACCUMULATE_L := $(PROPS_ACCUMULATE_L_LNK) LIBS LIBPATH
|
|---|
| 1182 | ## @}
|
|---|
| 1183 |
|
|---|
| 1184 | ## @name Properties valid on misc binaries (MISCBINS)
|
|---|
| 1185 | ## @{
|
|---|
| 1186 | PROPS_MISCBINS_SINGLE := $(PROPS_SINGLE_LNK) LDTOOL BINSUFF
|
|---|
| 1187 | PROPS_MISCBINS_DEFERRED := $(PROPS_DEFERRED)
|
|---|
| 1188 | PROPS_MISCBINS_ACCUMULATE_R := $(PROPS_ACCUMULATE_R_LNK) LDFLAGS
|
|---|
| 1189 | PROPS_MISCBINS_ACCUMULATE_L := $(PROPS_ACCUMULATE_L_LNK) LIBS LIBPATH
|
|---|
| 1190 | ## @}
|
|---|
| 1191 |
|
|---|
| 1192 | ## @name Properties valid on installs (INSTALLS)
|
|---|
| 1193 | ## @{
|
|---|
| 1194 | PROPS_INSTALLS_SINGLE := TOOL TEMPLATE INSTTYPE INST STAGE NOINST BLD_TYPE BLD_TRG BLD_TRG_ARCH BLD_TRG_CPU MODE UID GID
|
|---|
| 1195 | PROPS_INSTALLS_DEFERRED := INSTFUN INSTALLER PRE_FILE_CMDS POST_FILE_CMDS PRE_SYMLINK_CMDS POST_SYMLINK_CMDS \
|
|---|
| 1196 | PRE_DIRECTORY_CMDS POST_DIRECTORY_CMDS
|
|---|
| 1197 | PROPS_INSTALLS_ACCUMULATE_R := DEPS ORDERDEPS GOALS INST_ONLY_GOALS STAGE_ONLY_GOALS IFFLAGS EXEC_IFFLAGS
|
|---|
| 1198 | PROPS_INSTALLS_ACCUMULATE_L := SOURCES EXEC_SOURCES DIRS CLEAN
|
|---|
| 1199 | ## @}
|
|---|
| 1200 |
|
|---|
| 1201 | ## @name Properties valid on fetches (FETCHES)
|
|---|
| 1202 | ## @{
|
|---|
| 1203 | PROPS_FETCHES_SINGLE := TOOL TEMPLATE FETCHTOOL UNPACKTOOL PATCHTOOL INST FETCHDIR
|
|---|
| 1204 | PROPS_FETCHES_DEFERRED :=
|
|---|
| 1205 | PROPS_FETCHES_ACCUMULATE_R := FETCHFLAGS UNPACKFLAGS PATCHFLAGS
|
|---|
| 1206 | PROPS_FETCHES_ACCUMULATE_L := SOURCES CLEAN
|
|---|
| 1207 | ## @}
|
|---|
| 1208 |
|
|---|
| 1209 | ## KBUILD_COMPILE_CATEGTORIES
|
|---|
| 1210 | # Tools categories for compiling.
|
|---|
| 1211 | KBUILD_COMPILE_CATEGTORIES := AS C CXX PCH OBJC OBJCXX RC
|
|---|
| 1212 |
|
|---|
| 1213 | ## KBUILD_GENERIC_CATEGORIES
|
|---|
| 1214 | # Generic tool categories.
|
|---|
| 1215 | KBUILD_GENERIC_CATEGORIES := FETCH UNPACK PATCH $(addprefix LINK_,LIBRARY PROGRAM DLL SYSMOD MISCBIN)
|
|---|
| 1216 |
|
|---|
| 1217 | ## PROPS_TOOLS_ONLY
|
|---|
| 1218 | # Properties found only on tools.
|
|---|
| 1219 | # This is expanded in a deferred manner, so it will pick up changes made to
|
|---|
| 1220 | # KBUILD_COMPILE_CATEGTORIES and KBUILD_GENERIC_CATEGORIES made by units.
|
|---|
| 1221 | PROPS_TOOLS_ONLY = \
|
|---|
| 1222 | $(foreach cat, $(KBUILD_COMPILE_CATEGTORIES), \
|
|---|
| 1223 | COMPILE_$(cat)_CMDS \
|
|---|
| 1224 | COMPILE_$(cat)_OUTPUT \
|
|---|
| 1225 | COMPILE_$(cat)_OUTPUT_MAYBE \
|
|---|
| 1226 | COMPILE_$(cat)_DEPEND \
|
|---|
| 1227 | COMPILE_$(cat)_DEPORD \
|
|---|
| 1228 | COMPILE_$(cat)_USES_KOBJCACHE ) \
|
|---|
| 1229 | $(foreach cat, $(KBUILD_GENERIC_CATEGORIES), \
|
|---|
| 1230 | $(cat)_CMDS \
|
|---|
| 1231 | $(cat)_OUTPUT \
|
|---|
| 1232 | $(cat)_OUTPUT_MAYBE \
|
|---|
| 1233 | $(cat)_DEPEND \
|
|---|
| 1234 | $(cat)_DEPORD ))
|
|---|
| 1235 |
|
|---|
| 1236 |
|
|---|
| 1237 | #
|
|---|
| 1238 | # Here is a special 'hack' to prevent innocent environment variables being
|
|---|
| 1239 | # picked up and treated as properties. (The most annoying example of why
|
|---|
| 1240 | # this is necessary is the Visual C++ commandline with it's LIBPATH.)
|
|---|
| 1241 | #
|
|---|
| 1242 | # Define KBUILD_DONT_KILL_ENV_PROPS in the env. or on the commandline to
|
|---|
| 1243 | # disable this 'hack'.
|
|---|
| 1244 | #
|
|---|
| 1245 | ifndef KBUILD_DONT_KILL_ENV_PROPS
|
|---|
| 1246 |
|
|---|
| 1247 | define def_nuke_environment_prop
|
|---|
| 1248 | ifeq ($(origin $(prop)),environment)
|
|---|
| 1249 | $(prop) =
|
|---|
| 1250 | endif
|
|---|
| 1251 | endef
|
|---|
| 1252 | $(foreach prop, $(PROPS_ALL) \
|
|---|
| 1253 | FETCHES PATCHES BLDPROGS LIBRARIES IMPORT_LIBS DLLS PROGRAMS SYSMODS MISCBINS INSTALLS OTHERS \
|
|---|
| 1254 | SUBDIRS MAKEFILES BLDDIRS \
|
|---|
| 1255 | ,$(eval $(value def_nuke_environment_prop)))
|
|---|
| 1256 |
|
|---|
| 1257 | endif # KBUILD_DONT_KILL_ENV_PROPS
|
|---|
| 1258 |
|
|---|
| 1259 |
|
|---|
| 1260 | #
|
|---|
| 1261 | # Pass configuration.
|
|---|
| 1262 | #
|
|---|
| 1263 | # The PASS_<passname>_trgs variable is listing the targets.
|
|---|
| 1264 | # The PASS_<passname>_vars variable is listing the target variables.
|
|---|
| 1265 | # The PASS_<passname>_pass variable is the lowercased passname.
|
|---|
| 1266 | #
|
|---|
| 1267 |
|
|---|
| 1268 | ## PASS: fetches
|
|---|
| 1269 | # This pass fetches and unpacks things needed to complete the build.
|
|---|
| 1270 | PASS_FETCHES := Fetches
|
|---|
| 1271 | PASS_FETCHES_trgs :=
|
|---|
| 1272 | PASS_FETCHES_vars := _FETCHES
|
|---|
| 1273 | PASS_FETCHES_pass := fetches
|
|---|
| 1274 |
|
|---|
| 1275 | ## PASS: patches
|
|---|
| 1276 | # This pass applies patches.
|
|---|
| 1277 | PASS_PATCHES := Patches
|
|---|
| 1278 | PASS_PATCHES_trgs :=
|
|---|
| 1279 | PASS_PATCHES_vars := _PATCHES
|
|---|
| 1280 | PASS_PATCHES_pass := patches
|
|---|
| 1281 |
|
|---|
| 1282 | ## PASS: bldprogs
|
|---|
| 1283 | # This pass builds targets which are required for building the rest.
|
|---|
| 1284 | PASS_BLDPROGS := Build Programs
|
|---|
| 1285 | PASS_BLDPROGS_trgs :=
|
|---|
| 1286 | PASS_BLDPROGS_vars := _BLDPROGS
|
|---|
| 1287 | PASS_BLDPROGS_pass := bldprogs
|
|---|
| 1288 |
|
|---|
| 1289 | ## PASS: libraries
|
|---|
| 1290 | # This pass builds library targets.
|
|---|
| 1291 | PASS_LIBRARIES := Libraries
|
|---|
| 1292 | PASS_LIBRARIES_trgs :=
|
|---|
| 1293 | PASS_LIBRARIES_vars := _LIBS _IMPORT_LIBS _OTHER_LIBRARIES
|
|---|
| 1294 | PASS_LIBRARIES_pass := libraries
|
|---|
| 1295 |
|
|---|
| 1296 | ## PASS: binaries
|
|---|
| 1297 | # This pass builds dll targets.
|
|---|
| 1298 | PASS_DLLS := DLLs
|
|---|
| 1299 | PASS_DLLS_trgs :=
|
|---|
| 1300 | PASS_DLLS_vars := _DLLS _OTHER_DLLS
|
|---|
| 1301 | PASS_DLLS_pass := dlls
|
|---|
| 1302 |
|
|---|
| 1303 | ## PASS: binaries
|
|---|
| 1304 | # This pass builds binary targets, i.e. programs, system modules and stuff.
|
|---|
| 1305 | PASS_BINARIES := Programs
|
|---|
| 1306 | PASS_BINARIES_trgs :=
|
|---|
| 1307 | PASS_BINARIES_vars := _PROGRAMS _SYSMODS _MISC_BINS _OTHER_BINARIES
|
|---|
| 1308 | PASS_BINARIES_pass := binaries
|
|---|
| 1309 |
|
|---|
| 1310 | ## PASS: others
|
|---|
| 1311 | # This pass builds other targets.
|
|---|
| 1312 | PASS_OTHERS := Other Stuff
|
|---|
| 1313 | PASS_OTHERS_trgs :=
|
|---|
| 1314 | PASS_OTHERS_vars := _OTHERS
|
|---|
| 1315 | PASS_OTHERS_pass := others
|
|---|
| 1316 |
|
|---|
| 1317 | ## PASS: staging
|
|---|
| 1318 | # This pass installs the built entities to a sandbox area.
|
|---|
| 1319 | ## @todo split this up into build install (to sandbox) and real installation.
|
|---|
| 1320 | PASS_STAGING := Staging
|
|---|
| 1321 | PASS_STAGING_trgs :=
|
|---|
| 1322 | PASS_STAGING_vars := _STAGE_DIRS _INSTALLS _STAGE_FILES _DEBUG_STAGE_DIRS _DEBUG_STAGE_FILES
|
|---|
| 1323 | PASS_STAGING_pass := staging
|
|---|
| 1324 |
|
|---|
| 1325 | ## PASS: install
|
|---|
| 1326 | # This pass installs the built entities to where they will be used (using
|
|---|
| 1327 | # DESTROOT or PATH_INS to indicate where this is).
|
|---|
| 1328 | PASS_INSTALLS := Install
|
|---|
| 1329 | PASS_INSTALLS_trgs :=
|
|---|
| 1330 | PASS_INSTALLS_vars := _INSTALLS_DIRS _INSTALLS_FILES _DEBUG_INSTALL_DIRS _DEBUG_INSTALL_FILES
|
|---|
| 1331 | PASS_INSTALLS_pass := installs
|
|---|
| 1332 |
|
|---|
| 1333 | ## PASS: testing
|
|---|
| 1334 | # This pass processes custom rules for executing tests.
|
|---|
| 1335 | PASS_TESTING := Tests
|
|---|
| 1336 | PASS_TESTING_trgs :=
|
|---|
| 1337 | PASS_TESTING_vars := _TESTING
|
|---|
| 1338 | PASS_TESTING_pass := testing
|
|---|
| 1339 |
|
|---|
| 1340 | ## PASS: packing
|
|---|
| 1341 | # This pass processes custom packing rules.
|
|---|
| 1342 | PASS_PACKING := Packing
|
|---|
| 1343 | PASS_PACKING_trgs :=
|
|---|
| 1344 | PASS_PACKING_vars := _PACKING
|
|---|
| 1345 | PASS_PACKING_pass := packing
|
|---|
| 1346 |
|
|---|
| 1347 | ## PASS: clean
|
|---|
| 1348 | # This pass removes all generated files.
|
|---|
| 1349 | PASS_CLEAN := Clean
|
|---|
| 1350 | PASS_CLEAN_trgs := do-clean
|
|---|
| 1351 | PASS_CLEAN_vars :=
|
|---|
| 1352 | PASS_CLEAN_pass := clean
|
|---|
| 1353 |
|
|---|
| 1354 | ## PASS: nothing
|
|---|
| 1355 | # This pass just walks the tree.
|
|---|
| 1356 | PASS_NOTHING := Nothing
|
|---|
| 1357 | PASS_NOTHING_trgs := do-nothing
|
|---|
| 1358 | PASS_NOTHING_vars :=
|
|---|
| 1359 | PASS_NOTHING_pass := nothing
|
|---|
| 1360 |
|
|---|
| 1361 | ## DEFAULT_PASSES
|
|---|
| 1362 | # The default passes and their order.
|
|---|
| 1363 | DEFAULT_PASSES := BLDPROGS LIBRARIES DLLS BINARIES OTHERS STAGING
|
|---|
| 1364 |
|
|---|
| 1365 | ## PASSES
|
|---|
| 1366 | # The passes that should be defined. This must include
|
|---|
| 1367 | # all passes mentioned by DEFAULT_PASSES.
|
|---|
| 1368 | PASSES := FETCHES PATCHES $(DEFAULT_PASSES) INSTALLS TESTING PACKING CLEAN NOTHING
|
|---|
| 1369 |
|
|---|
| 1370 |
|
|---|
| 1371 | #
|
|---|
| 1372 | # Check for --pretty-command-printing before including the Config.kmk
|
|---|
| 1373 | # so that anyone overriding the message macros can take the implied
|
|---|
| 1374 | # verbosity level change into account.
|
|---|
| 1375 | #
|
|---|
| 1376 | ifndef KBUILD_VERBOSE
|
|---|
| 1377 | ifndef KBUILD_QUIET
|
|---|
| 1378 | ifeq ($(KMK_OPTS_PRETTY_COMMAND_PRINTING),1)
|
|---|
| 1379 | export KBUILD_VERBOSE := 2
|
|---|
| 1380 | endif
|
|---|
| 1381 | endif
|
|---|
| 1382 | endif
|
|---|
| 1383 |
|
|---|
| 1384 |
|
|---|
| 1385 | #
|
|---|
| 1386 | # Legacy variable translation.
|
|---|
| 1387 | # These will be eliminated when switching to the next version.
|
|---|
| 1388 | #
|
|---|
| 1389 | ifdef USE_KOBJCACHE
|
|---|
| 1390 | ifndef KBUILD_USE_KOBJCACHE
|
|---|
| 1391 | export KBUILD_USE_KOBJCACHE := $(USE_KOBJCACHE)
|
|---|
| 1392 | endif
|
|---|
| 1393 | endif
|
|---|
| 1394 |
|
|---|
| 1395 |
|
|---|
| 1396 | #
|
|---|
| 1397 | # Library path searching hints (target OS + arch).
|
|---|
| 1398 | #
|
|---|
| 1399 | # KBUILD_LIB_SEARCH_SUBS - Subdirs typically containing the right libraries.
|
|---|
| 1400 | # KBUILD_LIB_SEARCH_ROOTS - Roots to search for library subdirs.
|
|---|
| 1401 | # KBUILD_LIB_SEARCH_PATHS - ROOTS + SUBS.
|
|---|
| 1402 | #
|
|---|
| 1403 | ifeq ($(KBUILD_TARGET),darwin)
|
|---|
| 1404 | KBUILD_LIB_SEARCH_ROOTS := \
|
|---|
| 1405 | /usr/ \
|
|---|
| 1406 | /Developer/usr/
|
|---|
| 1407 | KBUILD_LIB_SEARCH_SUBS := lib/
|
|---|
| 1408 |
|
|---|
| 1409 | else if1of ($(KBUILD_TARGET), freebsd openbsd dragonfly)
|
|---|
| 1410 | KBUILD_LIB_SEARCH_ROOTS := \
|
|---|
| 1411 | / \
|
|---|
| 1412 | /usr/ \
|
|---|
| 1413 | /usr/local/
|
|---|
| 1414 | KBUILD_LIB_SEARCH_SUBS := lib/
|
|---|
| 1415 |
|
|---|
| 1416 | else ifeq ($(KBUILD_TARGET),netbsd)
|
|---|
| 1417 | KBUILD_LIB_SEARCH_ROOTS := \
|
|---|
| 1418 | / \
|
|---|
| 1419 | /usr/ \
|
|---|
| 1420 | /usr/pkg/ \
|
|---|
| 1421 | /usr/local/
|
|---|
| 1422 | KBUILD_LIB_SEARCH_SUBS := lib/
|
|---|
| 1423 |
|
|---|
| 1424 | else if1of ($(KBUILD_TARGET), gnukfbsd gnuknbsd linux)
|
|---|
| 1425 | ifeq ($(realpath /bin),/usr/bin)
|
|---|
| 1426 | KBUILD_LIB_SEARCH_ROOTS := \
|
|---|
| 1427 | /usr/ \
|
|---|
| 1428 | / \
|
|---|
| 1429 | /usr/local/
|
|---|
| 1430 | else
|
|---|
| 1431 | KBUILD_LIB_SEARCH_ROOTS := \
|
|---|
| 1432 | / \
|
|---|
| 1433 | /usr/ \
|
|---|
| 1434 | /usr/local/
|
|---|
| 1435 | endif
|
|---|
| 1436 | ifeq ($(KBUILD_TARGET_ARCH),amd64)
|
|---|
| 1437 | KBUILD_LIB_SEARCH_SUBS := \
|
|---|
| 1438 | lib/x86_64-linux-gnu/ \
|
|---|
| 1439 | lib64/ \
|
|---|
| 1440 | lib/
|
|---|
| 1441 | else ifeq ($(KBUILD_TARGET_ARCH),x86)
|
|---|
| 1442 | KBUILD_LIB_SEARCH_SUBS := \
|
|---|
| 1443 | lib/i686-linux-gnu/ \
|
|---|
| 1444 | lib/i386-linux-gnu/ \
|
|---|
| 1445 | lib32/ \
|
|---|
| 1446 | lib/
|
|---|
| 1447 | else
|
|---|
| 1448 | KBUILD_LIB_SEARCH_SUBS := lib/
|
|---|
| 1449 | endif
|
|---|
| 1450 |
|
|---|
| 1451 | else ifeq ($(KBUILD_TARGET),solaris)
|
|---|
| 1452 | KBUILD_LIB_SEARCH_ROOTS := \
|
|---|
| 1453 | / \
|
|---|
| 1454 | /usr/ \
|
|---|
| 1455 | /usr/sfw/ \
|
|---|
| 1456 | /usr/local/ \
|
|---|
| 1457 | /sw/
|
|---|
| 1458 | ifeq ($(KBUILD_TARGET_ARCH),amd64)
|
|---|
| 1459 | KBUILD_LIB_SEARCH_SUBS := lib/amd64/ lib/
|
|---|
| 1460 | else ifeq ($(KBUILD_TARGET_ARCH),sparc64)
|
|---|
| 1461 | KBUILD_LIB_SEARCH_SUBS := lib/sparcv9/ lib/
|
|---|
| 1462 | else
|
|---|
| 1463 | KBUILD_LIB_SEARCH_SUBS := lib/
|
|---|
| 1464 | endif
|
|---|
| 1465 |
|
|---|
| 1466 | else
|
|---|
| 1467 | KBUILD_LIB_SEARCH_SUBS :=
|
|---|
| 1468 | KBUILD_LIB_SEARCH_ROOTS :=
|
|---|
| 1469 | endif
|
|---|
| 1470 | KBUILD_LIB_SEARCH_PATHS := $(foreach root, $(KBUILD_LIB_SEARCH_ROOTS), $(addprefix $(root),$(KBUILD_LIB_SEARCH_SUBS)))
|
|---|
| 1471 |
|
|---|
| 1472 |
|
|---|
| 1473 | #
|
|---|
| 1474 | # This is how we find the closest config.kmk.
|
|---|
| 1475 | # It's a little hacky but I think it works fine.
|
|---|
| 1476 | #
|
|---|
| 1477 | _CFGDIR := .
|
|---|
| 1478 | _CFGFILES := ./Config.kmk ./config.kmk
|
|---|
| 1479 | define def_include_config
|
|---|
| 1480 | $(eval _CFGDIR := $(_CFGDIR)/$(dir))
|
|---|
| 1481 | _CFGFILES += $(_CFGDIR)/Config.kmk $(_CFGDIR)/config.kmk
|
|---|
| 1482 | endef
|
|---|
| 1483 | # walk down the _RELATIVE_ path specified by DEPTH.
|
|---|
| 1484 | $(foreach dir,$(subst /, ,$(DEPTH)), $(eval $(def_include_config)) )
|
|---|
| 1485 | # add the default config file.
|
|---|
| 1486 | _CFGFILE := $(firstword $(wildcard $(_CFGFILES) $(FILE_KBUILD_CONFIG)))
|
|---|
| 1487 | _CFGFILES :=
|
|---|
| 1488 | _CFGDIR :=
|
|---|
| 1489 | ifeq ($(_CFGFILE),)
|
|---|
| 1490 | $(error kBuild: no Config.kmk file found! Check the DEPTH: DEPTH='$(DEPTH)' PATH_CURRENT='$(PATH_CURRENT)')
|
|---|
| 1491 | endif
|
|---|
| 1492 |
|
|---|
| 1493 | # Include the config.kmk we found file (or the default one).
|
|---|
| 1494 | ifdef KBUILD_PROFILE_SELF
|
|---|
| 1495 | $(evalcall def_profile_self, including $(_CFGFILE))
|
|---|
| 1496 | include $(_CFGFILE)
|
|---|
| 1497 | $(evalcall def_profile_self, included $(_CFGFILE))
|
|---|
| 1498 | else
|
|---|
| 1499 | include $(_CFGFILE)
|
|---|
| 1500 | endif
|
|---|
| 1501 |
|
|---|
| 1502 |
|
|---|
| 1503 |
|
|---|
| 1504 | #
|
|---|
| 1505 | # Finalize a the central path variables now that we've included the Config.kmk file.
|
|---|
| 1506 | #
|
|---|
| 1507 | # This prevents some trouble when users override the defaults for these
|
|---|
| 1508 | # variables and uses relative paths or paths with incorrect case.
|
|---|
| 1509 | #
|
|---|
| 1510 | PATH_OUT_BASE := $(abspath $(PATH_OUT_BASE))
|
|---|
| 1511 | PATH_OUT := $(abspath $(PATH_OUT))
|
|---|
| 1512 | PATH_OBJ := $(abspath $(PATH_OBJ))
|
|---|
| 1513 | PATH_TARGET := $(abspath $(PATH_TARGET))
|
|---|
| 1514 | PATH_INS := $(abspath $(PATH_INS))
|
|---|
| 1515 | PATH_STAGE := $(abspath $(PATH_STAGE))
|
|---|
| 1516 |
|
|---|
| 1517 | # Finalize the install and staging directory layouts.
|
|---|
| 1518 | define def_kbuild_finalize_inst
|
|---|
| 1519 | local val := $(strip $($(y)_$(x)))
|
|---|
| 1520 | ifeq ($(val),)
|
|---|
| 1521 | $(error kBuild: '$(y)_$(x)' is set to an empty value.)
|
|---|
| 1522 | endif
|
|---|
| 1523 | ifneq ($(words $(val)),1)
|
|---|
| 1524 | $(error kBuild: The '$(y)_$(x)' value '$(val)' should not contain spaces.)
|
|---|
| 1525 | endif
|
|---|
| 1526 | ifneq ($(pos \,$(val)), 0)
|
|---|
| 1527 | $(error kBuild: The '$(y)_$(x)' value '$(val)' contains DOS slashes: not allowed.)
|
|---|
| 1528 | endif
|
|---|
| 1529 | ifneq ($(pos $(COLON),$(val)), 0)
|
|---|
| 1530 | $(error kBuild: The '$(y)_$(x)' value '$(val)' contains colon: not allowed.)
|
|---|
| 1531 | endif
|
|---|
| 1532 | ifneq ($(substr $(val),-1), /)
|
|---|
| 1533 | $(error kBuild: The '$(y)_$(x)' value '$(val)' has no trailing slash.)
|
|---|
| 1534 | endif
|
|---|
| 1535 | if $(pos /../,$(val)) != 0 || "$(substr $(val), 3)" == "../"
|
|---|
| 1536 | $(error kBuild: The '$(y)_$(x)' value '$(val)' contains dot-dot escape.)
|
|---|
| 1537 | endif
|
|---|
| 1538 | $($(y)_$(x) := $(val)
|
|---|
| 1539 |
|
|---|
| 1540 | local val := $(strip $(PATH_$(y)_$(x)))
|
|---|
| 1541 | ifeq ($(val),)
|
|---|
| 1542 | $(error kBuild: 'PATH_$(y)_$(x)' is set to an empty value.)
|
|---|
| 1543 | endif
|
|---|
| 1544 | PATH_$(y)_$(x) := $(val)
|
|---|
| 1545 | endef
|
|---|
| 1546 | $(foreach y, INST STAGE, $(foreach x, $(KBUILD_INST_PATHS), $(evalcall def_kbuild_finalize_inst)))
|
|---|
| 1547 |
|
|---|
| 1548 | # No abspath for devtools since they might've been referenced already and we
|
|---|
| 1549 | # don't want conflicting variable expansions.
|
|---|
| 1550 | KBUILD_DEVTOOLS := $(KBUILD_DEVTOOLS)
|
|---|
| 1551 | KBUILD_DEVTOOLS_TRG := $(KBUILD_DEVTOOLS_TRG)
|
|---|
| 1552 | KBUILD_DEVTOOLS_TRG_ALT := $(KBUILD_DEVTOOLS_TRG_ALT)
|
|---|
| 1553 | KBUILD_DEVTOOLS_HST := $(KBUILD_DEVTOOLS_HST)
|
|---|
| 1554 | KBUILD_DEVTOOLS_HST_ALT := $(KBUILD_DEVTOOLS_HST_ALT)
|
|---|
| 1555 |
|
|---|
| 1556 |
|
|---|
| 1557 | #
|
|---|
| 1558 | # Setup the message style. The default one is inlined.
|
|---|
| 1559 | #
|
|---|
| 1560 | # See kBuild/msgstyles for more styles or use KBUILD_MSG_STYLE_PATHS
|
|---|
| 1561 | # to create your own message style.
|
|---|
| 1562 | #
|
|---|
| 1563 | KBUILD_MSG_STYLE ?= default
|
|---|
| 1564 | ifeq ($(KBUILD_MSG_STYLE),default)
|
|---|
| 1565 | #
|
|---|
| 1566 | # The 'default' style.
|
|---|
| 1567 | #
|
|---|
| 1568 |
|
|---|
| 1569 | ## Fetch starting.
|
|---|
| 1570 | # @param 1 Target name.
|
|---|
| 1571 | MSG_FETCH ?= $(call MSG_L1,Fetching $1...)
|
|---|
| 1572 | ## Re-fetch starting.
|
|---|
| 1573 | # @param 1 Target name.
|
|---|
| 1574 | MSG_REFETCH ?= $(call MSG_L1,Re-fetching $1...)
|
|---|
| 1575 | ## Downloading a fetch component.
|
|---|
| 1576 | # @param 1 Target name.
|
|---|
| 1577 | # @param 2 The source URL.
|
|---|
| 1578 | # @param 3 The destination file name.
|
|---|
| 1579 | MSG_FETCH_DL ?= $(call MSG_L1,Downloading $1 - $2,=> $3)
|
|---|
| 1580 | ## Checking a fetch component.
|
|---|
| 1581 | # @param 1 Target name.
|
|---|
| 1582 | # @param 2 The source URL.
|
|---|
| 1583 | # @param 3 The destination file name.
|
|---|
| 1584 | MSG_FETCH_CHK?= $(call MSG_L1,Checking $1 - $3, ($2))
|
|---|
| 1585 | ## Unpacking a fetch component.
|
|---|
| 1586 | # @param 1 Target name.
|
|---|
| 1587 | # @param 2 The archive file name.
|
|---|
| 1588 | # @param 3 The target directory.
|
|---|
| 1589 | MSG_FETCH_UP ?= $(call MSG_L1,Unpacking $1 - $2 => $3)
|
|---|
| 1590 | ## Fetch completed.
|
|---|
| 1591 | # @param 1 Target name.
|
|---|
| 1592 | MSG_FETCH_OK ?= $(call MSG_L1,Successfully fetched $1)
|
|---|
| 1593 | ## Unfetch a fetch target.
|
|---|
| 1594 | # @param 1 Target name.
|
|---|
| 1595 | MSG_UNFETCH ?= $(call MSG_L1,Unfetching $1...)
|
|---|
| 1596 | ## Compiling a source file.
|
|---|
| 1597 | # @param 1 Target name.
|
|---|
| 1598 | # @param 2 The source filename.
|
|---|
| 1599 | # @param 3 The primary link output file name.
|
|---|
| 1600 | # @param 4 The source type (C,CXX,OBJC,AS,RC,++).
|
|---|
| 1601 | MSG_COMPILE ?= $(call MSG_L1,Compiling $1 - $2,=> $3)
|
|---|
| 1602 | ## Tool
|
|---|
| 1603 | # @param 1 The tool name (bin2c,...)
|
|---|
| 1604 | # @param 2 Target name.
|
|---|
| 1605 | # @param 3 The source filename.
|
|---|
| 1606 | # @param 4 The primary output file name.
|
|---|
| 1607 | MSG_TOOL ?= $(call MSG_L1,$1 $2 - $3,=> $4)
|
|---|
| 1608 | ## Generate a file, typically a source file.
|
|---|
| 1609 | # @param 1 Target name if applicable.
|
|---|
| 1610 | # @param 2 Output file name.
|
|---|
| 1611 | # @param 3 What it's generated from
|
|---|
| 1612 | MSG_GENERATE ?= $(call MSG_L1,Generating $(if $1,$1 - )$2,$(if $3,from $3))
|
|---|
| 1613 | ## Linking a bldprog/dll/program/sysmod target.
|
|---|
| 1614 | # @param 1 Target name.
|
|---|
| 1615 | # @param 2 The primary link output file name.
|
|---|
| 1616 | # @param 3 The link tool operation (LINK_LIBRARY,LINK_PROGRAM,LINK_DLL,LINK_SYSMOD,++).
|
|---|
| 1617 | MSG_LINK ?= $(call MSG_L1,Linking $1,=> $2)
|
|---|
| 1618 | ## Merging a library into the target (during library linking).
|
|---|
| 1619 | # @param 1 Target name.
|
|---|
| 1620 | # @param 2 The output library name.
|
|---|
| 1621 | # @param 3 The input library name.
|
|---|
| 1622 | MSG_AR_MERGE ?= $(call MSG_L1,Merging $3 into $1, ($2))
|
|---|
| 1623 | ## Creating a directory (build).
|
|---|
| 1624 | # @param 1 Directory name.
|
|---|
| 1625 | MSG_MKDIR ?= $(call MSG_L2,Creating directory $1)
|
|---|
| 1626 | ## Cleaning.
|
|---|
| 1627 | MSG_CLEAN ?= $(call MSG_L1,Cleaning...)
|
|---|
| 1628 | ## Nothing.
|
|---|
| 1629 | MSG_NOTHING ?= $(call MSG_L1,Did nothing in $(CURDIR))
|
|---|
| 1630 | ## Pass
|
|---|
| 1631 | # @param 1 The pass name.
|
|---|
| 1632 | MSG_PASS ?= $(call MSG_L1,Pass - $1)
|
|---|
| 1633 | ## Installing a bldprog/lib/dll/program/sysmod target.
|
|---|
| 1634 | # @param 1 Target name.
|
|---|
| 1635 | # @param 2 The source filename.
|
|---|
| 1636 | # @param 3 The destination file name.
|
|---|
| 1637 | MSG_INST_TRG ?= $(call MSG_L1,Installing $1 => $3)
|
|---|
| 1638 | ## Installing a file (install target).
|
|---|
| 1639 | # @param 1 The source filename.
|
|---|
| 1640 | # @param 2 The destination filename.
|
|---|
| 1641 | MSG_INST_FILE?= $(call MSG_L1,Installing $2,(<= $1))
|
|---|
| 1642 | ## Installing a symlink.
|
|---|
| 1643 | # @param 1 Symlink
|
|---|
| 1644 | # @param 2 Link target
|
|---|
| 1645 | MSG_INST_SYM ?= $(call MSG_L1,Installing symlink $1,=> $2)
|
|---|
| 1646 | ## Installing a directory.
|
|---|
| 1647 | # @param 1 Directory name.
|
|---|
| 1648 | MSG_INST_DIR ?= $(call MSG_L1,Installing directory $1)
|
|---|
| 1649 |
|
|---|
| 1650 | else
|
|---|
| 1651 | _KBUILD_MSG_STYLE_FILE := $(firstword $(foreach path, $(KBUILD_MSG_STYLE_PATHS) $(KBUILD_PATH)/msgstyles, $(wildcard $(path)/$(KBUILD_MSG_STYLE).kmk)))
|
|---|
| 1652 | ifneq ($(_KBUILD_MSG_STYLE_FILE),)
|
|---|
| 1653 | include $(_KBUILD_MSG_STYLE_FILE)
|
|---|
| 1654 | else
|
|---|
| 1655 | $(error kBuild: Can't find the style setup file for KBUILD_MSG_STYLE '$(KBUILD_MSG_STYLE)')
|
|---|
| 1656 | endif
|
|---|
| 1657 | endif
|
|---|
| 1658 |
|
|---|
| 1659 |
|
|---|
| 1660 | #
|
|---|
| 1661 | # Message macros.
|
|---|
| 1662 | #
|
|---|
| 1663 | # This is done after including Config.kmk as to allow for
|
|---|
| 1664 | # KBUILD_QUIET and KBUILD_VERBOSE to be configurable.
|
|---|
| 1665 | #
|
|---|
| 1666 | ifdef KBUILD_QUIET
|
|---|
| 1667 | # No output
|
|---|
| 1668 | QUIET := @
|
|---|
| 1669 | QUIET2:= @
|
|---|
| 1670 | MSG_L1 =
|
|---|
| 1671 | MSG_L2 =
|
|---|
| 1672 | else
|
|---|
| 1673 | ifndef KBUILD_VERBOSE
|
|---|
| 1674 | # Default output level.
|
|---|
| 1675 | QUIET := @
|
|---|
| 1676 | QUIET2 := @
|
|---|
| 1677 | MSG_L1 ?= %@$(ECHO) "kBuild: $1"
|
|---|
| 1678 | MSG_L2 =
|
|---|
| 1679 | else ifeq ($(KBUILD_VERBOSE),1)
|
|---|
| 1680 | # A bit more output
|
|---|
| 1681 | QUIET := @
|
|---|
| 1682 | QUIET2 := @
|
|---|
| 1683 | MSG_L1 ?= %@$(ECHO) "kBuild: $1 $2"
|
|---|
| 1684 | MSG_L2 =
|
|---|
| 1685 | else ifeq ($(KBUILD_VERBOSE),2)
|
|---|
| 1686 | # Lot more output
|
|---|
| 1687 | QUIET :=
|
|---|
| 1688 | QUIET2 := @
|
|---|
| 1689 | MSG_L1 ?= %@$(ECHO) "kBuild: $1 $2"
|
|---|
| 1690 | MSG_L2 ?= %@$(ECHO) "kBuild: $1"
|
|---|
| 1691 | else
|
|---|
| 1692 | # maximal output.
|
|---|
| 1693 | QUIET :=
|
|---|
| 1694 | QUIET2 :=
|
|---|
| 1695 | MSG_L1 ?= %@$(ECHO) "kBuild: $1 $2"
|
|---|
| 1696 | MSG_L2 ?= %@$(ECHO) "kBuild: $1"
|
|---|
| 1697 | endif
|
|---|
| 1698 | endif
|
|---|
| 1699 |
|
|---|
| 1700 |
|
|---|
| 1701 | ##
|
|---|
| 1702 | # An internal define used by subheader.kmk, subfooter.kmk, and
|
|---|
| 1703 | # KB_FN_PASS_0_ON_TARGET.
|
|---|
| 1704 | #
|
|---|
| 1705 | # @param target The target to process.
|
|---|
| 1706 | #
|
|---|
| 1707 | define def_subfooter_header_target_pass
|
|---|
| 1708 | ifndef $(target)_PATH
|
|---|
| 1709 | ifndef $(target)_DEFPATH
|
|---|
| 1710 | $(target)_DEFPATH := $(PATH_SUB_CURRENT)
|
|---|
| 1711 | endif
|
|---|
| 1712 | $(call KB_FN_ASSIGN_DEPRECATED,$(target)_PATH,$($(target)_DEFPATH), $(target)_DEFPATH)
|
|---|
| 1713 | else ifndef $(target)_DEFPATH
|
|---|
| 1714 | $(target)_DEFPATH := $($(target)_PATH)
|
|---|
| 1715 | endif
|
|---|
| 1716 | ifndef $(target)_MAKEFILE
|
|---|
| 1717 | $(target)_MAKEFILE := $(MAKEFILE_CURRENT)
|
|---|
| 1718 | endif
|
|---|
| 1719 | ifndef $(target)_0_OUTDIR
|
|---|
| 1720 | $(target)_0_OUTDIR := $(call TARGET_PATH,$(target))
|
|---|
| 1721 | $(call KB_FN_ASSIGN_DEPRECATED,PATH_$(target),$($(target)_0_OUTDIR), $(target)_0_OUTDIR)
|
|---|
| 1722 | endif
|
|---|
| 1723 | endef
|
|---|
| 1724 |
|
|---|
| 1725 | ##
|
|---|
| 1726 | # Function to call to set _0_OUTDIR, _DEFPATH, and _MAKEFILE earlier than subfooter.
|
|---|
| 1727 | # Can be used to avoid exploiting double expansion.
|
|---|
| 1728 | #
|
|---|
| 1729 | # @param 1 The target name.
|
|---|
| 1730 | KB_FN_DO_PASS0_ON_TARGET = $(foreach target,$1,$(if-expr defined($(target)_0_OUTDIR),,$(evalval def_subfooter_header_target_pass)))
|
|---|
| 1731 |
|
|---|
| 1732 |
|
|---|
| 1733 | #
|
|---|
| 1734 | # Validate any KBUILD_BLD_TYPES additions and finally the KBUILD_TYPE.
|
|---|
| 1735 | #
|
|---|
| 1736 | if1of ($(KBUILD_BLD_TYPES), $(KBUILD_OSES))
|
|---|
| 1737 | $(error kBuild: found KBUILD_BLD_TYPES in KBUILD_OSES!)
|
|---|
| 1738 | endif
|
|---|
| 1739 | if1of ($(KBUILD_BLD_TYPES), $(KBUILD_ARCHES))
|
|---|
| 1740 | $(error kBuild: found KBUILD_BLD_TYPES in KBUILD_ARCHES!)
|
|---|
| 1741 | endif
|
|---|
| 1742 | if1of ($(KBUILD_OSES), $(KBUILD_ARCHES))
|
|---|
| 1743 | $(error kBuild: found KBUILD_OSES in KBUILD_ARCHES!)
|
|---|
| 1744 | endif
|
|---|
| 1745 | ifn1of ($(KBUILD_TYPE), $(KBUILD_BLD_TYPES))
|
|---|
| 1746 | $(error kBuild: KBUILD_TYPE(=$(KBUILD_TYPE)) is not found in KBUILD_BLD_TYPES(=$(KBUILD_BLD_TYPES))!)
|
|---|
| 1747 | endif
|
|---|
| 1748 |
|
|---|
| 1749 |
|
|---|
| 1750 | #
|
|---|
| 1751 | # Mark the output and temporary directories as volatile on windows.
|
|---|
| 1752 | #
|
|---|
| 1753 | # This automatically means the directories not listed here are considered
|
|---|
| 1754 | # static and won't be invalidated once we start running compile jobs.
|
|---|
| 1755 | #
|
|---|
| 1756 | ifeq ($(KBUILD_HOST),win)
|
|---|
| 1757 | if $(KBUILD_KMK_REVISION) >= 2886
|
|---|
| 1758 | $(dircache-ctl volatile, $(PATH_OUT_BASE), $(PATH_OUT), $(TEMP), $(TMP), $(TMPDIR), $(TMP))
|
|---|
| 1759 | endif
|
|---|
| 1760 | endif
|
|---|
| 1761 |
|
|---|
| 1762 |
|
|---|
| 1763 | ifdef KBUILD_PROFILE_SELF
|
|---|
| 1764 | $(evalcall def_profile_self, end of header.kmk)
|
|---|
| 1765 | _KBUILD_TS_HEADER_END := $(_KBUILD_TS_PREV)
|
|---|
| 1766 | endif
|
|---|
| 1767 |
|
|---|
| 1768 | # end-of-file-content
|
|---|
| 1769 | __header_kmk__ := 1
|
|---|
| 1770 | endif # !__header_kmk__
|
|---|
| 1771 |
|
|---|