[69] | 1 | # $Id: header.kmk 2483 2011-07-21 13:33:41Z bird $
|
---|
| 2 | ## @file
|
---|
[978] | 3 | # kBuild - File included at top of a makefile.
|
---|
[69] | 4 | #
|
---|
[1547] | 5 |
|
---|
| 6 | #
|
---|
[2413] | 7 | # Copyright (c) 2004-2010 knut st. osmundsen <bird-kBuild-spamx@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
|
---|
[1777] | 73 | ifneq ($(int-ge $(KBUILD_VERSION_PATCH),4),1)
|
---|
| 74 | $(warning kBuild: kmk version mismatch! Expected 0.1.4 or later. Actual version is $(KBUILD_VERSION_MAJOR).$(KBUILD_VERSION_MINOR).$(KBUILD_VERSION_PATCH).)
|
---|
[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: 2483 $ )
|
---|
[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 |
|
---|
| 161 |
|
---|
[95] | 162 | #
|
---|
[1403] | 163 | # The list of standard build types in kBuild.
|
---|
| 164 | #
|
---|
[1416] | 165 | # This list can be extended in Config.kmk and it's possible to extend
|
---|
[1403] | 166 | # (inherit) another build type.
|
---|
| 167 | #
|
---|
[1420] | 168 | KBUILD_BLD_TYPES := release profile debug
|
---|
[1403] | 169 |
|
---|
| 170 |
|
---|
| 171 | #
|
---|
[985] | 172 | # The OSes, Architectures and CPUs that kBuild recognizes.
|
---|
[978] | 173 | #
|
---|
| 174 | # When kBuild is ported to a new OS or architecture a unique keyword needs
|
---|
| 175 | # to be assigned to it and added here. This strictness is required because
|
---|
| 176 | # this keyword namespace is shared between OSes, architectures, cpus and
|
---|
[984] | 177 | # build types. (PORTME)
|
---|
[978] | 178 | #
|
---|
[2087] | 179 | KBUILD_OSES := darwin dos dragonfly freebsd l4 linux netbsd nt openbsd os2 solaris win os-agnostic
|
---|
[1381] | 180 | KBUILD_ARCHES := x86 amd64 sparc32 sparc64 s390 s390x ppc32 ppc64 mips32 mips64 ia64 hppa32 hppa64 arm alpha
|
---|
[978] | 181 |
|
---|
| 182 |
|
---|
| 183 | #
|
---|
[585] | 184 | # Set default build type.
|
---|
[69] | 185 | #
|
---|
[1504] | 186 | ifndef KBUILD_TYPE
|
---|
| 187 | ifdef BUILD_TYPE
|
---|
| 188 | KBUILD_TYPE := $(BUILD_TYPE)
|
---|
| 189 | endif
|
---|
| 190 | else ifdef BUILD_TYPE
|
---|
| 191 | ifneq ($(KBUILD_TYPE),$(BUILD_TYPE))
|
---|
| 192 | ifeq ($(origin KBUILD_TYPE):$(origin BUILD_TYPE),environment:command line)
|
---|
| 193 | KBUILD_TYPE := $(BUILD_TYPE)
|
---|
| 194 | else ifneq ($(origin KBUILD_TYPE):$(origin BUILD_TYPE),command line:environment)
|
---|
| 195 | $(error kBuild: KBUILD_TYPE and BUILD_TYPE disagree.)
|
---|
| 196 | endif
|
---|
| 197 | endif
|
---|
| 198 | endif
|
---|
| 199 | override BUILD_TYPE = $(KBUILD_TYPE)
|
---|
| 200 |
|
---|
| 201 | ifndef KBUILD_TYPE
|
---|
| 202 | KBUILD_TYPE := release
|
---|
[978] | 203 | else
|
---|
[1504] | 204 | if1of ($(KBUILD_TYPE), $(KBUILD_OSES) $(KBUILD_ARCHES))
|
---|
| 205 | $(error kBuild: The KBUILD_TYPE value '$(KBUILD_TYPE)' is an OS or architecture!)
|
---|
[585] | 206 | endif
|
---|
[1504] | 207 | ifneq (.$(words $(KBUILD_TYPE)).$(KBUILD_TYPE).,.1.$(strip $(KBUILD_TYPE)).)
|
---|
| 208 | $(error kBuild: The KBUILD_TYPE value '$(KBUILD_TYPE)' contains spaces/tabs!)
|
---|
[978] | 209 | endif
|
---|
[72] | 210 | endif
|
---|
[69] | 211 |
|
---|
| 212 |
|
---|
| 213 | #
|
---|
[1561] | 214 | # Host platform legacy
|
---|
[1504] | 215 | # kmk deals with this, so this is only temporary until I've rebuilt everything.
|
---|
| 216 | #
|
---|
| 217 | ifndef KBUILD_HOST
|
---|
| 218 | KBUILD_HOST := $(BUILD_PLATFORM)
|
---|
| 219 | endif
|
---|
| 220 | ifndef KBUILD_HOST_ARCH
|
---|
| 221 | KBUILD_HOST_ARCH := $(BUILD_PLATFORM_ARCH)
|
---|
| 222 | endif
|
---|
| 223 | ifndef KBUILD_HOST_CPU
|
---|
| 224 | KBUILD_HOST_CPU := $(BUILD_PLATFORM_CPU)
|
---|
| 225 | endif
|
---|
| 226 |
|
---|
| 227 |
|
---|
| 228 | #
|
---|
[978] | 229 | # Assert valid build platform variables.
|
---|
[70] | 230 | #
|
---|
[978] | 231 | # All these are set by kmk so they shouldn't be any trouble
|
---|
| 232 | # unless the user starts messing about with environment variables.
|
---|
| 233 | #
|
---|
[1504] | 234 | ifneq (.$(words $(KBUILD_HOST)).$(KBUILD_HOST).,.1.$(strip $(KBUILD_HOST)).)
|
---|
| 235 | $(error kBuild: The KBUILD_HOST value '$(KBUILD_HOST)' contains spaces/tabs!)
|
---|
[72] | 236 | endif
|
---|
[1504] | 237 | ifneq ($(words $(filter $(KBUILD_HOST),$(KBUILD_OSES))),1)
|
---|
| 238 | $(error kBuild: KBUILD_HOST value '$(KBUILD_HOST)' is not recognized (valid: $(KBUILD_OSES)))
|
---|
[978] | 239 | endif
|
---|
[70] | 240 |
|
---|
[1504] | 241 | ifneq (.$(words $(KBUILD_HOST_ARCH)).$(KBUILD_HOST_ARCH).,.1.$(strip $(KBUILD_HOST_ARCH)).)
|
---|
| 242 | $(error kBuild: The KBUILD_HOST_ARCH value '$(KBUILD_HOST_ARCH)' contains spaces/tabs!)
|
---|
[329] | 243 | endif
|
---|
[1504] | 244 | ifneq ($(words $(filter $(KBUILD_HOST_ARCH),$(KBUILD_ARCHES))),1)
|
---|
| 245 | $(error kBuild: KBUILD_HOST_ARCH value '$(KBUILD_HOST_ARCH)' is not recognized (valid: $(KBUILD_ARCHES)))
|
---|
[329] | 246 | endif
|
---|
[72] | 247 |
|
---|
[1504] | 248 | ifeq ($(strip $(KBUILD_HOST_CPU)),)
|
---|
| 249 | KBUILD_HOST_CPU := blend
|
---|
[994] | 250 | else
|
---|
[1504] | 251 | ifneq (.$(words $(KBUILD_HOST_CPU)).$(KBUILD_HOST_CPU).,.1.$(strip $(KBUILD_HOST_CPU)).)
|
---|
| 252 | $(error kBuild: The KBUILD_HOST_CPU value '$(KBUILD_HOST_CPU)' contains spaces/tabs!)
|
---|
[994] | 253 | endif
|
---|
[2403] | 254 | if1of ($(KBUILD_HOST_CPU), $(KBUILD_OSES) $(KBUILD_ARCHES))
|
---|
[1504] | 255 | $(error kBuild: The KBUILD_HOST_CPU value '$(KBUILD_HOST_CPU)' was found in the OS or architecture keywords!)
|
---|
[994] | 256 | endif
|
---|
[1504] | 257 | ifeq ($(KBUILD_HOST_CPU),$(KBUILD_TYPE))
|
---|
| 258 | $(error kBuild: The KBUILD_HOST_CPU value '$(KBUILD_HOST_CPU)' is the same as the KBUILD_TYPE!)
|
---|
[994] | 259 | endif
|
---|
[978] | 260 | endif
|
---|
[72] | 261 |
|
---|
[978] | 262 |
|
---|
[70] | 263 | #
|
---|
[1504] | 264 | # Deal with target platform legacy.
|
---|
| 265 | #
|
---|
| 266 | ifndef KBUILD_TARGET
|
---|
| 267 | ifdef BUILD_TARGET
|
---|
| 268 | KBUILD_TARGET := $(BUILD_TARGET)
|
---|
| 269 | endif
|
---|
| 270 | else ifdef BUILD_TARGET
|
---|
| 271 | ifneq ($(KBUILD_TARGET),$(BUILD_TARGET))
|
---|
| 272 | ifeq ($(origin KBUILD_TARGET):$(origin BUILD_TARGET),environment:command line)
|
---|
| 273 | KBUILD_TARGET := $(BUILD_TARGET)
|
---|
| 274 | else ifneq ($(origin KBUILD_TARGET):$(origin BUILD_TARGET),command line:environment)
|
---|
[1561] | 275 | $(error kBuild: KBUILD_TARGET and BUILD_TARGET disagree)
|
---|
[1504] | 276 | endif
|
---|
| 277 | endif
|
---|
| 278 | endif
|
---|
| 279 | override BUILD_TARGET = $(KBUILD_TARGET)
|
---|
| 280 |
|
---|
| 281 | ifndef KBUILD_TARGET_ARCH
|
---|
| 282 | ifdef BUILD_TARGET_ARCH
|
---|
| 283 | KBUILD_TARGET_ARCH := $(BUILD_TARGET_ARCH)
|
---|
| 284 | endif
|
---|
| 285 | else ifdef BUILD_TARGET_ARCH
|
---|
| 286 | ifneq ($(KBUILD_TARGET_ARCH),$(BUILD_TARGET_ARCH))
|
---|
| 287 | ifeq ($(origin KBUILD_TARGET_ARCH):$(origin BUILD_TARGET_ARCH),environment:command line)
|
---|
| 288 | KBUILD_TARGET_ARCH := $(BUILD_TARGET_ARCH)
|
---|
| 289 | else ifneq ($(origin KBUILD_TARGET_ARCH):$(origin BUILD_TARGET_ARCH),command line:environment)
|
---|
[1561] | 290 | $(error kBuild: KBUILD_TARGET_ARCH and BUILD_TARGET_ARCH disagree)
|
---|
[1504] | 291 | endif
|
---|
| 292 | endif
|
---|
| 293 | endif
|
---|
| 294 | override BUILD_TARGET_ARCH = $(KBUILD_TARGET_ARCH)
|
---|
| 295 |
|
---|
| 296 | ifndef KBUILD_TARGET_CPU
|
---|
| 297 | ifdef BUILD_TARGET_CPU
|
---|
| 298 | KBUILD_TARGET_CPU := $(BUILD_TARGET_CPU)
|
---|
| 299 | endif
|
---|
| 300 | else ifdef BUILD_TARGET_CPU
|
---|
| 301 | ifneq ($(KBUILD_TARGET_CPU),$(BUILD_TARGET_CPU))
|
---|
| 302 | ifeq ($(origin KBUILD_TARGET_CPU):$(origin BUILD_TARGET_CPU),environment:command line)
|
---|
| 303 | KBUILD_TARGET_CPU := $(BUILD_TARGET_CPU)
|
---|
| 304 | else ifneq ($(origin KBUILD_TARGET_CPU):$(origin BUILD_TARGET_CPU),command line:environment)
|
---|
[1561] | 305 | $(error kBuild: KBUILD_TARGET_CPU and BUILD_TARGET_CPU disagree)
|
---|
[1504] | 306 | endif
|
---|
| 307 | endif
|
---|
| 308 | endif
|
---|
| 309 | override BUILD_TARGET_CPU = $(KBUILD_TARGET_CPU)
|
---|
| 310 |
|
---|
| 311 |
|
---|
| 312 | #
|
---|
[978] | 313 | # Assert or set default target platform.
|
---|
[1504] | 314 | # When not defined use the corresponding KBUILD_HOST value.
|
---|
[72] | 315 | #
|
---|
[1504] | 316 | ifndef KBUILD_TARGET
|
---|
| 317 | KBUILD_TARGET := $(KBUILD_HOST)
|
---|
[72] | 318 | else
|
---|
[1504] | 319 | ifneq (.$(words $(KBUILD_TARGET)).$(KBUILD_TARGET).,.1.$(strip $(KBUILD_TARGET)).)
|
---|
| 320 | $(error kBuild: The KBUILD_TARGET value '$(KBUILD_TARGET)' contains spaces/tabs!)
|
---|
[478] | 321 | endif
|
---|
[1504] | 322 | ifneq ($(words $(filter $(KBUILD_TARGET),$(KBUILD_OSES))),1)
|
---|
| 323 | $(error kBuild: KBUILD_TARGET value '$(KBUILD_TARGET)' is not recognized (valid: $(KBUILD_OSES)))
|
---|
[978] | 324 | endif
|
---|
[72] | 325 | endif
|
---|
| 326 |
|
---|
[1504] | 327 | ifndef KBUILD_TARGET_ARCH
|
---|
| 328 | KBUILD_TARGET_ARCH := $(KBUILD_HOST_ARCH)
|
---|
[978] | 329 | else
|
---|
[1504] | 330 | ifneq (.$(words $(KBUILD_TARGET_ARCH)).$(KBUILD_TARGET_ARCH).,.1.$(strip $(KBUILD_TARGET_ARCH)).)
|
---|
| 331 | $(error kBuild: The KBUILD_TARGET_ARCH value '$(KBUILD_TARGET_ARCH)' contains spaces/tabs!)
|
---|
[978] | 332 | endif
|
---|
[1504] | 333 | ifneq ($(words $(filter $(KBUILD_TARGET_ARCH),$(KBUILD_ARCHES))),1)
|
---|
| 334 | $(error kBuild: KBUILD_TARGET_ARCH value '$(KBUILD_TARGET_ARCH)' is not recognized (valid: $(KBUILD_ARCHES)))
|
---|
[978] | 335 | endif
|
---|
[329] | 336 | endif
|
---|
[978] | 337 |
|
---|
[1504] | 338 | ifndef KBUILD_TARGET_CPU
|
---|
| 339 | KBUILD_TARGET_CPU := $(KBUILD_HOST_CPU)
|
---|
| 340 | else ifeq ($(strip $(KBUILD_TARGET_CPU)),)
|
---|
| 341 | ifeq ($(KBUILD_TARGET_ARCH),$(KBUILD_HOST_ARCH))
|
---|
| 342 | KBUILD_TARGET_CPU := $(KBUILD_HOST_CPU)
|
---|
[994] | 343 | else
|
---|
[1504] | 344 | KBUILD_TARGET_CPU := blend
|
---|
[994] | 345 | endif
|
---|
[978] | 346 | else
|
---|
[1504] | 347 | ifneq (.$(words $(KBUILD_TARGET_CPU)).$(KBUILD_TARGET_CPU).,.1.$(strip $(KBUILD_TARGET_CPU)).)
|
---|
| 348 | $(error kBuild: The KBUILD_TARGET_CPU value '$(KBUILD_TARGET_CPU)' contains spaces/tabs!)
|
---|
[978] | 349 | endif
|
---|
[2403] | 350 | if1of ($(KBUILD_TARGET_CPU), $(KBUILD_OSES) $(KBUILD_ARCHES))
|
---|
[1504] | 351 | $(error kBuild: The KBUILD_TARGET_CPU value was found in the OS or architecture keywords!)
|
---|
[978] | 352 | endif
|
---|
[1504] | 353 | ifeq ($(KBUILD_TARGET_CPU),$(KBUILD_TYPE))
|
---|
| 354 | $(error kBuild: The KBUILD_TARGET_CPU value '$(KBUILD_TARGET_CPU)' is the same as the KBUILD_TYPE!)
|
---|
[978] | 355 | endif
|
---|
[329] | 356 | endif
|
---|
[72] | 357 |
|
---|
| 358 |
|
---|
| 359 | #
|
---|
[978] | 360 | # Paths and stuff.
|
---|
[69] | 361 | #
|
---|
[978] | 362 |
|
---|
| 363 | # Adjust DEPTH first.
|
---|
| 364 | DEPTH := $(strip $(DEPTH))
|
---|
| 365 | ifeq ($(DEPTH),)
|
---|
| 366 | DEPTH := .
|
---|
| 367 | endif
|
---|
| 368 |
|
---|
[725] | 369 | ## PATH_CURRENT is the current directory (getcwd).
|
---|
[306] | 370 | PATH_CURRENT := $(abspath $(CURDIR))
|
---|
[725] | 371 | ## PATH_SUB_CURRENT points to current directory of the current makefile.
|
---|
| 372 | # Meaning that it will change value as we enter and exit sub-makefiles.
|
---|
| 373 | PATH_SUB_CURRENT := $(PATH_CURRENT)
|
---|
| 374 | ## PATH_ROOT points to the project root directory.
|
---|
| 375 | PATH_ROOT := $(abspath $(PATH_CURRENT)/$(DEPTH))
|
---|
| 376 | ## PATH_SUB_ROOT points to the directory of the top-level makefile.
|
---|
[472] | 377 | ifneq ($(strip $(SUB_DEPTH)),)
|
---|
[978] | 378 | SUB_DEPTH := $(strip $(SUB_DEPTH))
|
---|
[725] | 379 | PATH_SUB_ROOT := $(abspath $(PATH_CURRENT)/$(SUB_DEPTH))
|
---|
[472] | 380 | else
|
---|
[725] | 381 | PATH_SUB_ROOT := $(PATH_CURRENT)
|
---|
[472] | 382 | endif
|
---|
[306] | 383 |
|
---|
[748] | 384 | ## CURSUBDIR is PATH_SUB_ROOT described relative to PATH_ROOT.
|
---|
[725] | 385 | # This variable is used to determin where the object files and other output goes.
|
---|
[1390] | 386 | ifneq ($(PATH_ROOT),$(PATH_SUB_ROOT))
|
---|
| 387 | CURSUBDIR := $(patsubst $(PATH_ROOT)/%,%,$(PATH_SUB_ROOT))
|
---|
[266] | 388 | else
|
---|
[1390] | 389 | CURSUBDIR := .
|
---|
[266] | 390 | endif
|
---|
[306] | 391 |
|
---|
[2475] | 392 | # Install directory layout. Relative to PATH_INS.
|
---|
[2479] | 393 | KBUILD_INST_PATHS := BIN DLL SYS LIB DOC DEBUG SBIN LIBEXEC SHARE
|
---|
[2475] | 394 | INST_BIN = bin/
|
---|
| 395 | if1of ($(KBUILD_TARGET), win)
|
---|
| 396 | INST_DLL = bin/
|
---|
| 397 | else
|
---|
| 398 | INST_DLL = lib/
|
---|
| 399 | endif
|
---|
| 400 | if1of ($(KBUILD_TARGET), os2 win)
|
---|
| 401 | INST_SYS = drivers/
|
---|
| 402 | else
|
---|
| 403 | INST_SYS = kernel/
|
---|
| 404 | endif
|
---|
| 405 | INST_LIB = lib/
|
---|
| 406 | INST_DOC = share/doc/
|
---|
| 407 | INST_DEBUG = debug/
|
---|
| 408 | INST_SBIN = sbin/
|
---|
| 409 | INST_LIBEXEC = libexec/
|
---|
| 410 | INST_SHARE = share/
|
---|
| 411 |
|
---|
| 412 | # Staging directory layout. Relative to PATH_STAGE.
|
---|
| 413 | STAGE_BIN = $(INST_BIN)
|
---|
| 414 | STAGE_DLL = $(INST_DLL)
|
---|
| 415 | STAGE_SYS = $(INST_SYS)
|
---|
| 416 | STAGE_LIB = $(INST_LIB)
|
---|
| 417 | STAGE_DOC = $(INST_DOC)
|
---|
| 418 | STAGE_DEBUG = $(INST_DEBUG)
|
---|
| 419 | STAGE_SBIN = $(INST_SBIN)
|
---|
| 420 | STAGE_LIBEXEC = $(INST_LIBEXEC)
|
---|
| 421 | STAGE_SHARE = $(INST_SHARE)
|
---|
| 422 |
|
---|
[2479] | 423 | # Install and staging directory paths.
|
---|
| 424 | $(foreach path, $(KBUILD_INST_PATHS), \
|
---|
| 425 | $(eval PATH_STAGE_$(path) = $$(patsubst %/,%,$$(PATH_STAGE)/$$(STAGE_$(path)))) \
|
---|
| 426 | $(eval PATH_INST_$(path) = $$(patsubst %/,%,$$(PATH_INS)/$$(INST_$(path)))) \
|
---|
| 427 | )
|
---|
| 428 |
|
---|
[70] | 429 | # Output directories.
|
---|
[242] | 430 | ifndef PATH_OUT_BASE
|
---|
[725] | 431 | PATH_OUT_BASE := $(PATH_ROOT)/out
|
---|
[242] | 432 | endif
|
---|
[240] | 433 | ifndef PATH_OUT
|
---|
[1504] | 434 | ifdef BUILD_TARGET_SUB # (BUILD_TARGET_SUB is not currently recognized by kBuild in any other places - obsolete)
|
---|
[1691] | 435 | PATH_OUT = $(PATH_OUT_BASE)/$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH).$(BUILD_TARGET_SUB)/$(KBUILD_TYPE)
|
---|
[725] | 436 | else
|
---|
[1691] | 437 | PATH_OUT = $(PATH_OUT_BASE)/$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)/$(KBUILD_TYPE)
|
---|
[725] | 438 | endif
|
---|
[329] | 439 | endif # !define PATH_OUT
|
---|
[1051] | 440 | PATH_OBJCACHE = $(PATH_OUT_BASE)/kObjCache
|
---|
[353] | 441 | PATH_OBJ = $(PATH_OUT)/obj
|
---|
| 442 | PATH_TARGET = $(PATH_OBJ)/$(CURSUBDIR)
|
---|
[2475] | 443 | PATH_STAGE = $(PATH_OUT)/stage
|
---|
| 444 | ifndef PATH_INS
|
---|
| 445 | ifdef DESTROOT
|
---|
| 446 | PATH_INS = $(DESTROOT)
|
---|
| 447 | else
|
---|
| 448 | PATH_INS = $(PATH_OUT)/dist
|
---|
| 449 | endif
|
---|
| 450 | endif
|
---|
[70] | 451 |
|
---|
[2271] | 452 | # Development tool tree.
|
---|
| 453 | KBUILD_DEVTOOLS = $(if $(PATH_DEVTOOLS),$(PATH_DEVTOOLS),$(PATH_ROOT)/tools)
|
---|
| 454 | KBUILD_DEVTOOLS_TRG = $(KBUILD_DEVTOOLS)/$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)
|
---|
| 455 | KBUILD_DEVTOOLS_HST = $(KBUILD_DEVTOOLS)/$(KBUILD_HOST).$(KBUILD_HOST_ARCH)
|
---|
| 456 |
|
---|
| 457 | if1of ($(KBUILD_TARGET_ARCH), amd64 hppa64 mips64 ppc64 s390x sparc64)
|
---|
| 458 | ifeq ($(KBUILD_TARGET_ARCH),amd64)
|
---|
| 459 | KBUILD_DEVTOOLS_TRG_ALT = $(PATH_DEVTOOLS)/$(KBUILD_TARGET).x86
|
---|
| 460 | else ifeq ($(KBUILD_TARGET_ARCH),hppa64)
|
---|
| 461 | KBUILD_DEVTOOLS_TRG_ALT = $(PATH_DEVTOOLS)/$(KBUILD_TARGET).hppa32
|
---|
| 462 | else ifeq ($(KBUILD_TARGET_ARCH),mips64)
|
---|
| 463 | KBUILD_DEVTOOLS_TRG_ALT = $(PATH_DEVTOOLS)/$(KBUILD_TARGET).mips32
|
---|
| 464 | else ifeq ($(KBUILD_TARGET_ARCH),ppc64)
|
---|
| 465 | KBUILD_DEVTOOLS_TRG_ALT = $(PATH_DEVTOOLS)/$(KBUILD_TARGET).ppc32
|
---|
| 466 | else ifeq ($(KBUILD_TARGET_ARCH),s390x)
|
---|
| 467 | KBUILD_DEVTOOLS_TRG_ALT = $(PATH_DEVTOOLS)/$(KBUILD_TARGET).s390
|
---|
| 468 | else ifeq ($(KBUILD_TARGET_ARCH),sparc64)
|
---|
| 469 | KBUILD_DEVTOOLS_TRG_ALT = $(PATH_DEVTOOLS)/$(KBUILD_TARGET).sparc32
|
---|
| 470 | endif
|
---|
| 471 | endif
|
---|
| 472 |
|
---|
| 473 | if1of ($(KBUILD_HOST_ARCH), amd64 hppa64 mips64 ppc64 s390x sparc64)
|
---|
| 474 | ifeq ($(KBUILD_HOST_ARCH),amd64)
|
---|
| 475 | KBUILD_DEVTOOLS_HST_ALT = $(PATH_DEVTOOLS)/$(KBUILD_HOST).x86
|
---|
| 476 | else ifeq ($(KBUILD_HOST_ARCH),hppa64)
|
---|
| 477 | KBUILD_DEVTOOLS_HST_ALT = $(PATH_DEVTOOLS)/$(KBUILD_HOST).hppa32
|
---|
| 478 | else ifeq ($(KBUILD_HOST_ARCH),mips64)
|
---|
| 479 | KBUILD_DEVTOOLS_HST_ALT = $(PATH_DEVTOOLS)/$(KBUILD_HOST).mips32
|
---|
| 480 | else ifeq ($(KBUILD_HOST_ARCH),ppc64)
|
---|
| 481 | KBUILD_DEVTOOLS_HST_ALT = $(PATH_DEVTOOLS)/$(KBUILD_HOST).ppc32
|
---|
| 482 | else ifeq ($(KBUILD_HOST_ARCH),s390x)
|
---|
| 483 | KBUILD_DEVTOOLS_HST_ALT = $(PATH_DEVTOOLS)/$(KBUILD_HOST).s390
|
---|
| 484 | else ifeq ($(KBUILD_HOST_ARCH),sparc64)
|
---|
| 485 | KBUILD_DEVTOOLS_HST_ALT = $(PATH_DEVTOOLS)/$(KBUILD_HOST).sparc32
|
---|
| 486 | endif
|
---|
| 487 | endif
|
---|
| 488 |
|
---|
| 489 |
|
---|
[1504] | 490 | # KBUILD_PATH / PATH_KBUILD is determined by kmk.
|
---|
| 491 | ifndef KBUILD_PATH
|
---|
| 492 | KBUILD_PATH := $(PATH_KBUILD)
|
---|
[70] | 493 | endif
|
---|
[1504] | 494 | ifeq ($(strip $(KBUILD_PATH)),)
|
---|
| 495 | $(error kBuild: KBUILD_PATH is missing or empty! kmk is supposed to set it.)
|
---|
[978] | 496 | endif
|
---|
[1504] | 497 | # KBUILD_BIN_PATH / PATH_KBUILD_BIN is determined by kmk.
|
---|
| 498 | ifndef KBUILD_BIN_PATH
|
---|
| 499 | KBUILD_BIN_PATH := $(PATH_KBUILD_BIN)
|
---|
| 500 | endif
|
---|
| 501 | ifeq ($(strip $(KBUILD_BIN_PATH)),)
|
---|
| 502 | $(error kBuild: KBUILD_BIN_PATH is missing or empty! kmk is supposed to set it.)
|
---|
| 503 | endif
|
---|
[978] | 504 |
|
---|
[69] | 505 | # kBuild files which might be of interest.
|
---|
[1664] | 506 | FILE_KBUILD_HEADER := $(KBUILD_PATH)/header.kmk
|
---|
| 507 | #FILE_KBUILD_CONFIG := $(KBUILD_PATH)/config.kmk
|
---|
| 508 | FILE_KBUILD_FOOTER := $(KBUILD_PATH)/footer.kmk
|
---|
| 509 | FILE_KBUILD_SUB_HEADER := $(KBUILD_PATH)/subheader.kmk
|
---|
| 510 | FILE_KBUILD_SUB_FOOTER := $(KBUILD_PATH)/subfooter.kmk
|
---|
[69] | 511 |
|
---|
[725] | 512 | ## MAKEFILE is the name of the main makefile.
|
---|
[204] | 513 | MAKEFILE := $(firstword $(MAKEFILE_LIST))
|
---|
[748] | 514 | ## MAKEFILE_CURRENT is the name of the current makefile.
|
---|
[725] | 515 | # This is updated everything a sub-makefile is included.
|
---|
| 516 | MAKEFILE_CURRENT := $(MAKEFILE)
|
---|
[69] | 517 |
|
---|
[72] | 518 |
|
---|
[1602] | 519 | ## @todo this should be done via SUFF_XYZ.target/host...
|
---|
| 520 |
|
---|
[69] | 521 | #
|
---|
[72] | 522 | # Build platform setup.
|
---|
[984] | 523 | # (PORTME)
|
---|
[69] | 524 | #
|
---|
[1602] | 525 | if1of ($(KBUILD_HOST), win nt)
|
---|
| 526 | # Win, Win32, Win64, NT.
|
---|
| 527 | EXEC_X86_WIN32 :=
|
---|
| 528 | HOSTSUFF_EXE := .exe
|
---|
[984] | 529 |
|
---|
[1602] | 530 | # OS/2.
|
---|
| 531 | else ifeq ($(KBUILD_HOST),os2)
|
---|
[83] | 532 | EXEC_X86_WIN32 := innopec.exe
|
---|
[69] | 533 | HOSTSUFF_EXE := .exe
|
---|
| 534 |
|
---|
[1602] | 535 | else if1of ($(KBUILD_HOST), freebsd dragonfly linux openbsd netbsd)
|
---|
| 536 | # Unix (like) systems with wine.
|
---|
[135] | 537 | EXEC_X86_WIN32 := wine
|
---|
[69] | 538 | HOSTSUFF_EXE :=
|
---|
[70] | 539 |
|
---|
[1602] | 540 | else
|
---|
| 541 | # Unix (like) systems without wine.
|
---|
[557] | 542 | EXEC_X86_WIN32 := false
|
---|
| 543 | HOSTSUFF_EXE :=
|
---|
| 544 | endif
|
---|
| 545 |
|
---|
[811] | 546 |
|
---|
[73] | 547 | #
|
---|
| 548 | # Build target setup.
|
---|
[984] | 549 | # (PORTME)
|
---|
[73] | 550 | #
|
---|
[1388] | 551 | SUFF_DEP := .dep
|
---|
[2088] | 552 | SUFF_BIN :=
|
---|
[1504] | 553 | if1of ($(KBUILD_TARGET), win nt os2)
|
---|
[1388] | 554 | SUFF_OBJ := .obj
|
---|
| 555 | SUFF_LIB := .lib
|
---|
| 556 | SUFF_DLL := .dll
|
---|
| 557 | SUFF_EXE := .exe
|
---|
| 558 | SUFF_SYS := .sys
|
---|
| 559 | SUFF_RES := .res
|
---|
[1504] | 560 | else ifeq ($(KBUILD_TARGET),l4)
|
---|
[1388] | 561 | SUFF_OBJ := .o
|
---|
| 562 | SUFF_LIB := .a
|
---|
| 563 | SUFF_DLL := .s.so
|
---|
| 564 | SUFF_EXE :=
|
---|
| 565 | SUFF_SYS := .a
|
---|
| 566 | SUFF_RES :=
|
---|
[1504] | 567 | else ifeq ($(KBUILD_TARGET),darwin)
|
---|
[1388] | 568 | SUFF_OBJ := .o
|
---|
| 569 | SUFF_LIB := .a
|
---|
| 570 | SUFF_DLL := .dylib
|
---|
| 571 | SUFF_EXE :=
|
---|
| 572 | SUFF_SYS :=
|
---|
| 573 | SUFF_RES :=
|
---|
| 574 | else
|
---|
| 575 | SUFF_OBJ := .o
|
---|
| 576 | SUFF_LIB := .a
|
---|
| 577 | SUFF_DLL := .so
|
---|
| 578 | SUFF_EXE :=
|
---|
[1602] | 579 | if1of ($(KBUILD_TARGET), dragonfly freebsd linux netbsd openbsd) ## @todo check netbsd and openbsd.
|
---|
[1389] | 580 | SUFF_SYS := .ko
|
---|
[1388] | 581 | else
|
---|
[1389] | 582 | SUFF_SYS :=
|
---|
| 583 | endif
|
---|
[1388] | 584 | SUFF_RES :=
|
---|
[73] | 585 | endif
|
---|
[69] | 586 |
|
---|
| 587 | #
|
---|
| 588 | # Standard kBuild tools.
|
---|
| 589 | #
|
---|
[978] | 590 | ifeq ($(KMK),kmk)
|
---|
[1504] | 591 | KMK := $(KBUILD_BIN_PATH)/kmk$(HOSTSUFF_EXE)
|
---|
[233] | 592 | endif
|
---|
[978] | 593 | MAKE := $(KMK)
|
---|
[233] | 594 |
|
---|
[1504] | 595 | GMAKE := $(KBUILD_BIN_PATH)/kmk_gmake$(HOSTSUFF_EXE)
|
---|
[1378] | 596 |
|
---|
[2148] | 597 | #DEP_EXT := $(KBUILD_BIN_PATH)/kDep$(HOSTSUFF_EXE)
|
---|
| 598 | #DEP_INT := $(KBUILD_BIN_PATH)/kDep$(HOSTSUFF_EXE)
|
---|
| 599 | #DEP := $(DEP_INT)
|
---|
[69] | 600 |
|
---|
[1504] | 601 | DEP_IDB_EXT := $(KBUILD_BIN_PATH)/kDepIDB$(HOSTSUFF_EXE)
|
---|
[2148] | 602 | DEP_IDB_INT := kmk_builtin_kDepIDB
|
---|
| 603 | DEP_IDB := $(DEP_IDB_INT)
|
---|
[397] | 604 |
|
---|
[2148] | 605 | DEP_PRE := $(KBUILD_BIN_PATH)/kDepPre$(HOSTSUFF_EXE)
|
---|
[380] | 606 |
|
---|
[1504] | 607 | KOBJCACHE_EXT := $(KBUILD_BIN_PATH)/kObjCache$(HOSTSUFF_EXE)
|
---|
[1004] | 608 | KOBJCACHE := $(KOBJCACHE_EXT)
|
---|
| 609 |
|
---|
[1504] | 610 | APPEND_EXT := $(KBUILD_BIN_PATH)/kmk_append$(HOSTSUFF_EXE)
|
---|
[2148] | 611 | APPEND_INT := kmk_builtin_append
|
---|
| 612 | APPEND := $(APPEND_INT)
|
---|
[69] | 613 |
|
---|
[1504] | 614 | CAT_EXT := $(KBUILD_BIN_PATH)/kmk_cat$(HOSTSUFF_EXE)
|
---|
[2148] | 615 | CAT_INT := kmk_builtin_cat
|
---|
| 616 | CAT := $(CAT_INT)
|
---|
[353] | 617 |
|
---|
[1753] | 618 | CHMOD_EXT := $(KBUILD_BIN_PATH)/kmk_chmod$(HOSTSUFF_EXE)
|
---|
[2148] | 619 | CHMOD_INT := kmk_builtin_chmod
|
---|
| 620 | CHMOD := $(CHMOD_INT)
|
---|
[1753] | 621 |
|
---|
[1504] | 622 | CMP_EXT := $(KBUILD_BIN_PATH)/kmk_cmp$(HOSTSUFF_EXE)
|
---|
[2148] | 623 | CMP_INT := kmk_builtin_cmp
|
---|
| 624 | CMP := $(CMP_INT)
|
---|
[1118] | 625 |
|
---|
[1504] | 626 | CP_EXT := $(KBUILD_BIN_PATH)/kmk_cp$(HOSTSUFF_EXE)
|
---|
[2148] | 627 | CP_INT := kmk_builtin_cp
|
---|
| 628 | CP := $(CP_INT)
|
---|
[1119] | 629 |
|
---|
[1504] | 630 | ECHO_EXT := $(KBUILD_BIN_PATH)/kmk_echo$(HOSTSUFF_EXE)
|
---|
[2148] | 631 | ECHO_INT := kmk_builtin_echo
|
---|
| 632 | ECHO := $(ECHO_INT)
|
---|
[380] | 633 |
|
---|
[1753] | 634 | EXPR_EXT := $(KBUILD_BIN_PATH)/kmk_expr$(HOSTSUFF_EXE)
|
---|
[2148] | 635 | EXPR_INT := kmk_builtin_expr
|
---|
| 636 | EXPR := $(EXPR_INT)
|
---|
[1753] | 637 |
|
---|
[1504] | 638 | INSTALL_EXT := $(KBUILD_BIN_PATH)/kmk_install$(HOSTSUFF_EXE)
|
---|
[2148] | 639 | INSTALL_INT := kmk_builtin_install
|
---|
| 640 | INSTALL := $(INSTALL_INT)
|
---|
[380] | 641 |
|
---|
[1504] | 642 | LN_EXT := $(KBUILD_BIN_PATH)/kmk_ln$(HOSTSUFF_EXE)
|
---|
[2148] | 643 | LN_INT := kmk_builtin_ln
|
---|
| 644 | LN := $(LN_INT)
|
---|
[380] | 645 |
|
---|
[1504] | 646 | MD5SUM_EXT := $(KBUILD_BIN_PATH)/kmk_md5sum$(HOSTSUFF_EXE)
|
---|
[2148] | 647 | MD5SUM_INT := kmk_builtin_md5sum
|
---|
| 648 | MD5SUM := $(MD5SUM_INT)
|
---|
[1118] | 649 |
|
---|
[1504] | 650 | MKDIR_EXT := $(KBUILD_BIN_PATH)/kmk_mkdir$(HOSTSUFF_EXE)
|
---|
[2148] | 651 | MKDIR_INT := kmk_builtin_mkdir
|
---|
| 652 | MKDIR := $(MKDIR_INT)
|
---|
[380] | 653 |
|
---|
[1504] | 654 | MV_EXT := $(KBUILD_BIN_PATH)/kmk_mv$(HOSTSUFF_EXE)
|
---|
[2148] | 655 | MV_INT := kmk_builtin_mv
|
---|
| 656 | MV := $(MV_INT)
|
---|
[380] | 657 |
|
---|
[1504] | 658 | PRINTF_EXT := $(KBUILD_BIN_PATH)/kmk_printf$(HOSTSUFF_EXE)
|
---|
[2148] | 659 | PRINTF_INT := kmk_builtin_printf
|
---|
| 660 | PRINTF := $(PRINTF_INT)
|
---|
[776] | 661 |
|
---|
[1504] | 662 | REDIRECT_EXT:= $(KBUILD_BIN_PATH)/kmk_redirect$(HOSTSUFF_EXE)
|
---|
[2148] | 663 | REDIRECT_INT:= $(REDIRECT_EXT)
|
---|
| 664 | REDIRECT := $(REDIRECT_INT)
|
---|
[1272] | 665 |
|
---|
[1504] | 666 | RM_EXT := $(KBUILD_BIN_PATH)/kmk_rm$(HOSTSUFF_EXE)
|
---|
[2148] | 667 | RM_INT := kmk_builtin_rm
|
---|
| 668 | RM := $(RM_INT)
|
---|
[380] | 669 |
|
---|
[1504] | 670 | RMDIR_EXT := $(KBUILD_BIN_PATH)/kmk_rmdir$(HOSTSUFF_EXE)
|
---|
[2148] | 671 | RMDIR_INT := kmk_builtin_rmdir
|
---|
| 672 | RMDIR := $(RMDIR_INT)
|
---|
[601] | 673 |
|
---|
[1504] | 674 | SED_EXT := $(KBUILD_BIN_PATH)/kmk_sed$(HOSTSUFF_EXE)
|
---|
[978] | 675 | SED_INT := $(SED_EXT)
|
---|
[380] | 676 | SED := $(SED_EXT)
|
---|
| 677 |
|
---|
[2148] | 678 | SLEEP_INT := kmk_builtin_sleep
|
---|
| 679 | SLEEP_EXT := $(KBUILD_BIN_PATH)/kmk_sleep$(HOSTSUFF_EXE)
|
---|
| 680 | SLEEP := $(SLEEP_EXT)
|
---|
| 681 |
|
---|
[1504] | 682 | TEST_EXT := $(KBUILD_BIN_PATH)/kmk_test$(HOSTSUFF_EXE)
|
---|
[2148] | 683 | TEST_INT := kmk_builtin_test
|
---|
| 684 | TEST := $(TEST_INT)
|
---|
[1296] | 685 |
|
---|
[2148] | 686 | TIME_EXT := $(KBUILD_BIN_PATH)/kmk_time$(HOSTSUFF_EXE)
|
---|
| 687 | TIME_INT := $(TIME_EXT)
|
---|
| 688 | TIME := $(TIME_INT)
|
---|
| 689 |
|
---|
[380] | 690 | # Our default shell is the Almquist shell from *BSD.
|
---|
[1504] | 691 | ASH := $(KBUILD_BIN_PATH)/kmk_ash$(HOSTSUFF_EXE)
|
---|
[380] | 692 | MAKESHELL := $(ASH)
|
---|
| 693 | SHELL := $(ASH)
|
---|
| 694 | export SHELL MAKESHELL
|
---|
| 695 |
|
---|
[414] | 696 | # Symlinking is problematic on some platforms...
|
---|
[380] | 697 | LN_SYMLINK := $(LN) -s
|
---|
| 698 |
|
---|
[2479] | 699 | # When copying to the staging area, use hard links to save time and space.
|
---|
| 700 | if1of ($(KMK_FEATURES), install-hard-linking)
|
---|
| 701 | INSTALL_STAGING := $(INSTALL) --hard-link-files-when-possible
|
---|
| 702 | else
|
---|
| 703 | INSTALL_STAGING := $(INSTALL)
|
---|
| 704 | endif
|
---|
[743] | 705 |
|
---|
[2479] | 706 |
|
---|
[743] | 707 | #
|
---|
| 708 | # Some Functions.
|
---|
[748] | 709 | # The lower cased ones are either fallbacks or candidates for functions.c.
|
---|
[743] | 710 | #
|
---|
| 711 |
|
---|
[130] | 712 | ## ABSPATH - make paths absolute.
|
---|
[129] | 713 | # This implementation is clumsy and doesn't resolve '..' and '.' components.
|
---|
[73] | 714 | #
|
---|
[129] | 715 | # @param $1 The paths to make absolute.
|
---|
[696] | 716 | # @obsolete Use the GNU make function $(abspath) directly now.
|
---|
[984] | 717 | ABSPATH = $(abspath $(1))$(warning ABSPATH is deprecated, use abspath directly!)
|
---|
[353] | 718 |
|
---|
[130] | 719 | ## DIRDEP - make create directory dependencies.
|
---|
| 720 | #
|
---|
| 721 | # @param $1 The paths to the directories which must be created.
|
---|
[353] | 722 | DIRDEP = $(foreach path,$(patsubst %/,%,$(1)),$(path)/)
|
---|
[129] | 723 |
|
---|
| 724 | ## Cygwin kludge.
|
---|
| 725 | # This converts /cygdrive/x/% to x:%.
|
---|
| 726 | #
|
---|
| 727 | # @param $1 The paths to make native.
|
---|
| 728 | # @remark This macro is pretty much obsolete since we don't use cygwin base make.
|
---|
| 729 | ifneq ($(patsubst /cygdrive/%,%,$(CURDIR)),$(CURDIR))
|
---|
[743] | 730 | CYGPATHMIXED = $(foreach path,$(1)\
|
---|
[129] | 731 | ,$(if $(patsubst /cygdrive/%,,$(path)),$(path),$(patsubst $(strip $(firstword $(subst /, ,$(patsubst /cygdrive/%,%,$(path)))))/%,$(strip $(firstword $(subst /, ,$(patsubst /cygdrive/%,%,$(path))))):/%,$(patsubst /cygdrive/%,%,$(path)))))
|
---|
| 732 | else
|
---|
[743] | 733 | CYGPATHMIXED = $(1)
|
---|
[129] | 734 | endif
|
---|
| 735 |
|
---|
[743] | 736 | ## Removes the drive letter from a path (if it has one)
|
---|
| 737 | # @param $1 the path
|
---|
| 738 | no-drive = $(word $(words $(subst :, ,$(1))),$(subst :, ,$(1)))
|
---|
[723] | 739 |
|
---|
[743] | 740 | ## Removes the root slash from a path (if it has one)
|
---|
| 741 | # @param $1 the path
|
---|
| 742 | no-root-slash = $(patsubst /%,%,$(1))
|
---|
[723] | 743 |
|
---|
[743] | 744 | ## Figure out where to put object files.
|
---|
| 745 | # @param $1 real target name.
|
---|
| 746 | # @param $2 normalized main target
|
---|
[748] | 747 | TARGET_BASE = $(PATH_TARGET)/$(2)/$(call no-root-slash,$(call no-drive,$(1)))
|
---|
[723] | 748 |
|
---|
[743] | 749 | ## Figure out where to put object files.
|
---|
| 750 | # @param $1 normalized main target
|
---|
| 751 | TARGET_PATH = $(PATH_TARGET)/$(1)
|
---|
[723] | 752 |
|
---|
[2223] | 753 | ##
|
---|
| 754 | # Checks if the specified short option ($1) is found in the flags ($2),
|
---|
| 755 | # assuming getopt style options.
|
---|
| 756 | #
|
---|
| 757 | # @returns $3 if present, $4 not.
|
---|
| 758 | #
|
---|
| 759 | # @param $1 The option (single char!).
|
---|
| 760 | # @param $2 The option arguments.
|
---|
| 761 | # @param $3 Eval and return if present.
|
---|
| 762 | # @param $4 Eval and return if not present.
|
---|
| 763 | #
|
---|
| 764 | # @todo May confuse option values starting with '-' for options.
|
---|
| 765 | # @remarks Invoke like this: $(evalcall KB_FN_OPT_TEST_SHORT,d,$(flags),present,not-present)
|
---|
| 766 | #
|
---|
| 767 | define KB_FN_OPT_TEST_SHORT
|
---|
| 768 | local options := $(translate $(strip $(filter -%,$(filter-out --%,$2))),$(SP)-,)
|
---|
| 769 | local .RETURN := $(if-expr $(pos $1,$(options)) != 0,$3,$4)
|
---|
| 770 | endef
|
---|
[723] | 771 |
|
---|
[2223] | 772 | ##
|
---|
| 773 | # Checks if the specified long option ($1) is found in the flags ($2),
|
---|
| 774 | # assuming getopt style options.
|
---|
[129] | 775 | #
|
---|
[2223] | 776 | # @returns $3 if present, $4 not.
|
---|
| 777 | #
|
---|
| 778 | # @param $1 The long option, dashes included. No % chars.
|
---|
| 779 | # @param $2 The option arguments.
|
---|
| 780 | # @param $3 Eval and return if present.
|
---|
| 781 | # @param $4 Eval and return if not present.
|
---|
| 782 | #
|
---|
| 783 | # @todo May confuse option values starting with '--' for options.
|
---|
| 784 | # @remarks Invoke like this: $(evalcall KBFN_OPT_TEST_SHORT,--defined,$(flags),present,not-present)
|
---|
| 785 | #
|
---|
| 786 | define KB_FN_OPT_TEST_LONG
|
---|
| 787 | local options := $(filter-out =delete=%,$(subst :, =delete=,$(subst =, =delete=,$2)))
|
---|
| 788 | local .RETURN := $(if-expr "$(filter $1,$(options))" != "",$3,$4)
|
---|
| 789 | endef
|
---|
| 790 |
|
---|
| 791 | ##
|
---|
| 792 | # Checks if the specified short ($1) or long ($2) option is found in the flags ($2),
|
---|
| 793 | # assuming getopt style options.
|
---|
| 794 | #
|
---|
| 795 | # @returns $4 if present, $5 not.
|
---|
| 796 | #
|
---|
| 797 | # @param $1 The short option (single char!).
|
---|
| 798 | # @param $2 The long option, dashes included. No % chars.
|
---|
| 799 | # @param $3 The option arguments.
|
---|
| 800 | # @param $4 Eval and return if present.
|
---|
| 801 | # @param $5 Eval and return if not present.
|
---|
| 802 | #
|
---|
| 803 | # @todo May confuse option values starting with '--' for options.
|
---|
| 804 | # @remarks Invoke like this: $(evalcall KB_FN_OPT_TEST_SHORT_LONG,d,--defined,$(flags),present,not-present)
|
---|
| 805 | #
|
---|
| 806 | define KB_FN_OPT_TEST_SHORT_LONG
|
---|
| 807 | local short_options := $(translate $(strip $(filter -%,$(filter-out --%,$3))),$(SP)-,)
|
---|
| 808 | local long_options := $(filter-out =delete=%,$(subst :, =delete=,$(subst =, =delete=,$3)))
|
---|
| 809 | local .RETURN := $(if-expr $(pos $1,$(short_options)) != 0 || "$(filter $2,$(long_options))" != "",$4,$5)
|
---|
| 810 | endef
|
---|
| 811 |
|
---|
[2434] | 812 | ##
|
---|
| 813 | # Make an assignment to a deprecated variable.
|
---|
| 814 | #
|
---|
| 815 | # @param $1 The variable name.
|
---|
| 816 | # @param $2 The value.
|
---|
| 817 | # @param $3 The variable to use instead.
|
---|
| 818 | #
|
---|
| 819 | ifdef KBUILD_WITH_DEPREATED_AS_ERROR
|
---|
[2441] | 820 | KB_FN_ASSIGN_DEPRECATED = $(eval $(subst :,$$(COLON),$1) = $2$$(error $1 is deprecated, use $3 instead))
|
---|
[2434] | 821 | else
|
---|
[2441] | 822 | KB_FN_ASSIGN_DEPRECATED = $(eval $(subst :,$$(COLON),$1) = $2$$(warning $1 is deprecated, use $3 instead))
|
---|
[2434] | 823 | endif
|
---|
[2223] | 824 |
|
---|
| 825 |
|
---|
| 826 | #
|
---|
[353] | 827 | # Initialize some of the globals which the Config.kmk and
|
---|
| 828 | # others can add stuff to if they like for processing in the footer.
|
---|
| 829 | #
|
---|
| 830 |
|
---|
[1416] | 831 | ## KBUILD_TEMPLATE_PATHS
|
---|
[353] | 832 | # List a paths (separated by space) where templates can be found.
|
---|
[1416] | 833 | KBUILD_TEMPLATE_PATHS :=
|
---|
[353] | 834 |
|
---|
[1416] | 835 | ## KBUILD_TOOL_PATHS
|
---|
[353] | 836 | # List of paths (separated by space) where tools can be found.
|
---|
[1416] | 837 | KBUILD_TOOL_PATHS :=
|
---|
[353] | 838 |
|
---|
[1416] | 839 | ## KBUILD_SDK_PATHS
|
---|
[353] | 840 | # List of paths (separated by space) where SDKs can be found.
|
---|
[1416] | 841 | KBUILD_SDK_PATHS :=
|
---|
[353] | 842 |
|
---|
[1621] | 843 | ## KBUILD_UNIT_PATHS
|
---|
| 844 | # List of paths (separated by space) where units (USES) can be found.
|
---|
| 845 | KBUILD_UNIT_PATHS :=
|
---|
| 846 |
|
---|
[1416] | 847 | ## KBUILD_DEFAULT_PATHS
|
---|
| 848 | # List of paths (separated by space) to search for stuff as a last resort.
|
---|
| 849 | KBUILD_DEFAULT_PATHS :=
|
---|
| 850 |
|
---|
[353] | 851 | ## Proritized list of the default makefile when walking subdirectories.
|
---|
| 852 | # The user can overload this list.
|
---|
| 853 | DEFAULT_MAKEFILE := Makefile.kmk makefile.kmk Makefile makefile
|
---|
| 854 |
|
---|
[1424] | 855 | ## KBUILD_SRC_HANDLERS
|
---|
| 856 | # The list of source handlers, pair of extension and handler.
|
---|
| 857 | # The user can overload this list to provide additional or custom
|
---|
| 858 | # handlers. On a per-target/template see SRC_HANDLERS.
|
---|
| 859 | KBUILD_SRC_HANDLERS := \
|
---|
| 860 | .c:def_src_handler_c \
|
---|
| 861 | .C:def_src_handler_c \
|
---|
| 862 | .cxx:def_src_handler_cxx \
|
---|
| 863 | .CXX:def_src_handler_cxx \
|
---|
| 864 | .cpp:def_src_handler_cxx \
|
---|
| 865 | .CPP:def_src_handler_cxx \
|
---|
| 866 | .cc:def_src_handler_cxx \
|
---|
| 867 | .CC:def_src_handler_cxx \
|
---|
| 868 | .m:def_src_handler_objc \
|
---|
[2356] | 869 | .M:def_src_handler_objcxx \
|
---|
| 870 | .mm:def_src_handler_objcxx \
|
---|
[1424] | 871 | .asm:def_src_handler_asm \
|
---|
| 872 | .ASM:def_src_handler_asm \
|
---|
| 873 | .s:def_src_handler_asm \
|
---|
| 874 | .S:def_src_handler_asm \
|
---|
| 875 | .rc:def_src_handler_rc \
|
---|
| 876 | .obj:def_src_handler_obj \
|
---|
| 877 | .o:def_src_handler_obj \
|
---|
[1435] | 878 | .res:def_src_handler_obj
|
---|
[980] | 879 |
|
---|
[640] | 880 | ## PROPS_TOOLS
|
---|
[985] | 881 | # This is a subset of PROPS_SINGLE.
|
---|
[2356] | 882 | PROPS_TOOLS := TOOL CTOOL CXXTOOL OBJCTOOL OBJCXXTOOL ASTOOL RCTOOL ARTOOL LDTOOL FETCHTOOL UNPACKTOOL PATCHTOOL
|
---|
[640] | 883 |
|
---|
[353] | 884 | ## PROPS_SINGLE
|
---|
| 885 | # The list of non-accumulative target properties.
|
---|
| 886 | # A Config.kmk file can add it's own properties to this list and kBuild
|
---|
[1400] | 887 | # will do the necessary inheritance for templates, sdks, tools and targets.
|
---|
[2475] | 888 | PROPS_SINGLE := $(PROPS_TOOLS) TEMPLATE INSTTYPE INST STAGE NOINST BLD_TYPE BLD_TRG BLD_TRG_ARCH BLD_TRG_CPU FETCHDIR \
|
---|
[2356] | 889 | OBJSUFF COBJSUFF CXXOBJSUFF OBJCOBJSUFF OBJCXXOBJSUFF ASOBJSUFF RCOBJSUFF SYSSUFF BINSUFF EXESUFF DLLSUFF LIBSUFF ARLIBSUFF \
|
---|
[2225] | 890 | MODE UID GID
|
---|
[985] | 891 | ## PROPS_SINGLE_LNK
|
---|
| 892 | # Subset of PROPS_SINGLE which applies to all linkable targets.
|
---|
[2356] | 893 | PROPS_SINGLE_LNK := TOOL TEMPLATE CTOOL CXXTOOL OBJCTOOL OBJCXXTOOL ASTOOL RCTOOL \
|
---|
[1621] | 894 | INST NOINST BLD_TYPE BLD_TRG BLD_TRG_ARCH BLD_TRG_CPU \
|
---|
[2356] | 895 | OBJSUFF COBJSUFF CXXOBJSUFF OBJCOBJSUFF OBJCXXOBJSUFF ASOBJSUFF RCOBJSUFF \
|
---|
[2225] | 896 | MODE UID GID
|
---|
[353] | 897 |
|
---|
| 898 | ## PROPS_DEFERRED
|
---|
[889] | 899 | # This list of non-accumulative target properties which are or may be
|
---|
| 900 | # functions, and thus should not be expanded until the very last moment.
|
---|
[2475] | 901 | PROPS_DEFERRED := INSTFUN INSTALLER PRE_CMDS POST_CMDS PRE_INST_CMDS POST_INST_CMDS NAME SONAME
|
---|
[353] | 902 |
|
---|
[660] | 903 | ## PROPS_ACCUMULATE_R
|
---|
[748] | 904 | # The list of accumulative target properties where the right most value/flag
|
---|
[660] | 905 | # is the 'most significant'.
|
---|
[353] | 906 | # A Config.kmk file can add it's own properties to this list and kBuild
|
---|
| 907 | # will do the necessary inheritance from templates to targets.
|
---|
[660] | 908 | PROPS_ACCUMULATE_R := \
|
---|
[1702] | 909 | DEPS LNK_DEPS ORDERDEPS LNK_ORDERDEPS DEFS \
|
---|
[985] | 910 | ARFLAGS \
|
---|
[660] | 911 | CFLAGS CDEFS \
|
---|
| 912 | CXXFLAGS CXXDEFS \
|
---|
[1256] | 913 | OBJCFLAGS OBJCDEFS \
|
---|
[2356] | 914 | OBJCXXFLAGS OBJCXXDEFS \
|
---|
[660] | 915 | ASFLAGS ASDEFS \
|
---|
| 916 | RCFLAGS RCDEFS \
|
---|
| 917 | LDFLAGS \
|
---|
[2483] | 918 | IDFLAGS IFFLAGS EXEC_IFFLAGS ISFLAGS \
|
---|
[640] | 919 | FETCHFLAGS UNPACKFLAGS PATCHFLAGS
|
---|
[985] | 920 | ## PROPS_ACCUMULATE_R_LNK
|
---|
| 921 | # Subset of PROPS_ACCUMULATE_R which applies to all linkable targets.
|
---|
| 922 | PROPS_ACCUMULATE_R_LNK := \
|
---|
[1702] | 923 | DEPS LNK_DEPS ORDERDEPS LNK_ORDERDEPS DEFS \
|
---|
[985] | 924 | CFLAGS CDEFS \
|
---|
| 925 | CXXFLAGS CXXDEFS \
|
---|
[1256] | 926 | OBJCFLAGS OBJCDEFS \
|
---|
[2356] | 927 | OBJCXXFLAGS OBJCXXDEFS \
|
---|
[985] | 928 | ASFLAGS ASDEFS \
|
---|
| 929 | RCFLAGS RCDEFS \
|
---|
[2483] | 930 | IDFLAGS IFFLAGS ISFLAGS
|
---|
[353] | 931 |
|
---|
[660] | 932 | ## PROPS_ACCUMULATE
|
---|
[748] | 933 | # The list of accumulative target properties where the left most value/flag
|
---|
[660] | 934 | # is the 'most significant'.
|
---|
| 935 | # A Config.kmk file can add it's own properties to this list and kBuild
|
---|
| 936 | # will do the necessary inheritance from templates to targets.
|
---|
| 937 | PROPS_ACCUMULATE_L := \
|
---|
[2483] | 938 | SDKS USES SOURCES EXEC_SOURCES SRC_HANDLERS INTERMEDIATES \
|
---|
[2356] | 939 | INCS CINCS CXXINCS OBJCINCS OBJCXXINCS ASINCS RCINCS \
|
---|
[897] | 940 | LIBS LIBPATH \
|
---|
[985] | 941 | DIRS BLDDIRS CLEAN
|
---|
| 942 | ## PROPS_ACCUMULATE_L_LNK
|
---|
| 943 | # Subset of PROPS_ACCUMULATE_L which applies to all linkable targets.
|
---|
| 944 | PROPS_ACCUMULATE_L_LNK := \
|
---|
[2344] | 945 | SDKS USES SOURCES SRC_HANDLERS INTERMEDIATES \
|
---|
[2356] | 946 | INCS CINCS CXXINCS OBJCINCS OBJCXXINCS ASINCS RCINCS \
|
---|
[985] | 947 | BLDDIRS CLEAN
|
---|
[353] | 948 |
|
---|
[662] | 949 | ## PROPS_ALL
|
---|
| 950 | # List of all the properties.
|
---|
| 951 | PROPS_ALL = $(PROPS_SINGLE) $(PROPS_DEFERRED) $(PROPS_ACCUMULATE_L) $(PROPS_ACCUMULATE_R)
|
---|
[660] | 952 |
|
---|
[985] | 953 | ## @name Properties valid on programs (BLDPROGS and PROGRAMS)
|
---|
| 954 | ## @{
|
---|
| 955 | PROPS_PROGRAMS_SINGLE := $(PROPS_SINGLE_LNK) LDTOOL EXESUFF
|
---|
| 956 | PROPS_PROGRAMS_DEFERRED := $(PROPS_DEFERRED)
|
---|
| 957 | PROPS_PROGRAMS_ACCUMULATE_R := $(PROPS_ACCUMULATE_R_LNK) LDFLAGS
|
---|
| 958 | PROPS_PROGRAMS_ACCUMULATE_L := $(PROPS_ACCUMULATE_L_LNK) LIBS LIBPATH
|
---|
| 959 | ## @}
|
---|
| 960 |
|
---|
| 961 | ## @name Properties valid on libraries (LIBRARIES and IMPORT_LIBS)
|
---|
| 962 | ## @{
|
---|
[989] | 963 | PROPS_LIBRARIES_SINGLE := $(PROPS_SINGLE_LNK) ARTOOL LIBSUFF ARLIBSUFF LIBSUFF
|
---|
[985] | 964 | PROPS_LIBRARIES_DEFERRED := $(filter-out SONAME,$(PROPS_DEFERRED))
|
---|
| 965 | PROPS_LIBRARIES_ACCUMULATE_R := $(PROPS_ACCUMULATE_R_LNK) ARFLAGS
|
---|
| 966 | PROPS_LIBRARIES_ACCUMULATE_L := $(PROPS_ACCUMULATE_L_LNK)
|
---|
| 967 | ## @}
|
---|
| 968 |
|
---|
| 969 | ## @name Properties valid on dlls (DLLS)
|
---|
| 970 | ## @{
|
---|
| 971 | PROPS_DLLS_SINGLE := $(PROPS_SINGLE_LNK) LDTOOL DLLSUFF LIBSUFF
|
---|
| 972 | PROPS_DLLS_DEFERRED := $(PROPS_DEFERRED)
|
---|
| 973 | PROPS_DLLS_ACCUMULATE_R := $(PROPS_ACCUMULATE_R_LNK) LDFLAGS
|
---|
| 974 | PROPS_DLLS_ACCUMULATE_L := $(PROPS_ACCUMULATE_L_LNK) LIBS LIBPATH
|
---|
| 975 | ## @}
|
---|
| 976 |
|
---|
[989] | 977 | ## @name Properties valid on system modules (SYSMODS)
|
---|
| 978 | ## @{
|
---|
| 979 | PROPS_SYSMODS_SINGLE := $(PROPS_SINGLE_LNK) LDTOOL SYSSUFF
|
---|
| 980 | PROPS_SYSMODS_DEFERRED := $(PROPS_DEFERRED)
|
---|
| 981 | PROPS_SYSMODS_ACCUMULATE_R := $(PROPS_ACCUMULATE_R_LNK) LDFLAGS
|
---|
| 982 | PROPS_SYSMODS_ACCUMULATE_L := $(PROPS_ACCUMULATE_L_LNK) LIBS LIBPATH
|
---|
| 983 | ## @}
|
---|
| 984 |
|
---|
[2084] | 985 | ## @name Properties valid on misc binaries (MISCBINS)
|
---|
| 986 | ## @{
|
---|
| 987 | PROPS_MISCBINS_SINGLE := $(PROPS_SINGLE_LNK) LDTOOL BINSUFF
|
---|
| 988 | PROPS_MISCBINS_DEFERRED := $(PROPS_DEFERRED)
|
---|
| 989 | PROPS_MISCBINS_ACCUMULATE_R := $(PROPS_ACCUMULATE_R_LNK) LDFLAGS
|
---|
| 990 | PROPS_MISCBINS_ACCUMULATE_L := $(PROPS_ACCUMULATE_L_LNK) LIBS LIBPATH
|
---|
| 991 | ## @}
|
---|
| 992 |
|
---|
[985] | 993 | ## @name Properties valid on installs (INSTALLS)
|
---|
| 994 | ## @{
|
---|
[2483] | 995 | PROPS_INSTALLS_SINGLE := TOOL TEMPLATE INST NOINST BLD_TYPE BLD_TRG BLD_TRG_ARCH BLD_TRG_CPU MODE UID GID
|
---|
[985] | 996 | PROPS_INSTALLS_DEFERRED := INSTFUN INSTALLER
|
---|
[2483] | 997 | PROPS_INSTALLS_ACCUMULATE_R := DEPS ORDERDEPS GOALS INST_ONLY_GOALS STAGE_ONLY_GOALS IFFLAGS EXEC_IFFLAGS
|
---|
| 998 | PROPS_INSTALLS_ACCUMULATE_L := SOURCES EXEC_SOURCES DIRS CLEAN
|
---|
[985] | 999 | ## @}
|
---|
| 1000 |
|
---|
[2475] | 1001 | ## @name Properties valid on fetches (FETCHES)
|
---|
[985] | 1002 | ## @{
|
---|
[1400] | 1003 | PROPS_FETCHES_SINGLE := TOOL TEMPLATE FETCHTOOL UNPACKTOOL PATCHTOOL INST FETCHDIR
|
---|
[985] | 1004 | PROPS_FETCHES_DEFERRED :=
|
---|
| 1005 | PROPS_FETCHES_ACCUMULATE_R := FETCHFLAGS UNPACKFLAGS PATCHFLAGS
|
---|
[1613] | 1006 | PROPS_FETCHES_ACCUMULATE_L := SOURCES CLEAN
|
---|
[985] | 1007 | ## @}
|
---|
| 1008 |
|
---|
[2274] | 1009 | ## KBUILD_COMPILE_CATEGTORIES
|
---|
| 1010 | # Tools categories for compiling.
|
---|
| 1011 | KBUILD_COMPILE_CATEGTORIES := AS C CXX OBJC OBJCXX RC
|
---|
[985] | 1012 |
|
---|
[2274] | 1013 | ## KBUILD_GENERIC_CATEGORIES
|
---|
| 1014 | # Generic tool categories.
|
---|
| 1015 | KBUILD_GENERIC_CATEGORIES := FETCH UNPACK PATCH $(addprefix LINK_,LIBRARY PROGRAM DLL SYSMOD MISCBIN)
|
---|
| 1016 |
|
---|
| 1017 | ## PROPS_TOOLS_ONLY
|
---|
| 1018 | # Properties found only on tools.
|
---|
| 1019 | # This is expanded in a deferred manner, so it will pick up changes made to
|
---|
| 1020 | # KBUILD_COMPILE_CATEGTORIES and KBUILD_GENERIC_CATEGORIES made by units.
|
---|
| 1021 | PROPS_TOOLS_ONLY = \
|
---|
| 1022 | $(foreach cat, $(KBUILD_COMPILE_CATEGTORIES), \
|
---|
| 1023 | COMPILE_$(cat)_CMDS \
|
---|
| 1024 | COMPILE_$(cat)_OUTPUT \
|
---|
| 1025 | COMPILE_$(cat)_OUTPUT_MAYBE \
|
---|
| 1026 | COMPILE_$(cat)_DEPEND \
|
---|
| 1027 | COMPILE_$(cat)_DEPORD \
|
---|
| 1028 | COMPILE_$(cat)_USES_KOBJCACHE ) \
|
---|
| 1029 | $(foreach cat, $(KBUILD_GENERIC_CATEGORIES), \
|
---|
| 1030 | $(cat)_CMDS \
|
---|
| 1031 | $(cat)_OUTPUT \
|
---|
| 1032 | $(cat)_OUTPUT_MAYBE \
|
---|
| 1033 | $(cat)_DEPEND \
|
---|
| 1034 | $(cat)_DEPORD ))
|
---|
| 1035 |
|
---|
| 1036 |
|
---|
[353] | 1037 | #
|
---|
[748] | 1038 | # Here is a special 'hack' to prevent innocent environment variables being
|
---|
| 1039 | # picked up and treated as properties. (The most annoying example of why
|
---|
[662] | 1040 | # this is necessary is the Visual C++ commandline with it's LIBPATH.)
|
---|
| 1041 | #
|
---|
[748] | 1042 | # Define KBUILD_DONT_KILL_ENV_PROPS in the env. or on the commandline to
|
---|
[662] | 1043 | # disable this 'hack'.
|
---|
| 1044 | #
|
---|
| 1045 | ifndef KBUILD_DONT_KILL_ENV_PROPS
|
---|
| 1046 |
|
---|
| 1047 | define def_nuke_environment_prop
|
---|
| 1048 | ifeq ($(origin $(prop)),environment)
|
---|
| 1049 | $(prop) =
|
---|
| 1050 | endif
|
---|
| 1051 | endef
|
---|
[762] | 1052 | $(foreach prop, $(PROPS_ALL) \
|
---|
[2084] | 1053 | FETCHES PATCHES BLDPROGS LIBRARIES IMPORT_LIBS DLLS PROGRAMS SYSMODS MISCBINS INSTALLS OTHERS \
|
---|
[897] | 1054 | SUBDIRS MAKEFILES BLDDIRS \
|
---|
[762] | 1055 | ,$(eval $(value def_nuke_environment_prop)))
|
---|
[662] | 1056 |
|
---|
[897] | 1057 | endif # KBUILD_DONT_KILL_ENV_PROPS
|
---|
[662] | 1058 |
|
---|
| 1059 |
|
---|
| 1060 | #
|
---|
[353] | 1061 | # Pass configuration.
|
---|
| 1062 | #
|
---|
| 1063 | # The PASS_<passname>_trgs variable is listing the targets.
|
---|
| 1064 | # The PASS_<passname>_vars variable is listing the target variables.
|
---|
| 1065 | # The PASS_<passname>_pass variable is the lowercased passname.
|
---|
| 1066 | #
|
---|
| 1067 |
|
---|
[640] | 1068 | ## PASS: fetches
|
---|
| 1069 | # This pass fetches and unpacks things needed to complete the build.
|
---|
| 1070 | PASS_FETCHES := Fetches
|
---|
| 1071 | PASS_FETCHES_trgs :=
|
---|
| 1072 | PASS_FETCHES_vars := _FETCHES
|
---|
| 1073 | PASS_FETCHES_pass := fetches
|
---|
| 1074 |
|
---|
| 1075 | ## PASS: patches
|
---|
| 1076 | # This pass applies patches.
|
---|
| 1077 | PASS_PATCHES := Patches
|
---|
| 1078 | PASS_PATCHES_trgs :=
|
---|
| 1079 | PASS_PATCHES_vars := _PATCHES
|
---|
| 1080 | PASS_PATCHES_pass := patches
|
---|
| 1081 |
|
---|
[353] | 1082 | ## PASS: bldprogs
|
---|
| 1083 | # This pass builds targets which are required for building the rest.
|
---|
| 1084 | PASS_BLDPROGS := Build Programs
|
---|
| 1085 | PASS_BLDPROGS_trgs :=
|
---|
| 1086 | PASS_BLDPROGS_vars := _BLDPROGS
|
---|
| 1087 | PASS_BLDPROGS_pass := bldprogs
|
---|
| 1088 |
|
---|
| 1089 | ## PASS: libraries
|
---|
| 1090 | # This pass builds library targets.
|
---|
| 1091 | PASS_LIBRARIES := Libraries
|
---|
| 1092 | PASS_LIBRARIES_trgs :=
|
---|
| 1093 | PASS_LIBRARIES_vars := _LIBS _IMPORT_LIBS _OTHER_LIBRARIES
|
---|
| 1094 | PASS_LIBRARIES_pass := libraries
|
---|
| 1095 |
|
---|
| 1096 | ## PASS: binaries
|
---|
| 1097 | # This pass builds dll targets.
|
---|
| 1098 | PASS_DLLS := DLLs
|
---|
| 1099 | PASS_DLLS_trgs :=
|
---|
| 1100 | PASS_DLLS_vars := _DLLS _OTHER_DLLS
|
---|
| 1101 | PASS_DLLS_pass := dlls
|
---|
| 1102 |
|
---|
| 1103 | ## PASS: binaries
|
---|
| 1104 | # This pass builds binary targets, i.e. programs, system modules and stuff.
|
---|
| 1105 | PASS_BINARIES := Programs
|
---|
| 1106 | PASS_BINARIES_trgs :=
|
---|
[2084] | 1107 | PASS_BINARIES_vars := _PROGRAMS _SYSMODS _MISC_BINS _OTHER_BINARIES
|
---|
[353] | 1108 | PASS_BINARIES_pass := binaries
|
---|
| 1109 |
|
---|
| 1110 | ## PASS: others
|
---|
| 1111 | # This pass builds other targets.
|
---|
| 1112 | PASS_OTHERS := Other Stuff
|
---|
| 1113 | PASS_OTHERS_trgs :=
|
---|
| 1114 | PASS_OTHERS_vars := _OTHERS
|
---|
| 1115 | PASS_OTHERS_pass := others
|
---|
| 1116 |
|
---|
[2475] | 1117 | ## PASS: staging
|
---|
[353] | 1118 | # This pass installs the built entities to a sandbox area.
|
---|
[1646] | 1119 | ## @todo split this up into build install (to sandbox) and real installation.
|
---|
[2475] | 1120 | PASS_STAGING := Staging
|
---|
| 1121 | PASS_STAGING_trgs :=
|
---|
| 1122 | PASS_STAGING_vars := _STAGING_DIRS _INSTALLS _STAGING_FILES
|
---|
| 1123 | PASS_STAGING_pass := staging
|
---|
| 1124 |
|
---|
| 1125 | ## PASS: install
|
---|
| 1126 | # This pass installs the built entities to where they will be used (using
|
---|
| 1127 | # DESTROOT or PATH_INS to indicate where this is).
|
---|
[353] | 1128 | PASS_INSTALLS := Install
|
---|
| 1129 | PASS_INSTALLS_trgs :=
|
---|
[2475] | 1130 | PASS_INSTALLS_vars := _INSTALLS_DIRS _INSTALLS_FILES
|
---|
[353] | 1131 | PASS_INSTALLS_pass := installs
|
---|
| 1132 |
|
---|
[1646] | 1133 | ## PASS: testing
|
---|
| 1134 | # This pass processes custom rules for executing tests.
|
---|
| 1135 | PASS_TESTING := Tests
|
---|
| 1136 | PASS_TESTING_trgs :=
|
---|
| 1137 | PASS_TESTING_vars := _TESTING
|
---|
| 1138 | PASS_TESTING_pass := testing
|
---|
| 1139 |
|
---|
[353] | 1140 | ## PASS: packing
|
---|
| 1141 | # This pass processes custom packing rules.
|
---|
| 1142 | PASS_PACKING := Packing
|
---|
[414] | 1143 | PASS_PACKING_trgs :=
|
---|
[417] | 1144 | PASS_PACKING_vars := _PACKING
|
---|
[353] | 1145 | PASS_PACKING_pass := packing
|
---|
| 1146 |
|
---|
| 1147 | ## PASS: clean
|
---|
| 1148 | # This pass removes all generated files.
|
---|
| 1149 | PASS_CLEAN := Clean
|
---|
| 1150 | PASS_CLEAN_trgs := do-clean
|
---|
| 1151 | PASS_CLEAN_vars :=
|
---|
| 1152 | PASS_CLEAN_pass := clean
|
---|
| 1153 |
|
---|
| 1154 | ## PASS: nothing
|
---|
| 1155 | # This pass just walks the tree.
|
---|
| 1156 | PASS_NOTHING := Nothing
|
---|
| 1157 | PASS_NOTHING_trgs := do-nothing
|
---|
| 1158 | PASS_NOTHING_vars :=
|
---|
| 1159 | PASS_NOTHING_pass := nothing
|
---|
| 1160 |
|
---|
| 1161 | ## DEFAULT_PASSES
|
---|
| 1162 | # The default passes and their order.
|
---|
[2475] | 1163 | DEFAULT_PASSES := BLDPROGS LIBRARIES DLLS BINARIES OTHERS STAGING
|
---|
[353] | 1164 |
|
---|
| 1165 | ## PASSES
|
---|
| 1166 | # The passes that should be defined. This must include
|
---|
| 1167 | # all passes mentioned by DEFAULT_PASSES.
|
---|
[2475] | 1168 | PASSES := FETCHES PATCHES $(DEFAULT_PASSES) INSTALLS TESTING PACKING CLEAN NOTHING
|
---|
[353] | 1169 |
|
---|
| 1170 |
|
---|
| 1171 | #
|
---|
[984] | 1172 | # Check for --pretty-command-printing before including the Config.kmk
|
---|
| 1173 | # so that anyone overriding the message macros can take the implied
|
---|
| 1174 | # verbosity level change into account.
|
---|
| 1175 | #
|
---|
| 1176 | ifndef KBUILD_VERBOSE
|
---|
| 1177 | ifndef KBUILD_QUIET
|
---|
[1562] | 1178 | ifeq ($(KMK_OPTS_PRETTY_COMMAND_PRINTING),1)
|
---|
[984] | 1179 | export KBUILD_VERBOSE := 2
|
---|
| 1180 | endif
|
---|
| 1181 | endif
|
---|
| 1182 | endif
|
---|
| 1183 |
|
---|
| 1184 |
|
---|
| 1185 | #
|
---|
[1418] | 1186 | # Legacy variable translation.
|
---|
| 1187 | # These will be eliminated when switching to the next version.
|
---|
| 1188 | #
|
---|
| 1189 | ifdef USE_KOBJCACHE
|
---|
| 1190 | ifndef KBUILD_USE_KOBJCACHE
|
---|
| 1191 | export KBUILD_USE_KOBJCACHE := $(USE_KOBJCACHE)
|
---|
| 1192 | endif
|
---|
| 1193 | endif
|
---|
| 1194 |
|
---|
| 1195 |
|
---|
| 1196 | #
|
---|
[69] | 1197 | # This is how we find the closest config.kmk.
|
---|
| 1198 | # It's a little hacky but I think it works fine.
|
---|
[70] | 1199 | #
|
---|
| 1200 | _CFGDIR := .
|
---|
[78] | 1201 | _CFGFILES := ./Config.kmk ./config.kmk
|
---|
[69] | 1202 | define def_include_config
|
---|
[78] | 1203 | $(eval _CFGDIR := $(_CFGDIR)/$(dir))
|
---|
| 1204 | _CFGFILES += $(_CFGDIR)/Config.kmk $(_CFGDIR)/config.kmk
|
---|
[69] | 1205 | endef
|
---|
| 1206 | # walk down the _RELATIVE_ path specified by DEPTH.
|
---|
[78] | 1207 | $(foreach dir,$(subst /, ,$(DEPTH)), $(eval $(def_include_config)) )
|
---|
[69] | 1208 | # add the default config file.
|
---|
[78] | 1209 | _CFGFILE := $(firstword $(wildcard $(_CFGFILES) $(FILE_KBUILD_CONFIG)))
|
---|
[69] | 1210 | _CFGFILES :=
|
---|
| 1211 | _CFGDIR :=
|
---|
[416] | 1212 | ifeq ($(_CFGFILE),)
|
---|
| 1213 | $(error kBuild: no Config.kmk file found! Check the DEPTH: DEPTH='$(DEPTH)' PATH_CURRENT='$(PATH_CURRENT)')
|
---|
| 1214 | endif
|
---|
[69] | 1215 |
|
---|
| 1216 | # Include the config.kmk we found file (or the default one).
|
---|
[988] | 1217 | ifdef KBUILD_PROFILE_SELF
|
---|
[2008] | 1218 | $(evalcall def_profile_self, including $(_CFGFILE))
|
---|
[988] | 1219 | include $(_CFGFILE)
|
---|
[2008] | 1220 | $(evalcall def_profile_self, included $(_CFGFILE))
|
---|
[988] | 1221 | else
|
---|
| 1222 | include $(_CFGFILE)
|
---|
| 1223 | endif
|
---|
| 1224 |
|
---|
| 1225 |
|
---|
| 1226 |
|
---|
[696] | 1227 | #
|
---|
[874] | 1228 | # Finalize a the central path variables now that we've included the Config.kmk file.
|
---|
| 1229 | #
|
---|
| 1230 | # This prevents some trouble when users override the defaults for these
|
---|
| 1231 | # variables and uses relative paths or paths with incorrect case.
|
---|
| 1232 | #
|
---|
[1692] | 1233 | PATH_OUT_BASE := $(abspath $(PATH_OUT_BASE))
|
---|
[2475] | 1234 | PATH_OUT := $(abspath $(PATH_OUT))
|
---|
| 1235 | PATH_OBJ := $(abspath $(PATH_OBJ))
|
---|
| 1236 | PATH_TARGET := $(abspath $(PATH_TARGET))
|
---|
| 1237 | PATH_INS := $(abspath $(PATH_INS))
|
---|
| 1238 | PATH_STAGE := $(abspath $(PATH_STAGE))
|
---|
[874] | 1239 |
|
---|
[2475] | 1240 | # Finalize the install and staging directory layouts.
|
---|
| 1241 | define def_kbuild_finalize_inst
|
---|
| 1242 | local val := $(strip $($(y)_$(x)))
|
---|
| 1243 | ifeq ($(val),)
|
---|
| 1244 | $(error kBuild: '$(y)_$(x)' is set to an empty value.)
|
---|
| 1245 | endif
|
---|
| 1246 | ifneq ($(words $(val)),1)
|
---|
| 1247 | $(error kBuild: The '$(y)_$(x)' value '$(val)' should not contain spaces.)
|
---|
| 1248 | endif
|
---|
| 1249 | ifneq ($(pos \,$(val)), 0)
|
---|
| 1250 | $(error kBuild: The '$(y)_$(x)' value '$(val)' contains DOS slashes: not allowed.)
|
---|
| 1251 | endif
|
---|
| 1252 | ifneq ($(pos $(COLON),$(val)), 0)
|
---|
| 1253 | $(error kBuild: The '$(y)_$(x)' value '$(val)' contains colon: not allowed.)
|
---|
| 1254 | endif
|
---|
| 1255 | ifneq ($(substr $(val),-1), /)
|
---|
| 1256 | $(error kBuild: The '$(y)_$(x)' value '$(val)' has no trailing slash.)
|
---|
| 1257 | endif
|
---|
| 1258 | if $(pos /../,$(val)) != 0 || "$(substr $(val), 3)" == "../"
|
---|
| 1259 | $(error kBuild: The '$(y)_$(x)' value '$(val)' contains dot-dot escape.)
|
---|
| 1260 | endif
|
---|
| 1261 | $($(y)_$(x) := $(val)
|
---|
[2479] | 1262 |
|
---|
| 1263 | local val := $(strip $(PATH_$(y)_$(x)))
|
---|
| 1264 | ifeq ($(val),)
|
---|
| 1265 | $(error kBuild: 'PATH_$(y)_$(x)' is set to an empty value.)
|
---|
| 1266 | endif
|
---|
| 1267 | PATH_$(y)_$(x) := $(val)
|
---|
[2475] | 1268 | endef
|
---|
[2479] | 1269 | $(foreach y, INST STAGE, $(foreach x, $(KBUILD_INST_PATHS), $(evalcall def_kbuild_finalize_inst)))
|
---|
[874] | 1270 |
|
---|
[2475] | 1271 |
|
---|
[874] | 1272 | #
|
---|
[788] | 1273 | # Setup the message style. The default one is inlined.
|
---|
[776] | 1274 | #
|
---|
[788] | 1275 | # See kBuild/msgstyles for more styles or use KBUILD_MSG_STYLE_PATHS
|
---|
| 1276 | # to create your own message style.
|
---|
| 1277 | #
|
---|
[776] | 1278 | KBUILD_MSG_STYLE ?= default
|
---|
| 1279 | ifeq ($(KBUILD_MSG_STYLE),default)
|
---|
| 1280 | #
|
---|
| 1281 | # The 'default' style.
|
---|
| 1282 | #
|
---|
| 1283 |
|
---|
| 1284 | ## Fetch starting.
|
---|
| 1285 | # @param 1 Target name.
|
---|
| 1286 | MSG_FETCH ?= $(call MSG_L1,Fetching $1...)
|
---|
| 1287 | ## Re-fetch starting.
|
---|
| 1288 | # @param 1 Target name.
|
---|
| 1289 | MSG_REFETCH ?= $(call MSG_L1,Re-fetching $1...)
|
---|
| 1290 | ## Downloading a fetch component.
|
---|
| 1291 | # @param 1 Target name.
|
---|
| 1292 | # @param 2 The source URL.
|
---|
| 1293 | # @param 3 The destination file name.
|
---|
| 1294 | MSG_FETCH_DL ?= $(call MSG_L1,Downloading $1 - $2,=> $3)
|
---|
| 1295 | ## Checking a fetch component.
|
---|
| 1296 | # @param 1 Target name.
|
---|
| 1297 | # @param 2 The source URL.
|
---|
| 1298 | # @param 3 The destination file name.
|
---|
| 1299 | MSG_FETCH_CHK?= $(call MSG_L1,Checking $1 - $3, ($2))
|
---|
| 1300 | ## Unpacking a fetch component.
|
---|
| 1301 | # @param 1 Target name.
|
---|
| 1302 | # @param 2 The archive file name.
|
---|
| 1303 | # @param 3 The target directory.
|
---|
| 1304 | MSG_FETCH_UP ?= $(call MSG_L1,Unpacking $1 - $2 => $3)
|
---|
| 1305 | ## Fetch completed.
|
---|
| 1306 | # @param 1 Target name.
|
---|
| 1307 | MSG_FETCH_OK ?= $(call MSG_L1,Successfully fetched $1)
|
---|
| 1308 | ## Unfetch a fetch target.
|
---|
| 1309 | # @param 1 Target name.
|
---|
| 1310 | MSG_UNFETCH ?= $(call MSG_L1,Unfetching $1...)
|
---|
| 1311 | ## Compiling a source file.
|
---|
| 1312 | # @param 1 Target name.
|
---|
| 1313 | # @param 2 The source filename.
|
---|
| 1314 | # @param 3 The primary link output file name.
|
---|
[1256] | 1315 | # @param 4 The source type (C,CXX,OBJC,AS,RC,++).
|
---|
[776] | 1316 | MSG_COMPILE ?= $(call MSG_L1,Compiling $1 - $2,=> $3)
|
---|
[890] | 1317 | ## Tool
|
---|
| 1318 | # @param 1 The tool name (bin2c,...)
|
---|
| 1319 | # @param 2 Target name.
|
---|
| 1320 | # @param 3 The source filename.
|
---|
| 1321 | # @param 4 The primary output file name.
|
---|
| 1322 | MSG_TOOL ?= $(call MSG_L1,$1 $2 - $3,=> $4)
|
---|
| 1323 | ## Generate a file, typically a source file.
|
---|
| 1324 | # @param 1 Target name if applicable.
|
---|
| 1325 | # @param 2 Output file name.
|
---|
| 1326 | # @param 3 What it's generated from
|
---|
| 1327 | MSG_GENERATE ?= $(call MSG_L1,Generating $(if $1,$1 - )$2,$(if $3,from $3))
|
---|
[776] | 1328 | ## Linking a bldprog/dll/program/sysmod target.
|
---|
| 1329 | # @param 1 Target name.
|
---|
| 1330 | # @param 2 The primary link output file name.
|
---|
| 1331 | # @param 3 The link tool operation (LINK_LIBRARY,LINK_PROGRAM,LINK_DLL,LINK_SYSMOD,++).
|
---|
| 1332 | MSG_LINK ?= $(call MSG_L1,Linking $1,=> $2)
|
---|
[844] | 1333 | ## Merging a library into the target (during library linking).
|
---|
| 1334 | # @param 1 Target name.
|
---|
| 1335 | # @param 2 The output library name.
|
---|
| 1336 | # @param 3 The input library name.
|
---|
[845] | 1337 | MSG_AR_MERGE ?= $(call MSG_L1,Merging $3 into $1, ($2))
|
---|
[776] | 1338 | ## Creating a directory (build).
|
---|
| 1339 | # @param 1 Directory name.
|
---|
| 1340 | MSG_MKDIR ?= $(call MSG_L2,Creating directory $1)
|
---|
| 1341 | ## Cleaning.
|
---|
| 1342 | MSG_CLEAN ?= $(call MSG_L1,Cleaning...)
|
---|
| 1343 | ## Nothing.
|
---|
| 1344 | MSG_NOTHING ?= $(call MSG_L1,Did nothing in $(CURDIR))
|
---|
| 1345 | ## Pass
|
---|
| 1346 | # @param 1 The pass name.
|
---|
| 1347 | MSG_PASS ?= $(call MSG_L1,Pass - $1)
|
---|
| 1348 | ## Installing a bldprog/lib/dll/program/sysmod target.
|
---|
| 1349 | # @param 1 Target name.
|
---|
| 1350 | # @param 2 The source filename.
|
---|
| 1351 | # @param 3 The destination file name.
|
---|
| 1352 | MSG_INST_TRG ?= $(call MSG_L1,Installing $1 => $3)
|
---|
| 1353 | ## Installing a file (install target).
|
---|
| 1354 | # @param 1 The source filename.
|
---|
| 1355 | # @param 2 The destination filename.
|
---|
| 1356 | MSG_INST_FILE?= $(call MSG_L1,Installing $2,(<= $1))
|
---|
| 1357 | ## Installing a symlink.
|
---|
| 1358 | # @param 1 Symlink
|
---|
| 1359 | # @param 2 Link target
|
---|
| 1360 | MSG_INST_SYM ?= $(call MSG_L1,Installing symlink $1,=> $2)
|
---|
| 1361 | ## Installing a directory.
|
---|
| 1362 | # @param 1 Directory name.
|
---|
| 1363 | MSG_INST_DIR ?= $(call MSG_L1,Installing directory $1)
|
---|
| 1364 |
|
---|
[788] | 1365 | else
|
---|
[1504] | 1366 | _KBUILD_MSG_STYLE_FILE := $(firstword $(foreach path, $(KBUILD_MSG_STYLE_PATHS) $(KBUILD_PATH)/msgstyles, $(wildcard $(path)/$(KBUILD_MSG_STYLE).kmk)))
|
---|
[788] | 1367 | ifneq ($(_KBUILD_MSG_STYLE_FILE),)
|
---|
| 1368 | include $(_KBUILD_MSG_STYLE_FILE)
|
---|
[776] | 1369 | else
|
---|
[788] | 1370 | $(error kBuild: Can't find the style setup file for KBUILD_MSG_STYLE '$(KBUILD_MSG_STYLE)')
|
---|
[776] | 1371 | endif
|
---|
| 1372 | endif
|
---|
| 1373 |
|
---|
| 1374 |
|
---|
| 1375 | #
|
---|
[696] | 1376 | # Message macros.
|
---|
| 1377 | #
|
---|
[748] | 1378 | # This is done after including Config.kmk as to allow for
|
---|
[696] | 1379 | # KBUILD_QUIET and KBUILD_VERBOSE to be configurable.
|
---|
| 1380 | #
|
---|
| 1381 | ifdef KBUILD_QUIET
|
---|
[776] | 1382 | # No output
|
---|
[696] | 1383 | QUIET := @
|
---|
| 1384 | QUIET2:= @
|
---|
| 1385 | MSG_L1 =
|
---|
| 1386 | MSG_L2 =
|
---|
| 1387 | else
|
---|
| 1388 | ifndef KBUILD_VERBOSE
|
---|
[776] | 1389 | # Default output level.
|
---|
| 1390 | QUIET := @
|
---|
| 1391 | QUIET2 := @
|
---|
[1496] | 1392 | MSG_L1 ?= %@$(ECHO) "kBuild: $1"
|
---|
[776] | 1393 | MSG_L2 =
|
---|
| 1394 | else ifeq ($(KBUILD_VERBOSE),1)
|
---|
| 1395 | # A bit more output
|
---|
| 1396 | QUIET := @
|
---|
| 1397 | QUIET2 := @
|
---|
[1496] | 1398 | MSG_L1 ?= %@$(ECHO) "kBuild: $1 $2"
|
---|
[776] | 1399 | MSG_L2 =
|
---|
| 1400 | else ifeq ($(KBUILD_VERBOSE),2)
|
---|
| 1401 | # Lot more output
|
---|
| 1402 | QUIET :=
|
---|
| 1403 | QUIET2 := @
|
---|
[1496] | 1404 | MSG_L1 ?= %@$(ECHO) "kBuild: $1 $2"
|
---|
| 1405 | MSG_L2 ?= %@$(ECHO) "kBuild: $1"
|
---|
[696] | 1406 | else
|
---|
| 1407 | # maximal output.
|
---|
[776] | 1408 | QUIET :=
|
---|
| 1409 | QUIET2 :=
|
---|
[1496] | 1410 | MSG_L1 ?= %@$(ECHO) "kBuild: $1 $2"
|
---|
| 1411 | MSG_L2 ?= %@$(ECHO) "kBuild: $1"
|
---|
[696] | 1412 | endif
|
---|
| 1413 | endif
|
---|
| 1414 |
|
---|
[776] | 1415 |
|
---|
[1403] | 1416 | #
|
---|
[1504] | 1417 | # Validate any KBUILD_BLD_TYPES additions and finally the KBUILD_TYPE.
|
---|
[1403] | 1418 | #
|
---|
| 1419 | if1of ($(KBUILD_BLD_TYPES), $(KBUILD_OSES))
|
---|
| 1420 | $(error kBuild: found KBUILD_BLD_TYPES in KBUILD_OSES!)
|
---|
| 1421 | endif
|
---|
| 1422 | if1of ($(KBUILD_BLD_TYPES), $(KBUILD_ARCHES))
|
---|
| 1423 | $(error kBuild: found KBUILD_BLD_TYPES in KBUILD_ARCHES!)
|
---|
| 1424 | endif
|
---|
| 1425 | if1of ($(KBUILD_OSES), $(KBUILD_ARCHES))
|
---|
| 1426 | $(error kBuild: found KBUILD_OSES in KBUILD_ARCHES!)
|
---|
| 1427 | endif
|
---|
[1504] | 1428 | ifn1of ($(KBUILD_TYPE), $(KBUILD_BLD_TYPES))
|
---|
| 1429 | $(error kBuild: KBUILD_TYPE(=$(KBUILD_TYPE)) is not found in KBUILD_BLD_TYPES(=$(KBUILD_BLD_TYPES))!)
|
---|
[1403] | 1430 | endif
|
---|
| 1431 |
|
---|
| 1432 |
|
---|
| 1433 |
|
---|
[988] | 1434 | ifdef KBUILD_PROFILE_SELF
|
---|
[2008] | 1435 | $(evalcall def_profile_self, end of header.kmk)
|
---|
| 1436 | _KBUILD_TS_HEADER_END := $(_KBUILD_TS_PREV)
|
---|
[988] | 1437 | endif
|
---|
| 1438 |
|
---|
[69] | 1439 | # end-of-file-content
|
---|
[72] | 1440 | __header_kmk__ := 1
|
---|
[69] | 1441 | endif # __header_kmk__
|
---|
[479] | 1442 |
|
---|