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