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