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