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