[69] | 1 | # $Id: header.kmk 978 2007-05-27 18:58:51Z bird $
|
---|
| 2 | ## @file
|
---|
| 3 | #
|
---|
[978] | 4 | # kBuild - File included at top of a makefile.
|
---|
[69] | 5 | #
|
---|
[782] | 6 | # Copyright (c) 2004-2007 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
|
---|
| 29 |
|
---|
[978] | 30 |
|
---|
[69] | 31 | #
|
---|
[978] | 32 | # Check make version before we do anything else.
|
---|
[69] | 33 | #
|
---|
[978] | 34 | ifndef KMK_VERSION
|
---|
| 35 | $(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.)
|
---|
| 36 | endif
|
---|
| 37 | ifneq ($(KBUILD_VERSION_MAJOR).$(KBUILD_VERSION_MINOR),0.1)
|
---|
| 38 | ifneq ($(KBUILD_VERSION_MAJOR),0)
|
---|
| 39 | $(warning kBuild: kmk major version mismatch, expected '0' found '$(KBUILD_VERSION_MAJOR)'!)
|
---|
| 40 | else
|
---|
| 41 | $(warning kBuild: kmk minor version mismatch, expected '1' found '$(KBUILD_VERSION_MINOR)'!)
|
---|
| 42 | endif
|
---|
| 43 | endif
|
---|
[69] | 44 |
|
---|
| 45 | #
|
---|
[978] | 46 | # The revision in which this file was last modified.
|
---|
| 47 | # This can be useful when using development versions of kBuild.
|
---|
[380] | 48 | #
|
---|
[978] | 49 | KMK_REVISION := $(patsubst %:,, $Rev: 978 $ )
|
---|
[414] | 50 |
|
---|
[978] | 51 |
|
---|
[380] | 52 | #
|
---|
[978] | 53 | # Define the default goal.
|
---|
[69] | 54 | #
|
---|
[978] | 55 | all: all_recursive
|
---|
[69] | 56 |
|
---|
[894] | 57 | #
|
---|
[978] | 58 | # The phony FORCE target.
|
---|
[894] | 59 | #
|
---|
[978] | 60 | FORCE:
|
---|
[72] | 61 |
|
---|
[978] | 62 |
|
---|
[69] | 63 | #
|
---|
[978] | 64 | # Enable delete on error and second expansion of prerequisites.
|
---|
[894] | 65 | #
|
---|
[978] | 66 | .DELETE_ON_ERROR:
|
---|
| 67 |
|
---|
[894] | 68 | .SECONDEXPANSION:
|
---|
| 69 |
|
---|
| 70 |
|
---|
| 71 | #
|
---|
[95] | 72 | # General purpose macros.
|
---|
| 73 | #
|
---|
[204] | 74 |
|
---|
[380] | 75 | ##
|
---|
| 76 | # Newline character(s).
|
---|
| 77 | define NL
|
---|
[95] | 78 |
|
---|
[380] | 79 |
|
---|
| 80 | endef
|
---|
| 81 |
|
---|
| 82 | ##
|
---|
| 83 | # Tab character.
|
---|
| 84 | TAB := $(subst ., ,.)
|
---|
| 85 |
|
---|
| 86 | ##
|
---|
[896] | 87 | # Newline + tab characters (for generating commands).
|
---|
| 88 | NLTAB = $(NL)$(TAB)
|
---|
| 89 |
|
---|
| 90 | ##
|
---|
[380] | 91 | # Space character.
|
---|
| 92 | SP := $(subst ., ,.)
|
---|
| 93 |
|
---|
| 94 | ##
|
---|
[895] | 95 | # Hash character.
|
---|
| 96 | define HASH
|
---|
| 97 | #
|
---|
| 98 | endef
|
---|
[380] | 99 |
|
---|
[895] | 100 | ##
|
---|
| 101 | # Colon character.
|
---|
| 102 | COLON := :
|
---|
| 103 |
|
---|
| 104 | ##
|
---|
| 105 | # Semicolon character.
|
---|
| 106 | SEMICOLON := ;
|
---|
| 107 |
|
---|
| 108 | ##
|
---|
| 109 | # Comma character.
|
---|
| 110 | COMMA := ,
|
---|
| 111 |
|
---|
| 112 | ##
|
---|
| 113 | # Dot character.
|
---|
| 114 | DOT := .
|
---|
| 115 |
|
---|
| 116 | ##
|
---|
| 117 | # Dollar character.
|
---|
| 118 | DOLLAR := $$
|
---|
| 119 |
|
---|
| 120 | ##
|
---|
| 121 | # Equal character.
|
---|
| 122 | EQUAL := =
|
---|
| 123 |
|
---|
| 124 |
|
---|
[95] | 125 | #
|
---|
[978] | 126 | # The OSes and Architectures that kBuild recognizes.
|
---|
| 127 | #
|
---|
| 128 | # When kBuild is ported to a new OS or architecture a unique keyword needs
|
---|
| 129 | # to be assigned to it and added here. This strictness is required because
|
---|
| 130 | # this keyword namespace is shared between OSes, architectures, cpus and
|
---|
| 131 | # build types.
|
---|
| 132 | #
|
---|
| 133 | KBUILD_OSES = darwin freebsd l4 linux netbsd nt openbsd os2 solaris win
|
---|
| 134 | KBUILD_ARCHES = x86 amd64 sparc32 sparc64 mips32 mips64 ppc32 ppc64
|
---|
| 135 |
|
---|
| 136 |
|
---|
| 137 | #
|
---|
[585] | 138 | # Set default build type.
|
---|
[69] | 139 | #
|
---|
| 140 | ifndef BUILD_TYPE
|
---|
[978] | 141 | BUILD_TYPE := release
|
---|
| 142 | else
|
---|
| 143 | ifneq ($(filter $(BUILD_TYPE),$(KBUILD_OSES) $(KBUILD_ARCHES)),)
|
---|
| 144 | $(error kBuild: The BUILD_TYPE value '$(BUILD_TYPE)' is an OS or architecture!)
|
---|
[585] | 145 | endif
|
---|
[978] | 146 | ifneq (.$(words $(BUILD_TYPE)).$(BUILD_TYPE).,.1.$(strip $(BUILD_TYPE)).)
|
---|
| 147 | $(error kBuild: The BUILD_TYPE value '$(BUILD_TYPE)' contains spaces/tabs!)
|
---|
| 148 | endif
|
---|
[72] | 149 | endif
|
---|
[69] | 150 |
|
---|
| 151 |
|
---|
| 152 | #
|
---|
[978] | 153 | # Assert valid build platform variables.
|
---|
[70] | 154 | #
|
---|
[978] | 155 | # All these are set by kmk so they shouldn't be any trouble
|
---|
| 156 | # unless the user starts messing about with environment variables.
|
---|
| 157 | #
|
---|
| 158 | ifneq (.$(words $(BUILD_PLATFORM)).$(BUILD_PLATFORM).,.1.$(strip $(BUILD_PLATFORM)).)
|
---|
| 159 | $(error kBuild: The BUILD_PLATFORM value '$(BUILD_PLATFORM)' contains spaces/tabs!)
|
---|
[72] | 160 | endif
|
---|
[978] | 161 | ifneq ($(words $(filter $(BUILD_PLATFORM),$(KBUILD_OSES))),1)
|
---|
| 162 | $(error kBuild: BUILD_PLATFORM value '$(BUILD_PLATFORM)' is not recognized (valid: $(KBUILD_OSES)))
|
---|
| 163 | endif
|
---|
[70] | 164 |
|
---|
[978] | 165 | ifneq (.$(BUILD_PLATFORM_ARCH).,.$(strip $(BUILD_PLATFORM_ARCH)).)
|
---|
| 166 | $(error kBuild: The BUILD_PLATFORM_ARCH value '$(BUILD_PLATFORM_ARCH)' contains spaces/tabs!)
|
---|
[329] | 167 | endif
|
---|
[978] | 168 | ifneq ($(words $(filter $(BUILD_PLATFORM_ARCH),$(KBUILD_ARCHES))),1)
|
---|
| 169 | $(error kBuild: BUILD_PLATFORM_ARCH value '$(BUILD_PLATFORM_ARCH)' is not recognized (valid: $(KBUILD_ARCHES)))
|
---|
[329] | 170 | endif
|
---|
[72] | 171 |
|
---|
[978] | 172 | ifeq ($(strip $(BUILD_PLATFORM_CPU)),)
|
---|
| 173 | $(error kBuild: The BUILD_PLATFORM_CPU value is missing (should be set by kmk)!)
|
---|
| 174 | endif
|
---|
| 175 | ifneq (.$(words $(BUILD_PLATFORM_CPU)).$(BUILD_PLATFORM_CPU).,.1.$(strip $(BUILD_PLATFORM_CPU)).)
|
---|
| 176 | $(error kBuild: The BUILD_PLATFORM_CPU value '$(BUILD_PLATFORM_CPU)' contains spaces/tabs!)
|
---|
| 177 | endif
|
---|
| 178 | ifneq ($(filter $(BUILD_PLATFORM_CPU), $(KBUILD_OSES) $(BUILD_ARCHES)),)
|
---|
| 179 | $(error kBuild: The BUILD_PLATFORM_CPU value '$(BUILD_PLATFORM_CPU)' was found in the OS or architecture keywords!)
|
---|
| 180 | endif
|
---|
| 181 | ifeq ($(BUILD_PLATFORM_CPU),$(BUILD_TYPE))
|
---|
| 182 | $(error kBuild: The BUILD_PLATFORM_CPU value '$(BUILD_PLATFORM_CPU)' is the same as the BUILD_TYPE!)
|
---|
| 183 | endif
|
---|
[72] | 184 |
|
---|
[978] | 185 |
|
---|
[70] | 186 | #
|
---|
[978] | 187 | # Assert or set default target platform.
|
---|
| 188 | # When not defined use the corresponding BUILD_PLATFORM value.
|
---|
[72] | 189 | #
|
---|
| 190 | ifndef BUILD_TARGET
|
---|
[978] | 191 | BUILD_TARGET := $(BUILD_PLATFORM)
|
---|
[72] | 192 | else
|
---|
[978] | 193 | ifneq (.$(words $(BUILD_TARGET)).$(BUILD_TARGET).,.$(strip $(BUILD_TARGET)).)
|
---|
| 194 | $(error kBuild: The BUILD_TARGET value '$(BUILD_TARGET)' contains spaces/tabs!)
|
---|
[478] | 195 | endif
|
---|
[978] | 196 | ifneq ($(words $(filter $(BUILD_TARGET),$(KBUILD_OSES))),1)
|
---|
| 197 | $(error kBuild: BUILD_TARGET value '$(BUILD_TARGET)' is not recognized (valid: $(KBUILD_OSES)))
|
---|
| 198 | endif
|
---|
[72] | 199 | endif
|
---|
| 200 |
|
---|
[329] | 201 | ifndef BUILD_TARGET_ARCH
|
---|
[978] | 202 | BUILD_TARGET_ARCH := $(BUILD_PLATFORM_ARCH)
|
---|
| 203 | else
|
---|
| 204 | ifneq (.$(BUILD_TARGET_ARCH).,.$(strip $(BUILD_TARGET_ARCH)).)
|
---|
| 205 | $(error kBuild: The BUILD_TARGET_ARCH value '$(BUILD_TARGET_ARCH)' contains spaces/tabs!)
|
---|
| 206 | endif
|
---|
| 207 | ifneq ($(words $(filter $(BUILD_TARGET_ARCH),$(KBUILD_ARCHES))),1)
|
---|
| 208 | $(error kBuild: BUILD_TARGET_ARCH value '$(BUILD_TARGET_ARCH)' is not recognized (valid: $(KBUILD_ARCHES)))
|
---|
| 209 | endif
|
---|
[329] | 210 | endif
|
---|
[978] | 211 |
|
---|
[329] | 212 | ifndef BUILD_TARGET_CPU
|
---|
[978] | 213 | BUILD_TARGET_CPU := $(BUILD_PLATFORM_CPU)
|
---|
| 214 | else
|
---|
| 215 | ifeq ($(strip $(BUILD_TARGET_CPU)),)
|
---|
| 216 | $(error kBuild: The BUILD_TARGET_CPU value is missing (should be set by kmk)!)
|
---|
| 217 | endif
|
---|
| 218 | ifneq (.$(words $(BUILD_TARGET_CPU)).$(BUILD_TARGET_CPU).,.1.$(strip $(BUILD_TARGET_CPU)).)
|
---|
| 219 | $(error kBuild: The BUILD_TARGET_CPU value '$(BUILD_TARGET_CPU)' contains spaces/tabs!)
|
---|
| 220 | endif
|
---|
| 221 | ifneq ($(filter $(BUILD_TARGET_CPU), $(KBUILD_OSES) $(BUILD_ARCHES)),)
|
---|
| 222 | $(error kBuild: The BUILD_TARGET_CPU value was found in the OS or architecture keywords!)
|
---|
| 223 | endif
|
---|
| 224 | ifeq ($(BUILD_TARGET_CPU),$(BUILD_TYPE))
|
---|
| 225 | $(error kBuild: The BUILD_TARGET_CPU value '$(BUILD_TARGET_CPU)' is the same as the BUILD_TYPE!)
|
---|
| 226 | endif
|
---|
[329] | 227 | endif
|
---|
[72] | 228 |
|
---|
| 229 |
|
---|
| 230 | #
|
---|
[978] | 231 | # Paths and stuff.
|
---|
[69] | 232 | #
|
---|
[978] | 233 |
|
---|
| 234 | # Adjust DEPTH first.
|
---|
| 235 | DEPTH := $(strip $(DEPTH))
|
---|
| 236 | ifeq ($(DEPTH),)
|
---|
| 237 | DEPTH := .
|
---|
| 238 | endif
|
---|
| 239 |
|
---|
[725] | 240 | ## PATH_CURRENT is the current directory (getcwd).
|
---|
[306] | 241 | PATH_CURRENT := $(abspath $(CURDIR))
|
---|
[725] | 242 | ## PATH_SUB_CURRENT points to current directory of the current makefile.
|
---|
| 243 | # Meaning that it will change value as we enter and exit sub-makefiles.
|
---|
| 244 | PATH_SUB_CURRENT := $(PATH_CURRENT)
|
---|
| 245 | ## PATH_ROOT points to the project root directory.
|
---|
| 246 | PATH_ROOT := $(abspath $(PATH_CURRENT)/$(DEPTH))
|
---|
| 247 | ## PATH_SUB_ROOT points to the directory of the top-level makefile.
|
---|
[472] | 248 | ifneq ($(strip $(SUB_DEPTH)),)
|
---|
[978] | 249 | SUB_DEPTH := $(strip $(SUB_DEPTH))
|
---|
[725] | 250 | PATH_SUB_ROOT := $(abspath $(PATH_CURRENT)/$(SUB_DEPTH))
|
---|
[472] | 251 | else
|
---|
[725] | 252 | PATH_SUB_ROOT := $(PATH_CURRENT)
|
---|
[472] | 253 | endif
|
---|
[306] | 254 |
|
---|
[748] | 255 | ## CURSUBDIR is PATH_SUB_ROOT described relative to PATH_ROOT.
|
---|
[725] | 256 | # This variable is used to determin where the object files and other output goes.
|
---|
[306] | 257 | ifneq ($(PATH_ROOT),$(PATH_CURRENT))
|
---|
[725] | 258 | CURSUBDIR := $(patsubst $(PATH_ROOT)/%,%,$(PATH_SUB_ROOT))
|
---|
[266] | 259 | else
|
---|
| 260 | CURSUBDIR := .
|
---|
| 261 | endif
|
---|
[306] | 262 |
|
---|
[70] | 263 | # Output directories.
|
---|
[242] | 264 | ifndef PATH_OUT_BASE
|
---|
[725] | 265 | PATH_OUT_BASE := $(PATH_ROOT)/out
|
---|
[242] | 266 | endif
|
---|
[240] | 267 | ifndef PATH_OUT
|
---|
[725] | 268 | ifdef BUILD_TARGET_SUB # (BUILD_TARGET_SUB is not currently recognized by kBuild in any other places.)
|
---|
| 269 | PATH_OUT := $(PATH_OUT_BASE)/$(BUILD_TARGET).$(BUILD_TARGET_ARCH).$(BUILD_TARGET_SUB)/$(BUILD_TYPE)
|
---|
| 270 | else
|
---|
| 271 | PATH_OUT := $(PATH_OUT_BASE)/$(BUILD_TARGET).$(BUILD_TARGET_ARCH)/$(BUILD_TYPE)
|
---|
| 272 | endif
|
---|
[329] | 273 | endif # !define PATH_OUT
|
---|
[353] | 274 | PATH_OBJ = $(PATH_OUT)/obj
|
---|
| 275 | PATH_TARGET = $(PATH_OBJ)/$(CURSUBDIR)
|
---|
| 276 | PATH_INS = $(PATH_OUT)
|
---|
| 277 | PATH_BIN = $(PATH_INS)/bin
|
---|
| 278 | PATH_DLL = $(PATH_INS)/bin
|
---|
| 279 | PATH_SYS = $(PATH_INS)/bin
|
---|
| 280 | PATH_LIB = $(PATH_INS)/lib
|
---|
| 281 | PATH_DOC = $(PATH_INS)/doc
|
---|
[70] | 282 |
|
---|
[978] | 283 | # PATH_KBUILD is determined by kmk.
|
---|
| 284 | ifeq ($(strip $(PATH_KBUILD)),)
|
---|
| 285 | $(error kBuild: PATH_KBUILD is missing or empty! kmk is supposed to set it.)
|
---|
[70] | 286 | endif
|
---|
[978] | 287 | # PATH_KBUILD_BIN is determined by kmk.
|
---|
| 288 | ifeq ($(strip $(PATH_KBUILD_BIN)),)
|
---|
| 289 | $(error kBuild: PATH_KBUILD_BIN is missing or empty! kmk is supposed to set it.)
|
---|
| 290 | endif
|
---|
| 291 |
|
---|
[69] | 292 | # kBuild files which might be of interest.
|
---|
| 293 | FILE_KBUILD_HEADER := $(PATH_KBUILD)/header.kmk
|
---|
[725] | 294 | #FILE_KBUILD_CONFIG := $(PATH_KBUILD)/config.kmk
|
---|
[69] | 295 | FILE_KBUILD_FOOTER := $(PATH_KBUILD)/footer.kmk
|
---|
| 296 |
|
---|
[725] | 297 | ## MAKEFILE is the name of the main makefile.
|
---|
[204] | 298 | MAKEFILE := $(firstword $(MAKEFILE_LIST))
|
---|
[748] | 299 | ## MAKEFILE_CURRENT is the name of the current makefile.
|
---|
[725] | 300 | # This is updated everything a sub-makefile is included.
|
---|
| 301 | MAKEFILE_CURRENT := $(MAKEFILE)
|
---|
[69] | 302 |
|
---|
[72] | 303 |
|
---|
[69] | 304 | #
|
---|
[72] | 305 | # Build platform setup.
|
---|
[69] | 306 | #
|
---|
| 307 | # OS/2
|
---|
[72] | 308 | ifeq ($(BUILD_PLATFORM),os2)
|
---|
[83] | 309 | EXEC_X86_WIN32 := innopec.exe
|
---|
[69] | 310 | HOSTSUFF_EXE := .exe
|
---|
| 311 | endif
|
---|
| 312 |
|
---|
| 313 | # Linux
|
---|
[72] | 314 | ifeq ($(BUILD_PLATFORM),linux)
|
---|
[135] | 315 | EXEC_X86_WIN32 := wine
|
---|
[69] | 316 | HOSTSUFF_EXE :=
|
---|
| 317 | endif
|
---|
[70] | 318 |
|
---|
[547] | 319 | # Win, Win32, Win64, NT.
|
---|
| 320 | ifeq ($(filter-out win32 win64 win nt,$(BUILD_PLATFORM)),)
|
---|
[69] | 321 | EXEC_X86_WIN32 :=
|
---|
| 322 | HOSTSUFF_EXE := .exe
|
---|
| 323 | endif
|
---|
| 324 |
|
---|
[299] | 325 | # FreeBSD
|
---|
| 326 | ifeq ($(BUILD_PLATFORM),freebsd)
|
---|
| 327 | EXEC_X86_WIN32 := wine
|
---|
| 328 | HOSTSUFF_EXE :=
|
---|
| 329 | endif
|
---|
[125] | 330 |
|
---|
[557] | 331 | # Darwin / Mac OS X
|
---|
| 332 | ifeq ($(BUILD_PLATFORM),darwin)
|
---|
| 333 | EXEC_X86_WIN32 := false
|
---|
| 334 | HOSTSUFF_EXE :=
|
---|
| 335 | endif
|
---|
| 336 |
|
---|
[811] | 337 | # Solaris
|
---|
| 338 | ifeq ($(BUILD_PLATFORM),solaris)
|
---|
| 339 | EXEC_X86_WIN32 := false
|
---|
| 340 | HOSTSUFF_EXE :=
|
---|
| 341 | endif
|
---|
| 342 |
|
---|
[299] | 343 |
|
---|
[73] | 344 | #
|
---|
| 345 | # Build target setup.
|
---|
| 346 | #
|
---|
[978] | 347 | SUFF_DEP := .dep
|
---|
[480] | 348 | ifeq ($(filter-out win32 win64 win nt os2,$(BUILD_TARGET)),)
|
---|
[73] | 349 | SUFF_OBJ := .obj
|
---|
| 350 | SUFF_LIB := .lib
|
---|
| 351 | SUFF_DLL := .dll
|
---|
| 352 | SUFF_EXE := .exe
|
---|
[86] | 353 | SUFF_SYS := .sys
|
---|
[73] | 354 | SUFF_RES := .res
|
---|
| 355 | endif
|
---|
[480] | 356 | ifeq ($(BUILD_TARGET),l4)
|
---|
[73] | 357 | SUFF_OBJ := .o
|
---|
| 358 | SUFF_LIB := .a
|
---|
[480] | 359 | SUFF_DLL := .s.so
|
---|
[73] | 360 | SUFF_EXE :=
|
---|
[86] | 361 | SUFF_SYS := .a
|
---|
[73] | 362 | SUFF_RES :=
|
---|
| 363 | endif
|
---|
[557] | 364 | ifeq ($(BUILD_TARGET),darwin)
|
---|
| 365 | SUFF_OBJ := .o
|
---|
| 366 | SUFF_LIB := .a
|
---|
| 367 | SUFF_DLL := .dylib
|
---|
| 368 | SUFF_EXE :=
|
---|
[761] | 369 | SUFF_SYS :=
|
---|
[557] | 370 | SUFF_RES :=
|
---|
| 371 | endif
|
---|
[480] | 372 | ifndef SUFF_OBJ
|
---|
[296] | 373 | SUFF_OBJ := .o
|
---|
| 374 | SUFF_LIB := .a
|
---|
[480] | 375 | SUFF_DLL := .so
|
---|
[296] | 376 | SUFF_EXE :=
|
---|
| 377 | SUFF_SYS := .a
|
---|
| 378 | SUFF_RES :=
|
---|
| 379 | endif
|
---|
[69] | 380 |
|
---|
| 381 | #
|
---|
| 382 | # Standard kBuild tools.
|
---|
| 383 | #
|
---|
[978] | 384 | ifeq ($(KMK),kmk)
|
---|
| 385 | KMK := $(PATH_KBUILD_BIN)/kmk$(HOSTSUFF_EXE)
|
---|
[233] | 386 | endif
|
---|
[978] | 387 | MAKE := $(KMK)
|
---|
[233] | 388 |
|
---|
[578] | 389 | DEP_EXT := $(PATH_KBUILD_BIN)/kDep$(HOSTSUFF_EXE)
|
---|
[380] | 390 | ifeq ($(filter kDep,$(KMK_BUILTIN)),kDep)
|
---|
[397] | 391 | DEP := kmk_builtin_kDep
|
---|
[230] | 392 | else
|
---|
[380] | 393 | DEP := $(DEP_EXT)
|
---|
[230] | 394 | endif
|
---|
[69] | 395 |
|
---|
[578] | 396 | DEP_IDB_EXT := $(PATH_KBUILD_BIN)/kDepIDB$(HOSTSUFF_EXE)
|
---|
[397] | 397 | ifeq ($(filter kDepPre,$(KMK_BUILTIN)),kDepIDB)
|
---|
| 398 | DEP_IDB := $(if kmk_builtin_kDepIDB
|
---|
| 399 | else
|
---|
| 400 | DEP_IDB := $(DEP_IDB_EXT)
|
---|
| 401 | endif
|
---|
| 402 |
|
---|
[578] | 403 | DEP_PRE_EXT := $(PATH_KBUILD_BIN)/kDepPre$(HOSTSUFF_EXE)
|
---|
[380] | 404 | ifeq ($(filter kDepPre,$(KMK_BUILTIN)),kDepPre)
|
---|
| 405 | DEP_PRE := $(if kmk_builtin_kDepPre
|
---|
| 406 | else
|
---|
| 407 | DEP_PRE := $(DEP_PRE_EXT)
|
---|
| 408 | endif
|
---|
| 409 |
|
---|
[578] | 410 | APPEND_EXT := $(PATH_KBUILD_BIN)/kmk_append$(HOSTSUFF_EXE)
|
---|
[380] | 411 | APPEND := kmk_builtin_append
|
---|
[69] | 412 |
|
---|
[578] | 413 | CAT_EXT := $(PATH_KBUILD_BIN)/kmk_cat$(HOSTSUFF_EXE)
|
---|
[380] | 414 | CAT := kmk_builtin_cat
|
---|
[353] | 415 |
|
---|
[578] | 416 | CP_EXT := $(PATH_KBUILD_BIN)/kmk_cp$(HOSTSUFF_EXE)
|
---|
[380] | 417 | CP := kmk_builtin_cp
|
---|
| 418 |
|
---|
[578] | 419 | ECHO_EXT := $(PATH_KBUILD_BIN)/kmk_echo$(HOSTSUFF_EXE)
|
---|
[380] | 420 | ECHO := kmk_builtin_echo
|
---|
| 421 |
|
---|
[578] | 422 | INSTALL_EXT := $(PATH_KBUILD_BIN)/kmk_install$(HOSTSUFF_EXE)
|
---|
[380] | 423 | INSTALL := kmk_builtin_install
|
---|
| 424 |
|
---|
[578] | 425 | LN_EXT := $(PATH_KBUILD_BIN)/kmk_ln$(HOSTSUFF_EXE)
|
---|
[380] | 426 | LN := kmk_builtin_ln
|
---|
| 427 |
|
---|
[578] | 428 | MKDIR_EXT := $(PATH_KBUILD_BIN)/kmk_mkdir$(HOSTSUFF_EXE)
|
---|
[380] | 429 | MKDIR := kmk_builtin_mkdir
|
---|
| 430 |
|
---|
[578] | 431 | MV_EXT := $(PATH_KBUILD_BIN)/kmk_mv$(HOSTSUFF_EXE)
|
---|
[380] | 432 | MV := kmk_builtin_mv
|
---|
| 433 |
|
---|
[776] | 434 | PRINTF_EXT := $(PATH_KBUILD_BIN)/kmk_printf$(HOSTSUFF_EXE)
|
---|
| 435 | PRINTF := kmk_builtin_printf
|
---|
| 436 |
|
---|
[578] | 437 | RM_EXT := $(PATH_KBUILD_BIN)/kmk_rm$(HOSTSUFF_EXE)
|
---|
[380] | 438 | RM := kmk_builtin_rm
|
---|
| 439 |
|
---|
[601] | 440 | RMDIR_EXT := $(PATH_KBUILD_BIN)/kmk_rmdir$(HOSTSUFF_EXE)
|
---|
| 441 | RMDIR := kmk_builtin_rmdir
|
---|
| 442 |
|
---|
[578] | 443 | SED_EXT := $(PATH_KBUILD_BIN)/kmk_sed$(HOSTSUFF_EXE)
|
---|
[380] | 444 | ifeq ($(filter sed,$(KMK_BUILTIN)),sed)
|
---|
[978] | 445 | SED_INT := kmk_builtin_sed
|
---|
[380] | 446 | else
|
---|
[978] | 447 | SED_INT := $(SED_EXT)
|
---|
| 448 | endif
|
---|
[380] | 449 | SED := $(SED_EXT)
|
---|
| 450 |
|
---|
| 451 | # Our default shell is the Almquist shell from *BSD.
|
---|
[578] | 452 | ASH := $(PATH_KBUILD_BIN)/kmk_ash$(HOSTSUFF_EXE)
|
---|
[380] | 453 | MAKESHELL := $(ASH)
|
---|
| 454 | SHELL := $(ASH)
|
---|
| 455 | export SHELL MAKESHELL
|
---|
| 456 |
|
---|
[414] | 457 | # Symlinking is problematic on some platforms...
|
---|
[380] | 458 | LN_SYMLINK := $(LN) -s
|
---|
| 459 |
|
---|
[743] | 460 |
|
---|
| 461 | #
|
---|
| 462 | # Some Functions.
|
---|
[748] | 463 | # The lower cased ones are either fallbacks or candidates for functions.c.
|
---|
[743] | 464 | #
|
---|
| 465 |
|
---|
[130] | 466 | ## ABSPATH - make paths absolute.
|
---|
[129] | 467 | # This implementation is clumsy and doesn't resolve '..' and '.' components.
|
---|
[73] | 468 | #
|
---|
[129] | 469 | # @param $1 The paths to make absolute.
|
---|
[696] | 470 | # @obsolete Use the GNU make function $(abspath) directly now.
|
---|
[306] | 471 | ABSPATH = $(abspath $(1))
|
---|
[353] | 472 |
|
---|
[130] | 473 | ## DIRDEP - make create directory dependencies.
|
---|
| 474 | #
|
---|
| 475 | # @param $1 The paths to the directories which must be created.
|
---|
[353] | 476 | DIRDEP = $(foreach path,$(patsubst %/,%,$(1)),$(path)/)
|
---|
[129] | 477 |
|
---|
| 478 | ## Cygwin kludge.
|
---|
| 479 | # This converts /cygdrive/x/% to x:%.
|
---|
| 480 | #
|
---|
| 481 | # @param $1 The paths to make native.
|
---|
| 482 | # @remark This macro is pretty much obsolete since we don't use cygwin base make.
|
---|
| 483 | ifneq ($(patsubst /cygdrive/%,%,$(CURDIR)),$(CURDIR))
|
---|
[743] | 484 | CYGPATHMIXED = $(foreach path,$(1)\
|
---|
[129] | 485 | ,$(if $(patsubst /cygdrive/%,,$(path)),$(path),$(patsubst $(strip $(firstword $(subst /, ,$(patsubst /cygdrive/%,%,$(path)))))/%,$(strip $(firstword $(subst /, ,$(patsubst /cygdrive/%,%,$(path))))):/%,$(patsubst /cygdrive/%,%,$(path)))))
|
---|
| 486 | else
|
---|
[743] | 487 | CYGPATHMIXED = $(1)
|
---|
[129] | 488 | endif
|
---|
| 489 |
|
---|
[743] | 490 | ## Removes the drive letter from a path (if it has one)
|
---|
| 491 | # @param $1 the path
|
---|
| 492 | no-drive = $(word $(words $(subst :, ,$(1))),$(subst :, ,$(1)))
|
---|
[723] | 493 |
|
---|
[743] | 494 | ## Removes the root slash from a path (if it has one)
|
---|
| 495 | # @param $1 the path
|
---|
| 496 | no-root-slash = $(patsubst /%,%,$(1))
|
---|
[723] | 497 |
|
---|
[743] | 498 | ## Figure out where to put object files.
|
---|
| 499 | # @param $1 real target name.
|
---|
| 500 | # @param $2 normalized main target
|
---|
[748] | 501 | TARGET_BASE = $(PATH_TARGET)/$(2)/$(call no-root-slash,$(call no-drive,$(1)))
|
---|
[723] | 502 |
|
---|
[743] | 503 | ## Figure out where to put object files.
|
---|
| 504 | # @param $1 normalized main target
|
---|
| 505 | TARGET_PATH = $(PATH_TARGET)/$(1)
|
---|
[723] | 506 |
|
---|
| 507 |
|
---|
[129] | 508 | #
|
---|
[353] | 509 | # Initialize some of the globals which the Config.kmk and
|
---|
| 510 | # others can add stuff to if they like for processing in the footer.
|
---|
| 511 | #
|
---|
| 512 |
|
---|
| 513 | ## ALL_TARGET
|
---|
| 514 | # This is the list of all targets.
|
---|
| 515 | ALL_TARGETS :=
|
---|
| 516 |
|
---|
| 517 | ## TEMPLATE_PATHS
|
---|
| 518 | # List a paths (separated by space) where templates can be found.
|
---|
| 519 | TEMPLATE_PATHS :=
|
---|
| 520 |
|
---|
| 521 | ## TOOL_PATHS
|
---|
| 522 | # List of paths (separated by space) where tools can be found.
|
---|
| 523 | TOOL_PATHS :=
|
---|
| 524 |
|
---|
| 525 | ## SDK_PATHS
|
---|
| 526 | # List of paths (separated by space) where SDKs can be found.
|
---|
| 527 | SDK_PATHS :=
|
---|
| 528 |
|
---|
| 529 | ## Proritized list of the default makefile when walking subdirectories.
|
---|
| 530 | # The user can overload this list.
|
---|
| 531 | DEFAULT_MAKEFILE := Makefile.kmk makefile.kmk Makefile makefile
|
---|
| 532 |
|
---|
[640] | 533 | ## PROPS_TOOLS
|
---|
| 534 | # This is a subset of the other PROPS
|
---|
[641] | 535 | PROPS_TOOLS := TOOL CTOOL CXXTOOL ASTOOL RCTOOL ARTOOL LDTOOL FETCHTOOL UNPACKTOOL PATCHTOOL
|
---|
[640] | 536 |
|
---|
[353] | 537 | ## PROPS_SINGLE
|
---|
| 538 | # The list of non-accumulative target properties.
|
---|
| 539 | # A Config.kmk file can add it's own properties to this list and kBuild
|
---|
| 540 | # will do the necessary inheritance from templates to targets.
|
---|
[641] | 541 | PROPS_SINGLE := $(PROPS_TOOLS) INST NOINST BLD_TYPE BLD_TRG BLD_TRG_ARCH BLD_TRG_CPU FETCHDIR \
|
---|
| 542 | OBJSUFF COBJSUFF CXXOBJSUFF ASOBJSUFF RCOBJSUFF SYSSUFF EXESUFF DLLSUFF LIBSUFF ARLIBSUFF
|
---|
[353] | 543 |
|
---|
| 544 | ## PROPS_DEFERRED
|
---|
[889] | 545 | # This list of non-accumulative target properties which are or may be
|
---|
| 546 | # functions, and thus should not be expanded until the very last moment.
|
---|
| 547 | PROPS_DEFERRED := INSTFUN INSTALLER PRE_CMDS POST_CMDS NAME
|
---|
[353] | 548 |
|
---|
[660] | 549 | ## PROPS_ACCUMULATE_R
|
---|
[748] | 550 | # The list of accumulative target properties where the right most value/flag
|
---|
[660] | 551 | # is the 'most significant'.
|
---|
[353] | 552 | # A Config.kmk file can add it's own properties to this list and kBuild
|
---|
| 553 | # will do the necessary inheritance from templates to targets.
|
---|
[660] | 554 | PROPS_ACCUMULATE_R := \
|
---|
[829] | 555 | DEFS DEPS ORDERDEPS \
|
---|
[660] | 556 | CFLAGS CDEFS \
|
---|
| 557 | CXXFLAGS CXXDEFS \
|
---|
| 558 | ASFLAGS ASDEFS \
|
---|
| 559 | RCFLAGS RCDEFS \
|
---|
| 560 | LDFLAGS \
|
---|
[830] | 561 | IDFLAGS IFDLAGS ISFLAGS \
|
---|
[640] | 562 | FETCHFLAGS UNPACKFLAGS PATCHFLAGS
|
---|
[353] | 563 |
|
---|
[660] | 564 | ## PROPS_ACCUMULATE
|
---|
[748] | 565 | # The list of accumulative target properties where the left most value/flag
|
---|
[660] | 566 | # is the 'most significant'.
|
---|
| 567 | # A Config.kmk file can add it's own properties to this list and kBuild
|
---|
| 568 | # will do the necessary inheritance from templates to targets.
|
---|
| 569 | PROPS_ACCUMULATE_L := \
|
---|
| 570 | SDKS SOURCES \
|
---|
| 571 | INCS CINCS CXXINCX ASINCS RCINCS \
|
---|
[897] | 572 | LIBS LIBPATH \
|
---|
[904] | 573 | DIRS BLDDIRS \
|
---|
| 574 | CLEAN
|
---|
[353] | 575 |
|
---|
[662] | 576 | ## PROPS_ALL
|
---|
| 577 | # List of all the properties.
|
---|
| 578 | PROPS_ALL = $(PROPS_SINGLE) $(PROPS_DEFERRED) $(PROPS_ACCUMULATE_L) $(PROPS_ACCUMULATE_R)
|
---|
[660] | 579 |
|
---|
[662] | 580 |
|
---|
[353] | 581 | #
|
---|
[748] | 582 | # Here is a special 'hack' to prevent innocent environment variables being
|
---|
| 583 | # picked up and treated as properties. (The most annoying example of why
|
---|
[662] | 584 | # this is necessary is the Visual C++ commandline with it's LIBPATH.)
|
---|
| 585 | #
|
---|
[748] | 586 | # Define KBUILD_DONT_KILL_ENV_PROPS in the env. or on the commandline to
|
---|
[662] | 587 | # disable this 'hack'.
|
---|
| 588 | #
|
---|
| 589 | ifndef KBUILD_DONT_KILL_ENV_PROPS
|
---|
| 590 |
|
---|
| 591 | define def_nuke_environment_prop
|
---|
| 592 | ifeq ($(origin $(prop)),environment)
|
---|
| 593 | $(prop) =
|
---|
| 594 | endif
|
---|
| 595 | endef
|
---|
[762] | 596 | $(foreach prop, $(PROPS_ALL) \
|
---|
| 597 | FETCHES PATCHES BLDPROGS LIBRARIES IMPORT_LIBS DLLS PROGRAMS SYSMODS INSTALLS OTHERS \
|
---|
[897] | 598 | SUBDIRS MAKEFILES BLDDIRS \
|
---|
[762] | 599 | ,$(eval $(value def_nuke_environment_prop)))
|
---|
[662] | 600 |
|
---|
[897] | 601 | endif # KBUILD_DONT_KILL_ENV_PROPS
|
---|
[662] | 602 |
|
---|
| 603 |
|
---|
| 604 | #
|
---|
[353] | 605 | # Pass configuration.
|
---|
| 606 | #
|
---|
| 607 | # The PASS_<passname>_trgs variable is listing the targets.
|
---|
| 608 | # The PASS_<passname>_vars variable is listing the target variables.
|
---|
| 609 | # The PASS_<passname>_pass variable is the lowercased passname.
|
---|
| 610 | #
|
---|
| 611 |
|
---|
[640] | 612 | ## PASS: fetches
|
---|
| 613 | # This pass fetches and unpacks things needed to complete the build.
|
---|
| 614 | PASS_FETCHES := Fetches
|
---|
| 615 | PASS_FETCHES_trgs :=
|
---|
| 616 | PASS_FETCHES_vars := _FETCHES
|
---|
| 617 | PASS_FETCHES_pass := fetches
|
---|
| 618 |
|
---|
| 619 | ## PASS: patches
|
---|
| 620 | # This pass applies patches.
|
---|
| 621 | PASS_PATCHES := Patches
|
---|
| 622 | PASS_PATCHES_trgs :=
|
---|
| 623 | PASS_PATCHES_vars := _PATCHES
|
---|
| 624 | PASS_PATCHES_pass := patches
|
---|
| 625 |
|
---|
[353] | 626 | ## PASS: bldprogs
|
---|
| 627 | # This pass builds targets which are required for building the rest.
|
---|
| 628 | PASS_BLDPROGS := Build Programs
|
---|
| 629 | PASS_BLDPROGS_trgs :=
|
---|
| 630 | PASS_BLDPROGS_vars := _BLDPROGS
|
---|
| 631 | PASS_BLDPROGS_pass := bldprogs
|
---|
| 632 |
|
---|
| 633 | ## PASS: libraries
|
---|
| 634 | # This pass builds library targets.
|
---|
| 635 | PASS_LIBRARIES := Libraries
|
---|
| 636 | PASS_LIBRARIES_trgs :=
|
---|
| 637 | PASS_LIBRARIES_vars := _LIBS _IMPORT_LIBS _OTHER_LIBRARIES
|
---|
| 638 | PASS_LIBRARIES_pass := libraries
|
---|
| 639 |
|
---|
| 640 | ## PASS: binaries
|
---|
| 641 | # This pass builds dll targets.
|
---|
| 642 | PASS_DLLS := DLLs
|
---|
| 643 | PASS_DLLS_trgs :=
|
---|
| 644 | PASS_DLLS_vars := _DLLS _OTHER_DLLS
|
---|
| 645 | PASS_DLLS_pass := dlls
|
---|
| 646 |
|
---|
| 647 | ## PASS: binaries
|
---|
| 648 | # This pass builds binary targets, i.e. programs, system modules and stuff.
|
---|
| 649 | PASS_BINARIES := Programs
|
---|
| 650 | PASS_BINARIES_trgs :=
|
---|
| 651 | PASS_BINARIES_vars := _PROGRAMS _SYSMODS _OTHER_BINARIES
|
---|
| 652 | PASS_BINARIES_pass := binaries
|
---|
| 653 |
|
---|
| 654 | ## PASS: others
|
---|
| 655 | # This pass builds other targets.
|
---|
| 656 | PASS_OTHERS := Other Stuff
|
---|
| 657 | PASS_OTHERS_trgs :=
|
---|
| 658 | PASS_OTHERS_vars := _OTHERS
|
---|
| 659 | PASS_OTHERS_pass := others
|
---|
| 660 |
|
---|
| 661 | ## PASS: install
|
---|
| 662 | # This pass installs the built entities to a sandbox area.
|
---|
| 663 | PASS_INSTALLS := Install
|
---|
| 664 | PASS_INSTALLS_trgs :=
|
---|
[854] | 665 | PASS_INSTALLS_vars := _INSTALLS_DIRS _INSTALLS _INSTALLS_FILES
|
---|
[353] | 666 | PASS_INSTALLS_pass := installs
|
---|
| 667 |
|
---|
| 668 | ## PASS: packing
|
---|
| 669 | # This pass processes custom packing rules.
|
---|
| 670 | PASS_PACKING := Packing
|
---|
[414] | 671 | PASS_PACKING_trgs :=
|
---|
[417] | 672 | PASS_PACKING_vars := _PACKING
|
---|
[353] | 673 | PASS_PACKING_pass := packing
|
---|
[414] | 674 | #alias
|
---|
| 675 | packing: pass_packing
|
---|
[353] | 676 |
|
---|
| 677 | ## PASS: clean
|
---|
| 678 | # This pass removes all generated files.
|
---|
| 679 | PASS_CLEAN := Clean
|
---|
| 680 | PASS_CLEAN_trgs := do-clean
|
---|
| 681 | PASS_CLEAN_vars :=
|
---|
| 682 | PASS_CLEAN_pass := clean
|
---|
| 683 | # alias
|
---|
| 684 | clean: pass_clean
|
---|
| 685 |
|
---|
| 686 | ## PASS: nothing
|
---|
| 687 | # This pass just walks the tree.
|
---|
| 688 | PASS_NOTHING := Nothing
|
---|
| 689 | PASS_NOTHING_trgs := do-nothing
|
---|
| 690 | PASS_NOTHING_vars :=
|
---|
| 691 | PASS_NOTHING_pass := nothing
|
---|
| 692 | # alias
|
---|
| 693 | nothing: pass_nothing
|
---|
| 694 |
|
---|
| 695 | ## DEFAULT_PASSES
|
---|
| 696 | # The default passes and their order.
|
---|
| 697 | DEFAULT_PASSES := BLDPROGS LIBRARIES DLLS BINARIES OTHERS INSTALLS
|
---|
| 698 |
|
---|
| 699 | ## PASSES
|
---|
| 700 | # The passes that should be defined. This must include
|
---|
| 701 | # all passes mentioned by DEFAULT_PASSES.
|
---|
[723] | 702 | PASSES := FETCHES PATCHES $(DEFAULT_PASSES) NOTHING CLEAN
|
---|
[353] | 703 |
|
---|
| 704 |
|
---|
| 705 | #
|
---|
[69] | 706 | # This is how we find the closest config.kmk.
|
---|
| 707 | # It's a little hacky but I think it works fine.
|
---|
[70] | 708 | #
|
---|
| 709 | _CFGDIR := .
|
---|
[78] | 710 | _CFGFILES := ./Config.kmk ./config.kmk
|
---|
[69] | 711 | define def_include_config
|
---|
[78] | 712 | $(eval _CFGDIR := $(_CFGDIR)/$(dir))
|
---|
| 713 | _CFGFILES += $(_CFGDIR)/Config.kmk $(_CFGDIR)/config.kmk
|
---|
[69] | 714 | endef
|
---|
| 715 | # walk down the _RELATIVE_ path specified by DEPTH.
|
---|
[78] | 716 | $(foreach dir,$(subst /, ,$(DEPTH)), $(eval $(def_include_config)) )
|
---|
[69] | 717 | # add the default config file.
|
---|
[78] | 718 | _CFGFILE := $(firstword $(wildcard $(_CFGFILES) $(FILE_KBUILD_CONFIG)))
|
---|
[69] | 719 | _CFGFILES :=
|
---|
| 720 | _CFGDIR :=
|
---|
[416] | 721 | ifeq ($(_CFGFILE),)
|
---|
| 722 | $(error kBuild: no Config.kmk file found! Check the DEPTH: DEPTH='$(DEPTH)' PATH_CURRENT='$(PATH_CURRENT)')
|
---|
| 723 | endif
|
---|
[69] | 724 |
|
---|
[978] | 725 |
|
---|
[776] | 726 | #
|
---|
| 727 | # Check for --pretty-command-printing before including the Config.kmk
|
---|
| 728 | # so that anyone overriding the message macros can take the implied
|
---|
| 729 | # verbosity level change into account.
|
---|
| 730 | #
|
---|
| 731 | ifndef KBUILD_VERBOSE
|
---|
| 732 | ifndef KBUILD_QUIET
|
---|
| 733 | ifneq ($(filter --pretty-command-printing,$(MAKEFLAGS)),)
|
---|
[823] | 734 | export KBUILD_VERBOSE := 2
|
---|
[776] | 735 | endif
|
---|
| 736 | endif
|
---|
| 737 | endif
|
---|
| 738 |
|
---|
| 739 |
|
---|
[69] | 740 | # Include the config.kmk we found file (or the default one).
|
---|
| 741 | include $(_CFGFILE)
|
---|
| 742 |
|
---|
| 743 |
|
---|
[696] | 744 | #
|
---|
[874] | 745 | # Finalize a the central path variables now that we've included the Config.kmk file.
|
---|
| 746 | #
|
---|
| 747 | # This prevents some trouble when users override the defaults for these
|
---|
| 748 | # variables and uses relative paths or paths with incorrect case.
|
---|
| 749 | #
|
---|
| 750 | PATH_OUT := $(abspath $(PATH_OUT))
|
---|
| 751 | PATH_OBJ := $(abspath $(PATH_OBJ))
|
---|
| 752 | PATH_TARGET := $(abspath $(PATH_TARGET))
|
---|
| 753 | PATH_INS := $(abspath $(PATH_INS))
|
---|
| 754 | PATH_BIN := $(abspath $(PATH_BIN))
|
---|
| 755 | PATH_DLL := $(abspath $(PATH_DLL))
|
---|
| 756 | PATH_SYS := $(abspath $(PATH_SYS))
|
---|
| 757 | PATH_LIB := $(abspath $(PATH_LIB))
|
---|
| 758 | PATH_DOC := $(abspath $(PATH_DOC))
|
---|
| 759 |
|
---|
| 760 |
|
---|
| 761 | #
|
---|
[788] | 762 | # Setup the message style. The default one is inlined.
|
---|
[776] | 763 | #
|
---|
[788] | 764 | # See kBuild/msgstyles for more styles or use KBUILD_MSG_STYLE_PATHS
|
---|
| 765 | # to create your own message style.
|
---|
| 766 | #
|
---|
[776] | 767 | KBUILD_MSG_STYLE ?= default
|
---|
| 768 | ifeq ($(KBUILD_MSG_STYLE),default)
|
---|
| 769 | #
|
---|
| 770 | # The 'default' style.
|
---|
| 771 | #
|
---|
| 772 |
|
---|
| 773 | ## Fetch starting.
|
---|
| 774 | # @param 1 Target name.
|
---|
| 775 | MSG_FETCH ?= $(call MSG_L1,Fetching $1...)
|
---|
| 776 | ## Re-fetch starting.
|
---|
| 777 | # @param 1 Target name.
|
---|
| 778 | MSG_REFETCH ?= $(call MSG_L1,Re-fetching $1...)
|
---|
| 779 | ## Downloading a fetch component.
|
---|
| 780 | # @param 1 Target name.
|
---|
| 781 | # @param 2 The source URL.
|
---|
| 782 | # @param 3 The destination file name.
|
---|
| 783 | MSG_FETCH_DL ?= $(call MSG_L1,Downloading $1 - $2,=> $3)
|
---|
| 784 | ## Checking a fetch component.
|
---|
| 785 | # @param 1 Target name.
|
---|
| 786 | # @param 2 The source URL.
|
---|
| 787 | # @param 3 The destination file name.
|
---|
| 788 | MSG_FETCH_CHK?= $(call MSG_L1,Checking $1 - $3, ($2))
|
---|
| 789 | ## Unpacking a fetch component.
|
---|
| 790 | # @param 1 Target name.
|
---|
| 791 | # @param 2 The archive file name.
|
---|
| 792 | # @param 3 The target directory.
|
---|
| 793 | MSG_FETCH_UP ?= $(call MSG_L1,Unpacking $1 - $2 => $3)
|
---|
| 794 | ## Fetch completed.
|
---|
| 795 | # @param 1 Target name.
|
---|
| 796 | MSG_FETCH_OK ?= $(call MSG_L1,Successfully fetched $1)
|
---|
| 797 | ## Unfetch a fetch target.
|
---|
| 798 | # @param 1 Target name.
|
---|
| 799 | MSG_UNFETCH ?= $(call MSG_L1,Unfetching $1...)
|
---|
| 800 | ## Compiling a source file.
|
---|
| 801 | # @param 1 Target name.
|
---|
| 802 | # @param 2 The source filename.
|
---|
| 803 | # @param 3 The primary link output file name.
|
---|
| 804 | # @param 4 The source type (CXX,C,AS,RC,++).
|
---|
| 805 | MSG_COMPILE ?= $(call MSG_L1,Compiling $1 - $2,=> $3)
|
---|
[890] | 806 | ## Tool
|
---|
| 807 | # @param 1 The tool name (bin2c,...)
|
---|
| 808 | # @param 2 Target name.
|
---|
| 809 | # @param 3 The source filename.
|
---|
| 810 | # @param 4 The primary output file name.
|
---|
| 811 | MSG_TOOL ?= $(call MSG_L1,$1 $2 - $3,=> $4)
|
---|
| 812 | ## Generate a file, typically a source file.
|
---|
| 813 | # @param 1 Target name if applicable.
|
---|
| 814 | # @param 2 Output file name.
|
---|
| 815 | # @param 3 What it's generated from
|
---|
| 816 | MSG_GENERATE ?= $(call MSG_L1,Generating $(if $1,$1 - )$2,$(if $3,from $3))
|
---|
[776] | 817 | ## Linking a bldprog/dll/program/sysmod target.
|
---|
| 818 | # @param 1 Target name.
|
---|
| 819 | # @param 2 The primary link output file name.
|
---|
| 820 | # @param 3 The link tool operation (LINK_LIBRARY,LINK_PROGRAM,LINK_DLL,LINK_SYSMOD,++).
|
---|
| 821 | MSG_LINK ?= $(call MSG_L1,Linking $1,=> $2)
|
---|
[844] | 822 | ## Merging a library into the target (during library linking).
|
---|
| 823 | # @param 1 Target name.
|
---|
| 824 | # @param 2 The output library name.
|
---|
| 825 | # @param 3 The input library name.
|
---|
[845] | 826 | MSG_AR_MERGE ?= $(call MSG_L1,Merging $3 into $1, ($2))
|
---|
[776] | 827 | ## Creating a directory (build).
|
---|
| 828 | # @param 1 Directory name.
|
---|
| 829 | MSG_MKDIR ?= $(call MSG_L2,Creating directory $1)
|
---|
| 830 | ## Cleaning.
|
---|
| 831 | MSG_CLEAN ?= $(call MSG_L1,Cleaning...)
|
---|
| 832 | ## Nothing.
|
---|
| 833 | MSG_NOTHING ?= $(call MSG_L1,Did nothing in $(CURDIR))
|
---|
| 834 | ## Pass
|
---|
| 835 | # @param 1 The pass name.
|
---|
| 836 | MSG_PASS ?= $(call MSG_L1,Pass - $1)
|
---|
| 837 | ## Installing a bldprog/lib/dll/program/sysmod target.
|
---|
| 838 | # @param 1 Target name.
|
---|
| 839 | # @param 2 The source filename.
|
---|
| 840 | # @param 3 The destination file name.
|
---|
| 841 | MSG_INST_TRG ?= $(call MSG_L1,Installing $1 => $3)
|
---|
| 842 | ## Installing a file (install target).
|
---|
| 843 | # @param 1 The source filename.
|
---|
| 844 | # @param 2 The destination filename.
|
---|
| 845 | MSG_INST_FILE?= $(call MSG_L1,Installing $2,(<= $1))
|
---|
| 846 | ## Installing a symlink.
|
---|
| 847 | # @param 1 Symlink
|
---|
| 848 | # @param 2 Link target
|
---|
| 849 | MSG_INST_SYM ?= $(call MSG_L1,Installing symlink $1,=> $2)
|
---|
| 850 | ## Installing a directory.
|
---|
| 851 | # @param 1 Directory name.
|
---|
| 852 | MSG_INST_DIR ?= $(call MSG_L1,Installing directory $1)
|
---|
| 853 |
|
---|
[788] | 854 | else
|
---|
| 855 | _KBUILD_MSG_STYLE_FILE := $(firstword $(foreach path, $(KBUILD_MSG_STYLE_PATHS) $(PATH_KBUILD)/msgstyles, $(wildcard $(path)/$(KBUILD_MSG_STYLE).kmk)))
|
---|
| 856 | ifneq ($(_KBUILD_MSG_STYLE_FILE),)
|
---|
| 857 | include $(_KBUILD_MSG_STYLE_FILE)
|
---|
[776] | 858 | else
|
---|
[788] | 859 | $(error kBuild: Can't find the style setup file for KBUILD_MSG_STYLE '$(KBUILD_MSG_STYLE)')
|
---|
[776] | 860 | endif
|
---|
| 861 | endif
|
---|
| 862 |
|
---|
| 863 |
|
---|
| 864 | #
|
---|
[696] | 865 | # Message macros.
|
---|
| 866 | #
|
---|
[748] | 867 | # This is done after including Config.kmk as to allow for
|
---|
[696] | 868 | # KBUILD_QUIET and KBUILD_VERBOSE to be configurable.
|
---|
| 869 | #
|
---|
| 870 | ifdef KBUILD_QUIET
|
---|
[776] | 871 | # No output
|
---|
[696] | 872 | QUIET := @
|
---|
| 873 | QUIET2:= @
|
---|
| 874 | MSG_L1 =
|
---|
| 875 | MSG_L2 =
|
---|
| 876 | else
|
---|
| 877 | ifndef KBUILD_VERBOSE
|
---|
[776] | 878 | # Default output level.
|
---|
| 879 | QUIET := @
|
---|
| 880 | QUIET2 := @
|
---|
| 881 | MSG_L1 ?= @$(ECHO) "kBuild: $1"
|
---|
| 882 | MSG_L2 =
|
---|
| 883 | else ifeq ($(KBUILD_VERBOSE),1)
|
---|
| 884 | # A bit more output
|
---|
| 885 | QUIET := @
|
---|
| 886 | QUIET2 := @
|
---|
| 887 | MSG_L1 ?= @$(ECHO) "kBuild: $1 $2"
|
---|
| 888 | MSG_L2 =
|
---|
| 889 | else ifeq ($(KBUILD_VERBOSE),2)
|
---|
| 890 | # Lot more output
|
---|
| 891 | QUIET :=
|
---|
| 892 | QUIET2 := @
|
---|
| 893 | MSG_L1 ?= @$(ECHO) "kBuild: $1 $2"
|
---|
| 894 | MSG_L2 ?= @$(ECHO) "kBuild: $1"
|
---|
[696] | 895 | else
|
---|
| 896 | # maximal output.
|
---|
[776] | 897 | QUIET :=
|
---|
| 898 | QUIET2 :=
|
---|
| 899 | MSG_L1 ?= @$(ECHO) "kBuild: $1 $2"
|
---|
| 900 | MSG_L2 ?= @$(ECHO) "kBuild: $1"
|
---|
[696] | 901 | endif
|
---|
| 902 | endif
|
---|
| 903 |
|
---|
[776] | 904 |
|
---|
[69] | 905 | # end-of-file-content
|
---|
[72] | 906 | __header_kmk__ := 1
|
---|
[69] | 907 | endif # __header_kmk__
|
---|
[479] | 908 |
|
---|