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