[69] | 1 | # $Id: header.kmk 1504 2008-04-09 00:04:42Z bird $
|
---|
| 2 | ## @file
|
---|
| 3 | #
|
---|
[978] | 4 | # kBuild - File included at top of a makefile.
|
---|
[69] | 5 | #
|
---|
[1504] | 6 | # Copyright (c) 2004-2008 knut st. osmundsen <bird-kBuild-spam@anduin.net>
|
---|
[69] | 7 | #
|
---|
| 8 | #
|
---|
| 9 | # This file is part of kBuild.
|
---|
| 10 | #
|
---|
| 11 | # kBuild is free software; you can redistribute it and/or modify
|
---|
| 12 | # it under the terms of the GNU General Public License as published by
|
---|
| 13 | # the Free Software Foundation; either version 2 of the License, or
|
---|
| 14 | # (at your option) any later version.
|
---|
| 15 | #
|
---|
| 16 | # kBuild is distributed in the hope that it will be useful,
|
---|
| 17 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
| 18 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
| 19 | # GNU General Public License for more details.
|
---|
| 20 | #
|
---|
| 21 | # You should have received a copy of the GNU General Public License
|
---|
| 22 | # along with kBuild; if not, write to the Free Software
|
---|
| 23 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
---|
| 24 | #
|
---|
| 25 | #
|
---|
| 26 |
|
---|
| 27 | ifndef __header_kmk__
|
---|
| 28 | # start-of-file-content
|
---|
[988] | 29 | ifdef KBUILD_PROFILE_SELF
|
---|
| 30 | _KBUILD_TS_HEADER_START := $(nanots ) # just a dummy warm up query
|
---|
| 31 | $(info prof: since start - since previous - event description)
|
---|
[1441] | 32 | $(info stat: $(make-stats ))
|
---|
[988] | 33 | _KBUILD_TS_HEADER_START := $(nanots )
|
---|
| 34 | _KBUILD_TS_PREV := $(_KBUILD_TS_HEADER_START)
|
---|
| 35 | endif
|
---|
[69] | 36 |
|
---|
[978] | 37 |
|
---|
[69] | 38 | #
|
---|
[978] | 39 | # Check make version before we do anything else.
|
---|
[69] | 40 | #
|
---|
[978] | 41 | ifndef KMK_VERSION
|
---|
[984] | 42 | $(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] | 43 | endif
|
---|
| 44 | ifneq ($(KBUILD_VERSION_MAJOR).$(KBUILD_VERSION_MINOR),0.1)
|
---|
| 45 | ifneq ($(KBUILD_VERSION_MAJOR),0)
|
---|
[1348] | 46 | $(warning kBuild: kmk major version mismatch! Expected '0' but found '$(KBUILD_VERSION_MAJOR)'!)
|
---|
[978] | 47 | else
|
---|
[1348] | 48 | $(warning kBuild: kmk minor version mismatch! Expected '1' but found '$(KBUILD_VERSION_MINOR)'!)
|
---|
[978] | 49 | endif
|
---|
[1348] | 50 | else
|
---|
[1504] | 51 | ifneq ($(int-ge $(KBUILD_VERSION_PATCH),3),1)
|
---|
| 52 | $(warning kBuild: kmk version mismatch! Expected 0.1.3 or later. Actual version is $(KBUILD_VERSION_MAJOR).$(KBUILD_VERSION_MINOR).$(KBUILD_VERSION_PATCH).)
|
---|
[1348] | 53 | endif
|
---|
[978] | 54 | endif
|
---|
[69] | 55 |
|
---|
| 56 | #
|
---|
[978] | 57 | # The revision in which this file was last modified.
|
---|
| 58 | # This can be useful when using development versions of kBuild.
|
---|
[380] | 59 | #
|
---|
[978] | 60 | KMK_REVISION := $(patsubst %:,, $Rev: 1504 $ )
|
---|
[414] | 61 |
|
---|
[978] | 62 |
|
---|
[380] | 63 | #
|
---|
[978] | 64 | # Define the default goal.
|
---|
[69] | 65 | #
|
---|
[1501] | 66 | .PHONY: all all_recursive
|
---|
[978] | 67 | all: all_recursive
|
---|
[69] | 68 |
|
---|
[894] | 69 | #
|
---|
[978] | 70 | # The phony FORCE target.
|
---|
[894] | 71 | #
|
---|
[1501] | 72 | .PHONY: FORCE
|
---|
[978] | 73 | FORCE:
|
---|
[72] | 74 |
|
---|
[978] | 75 |
|
---|
[69] | 76 | #
|
---|
[978] | 77 | # Enable delete on error and second expansion of prerequisites.
|
---|
[894] | 78 | #
|
---|
[978] | 79 | .DELETE_ON_ERROR:
|
---|
| 80 |
|
---|
[894] | 81 | .SECONDEXPANSION:
|
---|
| 82 |
|
---|
| 83 |
|
---|
| 84 | #
|
---|
[95] | 85 | # General purpose macros.
|
---|
| 86 | #
|
---|
[204] | 87 |
|
---|
[380] | 88 | ##
|
---|
| 89 | # Newline character(s).
|
---|
| 90 | define NL
|
---|
[95] | 91 |
|
---|
[380] | 92 |
|
---|
| 93 | endef
|
---|
| 94 |
|
---|
| 95 | ##
|
---|
| 96 | # Tab character.
|
---|
| 97 | TAB := $(subst ., ,.)
|
---|
| 98 |
|
---|
| 99 | ##
|
---|
[896] | 100 | # Newline + tab characters (for generating commands).
|
---|
| 101 | NLTAB = $(NL)$(TAB)
|
---|
| 102 |
|
---|
| 103 | ##
|
---|
[380] | 104 | # Space character.
|
---|
| 105 | SP := $(subst ., ,.)
|
---|
| 106 |
|
---|
| 107 | ##
|
---|
[895] | 108 | # Hash character.
|
---|
| 109 | define HASH
|
---|
| 110 | #
|
---|
| 111 | endef
|
---|
[380] | 112 |
|
---|
[895] | 113 | ##
|
---|
| 114 | # Colon character.
|
---|
| 115 | COLON := :
|
---|
| 116 |
|
---|
| 117 | ##
|
---|
| 118 | # Semicolon character.
|
---|
| 119 | SEMICOLON := ;
|
---|
| 120 |
|
---|
| 121 | ##
|
---|
| 122 | # Comma character.
|
---|
| 123 | COMMA := ,
|
---|
| 124 |
|
---|
| 125 | ##
|
---|
| 126 | # Dot character.
|
---|
| 127 | DOT := .
|
---|
| 128 |
|
---|
| 129 | ##
|
---|
| 130 | # Dollar character.
|
---|
| 131 | DOLLAR := $$
|
---|
| 132 |
|
---|
| 133 | ##
|
---|
| 134 | # Equal character.
|
---|
| 135 | EQUAL := =
|
---|
| 136 |
|
---|
| 137 |
|
---|
[95] | 138 | #
|
---|
[1403] | 139 | # The list of standard build types in kBuild.
|
---|
| 140 | #
|
---|
[1416] | 141 | # This list can be extended in Config.kmk and it's possible to extend
|
---|
[1403] | 142 | # (inherit) another build type.
|
---|
| 143 | #
|
---|
[1420] | 144 | KBUILD_BLD_TYPES := release profile debug
|
---|
[1403] | 145 |
|
---|
| 146 |
|
---|
| 147 | #
|
---|
[985] | 148 | # The OSes, Architectures and CPUs that kBuild recognizes.
|
---|
[978] | 149 | #
|
---|
| 150 | # When kBuild is ported to a new OS or architecture a unique keyword needs
|
---|
| 151 | # to be assigned to it and added here. This strictness is required because
|
---|
| 152 | # this keyword namespace is shared between OSes, architectures, cpus and
|
---|
[984] | 153 | # build types. (PORTME)
|
---|
[978] | 154 | #
|
---|
[985] | 155 | KBUILD_OSES := darwin freebsd l4 linux netbsd nt openbsd os2 solaris win
|
---|
[1381] | 156 | KBUILD_ARCHES := x86 amd64 sparc32 sparc64 s390 s390x ppc32 ppc64 mips32 mips64 ia64 hppa32 hppa64 arm alpha
|
---|
[978] | 157 |
|
---|
| 158 |
|
---|
| 159 | #
|
---|
[585] | 160 | # Set default build type.
|
---|
[69] | 161 | #
|
---|
[1504] | 162 | ifndef KBUILD_TYPE
|
---|
| 163 | ifdef BUILD_TYPE
|
---|
| 164 | KBUILD_TYPE := $(BUILD_TYPE)
|
---|
| 165 | endif
|
---|
| 166 | else ifdef BUILD_TYPE
|
---|
| 167 | ifneq ($(KBUILD_TYPE),$(BUILD_TYPE))
|
---|
| 168 | ifeq ($(origin KBUILD_TYPE):$(origin BUILD_TYPE),environment:command line)
|
---|
| 169 | KBUILD_TYPE := $(BUILD_TYPE)
|
---|
| 170 | else ifneq ($(origin KBUILD_TYPE):$(origin BUILD_TYPE),command line:environment)
|
---|
| 171 | $(error kBuild: KBUILD_TYPE and BUILD_TYPE disagree.)
|
---|
| 172 | endif
|
---|
| 173 | endif
|
---|
| 174 | endif
|
---|
| 175 | override BUILD_TYPE = $(KBUILD_TYPE)
|
---|
| 176 |
|
---|
| 177 | ifndef KBUILD_TYPE
|
---|
| 178 | KBUILD_TYPE := release
|
---|
[978] | 179 | else
|
---|
[1504] | 180 | if1of ($(KBUILD_TYPE), $(KBUILD_OSES) $(KBUILD_ARCHES))
|
---|
| 181 | $(error kBuild: The KBUILD_TYPE value '$(KBUILD_TYPE)' is an OS or architecture!)
|
---|
[585] | 182 | endif
|
---|
[1504] | 183 | ifneq (.$(words $(KBUILD_TYPE)).$(KBUILD_TYPE).,.1.$(strip $(KBUILD_TYPE)).)
|
---|
| 184 | $(error kBuild: The KBUILD_TYPE value '$(KBUILD_TYPE)' contains spaces/tabs!)
|
---|
[978] | 185 | endif
|
---|
[72] | 186 | endif
|
---|
[69] | 187 |
|
---|
| 188 |
|
---|
| 189 | #
|
---|
[1504] | 190 | # Host platform legacy
|
---|
| 191 | # kmk deals with this, so this is only temporary until I've rebuilt everything.
|
---|
| 192 | #
|
---|
| 193 | ifndef KBUILD_HOST
|
---|
| 194 | KBUILD_HOST := $(BUILD_PLATFORM)
|
---|
| 195 | endif
|
---|
| 196 | ifndef KBUILD_HOST_ARCH
|
---|
| 197 | KBUILD_HOST_ARCH := $(BUILD_PLATFORM_ARCH)
|
---|
| 198 | endif
|
---|
| 199 | ifndef KBUILD_HOST_CPU
|
---|
| 200 | KBUILD_HOST_CPU := $(BUILD_PLATFORM_CPU)
|
---|
| 201 | endif
|
---|
| 202 |
|
---|
| 203 |
|
---|
| 204 | #
|
---|
[978] | 205 | # Assert valid build platform variables.
|
---|
[70] | 206 | #
|
---|
[978] | 207 | # All these are set by kmk so they shouldn't be any trouble
|
---|
| 208 | # unless the user starts messing about with environment variables.
|
---|
| 209 | #
|
---|
[1504] | 210 | ifneq (.$(words $(KBUILD_HOST)).$(KBUILD_HOST).,.1.$(strip $(KBUILD_HOST)).)
|
---|
| 211 | $(error kBuild: The KBUILD_HOST value '$(KBUILD_HOST)' contains spaces/tabs!)
|
---|
[72] | 212 | endif
|
---|
[1504] | 213 | ifneq ($(words $(filter $(KBUILD_HOST),$(KBUILD_OSES))),1)
|
---|
| 214 | $(error kBuild: KBUILD_HOST value '$(KBUILD_HOST)' is not recognized (valid: $(KBUILD_OSES)))
|
---|
[978] | 215 | endif
|
---|
[70] | 216 |
|
---|
[1504] | 217 | ifneq (.$(words $(KBUILD_HOST_ARCH)).$(KBUILD_HOST_ARCH).,.1.$(strip $(KBUILD_HOST_ARCH)).)
|
---|
| 218 | $(error kBuild: The KBUILD_HOST_ARCH value '$(KBUILD_HOST_ARCH)' contains spaces/tabs!)
|
---|
[329] | 219 | endif
|
---|
[1504] | 220 | ifneq ($(words $(filter $(KBUILD_HOST_ARCH),$(KBUILD_ARCHES))),1)
|
---|
| 221 | $(error kBuild: KBUILD_HOST_ARCH value '$(KBUILD_HOST_ARCH)' is not recognized (valid: $(KBUILD_ARCHES)))
|
---|
[329] | 222 | endif
|
---|
[72] | 223 |
|
---|
[1504] | 224 | ifeq ($(strip $(KBUILD_HOST_CPU)),)
|
---|
| 225 | KBUILD_HOST_CPU := blend
|
---|
[994] | 226 | else
|
---|
[1504] | 227 | ifneq (.$(words $(KBUILD_HOST_CPU)).$(KBUILD_HOST_CPU).,.1.$(strip $(KBUILD_HOST_CPU)).)
|
---|
| 228 | $(error kBuild: The KBUILD_HOST_CPU value '$(KBUILD_HOST_CPU)' contains spaces/tabs!)
|
---|
[994] | 229 | endif
|
---|
[1504] | 230 | if1of ($(KBUILD_HOST_CPU), $(KBUILD_OSES) $(BUILD_ARCHES))
|
---|
| 231 | $(error kBuild: The KBUILD_HOST_CPU value '$(KBUILD_HOST_CPU)' was found in the OS or architecture keywords!)
|
---|
[994] | 232 | endif
|
---|
[1504] | 233 | ifeq ($(KBUILD_HOST_CPU),$(KBUILD_TYPE))
|
---|
| 234 | $(error kBuild: The KBUILD_HOST_CPU value '$(KBUILD_HOST_CPU)' is the same as the KBUILD_TYPE!)
|
---|
[994] | 235 | endif
|
---|
[978] | 236 | endif
|
---|
[72] | 237 |
|
---|
[978] | 238 |
|
---|
[70] | 239 | #
|
---|
[1504] | 240 | # Deal with target platform legacy.
|
---|
| 241 | #
|
---|
| 242 | ifndef KBUILD_TARGET
|
---|
| 243 | ifdef BUILD_TARGET
|
---|
| 244 | KBUILD_TARGET := $(BUILD_TARGET)
|
---|
| 245 | endif
|
---|
| 246 | else ifdef BUILD_TARGET
|
---|
| 247 | ifneq ($(KBUILD_TARGET),$(BUILD_TARGET))
|
---|
| 248 | ifeq ($(origin KBUILD_TARGET):$(origin BUILD_TARGET),environment:command line)
|
---|
| 249 | KBUILD_TARGET := $(BUILD_TARGET)
|
---|
| 250 | else ifneq ($(origin KBUILD_TARGET):$(origin BUILD_TARGET),command line:environment)
|
---|
| 251 | $(error kBuild: KBUILD_TARGET and BUILD_TARGET disagree)
|
---|
| 252 | endif
|
---|
| 253 | endif
|
---|
| 254 | endif
|
---|
| 255 | override BUILD_TARGET = $(KBUILD_TARGET)
|
---|
| 256 |
|
---|
| 257 | ifndef KBUILD_TARGET_ARCH
|
---|
| 258 | ifdef BUILD_TARGET_ARCH
|
---|
| 259 | KBUILD_TARGET_ARCH := $(BUILD_TARGET_ARCH)
|
---|
| 260 | endif
|
---|
| 261 | else ifdef BUILD_TARGET_ARCH
|
---|
| 262 | ifneq ($(KBUILD_TARGET_ARCH),$(BUILD_TARGET_ARCH))
|
---|
| 263 | ifeq ($(origin KBUILD_TARGET_ARCH):$(origin BUILD_TARGET_ARCH),environment:command line)
|
---|
| 264 | KBUILD_TARGET_ARCH := $(BUILD_TARGET_ARCH)
|
---|
| 265 | else ifneq ($(origin KBUILD_TARGET_ARCH):$(origin BUILD_TARGET_ARCH),command line:environment)
|
---|
| 266 | $(error kBuild: KBUILD_TARGET_ARCH and BUILD_TARGET_ARCH disagree)
|
---|
| 267 | endif
|
---|
| 268 | endif
|
---|
| 269 | endif
|
---|
| 270 | override BUILD_TARGET_ARCH = $(KBUILD_TARGET_ARCH)
|
---|
| 271 |
|
---|
| 272 | ifndef KBUILD_TARGET_CPU
|
---|
| 273 | ifdef BUILD_TARGET_CPU
|
---|
| 274 | KBUILD_TARGET_CPU := $(BUILD_TARGET_CPU)
|
---|
| 275 | endif
|
---|
| 276 | else ifdef BUILD_TARGET_CPU
|
---|
| 277 | ifneq ($(KBUILD_TARGET_CPU),$(BUILD_TARGET_CPU))
|
---|
| 278 | ifeq ($(origin KBUILD_TARGET_CPU):$(origin BUILD_TARGET_CPU),environment:command line)
|
---|
| 279 | KBUILD_TARGET_CPU := $(BUILD_TARGET_CPU)
|
---|
| 280 | else ifneq ($(origin KBUILD_TARGET_CPU):$(origin BUILD_TARGET_CPU),command line:environment)
|
---|
| 281 | $(error kBuild: KBUILD_TARGET_CPU and BUILD_TARGET_CPU disagree)
|
---|
| 282 | endif
|
---|
| 283 | endif
|
---|
| 284 | endif
|
---|
| 285 | override BUILD_TARGET_CPU = $(KBUILD_TARGET_CPU)
|
---|
| 286 |
|
---|
| 287 |
|
---|
| 288 | #
|
---|
[978] | 289 | # Assert or set default target platform.
|
---|
[1504] | 290 | # When not defined use the corresponding KBUILD_HOST value.
|
---|
[72] | 291 | #
|
---|
[1504] | 292 | ifndef KBUILD_TARGET
|
---|
| 293 | KBUILD_TARGET := $(KBUILD_HOST)
|
---|
[72] | 294 | else
|
---|
[1504] | 295 | ifneq (.$(words $(KBUILD_TARGET)).$(KBUILD_TARGET).,.1.$(strip $(KBUILD_TARGET)).)
|
---|
| 296 | $(error kBuild: The KBUILD_TARGET value '$(KBUILD_TARGET)' contains spaces/tabs!)
|
---|
[478] | 297 | endif
|
---|
[1504] | 298 | ifneq ($(words $(filter $(KBUILD_TARGET),$(KBUILD_OSES))),1)
|
---|
| 299 | $(error kBuild: KBUILD_TARGET value '$(KBUILD_TARGET)' is not recognized (valid: $(KBUILD_OSES)))
|
---|
[978] | 300 | endif
|
---|
[72] | 301 | endif
|
---|
| 302 |
|
---|
[1504] | 303 | ifndef KBUILD_TARGET_ARCH
|
---|
| 304 | KBUILD_TARGET_ARCH := $(KBUILD_HOST_ARCH)
|
---|
[978] | 305 | else
|
---|
[1504] | 306 | ifneq (.$(words $(KBUILD_TARGET_ARCH)).$(KBUILD_TARGET_ARCH).,.1.$(strip $(KBUILD_TARGET_ARCH)).)
|
---|
| 307 | $(error kBuild: The KBUILD_TARGET_ARCH value '$(KBUILD_TARGET_ARCH)' contains spaces/tabs!)
|
---|
[978] | 308 | endif
|
---|
[1504] | 309 | ifneq ($(words $(filter $(KBUILD_TARGET_ARCH),$(KBUILD_ARCHES))),1)
|
---|
| 310 | $(error kBuild: KBUILD_TARGET_ARCH value '$(KBUILD_TARGET_ARCH)' is not recognized (valid: $(KBUILD_ARCHES)))
|
---|
[978] | 311 | endif
|
---|
[329] | 312 | endif
|
---|
[978] | 313 |
|
---|
[1504] | 314 | ifndef KBUILD_TARGET_CPU
|
---|
| 315 | KBUILD_TARGET_CPU := $(KBUILD_HOST_CPU)
|
---|
| 316 | else ifeq ($(strip $(KBUILD_TARGET_CPU)),)
|
---|
| 317 | ifeq ($(KBUILD_TARGET_ARCH),$(KBUILD_HOST_ARCH))
|
---|
| 318 | KBUILD_TARGET_CPU := $(KBUILD_HOST_CPU)
|
---|
[994] | 319 | else
|
---|
[1504] | 320 | KBUILD_TARGET_CPU := blend
|
---|
[994] | 321 | endif
|
---|
[978] | 322 | else
|
---|
[1504] | 323 | ifneq (.$(words $(KBUILD_TARGET_CPU)).$(KBUILD_TARGET_CPU).,.1.$(strip $(KBUILD_TARGET_CPU)).)
|
---|
| 324 | $(error kBuild: The KBUILD_TARGET_CPU value '$(KBUILD_TARGET_CPU)' contains spaces/tabs!)
|
---|
[978] | 325 | endif
|
---|
[1504] | 326 | if1of ($(KBUILD_TARGET_CPU), $(KBUILD_OSES) $(BUILD_ARCHES))
|
---|
| 327 | $(error kBuild: The KBUILD_TARGET_CPU value was found in the OS or architecture keywords!)
|
---|
[978] | 328 | endif
|
---|
[1504] | 329 | ifeq ($(KBUILD_TARGET_CPU),$(KBUILD_TYPE))
|
---|
| 330 | $(error kBuild: The KBUILD_TARGET_CPU value '$(KBUILD_TARGET_CPU)' is the same as the KBUILD_TYPE!)
|
---|
[978] | 331 | endif
|
---|
[329] | 332 | endif
|
---|
[72] | 333 |
|
---|
| 334 |
|
---|
| 335 | #
|
---|
[978] | 336 | # Paths and stuff.
|
---|
[69] | 337 | #
|
---|
[978] | 338 |
|
---|
| 339 | # Adjust DEPTH first.
|
---|
| 340 | DEPTH := $(strip $(DEPTH))
|
---|
| 341 | ifeq ($(DEPTH),)
|
---|
| 342 | DEPTH := .
|
---|
| 343 | endif
|
---|
| 344 |
|
---|
[725] | 345 | ## PATH_CURRENT is the current directory (getcwd).
|
---|
[306] | 346 | PATH_CURRENT := $(abspath $(CURDIR))
|
---|
[725] | 347 | ## PATH_SUB_CURRENT points to current directory of the current makefile.
|
---|
| 348 | # Meaning that it will change value as we enter and exit sub-makefiles.
|
---|
| 349 | PATH_SUB_CURRENT := $(PATH_CURRENT)
|
---|
| 350 | ## PATH_ROOT points to the project root directory.
|
---|
| 351 | PATH_ROOT := $(abspath $(PATH_CURRENT)/$(DEPTH))
|
---|
| 352 | ## PATH_SUB_ROOT points to the directory of the top-level makefile.
|
---|
[472] | 353 | ifneq ($(strip $(SUB_DEPTH)),)
|
---|
[978] | 354 | SUB_DEPTH := $(strip $(SUB_DEPTH))
|
---|
[725] | 355 | PATH_SUB_ROOT := $(abspath $(PATH_CURRENT)/$(SUB_DEPTH))
|
---|
[472] | 356 | else
|
---|
[725] | 357 | PATH_SUB_ROOT := $(PATH_CURRENT)
|
---|
[472] | 358 | endif
|
---|
[306] | 359 |
|
---|
[748] | 360 | ## CURSUBDIR is PATH_SUB_ROOT described relative to PATH_ROOT.
|
---|
[725] | 361 | # This variable is used to determin where the object files and other output goes.
|
---|
[1390] | 362 | ifneq ($(PATH_ROOT),$(PATH_SUB_ROOT))
|
---|
| 363 | CURSUBDIR := $(patsubst $(PATH_ROOT)/%,%,$(PATH_SUB_ROOT))
|
---|
[266] | 364 | else
|
---|
[1390] | 365 | CURSUBDIR := .
|
---|
[266] | 366 | endif
|
---|
[306] | 367 |
|
---|
[70] | 368 | # Output directories.
|
---|
[242] | 369 | ifndef PATH_OUT_BASE
|
---|
[725] | 370 | PATH_OUT_BASE := $(PATH_ROOT)/out
|
---|
[242] | 371 | endif
|
---|
[240] | 372 | ifndef PATH_OUT
|
---|
[1504] | 373 | ifdef BUILD_TARGET_SUB # (BUILD_TARGET_SUB is not currently recognized by kBuild in any other places - obsolete)
|
---|
| 374 | PATH_OUT := $(PATH_OUT_BASE)/$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH).$(BUILD_TARGET_SUB)/$(KBUILD_TYPE)
|
---|
[725] | 375 | else
|
---|
[1504] | 376 | PATH_OUT := $(PATH_OUT_BASE)/$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)/$(KBUILD_TYPE)
|
---|
[725] | 377 | endif
|
---|
[329] | 378 | endif # !define PATH_OUT
|
---|
[1051] | 379 | PATH_OBJCACHE = $(PATH_OUT_BASE)/kObjCache
|
---|
[353] | 380 | PATH_OBJ = $(PATH_OUT)/obj
|
---|
| 381 | PATH_TARGET = $(PATH_OBJ)/$(CURSUBDIR)
|
---|
| 382 | PATH_INS = $(PATH_OUT)
|
---|
| 383 | PATH_BIN = $(PATH_INS)/bin
|
---|
| 384 | PATH_DLL = $(PATH_INS)/bin
|
---|
| 385 | PATH_SYS = $(PATH_INS)/bin
|
---|
| 386 | PATH_LIB = $(PATH_INS)/lib
|
---|
| 387 | PATH_DOC = $(PATH_INS)/doc
|
---|
[70] | 388 |
|
---|
[1504] | 389 | # KBUILD_PATH / PATH_KBUILD is determined by kmk.
|
---|
| 390 | ifndef KBUILD_PATH
|
---|
| 391 | KBUILD_PATH := $(PATH_KBUILD)
|
---|
[70] | 392 | endif
|
---|
[1504] | 393 | ifeq ($(strip $(KBUILD_PATH)),)
|
---|
| 394 | $(error kBuild: KBUILD_PATH is missing or empty! kmk is supposed to set it.)
|
---|
[978] | 395 | endif
|
---|
[1504] | 396 | # KBUILD_BIN_PATH / PATH_KBUILD_BIN is determined by kmk.
|
---|
| 397 | ifndef KBUILD_BIN_PATH
|
---|
| 398 | KBUILD_BIN_PATH := $(PATH_KBUILD_BIN)
|
---|
| 399 | endif
|
---|
| 400 | ifeq ($(strip $(KBUILD_BIN_PATH)),)
|
---|
| 401 | $(error kBuild: KBUILD_BIN_PATH is missing or empty! kmk is supposed to set it.)
|
---|
| 402 | endif
|
---|
[978] | 403 |
|
---|
[69] | 404 | # kBuild files which might be of interest.
|
---|
[1504] | 405 | FILE_KBUILD_HEADER := $(KBUILD_PATH)/header.kmk
|
---|
| 406 | #FILE_KBUILD_CONFIG := $(KBUILD_PATH)/config.kmk
|
---|
| 407 | FILE_KBUILD_FOOTER := $(KBUILD_PATH)/footer.kmk
|
---|
[69] | 408 |
|
---|
[725] | 409 | ## MAKEFILE is the name of the main makefile.
|
---|
[204] | 410 | MAKEFILE := $(firstword $(MAKEFILE_LIST))
|
---|
[748] | 411 | ## MAKEFILE_CURRENT is the name of the current makefile.
|
---|
[725] | 412 | # This is updated everything a sub-makefile is included.
|
---|
| 413 | MAKEFILE_CURRENT := $(MAKEFILE)
|
---|
[69] | 414 |
|
---|
[72] | 415 |
|
---|
[69] | 416 | #
|
---|
[72] | 417 | # Build platform setup.
|
---|
[984] | 418 | # (PORTME)
|
---|
[69] | 419 | #
|
---|
[984] | 420 |
|
---|
[69] | 421 | # OS/2
|
---|
[1504] | 422 | ifeq ($(KBUILD_HOST),os2)
|
---|
[83] | 423 | EXEC_X86_WIN32 := innopec.exe
|
---|
[69] | 424 | HOSTSUFF_EXE := .exe
|
---|
| 425 | endif
|
---|
| 426 |
|
---|
| 427 | # Linux
|
---|
[1504] | 428 | ifeq ($(KBUILD_HOST),linux)
|
---|
[135] | 429 | EXEC_X86_WIN32 := wine
|
---|
[69] | 430 | HOSTSUFF_EXE :=
|
---|
| 431 | endif
|
---|
[70] | 432 |
|
---|
[547] | 433 | # Win, Win32, Win64, NT.
|
---|
[1504] | 434 | if1of ($(KBUILD_HOST), win nt)
|
---|
[69] | 435 | EXEC_X86_WIN32 :=
|
---|
| 436 | HOSTSUFF_EXE := .exe
|
---|
| 437 | endif
|
---|
| 438 |
|
---|
[299] | 439 | # FreeBSD
|
---|
[1504] | 440 | ifeq ($(KBUILD_HOST),freebsd)
|
---|
[299] | 441 | EXEC_X86_WIN32 := wine
|
---|
| 442 | HOSTSUFF_EXE :=
|
---|
| 443 | endif
|
---|
[125] | 444 |
|
---|
[557] | 445 | # Darwin / Mac OS X
|
---|
[1504] | 446 | ifeq ($(KBUILD_HOST),darwin)
|
---|
[557] | 447 | EXEC_X86_WIN32 := false
|
---|
| 448 | HOSTSUFF_EXE :=
|
---|
| 449 | endif
|
---|
| 450 |
|
---|
[811] | 451 | # Solaris
|
---|
[1504] | 452 | ifeq ($(KBUILD_HOST),solaris)
|
---|
[811] | 453 | EXEC_X86_WIN32 := false
|
---|
| 454 | HOSTSUFF_EXE :=
|
---|
| 455 | endif
|
---|
| 456 |
|
---|
[299] | 457 |
|
---|
[73] | 458 | #
|
---|
| 459 | # Build target setup.
|
---|
[984] | 460 | # (PORTME)
|
---|
[73] | 461 | #
|
---|
[1388] | 462 | SUFF_DEP := .dep
|
---|
[1504] | 463 | if1of ($(KBUILD_TARGET), win nt os2)
|
---|
[1388] | 464 | SUFF_OBJ := .obj
|
---|
| 465 | SUFF_LIB := .lib
|
---|
| 466 | SUFF_DLL := .dll
|
---|
| 467 | SUFF_EXE := .exe
|
---|
| 468 | SUFF_SYS := .sys
|
---|
| 469 | SUFF_RES := .res
|
---|
[1504] | 470 | else ifeq ($(KBUILD_TARGET),l4)
|
---|
[1388] | 471 | SUFF_OBJ := .o
|
---|
| 472 | SUFF_LIB := .a
|
---|
| 473 | SUFF_DLL := .s.so
|
---|
| 474 | SUFF_EXE :=
|
---|
| 475 | SUFF_SYS := .a
|
---|
| 476 | SUFF_RES :=
|
---|
[1504] | 477 | else ifeq ($(KBUILD_TARGET),darwin)
|
---|
[1388] | 478 | SUFF_OBJ := .o
|
---|
| 479 | SUFF_LIB := .a
|
---|
| 480 | SUFF_DLL := .dylib
|
---|
| 481 | SUFF_EXE :=
|
---|
| 482 | SUFF_SYS :=
|
---|
| 483 | SUFF_RES :=
|
---|
| 484 | else
|
---|
| 485 | SUFF_OBJ := .o
|
---|
| 486 | SUFF_LIB := .a
|
---|
| 487 | SUFF_DLL := .so
|
---|
| 488 | SUFF_EXE :=
|
---|
[1504] | 489 | if1of ($(KBUILD_TARGET), freebsd linux netbsd openbsd) ## @todo check netbsd and openbsd.
|
---|
[1389] | 490 | SUFF_SYS := .ko
|
---|
[1388] | 491 | else
|
---|
[1389] | 492 | SUFF_SYS :=
|
---|
| 493 | endif
|
---|
[1388] | 494 | SUFF_RES :=
|
---|
[73] | 495 | endif
|
---|
[69] | 496 |
|
---|
| 497 | #
|
---|
| 498 | # Standard kBuild tools.
|
---|
| 499 | #
|
---|
[978] | 500 | ifeq ($(KMK),kmk)
|
---|
[1504] | 501 | KMK := $(KBUILD_BIN_PATH)/kmk$(HOSTSUFF_EXE)
|
---|
[233] | 502 | endif
|
---|
[978] | 503 | MAKE := $(KMK)
|
---|
[233] | 504 |
|
---|
[1504] | 505 | GMAKE := $(KBUILD_BIN_PATH)/kmk_gmake$(HOSTSUFF_EXE)
|
---|
[1378] | 506 |
|
---|
[1504] | 507 | DEP_EXT := $(KBUILD_BIN_PATH)/kDep$(HOSTSUFF_EXE)
|
---|
[1388] | 508 | if1of (kDep, $(KMK_BUILTIN))
|
---|
[397] | 509 | DEP := kmk_builtin_kDep
|
---|
[230] | 510 | else
|
---|
[380] | 511 | DEP := $(DEP_EXT)
|
---|
[230] | 512 | endif
|
---|
[69] | 513 |
|
---|
[1504] | 514 | DEP_IDB_EXT := $(KBUILD_BIN_PATH)/kDepIDB$(HOSTSUFF_EXE)
|
---|
[1388] | 515 | if1of (kDepIDB, $(KMK_BUILTIN))
|
---|
[1004] | 516 | DEP_IDB := kmk_builtin_kDepIDB
|
---|
[397] | 517 | else
|
---|
| 518 | DEP_IDB := $(DEP_IDB_EXT)
|
---|
| 519 | endif
|
---|
| 520 |
|
---|
[1504] | 521 | DEP_PRE_EXT := $(KBUILD_BIN_PATH)/kDepPre$(HOSTSUFF_EXE)
|
---|
[1388] | 522 | if1of (kDepPre, $(KMK_BUILTIN))
|
---|
[1004] | 523 | DEP_PRE := kmk_builtin_kDepPre
|
---|
[380] | 524 | else
|
---|
| 525 | DEP_PRE := $(DEP_PRE_EXT)
|
---|
| 526 | endif
|
---|
| 527 |
|
---|
[1504] | 528 | KOBJCACHE_EXT := $(KBUILD_BIN_PATH)/kObjCache$(HOSTSUFF_EXE)
|
---|
[1388] | 529 | if1of (kObjCache, $(KMK_BUILTIN))
|
---|
[1004] | 530 | KOBJCACHE := kmk_builtin_kObjCache
|
---|
| 531 | else
|
---|
| 532 | KOBJCACHE := $(KOBJCACHE_EXT)
|
---|
| 533 | endif
|
---|
| 534 |
|
---|
[1504] | 535 | APPEND_EXT := $(KBUILD_BIN_PATH)/kmk_append$(HOSTSUFF_EXE)
|
---|
[380] | 536 | APPEND := kmk_builtin_append
|
---|
[69] | 537 |
|
---|
[1504] | 538 | CAT_EXT := $(KBUILD_BIN_PATH)/kmk_cat$(HOSTSUFF_EXE)
|
---|
[380] | 539 | CAT := kmk_builtin_cat
|
---|
[353] | 540 |
|
---|
[1504] | 541 | CMP_EXT := $(KBUILD_BIN_PATH)/kmk_cmp$(HOSTSUFF_EXE)
|
---|
[1118] | 542 | CMP := kmk_builtin_cmp
|
---|
| 543 |
|
---|
[1504] | 544 | CP_EXT := $(KBUILD_BIN_PATH)/kmk_cp$(HOSTSUFF_EXE)
|
---|
[1119] | 545 | CP := kmk_builtin_cp
|
---|
| 546 |
|
---|
[1504] | 547 | ECHO_EXT := $(KBUILD_BIN_PATH)/kmk_echo$(HOSTSUFF_EXE)
|
---|
[380] | 548 | ECHO := kmk_builtin_echo
|
---|
| 549 |
|
---|
[1504] | 550 | INSTALL_EXT := $(KBUILD_BIN_PATH)/kmk_install$(HOSTSUFF_EXE)
|
---|
[380] | 551 | INSTALL := kmk_builtin_install
|
---|
| 552 |
|
---|
[1504] | 553 | LN_EXT := $(KBUILD_BIN_PATH)/kmk_ln$(HOSTSUFF_EXE)
|
---|
[380] | 554 | LN := kmk_builtin_ln
|
---|
| 555 |
|
---|
[1504] | 556 | MD5SUM_EXT := $(KBUILD_BIN_PATH)/kmk_md5sum$(HOSTSUFF_EXE)
|
---|
[1118] | 557 | MD5SUM := kmk_builtin_md5sum
|
---|
| 558 |
|
---|
[1504] | 559 | MKDIR_EXT := $(KBUILD_BIN_PATH)/kmk_mkdir$(HOSTSUFF_EXE)
|
---|
[380] | 560 | MKDIR := kmk_builtin_mkdir
|
---|
| 561 |
|
---|
[1504] | 562 | MV_EXT := $(KBUILD_BIN_PATH)/kmk_mv$(HOSTSUFF_EXE)
|
---|
[380] | 563 | MV := kmk_builtin_mv
|
---|
| 564 |
|
---|
[1504] | 565 | PRINTF_EXT := $(KBUILD_BIN_PATH)/kmk_printf$(HOSTSUFF_EXE)
|
---|
[776] | 566 | PRINTF := kmk_builtin_printf
|
---|
| 567 |
|
---|
[1504] | 568 | REDIRECT_EXT:= $(KBUILD_BIN_PATH)/kmk_redirect$(HOSTSUFF_EXE)
|
---|
[1388] | 569 | if1of (redirect, $(KMK_BUILTIN))
|
---|
[1272] | 570 | REDIRECT := kmk_builtin_redirect
|
---|
| 571 | else
|
---|
| 572 | REDIRECT := $(REDIRECT_EXT)
|
---|
| 573 | endif
|
---|
| 574 |
|
---|
[1504] | 575 | RM_EXT := $(KBUILD_BIN_PATH)/kmk_rm$(HOSTSUFF_EXE)
|
---|
[380] | 576 | RM := kmk_builtin_rm
|
---|
| 577 |
|
---|
[1504] | 578 | RMDIR_EXT := $(KBUILD_BIN_PATH)/kmk_rmdir$(HOSTSUFF_EXE)
|
---|
[601] | 579 | RMDIR := kmk_builtin_rmdir
|
---|
| 580 |
|
---|
[1504] | 581 | SED_EXT := $(KBUILD_BIN_PATH)/kmk_sed$(HOSTSUFF_EXE)
|
---|
[1272] | 582 | if1of (sed, $(KMK_BUILTIN))
|
---|
[978] | 583 | SED_INT := kmk_builtin_sed
|
---|
[380] | 584 | else
|
---|
[978] | 585 | SED_INT := $(SED_EXT)
|
---|
| 586 | endif
|
---|
[380] | 587 | SED := $(SED_EXT)
|
---|
| 588 |
|
---|
[1504] | 589 | TEST_EXT := $(KBUILD_BIN_PATH)/kmk_test$(HOSTSUFF_EXE)
|
---|
[1296] | 590 | TEST := kmk_builtin_test
|
---|
| 591 |
|
---|
[380] | 592 | # Our default shell is the Almquist shell from *BSD.
|
---|
[1504] | 593 | ASH := $(KBUILD_BIN_PATH)/kmk_ash$(HOSTSUFF_EXE)
|
---|
[380] | 594 | MAKESHELL := $(ASH)
|
---|
| 595 | SHELL := $(ASH)
|
---|
| 596 | export SHELL MAKESHELL
|
---|
| 597 |
|
---|
[414] | 598 | # Symlinking is problematic on some platforms...
|
---|
[380] | 599 | LN_SYMLINK := $(LN) -s
|
---|
| 600 |
|
---|
[743] | 601 |
|
---|
| 602 | #
|
---|
| 603 | # Some Functions.
|
---|
[748] | 604 | # The lower cased ones are either fallbacks or candidates for functions.c.
|
---|
[743] | 605 | #
|
---|
| 606 |
|
---|
[130] | 607 | ## ABSPATH - make paths absolute.
|
---|
[129] | 608 | # This implementation is clumsy and doesn't resolve '..' and '.' components.
|
---|
[73] | 609 | #
|
---|
[129] | 610 | # @param $1 The paths to make absolute.
|
---|
[696] | 611 | # @obsolete Use the GNU make function $(abspath) directly now.
|
---|
[984] | 612 | ABSPATH = $(abspath $(1))$(warning ABSPATH is deprecated, use abspath directly!)
|
---|
[353] | 613 |
|
---|
[130] | 614 | ## DIRDEP - make create directory dependencies.
|
---|
| 615 | #
|
---|
| 616 | # @param $1 The paths to the directories which must be created.
|
---|
[353] | 617 | DIRDEP = $(foreach path,$(patsubst %/,%,$(1)),$(path)/)
|
---|
[129] | 618 |
|
---|
| 619 | ## Cygwin kludge.
|
---|
| 620 | # This converts /cygdrive/x/% to x:%.
|
---|
| 621 | #
|
---|
| 622 | # @param $1 The paths to make native.
|
---|
| 623 | # @remark This macro is pretty much obsolete since we don't use cygwin base make.
|
---|
| 624 | ifneq ($(patsubst /cygdrive/%,%,$(CURDIR)),$(CURDIR))
|
---|
[743] | 625 | CYGPATHMIXED = $(foreach path,$(1)\
|
---|
[129] | 626 | ,$(if $(patsubst /cygdrive/%,,$(path)),$(path),$(patsubst $(strip $(firstword $(subst /, ,$(patsubst /cygdrive/%,%,$(path)))))/%,$(strip $(firstword $(subst /, ,$(patsubst /cygdrive/%,%,$(path))))):/%,$(patsubst /cygdrive/%,%,$(path)))))
|
---|
| 627 | else
|
---|
[743] | 628 | CYGPATHMIXED = $(1)
|
---|
[129] | 629 | endif
|
---|
| 630 |
|
---|
[743] | 631 | ## Removes the drive letter from a path (if it has one)
|
---|
| 632 | # @param $1 the path
|
---|
| 633 | no-drive = $(word $(words $(subst :, ,$(1))),$(subst :, ,$(1)))
|
---|
[723] | 634 |
|
---|
[743] | 635 | ## Removes the root slash from a path (if it has one)
|
---|
| 636 | # @param $1 the path
|
---|
| 637 | no-root-slash = $(patsubst /%,%,$(1))
|
---|
[723] | 638 |
|
---|
[743] | 639 | ## Figure out where to put object files.
|
---|
| 640 | # @param $1 real target name.
|
---|
| 641 | # @param $2 normalized main target
|
---|
[748] | 642 | TARGET_BASE = $(PATH_TARGET)/$(2)/$(call no-root-slash,$(call no-drive,$(1)))
|
---|
[723] | 643 |
|
---|
[743] | 644 | ## Figure out where to put object files.
|
---|
| 645 | # @param $1 normalized main target
|
---|
| 646 | TARGET_PATH = $(PATH_TARGET)/$(1)
|
---|
[723] | 647 |
|
---|
| 648 |
|
---|
[129] | 649 | #
|
---|
[353] | 650 | # Initialize some of the globals which the Config.kmk and
|
---|
| 651 | # others can add stuff to if they like for processing in the footer.
|
---|
| 652 | #
|
---|
| 653 |
|
---|
[1416] | 654 | ## KBUILD_TEMPLATE_PATHS
|
---|
[353] | 655 | # List a paths (separated by space) where templates can be found.
|
---|
[1416] | 656 | KBUILD_TEMPLATE_PATHS :=
|
---|
[353] | 657 |
|
---|
[1416] | 658 | ## KBUILD_TOOL_PATHS
|
---|
[353] | 659 | # List of paths (separated by space) where tools can be found.
|
---|
[1416] | 660 | KBUILD_TOOL_PATHS :=
|
---|
[353] | 661 |
|
---|
[1416] | 662 | ## KBUILD_SDK_PATHS
|
---|
[353] | 663 | # List of paths (separated by space) where SDKs can be found.
|
---|
[1416] | 664 | KBUILD_SDK_PATHS :=
|
---|
[353] | 665 |
|
---|
[1416] | 666 | ## KBUILD_DEFAULT_PATHS
|
---|
| 667 | # List of paths (separated by space) to search for stuff as a last resort.
|
---|
| 668 | KBUILD_DEFAULT_PATHS :=
|
---|
| 669 |
|
---|
[353] | 670 | ## Proritized list of the default makefile when walking subdirectories.
|
---|
| 671 | # The user can overload this list.
|
---|
| 672 | DEFAULT_MAKEFILE := Makefile.kmk makefile.kmk Makefile makefile
|
---|
| 673 |
|
---|
[1424] | 674 | ## KBUILD_SRC_HANDLERS
|
---|
| 675 | # The list of source handlers, pair of extension and handler.
|
---|
| 676 | # The user can overload this list to provide additional or custom
|
---|
| 677 | # handlers. On a per-target/template see SRC_HANDLERS.
|
---|
| 678 | KBUILD_SRC_HANDLERS := \
|
---|
| 679 | .c:def_src_handler_c \
|
---|
| 680 | .C:def_src_handler_c \
|
---|
| 681 | .cxx:def_src_handler_cxx \
|
---|
| 682 | .CXX:def_src_handler_cxx \
|
---|
| 683 | .cpp:def_src_handler_cxx \
|
---|
| 684 | .CPP:def_src_handler_cxx \
|
---|
| 685 | .cc:def_src_handler_cxx \
|
---|
| 686 | .CC:def_src_handler_cxx \
|
---|
| 687 | .m:def_src_handler_objc \
|
---|
| 688 | .asm:def_src_handler_asm \
|
---|
| 689 | .ASM:def_src_handler_asm \
|
---|
| 690 | .s:def_src_handler_asm \
|
---|
| 691 | .S:def_src_handler_asm \
|
---|
| 692 | .rc:def_src_handler_rc \
|
---|
| 693 | .obj:def_src_handler_obj \
|
---|
| 694 | .o:def_src_handler_obj \
|
---|
[1435] | 695 | .res:def_src_handler_obj
|
---|
[980] | 696 |
|
---|
[640] | 697 | ## PROPS_TOOLS
|
---|
[985] | 698 | # This is a subset of PROPS_SINGLE.
|
---|
[1256] | 699 | PROPS_TOOLS := TOOL CTOOL CXXTOOL OBJCTOOL ASTOOL RCTOOL ARTOOL LDTOOL FETCHTOOL UNPACKTOOL PATCHTOOL
|
---|
[640] | 700 |
|
---|
[353] | 701 | ## PROPS_SINGLE
|
---|
| 702 | # The list of non-accumulative target properties.
|
---|
| 703 | # A Config.kmk file can add it's own properties to this list and kBuild
|
---|
[1400] | 704 | # will do the necessary inheritance for templates, sdks, tools and targets.
|
---|
| 705 | PROPS_SINGLE := $(PROPS_TOOLS) TEMPLATE INST NOINST BLD_TYPE BLD_TRG BLD_TRG_ARCH BLD_TRG_CPU FETCHDIR \
|
---|
[1256] | 706 | OBJSUFF COBJSUFF CXXOBJSUFF OBJCOBJSUFF ASOBJSUFF RCOBJSUFF SYSSUFF EXESUFF DLLSUFF LIBSUFF ARLIBSUFF
|
---|
[985] | 707 | ## PROPS_SINGLE_LNK
|
---|
| 708 | # Subset of PROPS_SINGLE which applies to all linkable targets.
|
---|
[1400] | 709 | PROPS_SINGLE_LNK := TOOL TEMPLATE CTOOL CXXTOOL OBJCTOOL ASTOOL RCTOOL \
|
---|
[985] | 710 | INST NOINST BLD_TYPE BLD_TRG BLD_TRG_ARCH BLD_TRG_CPU \
|
---|
[1256] | 711 | OBJSUFF COBJSUFF CXXOBJSUFF OBJCOBJSUFF ASOBJSUFF RCOBJSUFF
|
---|
[353] | 712 |
|
---|
| 713 | ## PROPS_DEFERRED
|
---|
[889] | 714 | # This list of non-accumulative target properties which are or may be
|
---|
| 715 | # functions, and thus should not be expanded until the very last moment.
|
---|
[985] | 716 | PROPS_DEFERRED := INSTFUN INSTALLER PRE_CMDS POST_CMDS NAME SONAME
|
---|
[353] | 717 |
|
---|
[660] | 718 | ## PROPS_ACCUMULATE_R
|
---|
[748] | 719 | # The list of accumulative target properties where the right most value/flag
|
---|
[660] | 720 | # is the 'most significant'.
|
---|
[353] | 721 | # A Config.kmk file can add it's own properties to this list and kBuild
|
---|
| 722 | # will do the necessary inheritance from templates to targets.
|
---|
[660] | 723 | PROPS_ACCUMULATE_R := \
|
---|
[985] | 724 | DEPS ORDERDEPS DEFS \
|
---|
| 725 | ARFLAGS \
|
---|
[660] | 726 | CFLAGS CDEFS \
|
---|
| 727 | CXXFLAGS CXXDEFS \
|
---|
[1256] | 728 | OBJCFLAGS OBJCDEFS \
|
---|
[660] | 729 | ASFLAGS ASDEFS \
|
---|
| 730 | RCFLAGS RCDEFS \
|
---|
| 731 | LDFLAGS \
|
---|
[830] | 732 | IDFLAGS IFDLAGS ISFLAGS \
|
---|
[640] | 733 | FETCHFLAGS UNPACKFLAGS PATCHFLAGS
|
---|
[985] | 734 | ## PROPS_ACCUMULATE_R_LNK
|
---|
| 735 | # Subset of PROPS_ACCUMULATE_R which applies to all linkable targets.
|
---|
| 736 | PROPS_ACCUMULATE_R_LNK := \
|
---|
| 737 | DEPS ORDERDEPS DEFS \
|
---|
| 738 | CFLAGS CDEFS \
|
---|
| 739 | CXXFLAGS CXXDEFS \
|
---|
[1256] | 740 | OBJCFLAGS OBJCDEFS \
|
---|
[985] | 741 | ASFLAGS ASDEFS \
|
---|
| 742 | RCFLAGS RCDEFS \
|
---|
| 743 | IDFLAGS IFDLAGS ISFLAGS
|
---|
[353] | 744 |
|
---|
[660] | 745 | ## PROPS_ACCUMULATE
|
---|
[748] | 746 | # The list of accumulative target properties where the left most value/flag
|
---|
[660] | 747 | # is the 'most significant'.
|
---|
| 748 | # A Config.kmk file can add it's own properties to this list and kBuild
|
---|
| 749 | # will do the necessary inheritance from templates to targets.
|
---|
| 750 | PROPS_ACCUMULATE_L := \
|
---|
[1426] | 751 | SDKS SOURCES SRC_HANDLERS INTERMEDIATES \
|
---|
[1256] | 752 | INCS CINCS CXXINCS OBJCINCS ASINCS RCINCS \
|
---|
[897] | 753 | LIBS LIBPATH \
|
---|
[985] | 754 | DIRS BLDDIRS CLEAN
|
---|
| 755 | ## PROPS_ACCUMULATE_L_LNK
|
---|
| 756 | # Subset of PROPS_ACCUMULATE_L which applies to all linkable targets.
|
---|
| 757 | PROPS_ACCUMULATE_L_LNK := \
|
---|
[1424] | 758 | SDKS SOURCES SRC_HANDLERS \
|
---|
[1256] | 759 | INCS CINCS CXXINCS OBJCINCS ASINCS RCINCS \
|
---|
[985] | 760 | BLDDIRS CLEAN
|
---|
[353] | 761 |
|
---|
[662] | 762 | ## PROPS_ALL
|
---|
| 763 | # List of all the properties.
|
---|
| 764 | PROPS_ALL = $(PROPS_SINGLE) $(PROPS_DEFERRED) $(PROPS_ACCUMULATE_L) $(PROPS_ACCUMULATE_R)
|
---|
[660] | 765 |
|
---|
[662] | 766 |
|
---|
[985] | 767 | ## @name Properties valid on programs (BLDPROGS and PROGRAMS)
|
---|
| 768 | ## @{
|
---|
| 769 | PROPS_PROGRAMS_SINGLE := $(PROPS_SINGLE_LNK) LDTOOL EXESUFF
|
---|
| 770 | PROPS_PROGRAMS_DEFERRED := $(PROPS_DEFERRED)
|
---|
| 771 | PROPS_PROGRAMS_ACCUMULATE_R := $(PROPS_ACCUMULATE_R_LNK) LDFLAGS
|
---|
| 772 | PROPS_PROGRAMS_ACCUMULATE_L := $(PROPS_ACCUMULATE_L_LNK) LIBS LIBPATH
|
---|
| 773 | ## @}
|
---|
| 774 |
|
---|
| 775 | ## @name Properties valid on libraries (LIBRARIES and IMPORT_LIBS)
|
---|
| 776 | ## @{
|
---|
[989] | 777 | PROPS_LIBRARIES_SINGLE := $(PROPS_SINGLE_LNK) ARTOOL LIBSUFF ARLIBSUFF LIBSUFF
|
---|
[985] | 778 | PROPS_LIBRARIES_DEFERRED := $(filter-out SONAME,$(PROPS_DEFERRED))
|
---|
| 779 | PROPS_LIBRARIES_ACCUMULATE_R := $(PROPS_ACCUMULATE_R_LNK) ARFLAGS
|
---|
| 780 | PROPS_LIBRARIES_ACCUMULATE_L := $(PROPS_ACCUMULATE_L_LNK)
|
---|
| 781 | ## @}
|
---|
| 782 |
|
---|
| 783 | ## @name Properties valid on dlls (DLLS)
|
---|
| 784 | ## @{
|
---|
| 785 | PROPS_DLLS_SINGLE := $(PROPS_SINGLE_LNK) LDTOOL DLLSUFF LIBSUFF
|
---|
| 786 | PROPS_DLLS_DEFERRED := $(PROPS_DEFERRED)
|
---|
| 787 | PROPS_DLLS_ACCUMULATE_R := $(PROPS_ACCUMULATE_R_LNK) LDFLAGS
|
---|
| 788 | PROPS_DLLS_ACCUMULATE_L := $(PROPS_ACCUMULATE_L_LNK) LIBS LIBPATH
|
---|
| 789 | ## @}
|
---|
| 790 |
|
---|
[989] | 791 | ## @name Properties valid on system modules (SYSMODS)
|
---|
| 792 | ## @{
|
---|
| 793 | PROPS_SYSMODS_SINGLE := $(PROPS_SINGLE_LNK) LDTOOL SYSSUFF
|
---|
| 794 | PROPS_SYSMODS_DEFERRED := $(PROPS_DEFERRED)
|
---|
| 795 | PROPS_SYSMODS_ACCUMULATE_R := $(PROPS_ACCUMULATE_R_LNK) LDFLAGS
|
---|
| 796 | PROPS_SYSMODS_ACCUMULATE_L := $(PROPS_ACCUMULATE_L_LNK) LIBS LIBPATH
|
---|
| 797 | ## @}
|
---|
| 798 |
|
---|
[985] | 799 | ## @name Properties valid on installs (INSTALLS)
|
---|
| 800 | ## @{
|
---|
[1400] | 801 | PROPS_INSTALLS_SINGLE := TOOL TEMPLATE INST NOINST
|
---|
[985] | 802 | PROPS_INSTALLS_DEFERRED := INSTFUN INSTALLER
|
---|
| 803 | PROPS_INSTALLS_ACCUMULATE_R := DEPS ORDERDEPS
|
---|
| 804 | PROPS_INSTALLS_ACCUMULATE_L := SOURCES DIRS CLEAN
|
---|
| 805 | ## @}
|
---|
| 806 |
|
---|
| 807 | ## @name Properties valid on fetches (INSTALLS)
|
---|
| 808 | ## @{
|
---|
[1400] | 809 | PROPS_FETCHES_SINGLE := TOOL TEMPLATE FETCHTOOL UNPACKTOOL PATCHTOOL INST FETCHDIR
|
---|
[985] | 810 | PROPS_FETCHES_DEFERRED :=
|
---|
| 811 | PROPS_FETCHES_ACCUMULATE_R := FETCHFLAGS UNPACKFLAGS PATCHFLAGS
|
---|
| 812 | PROPS_FETCHES_ACCUMULATE_L := SOURCES
|
---|
| 813 | ## @}
|
---|
| 814 |
|
---|
| 815 |
|
---|
[353] | 816 | #
|
---|
[748] | 817 | # Here is a special 'hack' to prevent innocent environment variables being
|
---|
| 818 | # picked up and treated as properties. (The most annoying example of why
|
---|
[662] | 819 | # this is necessary is the Visual C++ commandline with it's LIBPATH.)
|
---|
| 820 | #
|
---|
[748] | 821 | # Define KBUILD_DONT_KILL_ENV_PROPS in the env. or on the commandline to
|
---|
[662] | 822 | # disable this 'hack'.
|
---|
| 823 | #
|
---|
| 824 | ifndef KBUILD_DONT_KILL_ENV_PROPS
|
---|
| 825 |
|
---|
| 826 | define def_nuke_environment_prop
|
---|
| 827 | ifeq ($(origin $(prop)),environment)
|
---|
| 828 | $(prop) =
|
---|
| 829 | endif
|
---|
| 830 | endef
|
---|
[762] | 831 | $(foreach prop, $(PROPS_ALL) \
|
---|
| 832 | FETCHES PATCHES BLDPROGS LIBRARIES IMPORT_LIBS DLLS PROGRAMS SYSMODS INSTALLS OTHERS \
|
---|
[897] | 833 | SUBDIRS MAKEFILES BLDDIRS \
|
---|
[762] | 834 | ,$(eval $(value def_nuke_environment_prop)))
|
---|
[662] | 835 |
|
---|
[897] | 836 | endif # KBUILD_DONT_KILL_ENV_PROPS
|
---|
[662] | 837 |
|
---|
| 838 |
|
---|
| 839 | #
|
---|
[353] | 840 | # Pass configuration.
|
---|
| 841 | #
|
---|
| 842 | # The PASS_<passname>_trgs variable is listing the targets.
|
---|
| 843 | # The PASS_<passname>_vars variable is listing the target variables.
|
---|
| 844 | # The PASS_<passname>_pass variable is the lowercased passname.
|
---|
| 845 | #
|
---|
| 846 |
|
---|
[640] | 847 | ## PASS: fetches
|
---|
| 848 | # This pass fetches and unpacks things needed to complete the build.
|
---|
| 849 | PASS_FETCHES := Fetches
|
---|
| 850 | PASS_FETCHES_trgs :=
|
---|
| 851 | PASS_FETCHES_vars := _FETCHES
|
---|
| 852 | PASS_FETCHES_pass := fetches
|
---|
| 853 |
|
---|
| 854 | ## PASS: patches
|
---|
| 855 | # This pass applies patches.
|
---|
| 856 | PASS_PATCHES := Patches
|
---|
| 857 | PASS_PATCHES_trgs :=
|
---|
| 858 | PASS_PATCHES_vars := _PATCHES
|
---|
| 859 | PASS_PATCHES_pass := patches
|
---|
| 860 |
|
---|
[353] | 861 | ## PASS: bldprogs
|
---|
| 862 | # This pass builds targets which are required for building the rest.
|
---|
| 863 | PASS_BLDPROGS := Build Programs
|
---|
| 864 | PASS_BLDPROGS_trgs :=
|
---|
| 865 | PASS_BLDPROGS_vars := _BLDPROGS
|
---|
| 866 | PASS_BLDPROGS_pass := bldprogs
|
---|
| 867 |
|
---|
| 868 | ## PASS: libraries
|
---|
| 869 | # This pass builds library targets.
|
---|
| 870 | PASS_LIBRARIES := Libraries
|
---|
| 871 | PASS_LIBRARIES_trgs :=
|
---|
| 872 | PASS_LIBRARIES_vars := _LIBS _IMPORT_LIBS _OTHER_LIBRARIES
|
---|
| 873 | PASS_LIBRARIES_pass := libraries
|
---|
| 874 |
|
---|
| 875 | ## PASS: binaries
|
---|
| 876 | # This pass builds dll targets.
|
---|
| 877 | PASS_DLLS := DLLs
|
---|
| 878 | PASS_DLLS_trgs :=
|
---|
| 879 | PASS_DLLS_vars := _DLLS _OTHER_DLLS
|
---|
| 880 | PASS_DLLS_pass := dlls
|
---|
| 881 |
|
---|
| 882 | ## PASS: binaries
|
---|
| 883 | # This pass builds binary targets, i.e. programs, system modules and stuff.
|
---|
| 884 | PASS_BINARIES := Programs
|
---|
| 885 | PASS_BINARIES_trgs :=
|
---|
| 886 | PASS_BINARIES_vars := _PROGRAMS _SYSMODS _OTHER_BINARIES
|
---|
| 887 | PASS_BINARIES_pass := binaries
|
---|
| 888 |
|
---|
| 889 | ## PASS: others
|
---|
| 890 | # This pass builds other targets.
|
---|
| 891 | PASS_OTHERS := Other Stuff
|
---|
| 892 | PASS_OTHERS_trgs :=
|
---|
| 893 | PASS_OTHERS_vars := _OTHERS
|
---|
| 894 | PASS_OTHERS_pass := others
|
---|
| 895 |
|
---|
| 896 | ## PASS: install
|
---|
| 897 | # This pass installs the built entities to a sandbox area.
|
---|
| 898 | PASS_INSTALLS := Install
|
---|
| 899 | PASS_INSTALLS_trgs :=
|
---|
[854] | 900 | PASS_INSTALLS_vars := _INSTALLS_DIRS _INSTALLS _INSTALLS_FILES
|
---|
[353] | 901 | PASS_INSTALLS_pass := installs
|
---|
| 902 |
|
---|
| 903 | ## PASS: packing
|
---|
| 904 | # This pass processes custom packing rules.
|
---|
| 905 | PASS_PACKING := Packing
|
---|
[414] | 906 | PASS_PACKING_trgs :=
|
---|
[417] | 907 | PASS_PACKING_vars := _PACKING
|
---|
[353] | 908 | PASS_PACKING_pass := packing
|
---|
[414] | 909 | #alias
|
---|
| 910 | packing: pass_packing
|
---|
[353] | 911 |
|
---|
| 912 | ## PASS: clean
|
---|
| 913 | # This pass removes all generated files.
|
---|
| 914 | PASS_CLEAN := Clean
|
---|
| 915 | PASS_CLEAN_trgs := do-clean
|
---|
| 916 | PASS_CLEAN_vars :=
|
---|
| 917 | PASS_CLEAN_pass := clean
|
---|
| 918 | # alias
|
---|
| 919 | clean: pass_clean
|
---|
| 920 |
|
---|
| 921 | ## PASS: nothing
|
---|
| 922 | # This pass just walks the tree.
|
---|
| 923 | PASS_NOTHING := Nothing
|
---|
| 924 | PASS_NOTHING_trgs := do-nothing
|
---|
| 925 | PASS_NOTHING_vars :=
|
---|
| 926 | PASS_NOTHING_pass := nothing
|
---|
| 927 | # alias
|
---|
| 928 | nothing: pass_nothing
|
---|
| 929 |
|
---|
| 930 | ## DEFAULT_PASSES
|
---|
| 931 | # The default passes and their order.
|
---|
| 932 | DEFAULT_PASSES := BLDPROGS LIBRARIES DLLS BINARIES OTHERS INSTALLS
|
---|
| 933 |
|
---|
| 934 | ## PASSES
|
---|
| 935 | # The passes that should be defined. This must include
|
---|
| 936 | # all passes mentioned by DEFAULT_PASSES.
|
---|
[723] | 937 | PASSES := FETCHES PATCHES $(DEFAULT_PASSES) NOTHING CLEAN
|
---|
[353] | 938 |
|
---|
| 939 |
|
---|
| 940 | #
|
---|
[984] | 941 | # Check for --pretty-command-printing before including the Config.kmk
|
---|
| 942 | # so that anyone overriding the message macros can take the implied
|
---|
| 943 | # verbosity level change into account.
|
---|
| 944 | #
|
---|
| 945 | ifndef KBUILD_VERBOSE
|
---|
| 946 | ifndef KBUILD_QUIET
|
---|
| 947 | ifneq ($(filter --pretty-command-printing,$(MAKEFLAGS)),)
|
---|
| 948 | export KBUILD_VERBOSE := 2
|
---|
| 949 | endif
|
---|
| 950 | endif
|
---|
| 951 | endif
|
---|
| 952 |
|
---|
| 953 |
|
---|
| 954 | #
|
---|
[1418] | 955 | # Legacy variable translation.
|
---|
| 956 | # These will be eliminated when switching to the next version.
|
---|
| 957 | #
|
---|
| 958 | ifdef USE_KOBJCACHE
|
---|
| 959 | ifndef KBUILD_USE_KOBJCACHE
|
---|
| 960 | export KBUILD_USE_KOBJCACHE := $(USE_KOBJCACHE)
|
---|
| 961 | endif
|
---|
| 962 | endif
|
---|
| 963 |
|
---|
| 964 |
|
---|
| 965 | #
|
---|
[69] | 966 | # This is how we find the closest config.kmk.
|
---|
| 967 | # It's a little hacky but I think it works fine.
|
---|
[70] | 968 | #
|
---|
| 969 | _CFGDIR := .
|
---|
[78] | 970 | _CFGFILES := ./Config.kmk ./config.kmk
|
---|
[69] | 971 | define def_include_config
|
---|
[78] | 972 | $(eval _CFGDIR := $(_CFGDIR)/$(dir))
|
---|
| 973 | _CFGFILES += $(_CFGDIR)/Config.kmk $(_CFGDIR)/config.kmk
|
---|
[69] | 974 | endef
|
---|
| 975 | # walk down the _RELATIVE_ path specified by DEPTH.
|
---|
[78] | 976 | $(foreach dir,$(subst /, ,$(DEPTH)), $(eval $(def_include_config)) )
|
---|
[69] | 977 | # add the default config file.
|
---|
[78] | 978 | _CFGFILE := $(firstword $(wildcard $(_CFGFILES) $(FILE_KBUILD_CONFIG)))
|
---|
[69] | 979 | _CFGFILES :=
|
---|
| 980 | _CFGDIR :=
|
---|
[416] | 981 | ifeq ($(_CFGFILE),)
|
---|
| 982 | $(error kBuild: no Config.kmk file found! Check the DEPTH: DEPTH='$(DEPTH)' PATH_CURRENT='$(PATH_CURRENT)')
|
---|
| 983 | endif
|
---|
[69] | 984 |
|
---|
| 985 | # Include the config.kmk we found file (or the default one).
|
---|
[988] | 986 | ifdef KBUILD_PROFILE_SELF
|
---|
| 987 | _KBUILD_TS_NOW := $(nanots )
|
---|
| 988 | $(info prof: $(int-sub $(_KBUILD_TS_NOW), $(_KBUILD_TS_HEADER_START)) - $(int-sub $(_KBUILD_TS_NOW), $(_KBUILD_TS_PREV)) - including $(_CFGFILE))
|
---|
[1441] | 989 | $(info stat: $(make-stats ))
|
---|
[988] | 990 | _KBUILD_TS_PREV := $(_KBUILD_TS_NOW)
|
---|
[69] | 991 |
|
---|
[988] | 992 | include $(_CFGFILE)
|
---|
[69] | 993 |
|
---|
[988] | 994 | _KBUILD_TS_NOW := $(nanots )
|
---|
| 995 | $(info prof: $(int-sub $(_KBUILD_TS_NOW), $(_KBUILD_TS_HEADER_START)) - $(int-sub $(_KBUILD_TS_NOW), $(_KBUILD_TS_PREV)) - included $(_CFGFILE))
|
---|
[1441] | 996 | $(info stat: $(make-stats ))
|
---|
[988] | 997 | _KBUILD_TS_PREV := $(_KBUILD_TS_NOW)
|
---|
| 998 | else
|
---|
| 999 | include $(_CFGFILE)
|
---|
| 1000 | endif
|
---|
| 1001 |
|
---|
| 1002 |
|
---|
| 1003 |
|
---|
[696] | 1004 | #
|
---|
[874] | 1005 | # Finalize a the central path variables now that we've included the Config.kmk file.
|
---|
| 1006 | #
|
---|
| 1007 | # This prevents some trouble when users override the defaults for these
|
---|
| 1008 | # variables and uses relative paths or paths with incorrect case.
|
---|
| 1009 | #
|
---|
| 1010 | PATH_OUT := $(abspath $(PATH_OUT))
|
---|
| 1011 | PATH_OBJ := $(abspath $(PATH_OBJ))
|
---|
| 1012 | PATH_TARGET := $(abspath $(PATH_TARGET))
|
---|
| 1013 | PATH_INS := $(abspath $(PATH_INS))
|
---|
| 1014 | PATH_BIN := $(abspath $(PATH_BIN))
|
---|
| 1015 | PATH_DLL := $(abspath $(PATH_DLL))
|
---|
| 1016 | PATH_SYS := $(abspath $(PATH_SYS))
|
---|
| 1017 | PATH_LIB := $(abspath $(PATH_LIB))
|
---|
| 1018 | PATH_DOC := $(abspath $(PATH_DOC))
|
---|
| 1019 |
|
---|
| 1020 |
|
---|
| 1021 | #
|
---|
[788] | 1022 | # Setup the message style. The default one is inlined.
|
---|
[776] | 1023 | #
|
---|
[788] | 1024 | # See kBuild/msgstyles for more styles or use KBUILD_MSG_STYLE_PATHS
|
---|
| 1025 | # to create your own message style.
|
---|
| 1026 | #
|
---|
[776] | 1027 | KBUILD_MSG_STYLE ?= default
|
---|
| 1028 | ifeq ($(KBUILD_MSG_STYLE),default)
|
---|
| 1029 | #
|
---|
| 1030 | # The 'default' style.
|
---|
| 1031 | #
|
---|
| 1032 |
|
---|
| 1033 | ## Fetch starting.
|
---|
| 1034 | # @param 1 Target name.
|
---|
| 1035 | MSG_FETCH ?= $(call MSG_L1,Fetching $1...)
|
---|
| 1036 | ## Re-fetch starting.
|
---|
| 1037 | # @param 1 Target name.
|
---|
| 1038 | MSG_REFETCH ?= $(call MSG_L1,Re-fetching $1...)
|
---|
| 1039 | ## Downloading a fetch component.
|
---|
| 1040 | # @param 1 Target name.
|
---|
| 1041 | # @param 2 The source URL.
|
---|
| 1042 | # @param 3 The destination file name.
|
---|
| 1043 | MSG_FETCH_DL ?= $(call MSG_L1,Downloading $1 - $2,=> $3)
|
---|
| 1044 | ## Checking a fetch component.
|
---|
| 1045 | # @param 1 Target name.
|
---|
| 1046 | # @param 2 The source URL.
|
---|
| 1047 | # @param 3 The destination file name.
|
---|
| 1048 | MSG_FETCH_CHK?= $(call MSG_L1,Checking $1 - $3, ($2))
|
---|
| 1049 | ## Unpacking a fetch component.
|
---|
| 1050 | # @param 1 Target name.
|
---|
| 1051 | # @param 2 The archive file name.
|
---|
| 1052 | # @param 3 The target directory.
|
---|
| 1053 | MSG_FETCH_UP ?= $(call MSG_L1,Unpacking $1 - $2 => $3)
|
---|
| 1054 | ## Fetch completed.
|
---|
| 1055 | # @param 1 Target name.
|
---|
| 1056 | MSG_FETCH_OK ?= $(call MSG_L1,Successfully fetched $1)
|
---|
| 1057 | ## Unfetch a fetch target.
|
---|
| 1058 | # @param 1 Target name.
|
---|
| 1059 | MSG_UNFETCH ?= $(call MSG_L1,Unfetching $1...)
|
---|
| 1060 | ## Compiling a source file.
|
---|
| 1061 | # @param 1 Target name.
|
---|
| 1062 | # @param 2 The source filename.
|
---|
| 1063 | # @param 3 The primary link output file name.
|
---|
[1256] | 1064 | # @param 4 The source type (C,CXX,OBJC,AS,RC,++).
|
---|
[776] | 1065 | MSG_COMPILE ?= $(call MSG_L1,Compiling $1 - $2,=> $3)
|
---|
[890] | 1066 | ## Tool
|
---|
| 1067 | # @param 1 The tool name (bin2c,...)
|
---|
| 1068 | # @param 2 Target name.
|
---|
| 1069 | # @param 3 The source filename.
|
---|
| 1070 | # @param 4 The primary output file name.
|
---|
| 1071 | MSG_TOOL ?= $(call MSG_L1,$1 $2 - $3,=> $4)
|
---|
| 1072 | ## Generate a file, typically a source file.
|
---|
| 1073 | # @param 1 Target name if applicable.
|
---|
| 1074 | # @param 2 Output file name.
|
---|
| 1075 | # @param 3 What it's generated from
|
---|
| 1076 | MSG_GENERATE ?= $(call MSG_L1,Generating $(if $1,$1 - )$2,$(if $3,from $3))
|
---|
[776] | 1077 | ## Linking a bldprog/dll/program/sysmod target.
|
---|
| 1078 | # @param 1 Target name.
|
---|
| 1079 | # @param 2 The primary link output file name.
|
---|
| 1080 | # @param 3 The link tool operation (LINK_LIBRARY,LINK_PROGRAM,LINK_DLL,LINK_SYSMOD,++).
|
---|
| 1081 | MSG_LINK ?= $(call MSG_L1,Linking $1,=> $2)
|
---|
[844] | 1082 | ## Merging a library into the target (during library linking).
|
---|
| 1083 | # @param 1 Target name.
|
---|
| 1084 | # @param 2 The output library name.
|
---|
| 1085 | # @param 3 The input library name.
|
---|
[845] | 1086 | MSG_AR_MERGE ?= $(call MSG_L1,Merging $3 into $1, ($2))
|
---|
[776] | 1087 | ## Creating a directory (build).
|
---|
| 1088 | # @param 1 Directory name.
|
---|
| 1089 | MSG_MKDIR ?= $(call MSG_L2,Creating directory $1)
|
---|
| 1090 | ## Cleaning.
|
---|
| 1091 | MSG_CLEAN ?= $(call MSG_L1,Cleaning...)
|
---|
| 1092 | ## Nothing.
|
---|
| 1093 | MSG_NOTHING ?= $(call MSG_L1,Did nothing in $(CURDIR))
|
---|
| 1094 | ## Pass
|
---|
| 1095 | # @param 1 The pass name.
|
---|
| 1096 | MSG_PASS ?= $(call MSG_L1,Pass - $1)
|
---|
| 1097 | ## Installing a bldprog/lib/dll/program/sysmod target.
|
---|
| 1098 | # @param 1 Target name.
|
---|
| 1099 | # @param 2 The source filename.
|
---|
| 1100 | # @param 3 The destination file name.
|
---|
| 1101 | MSG_INST_TRG ?= $(call MSG_L1,Installing $1 => $3)
|
---|
| 1102 | ## Installing a file (install target).
|
---|
| 1103 | # @param 1 The source filename.
|
---|
| 1104 | # @param 2 The destination filename.
|
---|
| 1105 | MSG_INST_FILE?= $(call MSG_L1,Installing $2,(<= $1))
|
---|
| 1106 | ## Installing a symlink.
|
---|
| 1107 | # @param 1 Symlink
|
---|
| 1108 | # @param 2 Link target
|
---|
| 1109 | MSG_INST_SYM ?= $(call MSG_L1,Installing symlink $1,=> $2)
|
---|
| 1110 | ## Installing a directory.
|
---|
| 1111 | # @param 1 Directory name.
|
---|
| 1112 | MSG_INST_DIR ?= $(call MSG_L1,Installing directory $1)
|
---|
| 1113 |
|
---|
[788] | 1114 | else
|
---|
[1504] | 1115 | _KBUILD_MSG_STYLE_FILE := $(firstword $(foreach path, $(KBUILD_MSG_STYLE_PATHS) $(KBUILD_PATH)/msgstyles, $(wildcard $(path)/$(KBUILD_MSG_STYLE).kmk)))
|
---|
[788] | 1116 | ifneq ($(_KBUILD_MSG_STYLE_FILE),)
|
---|
| 1117 | include $(_KBUILD_MSG_STYLE_FILE)
|
---|
[776] | 1118 | else
|
---|
[788] | 1119 | $(error kBuild: Can't find the style setup file for KBUILD_MSG_STYLE '$(KBUILD_MSG_STYLE)')
|
---|
[776] | 1120 | endif
|
---|
| 1121 | endif
|
---|
| 1122 |
|
---|
| 1123 |
|
---|
| 1124 | #
|
---|
[696] | 1125 | # Message macros.
|
---|
| 1126 | #
|
---|
[748] | 1127 | # This is done after including Config.kmk as to allow for
|
---|
[696] | 1128 | # KBUILD_QUIET and KBUILD_VERBOSE to be configurable.
|
---|
| 1129 | #
|
---|
| 1130 | ifdef KBUILD_QUIET
|
---|
[776] | 1131 | # No output
|
---|
[696] | 1132 | QUIET := @
|
---|
| 1133 | QUIET2:= @
|
---|
| 1134 | MSG_L1 =
|
---|
| 1135 | MSG_L2 =
|
---|
| 1136 | else
|
---|
| 1137 | ifndef KBUILD_VERBOSE
|
---|
[776] | 1138 | # Default output level.
|
---|
| 1139 | QUIET := @
|
---|
| 1140 | QUIET2 := @
|
---|
[1496] | 1141 | MSG_L1 ?= %@$(ECHO) "kBuild: $1"
|
---|
[776] | 1142 | MSG_L2 =
|
---|
| 1143 | else ifeq ($(KBUILD_VERBOSE),1)
|
---|
| 1144 | # A bit more output
|
---|
| 1145 | QUIET := @
|
---|
| 1146 | QUIET2 := @
|
---|
[1496] | 1147 | MSG_L1 ?= %@$(ECHO) "kBuild: $1 $2"
|
---|
[776] | 1148 | MSG_L2 =
|
---|
| 1149 | else ifeq ($(KBUILD_VERBOSE),2)
|
---|
| 1150 | # Lot more output
|
---|
| 1151 | QUIET :=
|
---|
| 1152 | QUIET2 := @
|
---|
[1496] | 1153 | MSG_L1 ?= %@$(ECHO) "kBuild: $1 $2"
|
---|
| 1154 | MSG_L2 ?= %@$(ECHO) "kBuild: $1"
|
---|
[696] | 1155 | else
|
---|
| 1156 | # maximal output.
|
---|
[776] | 1157 | QUIET :=
|
---|
| 1158 | QUIET2 :=
|
---|
[1496] | 1159 | MSG_L1 ?= %@$(ECHO) "kBuild: $1 $2"
|
---|
| 1160 | MSG_L2 ?= %@$(ECHO) "kBuild: $1"
|
---|
[696] | 1161 | endif
|
---|
| 1162 | endif
|
---|
| 1163 |
|
---|
[776] | 1164 |
|
---|
[1403] | 1165 | #
|
---|
[1504] | 1166 | # Validate any KBUILD_BLD_TYPES additions and finally the KBUILD_TYPE.
|
---|
[1403] | 1167 | #
|
---|
| 1168 | if1of ($(KBUILD_BLD_TYPES), $(KBUILD_OSES))
|
---|
| 1169 | $(error kBuild: found KBUILD_BLD_TYPES in KBUILD_OSES!)
|
---|
| 1170 | endif
|
---|
| 1171 | if1of ($(KBUILD_BLD_TYPES), $(KBUILD_ARCHES))
|
---|
| 1172 | $(error kBuild: found KBUILD_BLD_TYPES in KBUILD_ARCHES!)
|
---|
| 1173 | endif
|
---|
| 1174 | if1of ($(KBUILD_OSES), $(KBUILD_ARCHES))
|
---|
| 1175 | $(error kBuild: found KBUILD_OSES in KBUILD_ARCHES!)
|
---|
| 1176 | endif
|
---|
[1504] | 1177 | ifn1of ($(KBUILD_TYPE), $(KBUILD_BLD_TYPES))
|
---|
| 1178 | $(error kBuild: KBUILD_TYPE(=$(KBUILD_TYPE)) is not found in KBUILD_BLD_TYPES(=$(KBUILD_BLD_TYPES))!)
|
---|
[1403] | 1179 | endif
|
---|
| 1180 |
|
---|
| 1181 |
|
---|
| 1182 |
|
---|
[988] | 1183 | ifdef KBUILD_PROFILE_SELF
|
---|
| 1184 | _KBUILD_TS_HEADER_END := $(nanots )
|
---|
| 1185 | $(info prof: $(int-sub $(_KBUILD_TS_HEADER_END), $(_KBUILD_TS_HEADER_START)) - $(int-sub $(_KBUILD_TS_HEADER_END), $(_KBUILD_TS_PREV)) - end of header.kmk)
|
---|
[1441] | 1186 | $(info stat: $(make-stats ))
|
---|
[988] | 1187 | _KBUILD_TS_PREV := $(_KBUILD_TS_HEADER_END)
|
---|
| 1188 | endif
|
---|
| 1189 |
|
---|
[69] | 1190 | # end-of-file-content
|
---|
[72] | 1191 | __header_kmk__ := 1
|
---|
[69] | 1192 | endif # __header_kmk__
|
---|
[479] | 1193 |
|
---|