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