source: trunk/kBuild/header.kmk@ 1426

Last change on this file since 1426 was 1426, checked in by bird, 17 years ago

Added a INTERMEDIATES keyword which all source -> object rules depends (order) on, so that handler that generates headers and stuff can ensure that their rules are executed before any stuff is compiled.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id Revision
File size: 32.0 KB
RevLine 
[69]1# $Id: header.kmk 1426 2008-03-21 08:06:09Z bird $
2## @file
3#
[978]4# kBuild - File included at top of a makefile.
[69]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
27ifndef __header_kmk__
28# start-of-file-content
[988]29ifdef KBUILD_PROFILE_SELF
30 _KBUILD_TS_HEADER_START := $(nanots ) # just a dummy warm up query
31 $(info prof: since start - since previous - event description)
32 _KBUILD_TS_HEADER_START := $(nanots )
33 _KBUILD_TS_PREV := $(_KBUILD_TS_HEADER_START)
34endif
[69]35
[978]36
[69]37#
[978]38# Check make version before we do anything else.
[69]39#
[978]40ifndef KMK_VERSION
[984]41 $(error kBuild: The kmk default variable KMK_VERSION isn't defined! Make sure you are using 'kmk' and not 'make', 'gmake', 'kmk_gmake', 'dmake' or any other make program)
[978]42endif
43ifneq ($(KBUILD_VERSION_MAJOR).$(KBUILD_VERSION_MINOR),0.1)
44 ifneq ($(KBUILD_VERSION_MAJOR),0)
[1348]45 $(warning kBuild: kmk major version mismatch! Expected '0' but found '$(KBUILD_VERSION_MAJOR)'!)
[978]46 else
[1348]47 $(warning kBuild: kmk minor version mismatch! Expected '1' but found '$(KBUILD_VERSION_MINOR)'!)
[978]48 endif
[1348]49else
50 ifneq ($(int-ge $(KBUILD_VERSION_PATCH),2),1)
51 $(warning kBuild: kmk version mismatch! Expected 0.1.2 or later. Actual version is $(KBUILD_VERSION_MAJOR).$(KBUILD_VERSION_MINOR).$(KBUILD_VERSION_PATCH).)
52 endif
[978]53endif
[69]54
55#
[978]56# The revision in which this file was last modified.
57# This can be useful when using development versions of kBuild.
[380]58#
[978]59KMK_REVISION := $(patsubst %:,, $Rev: 1426 $ )
[414]60
[978]61
[380]62#
[978]63# Define the default goal.
[69]64#
[978]65all: all_recursive
[69]66
[894]67#
[978]68# The phony FORCE target.
[894]69#
[978]70FORCE:
[72]71
[978]72
[69]73#
[978]74# Enable delete on error and second expansion of prerequisites.
[894]75#
[978]76.DELETE_ON_ERROR:
77
[894]78.SECONDEXPANSION:
79
80
81#
[95]82# General purpose macros.
83#
[204]84
[380]85##
86# Newline character(s).
87define NL
[95]88
[380]89
90endef
91
92##
93# Tab character.
94TAB := $(subst ., ,.)
95
96##
[896]97# Newline + tab characters (for generating commands).
98NLTAB = $(NL)$(TAB)
99
100##
[380]101# Space character.
102SP := $(subst ., ,.)
103
104##
[895]105# Hash character.
106define HASH
107#
108endef
[380]109
[895]110##
111# Colon character.
112COLON := :
113
114##
115# Semicolon character.
116SEMICOLON := ;
117
118##
119# Comma character.
120COMMA := ,
121
122##
123# Dot character.
124DOT := .
125
126##
127# Dollar character.
128DOLLAR := $$
129
130##
131# Equal character.
132EQUAL := =
133
134
[95]135#
[1403]136# The list of standard build types in kBuild.
137#
[1416]138# This list can be extended in Config.kmk and it's possible to extend
[1403]139# (inherit) another build type.
140#
[1420]141KBUILD_BLD_TYPES := release profile debug
[1403]142
143
144#
[985]145# The OSes, Architectures and CPUs that kBuild recognizes.
[978]146#
147# When kBuild is ported to a new OS or architecture a unique keyword needs
148# to be assigned to it and added here. This strictness is required because
149# this keyword namespace is shared between OSes, architectures, cpus and
[984]150# build types. (PORTME)
[978]151#
[985]152KBUILD_OSES := darwin freebsd l4 linux netbsd nt openbsd os2 solaris win
[1381]153KBUILD_ARCHES := x86 amd64 sparc32 sparc64 s390 s390x ppc32 ppc64 mips32 mips64 ia64 hppa32 hppa64 arm alpha
[978]154
155
156#
[585]157# Set default build type.
[69]158#
159ifndef BUILD_TYPE
[978]160 BUILD_TYPE := release
161else
[1388]162 if1of ($(BUILD_TYPE), $(KBUILD_OSES) $(KBUILD_ARCHES))
[978]163 $(error kBuild: The BUILD_TYPE value '$(BUILD_TYPE)' is an OS or architecture!)
[585]164 endif
[978]165 ifneq (.$(words $(BUILD_TYPE)).$(BUILD_TYPE).,.1.$(strip $(BUILD_TYPE)).)
166 $(error kBuild: The BUILD_TYPE value '$(BUILD_TYPE)' contains spaces/tabs!)
167 endif
[72]168endif
[69]169
170
171#
[978]172# Assert valid build platform variables.
[70]173#
[978]174# All these are set by kmk so they shouldn't be any trouble
175# unless the user starts messing about with environment variables.
176#
177ifneq (.$(words $(BUILD_PLATFORM)).$(BUILD_PLATFORM).,.1.$(strip $(BUILD_PLATFORM)).)
178 $(error kBuild: The BUILD_PLATFORM value '$(BUILD_PLATFORM)' contains spaces/tabs!)
[72]179endif
[978]180ifneq ($(words $(filter $(BUILD_PLATFORM),$(KBUILD_OSES))),1)
181 $(error kBuild: BUILD_PLATFORM value '$(BUILD_PLATFORM)' is not recognized (valid: $(KBUILD_OSES)))
182endif
[70]183
[980]184ifneq (.$(words $(BUILD_PLATFORM_ARCH)).$(BUILD_PLATFORM_ARCH).,.1.$(strip $(BUILD_PLATFORM_ARCH)).)
[978]185 $(error kBuild: The BUILD_PLATFORM_ARCH value '$(BUILD_PLATFORM_ARCH)' contains spaces/tabs!)
[329]186endif
[978]187ifneq ($(words $(filter $(BUILD_PLATFORM_ARCH),$(KBUILD_ARCHES))),1)
188 $(error kBuild: BUILD_PLATFORM_ARCH value '$(BUILD_PLATFORM_ARCH)' is not recognized (valid: $(KBUILD_ARCHES)))
[329]189endif
[72]190
[978]191ifeq ($(strip $(BUILD_PLATFORM_CPU)),)
[994]192 BUILD_PLATFORM_CPU := blend
193else
194 ifneq (.$(words $(BUILD_PLATFORM_CPU)).$(BUILD_PLATFORM_CPU).,.1.$(strip $(BUILD_PLATFORM_CPU)).)
195 $(error kBuild: The BUILD_PLATFORM_CPU value '$(BUILD_PLATFORM_CPU)' contains spaces/tabs!)
196 endif
[1348]197 if1of ($(BUILD_PLATFORM_CPU), $(KBUILD_OSES) $(BUILD_ARCHES))
[994]198 $(error kBuild: The BUILD_PLATFORM_CPU value '$(BUILD_PLATFORM_CPU)' was found in the OS or architecture keywords!)
199 endif
200 ifeq ($(BUILD_PLATFORM_CPU),$(BUILD_TYPE))
201 $(error kBuild: The BUILD_PLATFORM_CPU value '$(BUILD_PLATFORM_CPU)' is the same as the BUILD_TYPE!)
202 endif
[978]203endif
[72]204
[978]205
[70]206#
[978]207# Assert or set default target platform.
208# When not defined use the corresponding BUILD_PLATFORM value.
[72]209#
210ifndef BUILD_TARGET
[978]211 BUILD_TARGET := $(BUILD_PLATFORM)
[72]212else
[980]213 ifneq (.$(words $(BUILD_TARGET)).$(BUILD_TARGET).,.1.$(strip $(BUILD_TARGET)).)
[978]214 $(error kBuild: The BUILD_TARGET value '$(BUILD_TARGET)' contains spaces/tabs!)
[478]215 endif
[978]216 ifneq ($(words $(filter $(BUILD_TARGET),$(KBUILD_OSES))),1)
217 $(error kBuild: BUILD_TARGET value '$(BUILD_TARGET)' is not recognized (valid: $(KBUILD_OSES)))
218 endif
[72]219endif
220
[329]221ifndef BUILD_TARGET_ARCH
[978]222 BUILD_TARGET_ARCH := $(BUILD_PLATFORM_ARCH)
223else
[980]224 ifneq (.$(words $(BUILD_TARGET_ARCH)).$(BUILD_TARGET_ARCH).,.1.$(strip $(BUILD_TARGET_ARCH)).)
[978]225 $(error kBuild: The BUILD_TARGET_ARCH value '$(BUILD_TARGET_ARCH)' contains spaces/tabs!)
226 endif
227 ifneq ($(words $(filter $(BUILD_TARGET_ARCH),$(KBUILD_ARCHES))),1)
228 $(error kBuild: BUILD_TARGET_ARCH value '$(BUILD_TARGET_ARCH)' is not recognized (valid: $(KBUILD_ARCHES)))
229 endif
[329]230endif
[978]231
[329]232ifndef BUILD_TARGET_CPU
[978]233 BUILD_TARGET_CPU := $(BUILD_PLATFORM_CPU)
[994]234else ifeq ($(strip $(BUILD_TARGET_CPU)),)
235 ifeq ($(BUILD_TARGET_ARCH),$(BUILD_PLATFORM_ARCH))
236 BUILD_TARGET_CPU := $(BUILD_PLATFORM_CPU)
237 else
238 BUILD_TARGET_CPU := blend
239 endif
[978]240else
241 ifneq (.$(words $(BUILD_TARGET_CPU)).$(BUILD_TARGET_CPU).,.1.$(strip $(BUILD_TARGET_CPU)).)
242 $(error kBuild: The BUILD_TARGET_CPU value '$(BUILD_TARGET_CPU)' contains spaces/tabs!)
243 endif
[1348]244 if1of ($(BUILD_TARGET_CPU), $(KBUILD_OSES) $(BUILD_ARCHES))
[978]245 $(error kBuild: The BUILD_TARGET_CPU value was found in the OS or architecture keywords!)
246 endif
247 ifeq ($(BUILD_TARGET_CPU),$(BUILD_TYPE))
248 $(error kBuild: The BUILD_TARGET_CPU value '$(BUILD_TARGET_CPU)' is the same as the BUILD_TYPE!)
249 endif
[329]250endif
[72]251
252
253#
[978]254# Paths and stuff.
[69]255#
[978]256
257# Adjust DEPTH first.
258DEPTH := $(strip $(DEPTH))
259ifeq ($(DEPTH),)
260 DEPTH := .
261endif
262
[725]263## PATH_CURRENT is the current directory (getcwd).
[306]264PATH_CURRENT := $(abspath $(CURDIR))
[725]265## PATH_SUB_CURRENT points to current directory of the current makefile.
266# Meaning that it will change value as we enter and exit sub-makefiles.
267PATH_SUB_CURRENT := $(PATH_CURRENT)
268## PATH_ROOT points to the project root directory.
269PATH_ROOT := $(abspath $(PATH_CURRENT)/$(DEPTH))
270## PATH_SUB_ROOT points to the directory of the top-level makefile.
[472]271ifneq ($(strip $(SUB_DEPTH)),)
[978]272 SUB_DEPTH := $(strip $(SUB_DEPTH))
[725]273 PATH_SUB_ROOT := $(abspath $(PATH_CURRENT)/$(SUB_DEPTH))
[472]274else
[725]275 PATH_SUB_ROOT := $(PATH_CURRENT)
[472]276endif
[306]277
[748]278## CURSUBDIR is PATH_SUB_ROOT described relative to PATH_ROOT.
[725]279# This variable is used to determin where the object files and other output goes.
[1390]280ifneq ($(PATH_ROOT),$(PATH_SUB_ROOT))
281 CURSUBDIR := $(patsubst $(PATH_ROOT)/%,%,$(PATH_SUB_ROOT))
[266]282else
[1390]283 CURSUBDIR := .
[266]284endif
[306]285
[70]286# Output directories.
[242]287ifndef PATH_OUT_BASE
[725]288 PATH_OUT_BASE := $(PATH_ROOT)/out
[242]289endif
[240]290ifndef PATH_OUT
[725]291 ifdef BUILD_TARGET_SUB # (BUILD_TARGET_SUB is not currently recognized by kBuild in any other places.)
292 PATH_OUT := $(PATH_OUT_BASE)/$(BUILD_TARGET).$(BUILD_TARGET_ARCH).$(BUILD_TARGET_SUB)/$(BUILD_TYPE)
293 else
294 PATH_OUT := $(PATH_OUT_BASE)/$(BUILD_TARGET).$(BUILD_TARGET_ARCH)/$(BUILD_TYPE)
295 endif
[329]296endif # !define PATH_OUT
[1051]297PATH_OBJCACHE = $(PATH_OUT_BASE)/kObjCache
[353]298PATH_OBJ = $(PATH_OUT)/obj
299PATH_TARGET = $(PATH_OBJ)/$(CURSUBDIR)
300PATH_INS = $(PATH_OUT)
301PATH_BIN = $(PATH_INS)/bin
302PATH_DLL = $(PATH_INS)/bin
303PATH_SYS = $(PATH_INS)/bin
304PATH_LIB = $(PATH_INS)/lib
305PATH_DOC = $(PATH_INS)/doc
[70]306
[978]307# PATH_KBUILD is determined by kmk.
308ifeq ($(strip $(PATH_KBUILD)),)
309 $(error kBuild: PATH_KBUILD is missing or empty! kmk is supposed to set it.)
[70]310endif
[978]311# PATH_KBUILD_BIN is determined by kmk.
312ifeq ($(strip $(PATH_KBUILD_BIN)),)
313 $(error kBuild: PATH_KBUILD_BIN is missing or empty! kmk is supposed to set it.)
314endif
315
[69]316# kBuild files which might be of interest.
317FILE_KBUILD_HEADER := $(PATH_KBUILD)/header.kmk
[725]318#FILE_KBUILD_CONFIG := $(PATH_KBUILD)/config.kmk
[69]319FILE_KBUILD_FOOTER := $(PATH_KBUILD)/footer.kmk
320
[725]321## MAKEFILE is the name of the main makefile.
[204]322MAKEFILE := $(firstword $(MAKEFILE_LIST))
[748]323## MAKEFILE_CURRENT is the name of the current makefile.
[725]324# This is updated everything a sub-makefile is included.
325MAKEFILE_CURRENT := $(MAKEFILE)
[69]326
[72]327
[69]328#
[72]329# Build platform setup.
[984]330# (PORTME)
[69]331#
[984]332
[69]333# OS/2
[72]334ifeq ($(BUILD_PLATFORM),os2)
[83]335EXEC_X86_WIN32 := innopec.exe
[69]336HOSTSUFF_EXE := .exe
337endif
338
339# Linux
[72]340ifeq ($(BUILD_PLATFORM),linux)
[135]341EXEC_X86_WIN32 := wine
[69]342HOSTSUFF_EXE :=
343endif
[70]344
[547]345# Win, Win32, Win64, NT.
[1388]346if1of ($(BUILD_PLATFORM), win nt)
[69]347EXEC_X86_WIN32 :=
348HOSTSUFF_EXE := .exe
349endif
350
[299]351# FreeBSD
352ifeq ($(BUILD_PLATFORM),freebsd)
353EXEC_X86_WIN32 := wine
354HOSTSUFF_EXE :=
355endif
[125]356
[557]357# Darwin / Mac OS X
358ifeq ($(BUILD_PLATFORM),darwin)
359EXEC_X86_WIN32 := false
360HOSTSUFF_EXE :=
361endif
362
[811]363# Solaris
364ifeq ($(BUILD_PLATFORM),solaris)
365EXEC_X86_WIN32 := false
366HOSTSUFF_EXE :=
367endif
368
[299]369
[73]370#
371# Build target setup.
[984]372# (PORTME)
[73]373#
[1388]374SUFF_DEP := .dep
375if1of ($(BUILD_TARGET), win nt os2)
376SUFF_OBJ := .obj
377SUFF_LIB := .lib
378SUFF_DLL := .dll
379SUFF_EXE := .exe
380SUFF_SYS := .sys
381SUFF_RES := .res
382else ifeq ($(BUILD_TARGET),l4)
383SUFF_OBJ := .o
384SUFF_LIB := .a
385SUFF_DLL := .s.so
386SUFF_EXE :=
387SUFF_SYS := .a
388SUFF_RES :=
389else ifeq ($(BUILD_TARGET),darwin)
390SUFF_OBJ := .o
391SUFF_LIB := .a
392SUFF_DLL := .dylib
393SUFF_EXE :=
394SUFF_SYS :=
395SUFF_RES :=
396else
397SUFF_OBJ := .o
398SUFF_LIB := .a
399SUFF_DLL := .so
400SUFF_EXE :=
401 if1of ($(BUILD_TARGET), freebsd linux netbsd openbsd) ## @todo check netbsd and openbsd.
[1389]402SUFF_SYS := .ko
[1388]403 else
[1389]404SUFF_SYS :=
405 endif
[1388]406SUFF_RES :=
[73]407endif
[69]408
409#
410# Standard kBuild tools.
411#
[978]412ifeq ($(KMK),kmk)
413KMK := $(PATH_KBUILD_BIN)/kmk$(HOSTSUFF_EXE)
[233]414endif
[978]415MAKE := $(KMK)
[233]416
[1378]417GMAKE := $(PATH_KBUILD_BIN)/kmk_gmake$(HOSTSUFF_EXE)
418
[578]419DEP_EXT := $(PATH_KBUILD_BIN)/kDep$(HOSTSUFF_EXE)
[1388]420if1of (kDep, $(KMK_BUILTIN))
[397]421DEP := kmk_builtin_kDep
[230]422else
[380]423DEP := $(DEP_EXT)
[230]424endif
[69]425
[578]426DEP_IDB_EXT := $(PATH_KBUILD_BIN)/kDepIDB$(HOSTSUFF_EXE)
[1388]427if1of (kDepIDB, $(KMK_BUILTIN))
[1004]428DEP_IDB := kmk_builtin_kDepIDB
[397]429else
430DEP_IDB := $(DEP_IDB_EXT)
431endif
432
[578]433DEP_PRE_EXT := $(PATH_KBUILD_BIN)/kDepPre$(HOSTSUFF_EXE)
[1388]434if1of (kDepPre, $(KMK_BUILTIN))
[1004]435DEP_PRE := kmk_builtin_kDepPre
[380]436else
437DEP_PRE := $(DEP_PRE_EXT)
438endif
439
[1004]440KOBJCACHE_EXT := $(PATH_KBUILD_BIN)/kObjCache$(HOSTSUFF_EXE)
[1388]441if1of (kObjCache, $(KMK_BUILTIN))
[1004]442KOBJCACHE := kmk_builtin_kObjCache
443else
444KOBJCACHE := $(KOBJCACHE_EXT)
445endif
446
[578]447APPEND_EXT := $(PATH_KBUILD_BIN)/kmk_append$(HOSTSUFF_EXE)
[380]448APPEND := kmk_builtin_append
[69]449
[578]450CAT_EXT := $(PATH_KBUILD_BIN)/kmk_cat$(HOSTSUFF_EXE)
[380]451CAT := kmk_builtin_cat
[353]452
[1118]453CMP_EXT := $(PATH_KBUILD_BIN)/kmk_cmp$(HOSTSUFF_EXE)
454CMP := kmk_builtin_cmp
455
[1119]456CP_EXT := $(PATH_KBUILD_BIN)/kmk_cp$(HOSTSUFF_EXE)
457CP := kmk_builtin_cp
458
[578]459ECHO_EXT := $(PATH_KBUILD_BIN)/kmk_echo$(HOSTSUFF_EXE)
[380]460ECHO := kmk_builtin_echo
461
[578]462INSTALL_EXT := $(PATH_KBUILD_BIN)/kmk_install$(HOSTSUFF_EXE)
[380]463INSTALL := kmk_builtin_install
464
[578]465LN_EXT := $(PATH_KBUILD_BIN)/kmk_ln$(HOSTSUFF_EXE)
[380]466LN := kmk_builtin_ln
467
[1118]468MD5SUM_EXT := $(PATH_KBUILD_BIN)/kmk_md5sum$(HOSTSUFF_EXE)
469MD5SUM := kmk_builtin_md5sum
470
[578]471MKDIR_EXT := $(PATH_KBUILD_BIN)/kmk_mkdir$(HOSTSUFF_EXE)
[380]472MKDIR := kmk_builtin_mkdir
473
[578]474MV_EXT := $(PATH_KBUILD_BIN)/kmk_mv$(HOSTSUFF_EXE)
[380]475MV := kmk_builtin_mv
476
[776]477PRINTF_EXT := $(PATH_KBUILD_BIN)/kmk_printf$(HOSTSUFF_EXE)
478PRINTF := kmk_builtin_printf
479
[1272]480REDIRECT_EXT:= $(PATH_KBUILD_BIN)/kmk_redirect$(HOSTSUFF_EXE)
[1388]481if1of (redirect, $(KMK_BUILTIN))
[1272]482REDIRECT := kmk_builtin_redirect
483else
484REDIRECT := $(REDIRECT_EXT)
485endif
486
[578]487RM_EXT := $(PATH_KBUILD_BIN)/kmk_rm$(HOSTSUFF_EXE)
[380]488RM := kmk_builtin_rm
489
[601]490RMDIR_EXT := $(PATH_KBUILD_BIN)/kmk_rmdir$(HOSTSUFF_EXE)
491RMDIR := kmk_builtin_rmdir
492
[578]493SED_EXT := $(PATH_KBUILD_BIN)/kmk_sed$(HOSTSUFF_EXE)
[1272]494if1of (sed, $(KMK_BUILTIN))
[978]495SED_INT := kmk_builtin_sed
[380]496else
[978]497SED_INT := $(SED_EXT)
498endif
[380]499SED := $(SED_EXT)
500
[1296]501TEST_EXT := $(PATH_KBUILD_BIN)/kmk_test$(HOSTSUFF_EXE)
502TEST := kmk_builtin_test
503
[380]504# Our default shell is the Almquist shell from *BSD.
[578]505ASH := $(PATH_KBUILD_BIN)/kmk_ash$(HOSTSUFF_EXE)
[380]506MAKESHELL := $(ASH)
507SHELL := $(ASH)
508export SHELL MAKESHELL
509
[414]510# Symlinking is problematic on some platforms...
[380]511LN_SYMLINK := $(LN) -s
512
[743]513
514#
515# Some Functions.
[748]516# The lower cased ones are either fallbacks or candidates for functions.c.
[743]517#
518
[130]519## ABSPATH - make paths absolute.
[129]520# This implementation is clumsy and doesn't resolve '..' and '.' components.
[73]521#
[129]522# @param $1 The paths to make absolute.
[696]523# @obsolete Use the GNU make function $(abspath) directly now.
[984]524ABSPATH = $(abspath $(1))$(warning ABSPATH is deprecated, use abspath directly!)
[353]525
[130]526## DIRDEP - make create directory dependencies.
527#
528# @param $1 The paths to the directories which must be created.
[353]529DIRDEP = $(foreach path,$(patsubst %/,%,$(1)),$(path)/)
[129]530
531## Cygwin kludge.
532# This converts /cygdrive/x/% to x:%.
533#
534# @param $1 The paths to make native.
535# @remark This macro is pretty much obsolete since we don't use cygwin base make.
536ifneq ($(patsubst /cygdrive/%,%,$(CURDIR)),$(CURDIR))
[743]537 CYGPATHMIXED = $(foreach path,$(1)\
[129]538 ,$(if $(patsubst /cygdrive/%,,$(path)),$(path),$(patsubst $(strip $(firstword $(subst /, ,$(patsubst /cygdrive/%,%,$(path)))))/%,$(strip $(firstword $(subst /, ,$(patsubst /cygdrive/%,%,$(path))))):/%,$(patsubst /cygdrive/%,%,$(path)))))
539else
[743]540 CYGPATHMIXED = $(1)
[129]541endif
542
[743]543## Removes the drive letter from a path (if it has one)
544# @param $1 the path
545no-drive = $(word $(words $(subst :, ,$(1))),$(subst :, ,$(1)))
[723]546
[743]547## Removes the root slash from a path (if it has one)
548# @param $1 the path
549no-root-slash = $(patsubst /%,%,$(1))
[723]550
[743]551## Figure out where to put object files.
552# @param $1 real target name.
553# @param $2 normalized main target
[748]554TARGET_BASE = $(PATH_TARGET)/$(2)/$(call no-root-slash,$(call no-drive,$(1)))
[723]555
[743]556## Figure out where to put object files.
557# @param $1 normalized main target
558TARGET_PATH = $(PATH_TARGET)/$(1)
[723]559
560
[129]561#
[353]562# Initialize some of the globals which the Config.kmk and
563# others can add stuff to if they like for processing in the footer.
564#
565
[1416]566## KBUILD_TEMPLATE_PATHS
[353]567# List a paths (separated by space) where templates can be found.
[1416]568KBUILD_TEMPLATE_PATHS :=
[353]569
[1416]570## KBUILD_TOOL_PATHS
[353]571# List of paths (separated by space) where tools can be found.
[1416]572KBUILD_TOOL_PATHS :=
[353]573
[1416]574## KBUILD_SDK_PATHS
[353]575# List of paths (separated by space) where SDKs can be found.
[1416]576KBUILD_SDK_PATHS :=
[353]577
[1416]578## KBUILD_DEFAULT_PATHS
579# List of paths (separated by space) to search for stuff as a last resort.
580KBUILD_DEFAULT_PATHS :=
581
[353]582## Proritized list of the default makefile when walking subdirectories.
583# The user can overload this list.
584DEFAULT_MAKEFILE := Makefile.kmk makefile.kmk Makefile makefile
585
[1424]586## KBUILD_SRC_HANDLERS
587# The list of source handlers, pair of extension and handler.
588# The user can overload this list to provide additional or custom
589# handlers. On a per-target/template see SRC_HANDLERS.
590KBUILD_SRC_HANDLERS := \
591 .c:def_src_handler_c \
592 .C:def_src_handler_c \
593.cxx:def_src_handler_cxx \
594.CXX:def_src_handler_cxx \
595.cpp:def_src_handler_cxx \
596.CPP:def_src_handler_cxx \
597 .cc:def_src_handler_cxx \
598 .CC:def_src_handler_cxx \
599 .m:def_src_handler_objc \
600.asm:def_src_handler_asm \
601.ASM:def_src_handler_asm \
602 .s:def_src_handler_asm \
603 .S:def_src_handler_asm \
604 .rc:def_src_handler_rc \
605.obj:def_src_handler_obj \
606 .o:def_src_handler_obj \
607.res:def_src_handler_obj \
608.lib:def_src_handler_obj \
609 .a:def_src_handler_obj \
[980]610
[640]611## PROPS_TOOLS
[985]612# This is a subset of PROPS_SINGLE.
[1256]613PROPS_TOOLS := TOOL CTOOL CXXTOOL OBJCTOOL ASTOOL RCTOOL ARTOOL LDTOOL FETCHTOOL UNPACKTOOL PATCHTOOL
[640]614
[353]615## PROPS_SINGLE
616# The list of non-accumulative target properties.
617# A Config.kmk file can add it's own properties to this list and kBuild
[1400]618# will do the necessary inheritance for templates, sdks, tools and targets.
619PROPS_SINGLE := $(PROPS_TOOLS) TEMPLATE INST NOINST BLD_TYPE BLD_TRG BLD_TRG_ARCH BLD_TRG_CPU FETCHDIR \
[1256]620 OBJSUFF COBJSUFF CXXOBJSUFF OBJCOBJSUFF ASOBJSUFF RCOBJSUFF SYSSUFF EXESUFF DLLSUFF LIBSUFF ARLIBSUFF
[985]621## PROPS_SINGLE_LNK
622# Subset of PROPS_SINGLE which applies to all linkable targets.
[1400]623PROPS_SINGLE_LNK := TOOL TEMPLATE CTOOL CXXTOOL OBJCTOOL ASTOOL RCTOOL \
[985]624 INST NOINST BLD_TYPE BLD_TRG BLD_TRG_ARCH BLD_TRG_CPU \
[1256]625 OBJSUFF COBJSUFF CXXOBJSUFF OBJCOBJSUFF ASOBJSUFF RCOBJSUFF
[353]626
627## PROPS_DEFERRED
[889]628# This list of non-accumulative target properties which are or may be
629# functions, and thus should not be expanded until the very last moment.
[985]630PROPS_DEFERRED := INSTFUN INSTALLER PRE_CMDS POST_CMDS NAME SONAME
[353]631
[660]632## PROPS_ACCUMULATE_R
[748]633# The list of accumulative target properties where the right most value/flag
[660]634# is the 'most significant'.
[353]635# A Config.kmk file can add it's own properties to this list and kBuild
636# will do the necessary inheritance from templates to targets.
[660]637PROPS_ACCUMULATE_R := \
[985]638 DEPS ORDERDEPS DEFS \
639 ARFLAGS \
[660]640 CFLAGS CDEFS \
641 CXXFLAGS CXXDEFS \
[1256]642 OBJCFLAGS OBJCDEFS \
[660]643 ASFLAGS ASDEFS \
644 RCFLAGS RCDEFS \
645 LDFLAGS \
[830]646 IDFLAGS IFDLAGS ISFLAGS \
[640]647 FETCHFLAGS UNPACKFLAGS PATCHFLAGS
[985]648## PROPS_ACCUMULATE_R_LNK
649# Subset of PROPS_ACCUMULATE_R which applies to all linkable targets.
650PROPS_ACCUMULATE_R_LNK := \
651 DEPS ORDERDEPS DEFS \
652 CFLAGS CDEFS \
653 CXXFLAGS CXXDEFS \
[1256]654 OBJCFLAGS OBJCDEFS \
[985]655 ASFLAGS ASDEFS \
656 RCFLAGS RCDEFS \
657 IDFLAGS IFDLAGS ISFLAGS
[353]658
[660]659## PROPS_ACCUMULATE
[748]660# The list of accumulative target properties where the left most value/flag
[660]661# is the 'most significant'.
662# A Config.kmk file can add it's own properties to this list and kBuild
663# will do the necessary inheritance from templates to targets.
664PROPS_ACCUMULATE_L := \
[1426]665 SDKS SOURCES SRC_HANDLERS INTERMEDIATES \
[1256]666 INCS CINCS CXXINCS OBJCINCS ASINCS RCINCS \
[897]667 LIBS LIBPATH \
[985]668 DIRS BLDDIRS CLEAN
669## PROPS_ACCUMULATE_L_LNK
670# Subset of PROPS_ACCUMULATE_L which applies to all linkable targets.
671PROPS_ACCUMULATE_L_LNK := \
[1424]672 SDKS SOURCES SRC_HANDLERS \
[1256]673 INCS CINCS CXXINCS OBJCINCS ASINCS RCINCS \
[985]674 BLDDIRS CLEAN
[353]675
[662]676## PROPS_ALL
677# List of all the properties.
678PROPS_ALL = $(PROPS_SINGLE) $(PROPS_DEFERRED) $(PROPS_ACCUMULATE_L) $(PROPS_ACCUMULATE_R)
[660]679
[662]680
[985]681## @name Properties valid on programs (BLDPROGS and PROGRAMS)
682## @{
683PROPS_PROGRAMS_SINGLE := $(PROPS_SINGLE_LNK) LDTOOL EXESUFF
684PROPS_PROGRAMS_DEFERRED := $(PROPS_DEFERRED)
685PROPS_PROGRAMS_ACCUMULATE_R := $(PROPS_ACCUMULATE_R_LNK) LDFLAGS
686PROPS_PROGRAMS_ACCUMULATE_L := $(PROPS_ACCUMULATE_L_LNK) LIBS LIBPATH
687## @}
688
689## @name Properties valid on libraries (LIBRARIES and IMPORT_LIBS)
690## @{
[989]691PROPS_LIBRARIES_SINGLE := $(PROPS_SINGLE_LNK) ARTOOL LIBSUFF ARLIBSUFF LIBSUFF
[985]692PROPS_LIBRARIES_DEFERRED := $(filter-out SONAME,$(PROPS_DEFERRED))
693PROPS_LIBRARIES_ACCUMULATE_R := $(PROPS_ACCUMULATE_R_LNK) ARFLAGS
694PROPS_LIBRARIES_ACCUMULATE_L := $(PROPS_ACCUMULATE_L_LNK)
695## @}
696
697## @name Properties valid on dlls (DLLS)
698## @{
699PROPS_DLLS_SINGLE := $(PROPS_SINGLE_LNK) LDTOOL DLLSUFF LIBSUFF
700PROPS_DLLS_DEFERRED := $(PROPS_DEFERRED)
701PROPS_DLLS_ACCUMULATE_R := $(PROPS_ACCUMULATE_R_LNK) LDFLAGS
702PROPS_DLLS_ACCUMULATE_L := $(PROPS_ACCUMULATE_L_LNK) LIBS LIBPATH
703## @}
704
[989]705## @name Properties valid on system modules (SYSMODS)
706## @{
707PROPS_SYSMODS_SINGLE := $(PROPS_SINGLE_LNK) LDTOOL SYSSUFF
708PROPS_SYSMODS_DEFERRED := $(PROPS_DEFERRED)
709PROPS_SYSMODS_ACCUMULATE_R := $(PROPS_ACCUMULATE_R_LNK) LDFLAGS
710PROPS_SYSMODS_ACCUMULATE_L := $(PROPS_ACCUMULATE_L_LNK) LIBS LIBPATH
711## @}
712
[985]713## @name Properties valid on installs (INSTALLS)
714## @{
[1400]715PROPS_INSTALLS_SINGLE := TOOL TEMPLATE INST NOINST
[985]716PROPS_INSTALLS_DEFERRED := INSTFUN INSTALLER
717PROPS_INSTALLS_ACCUMULATE_R := DEPS ORDERDEPS
718PROPS_INSTALLS_ACCUMULATE_L := SOURCES DIRS CLEAN
719## @}
720
721## @name Properties valid on fetches (INSTALLS)
722## @{
[1400]723PROPS_FETCHES_SINGLE := TOOL TEMPLATE FETCHTOOL UNPACKTOOL PATCHTOOL INST FETCHDIR
[985]724PROPS_FETCHES_DEFERRED :=
725PROPS_FETCHES_ACCUMULATE_R := FETCHFLAGS UNPACKFLAGS PATCHFLAGS
726PROPS_FETCHES_ACCUMULATE_L := SOURCES
727## @}
728
729
[353]730#
[748]731# Here is a special 'hack' to prevent innocent environment variables being
732# picked up and treated as properties. (The most annoying example of why
[662]733# this is necessary is the Visual C++ commandline with it's LIBPATH.)
734#
[748]735# Define KBUILD_DONT_KILL_ENV_PROPS in the env. or on the commandline to
[662]736# disable this 'hack'.
737#
738ifndef KBUILD_DONT_KILL_ENV_PROPS
739
740define def_nuke_environment_prop
741ifeq ($(origin $(prop)),environment)
742$(prop) =
743endif
744endef
[762]745$(foreach prop, $(PROPS_ALL) \
746 FETCHES PATCHES BLDPROGS LIBRARIES IMPORT_LIBS DLLS PROGRAMS SYSMODS INSTALLS OTHERS \
[897]747 SUBDIRS MAKEFILES BLDDIRS \
[762]748 ,$(eval $(value def_nuke_environment_prop)))
[662]749
[897]750endif # KBUILD_DONT_KILL_ENV_PROPS
[662]751
752
753#
[353]754# Pass configuration.
755#
756# The PASS_<passname>_trgs variable is listing the targets.
757# The PASS_<passname>_vars variable is listing the target variables.
758# The PASS_<passname>_pass variable is the lowercased passname.
759#
760
[640]761## PASS: fetches
762# This pass fetches and unpacks things needed to complete the build.
763PASS_FETCHES := Fetches
764PASS_FETCHES_trgs :=
765PASS_FETCHES_vars := _FETCHES
766PASS_FETCHES_pass := fetches
767
768## PASS: patches
769# This pass applies patches.
770PASS_PATCHES := Patches
771PASS_PATCHES_trgs :=
772PASS_PATCHES_vars := _PATCHES
773PASS_PATCHES_pass := patches
774
[353]775## PASS: bldprogs
776# This pass builds targets which are required for building the rest.
777PASS_BLDPROGS := Build Programs
778PASS_BLDPROGS_trgs :=
779PASS_BLDPROGS_vars := _BLDPROGS
780PASS_BLDPROGS_pass := bldprogs
781
782## PASS: libraries
783# This pass builds library targets.
784PASS_LIBRARIES := Libraries
785PASS_LIBRARIES_trgs :=
786PASS_LIBRARIES_vars := _LIBS _IMPORT_LIBS _OTHER_LIBRARIES
787PASS_LIBRARIES_pass := libraries
788
789## PASS: binaries
790# This pass builds dll targets.
791PASS_DLLS := DLLs
792PASS_DLLS_trgs :=
793PASS_DLLS_vars := _DLLS _OTHER_DLLS
794PASS_DLLS_pass := dlls
795
796## PASS: binaries
797# This pass builds binary targets, i.e. programs, system modules and stuff.
798PASS_BINARIES := Programs
799PASS_BINARIES_trgs :=
800PASS_BINARIES_vars := _PROGRAMS _SYSMODS _OTHER_BINARIES
801PASS_BINARIES_pass := binaries
802
803## PASS: others
804# This pass builds other targets.
805PASS_OTHERS := Other Stuff
806PASS_OTHERS_trgs :=
807PASS_OTHERS_vars := _OTHERS
808PASS_OTHERS_pass := others
809
810## PASS: install
811# This pass installs the built entities to a sandbox area.
812PASS_INSTALLS := Install
813PASS_INSTALLS_trgs :=
[854]814PASS_INSTALLS_vars := _INSTALLS_DIRS _INSTALLS _INSTALLS_FILES
[353]815PASS_INSTALLS_pass := installs
816
817## PASS: packing
818# This pass processes custom packing rules.
819PASS_PACKING := Packing
[414]820PASS_PACKING_trgs :=
[417]821PASS_PACKING_vars := _PACKING
[353]822PASS_PACKING_pass := packing
[414]823#alias
824packing: pass_packing
[353]825
826## PASS: clean
827# This pass removes all generated files.
828PASS_CLEAN := Clean
829PASS_CLEAN_trgs := do-clean
830PASS_CLEAN_vars :=
831PASS_CLEAN_pass := clean
832# alias
833clean: pass_clean
834
835## PASS: nothing
836# This pass just walks the tree.
837PASS_NOTHING := Nothing
838PASS_NOTHING_trgs := do-nothing
839PASS_NOTHING_vars :=
840PASS_NOTHING_pass := nothing
841# alias
842nothing: pass_nothing
843
844## DEFAULT_PASSES
845# The default passes and their order.
846DEFAULT_PASSES := BLDPROGS LIBRARIES DLLS BINARIES OTHERS INSTALLS
847
848## PASSES
849# The passes that should be defined. This must include
850# all passes mentioned by DEFAULT_PASSES.
[723]851PASSES := FETCHES PATCHES $(DEFAULT_PASSES) NOTHING CLEAN
[353]852
853
854#
[984]855# Check for --pretty-command-printing before including the Config.kmk
856# so that anyone overriding the message macros can take the implied
857# verbosity level change into account.
858#
859ifndef KBUILD_VERBOSE
860 ifndef KBUILD_QUIET
861 ifneq ($(filter --pretty-command-printing,$(MAKEFLAGS)),)
862 export KBUILD_VERBOSE := 2
863 endif
864 endif
865endif
866
867
868#
[1418]869# Legacy variable translation.
870# These will be eliminated when switching to the next version.
871#
872ifdef USE_KOBJCACHE
873 ifndef KBUILD_USE_KOBJCACHE
874 export KBUILD_USE_KOBJCACHE := $(USE_KOBJCACHE)
875 endif
876endif
877
878
879#
[69]880# This is how we find the closest config.kmk.
881# It's a little hacky but I think it works fine.
[70]882#
883_CFGDIR := .
[78]884_CFGFILES := ./Config.kmk ./config.kmk
[69]885define def_include_config
[78]886$(eval _CFGDIR := $(_CFGDIR)/$(dir))
887_CFGFILES += $(_CFGDIR)/Config.kmk $(_CFGDIR)/config.kmk
[69]888endef
889# walk down the _RELATIVE_ path specified by DEPTH.
[78]890$(foreach dir,$(subst /, ,$(DEPTH)), $(eval $(def_include_config)) )
[69]891# add the default config file.
[78]892_CFGFILE := $(firstword $(wildcard $(_CFGFILES) $(FILE_KBUILD_CONFIG)))
[69]893_CFGFILES :=
894_CFGDIR :=
[416]895ifeq ($(_CFGFILE),)
896$(error kBuild: no Config.kmk file found! Check the DEPTH: DEPTH='$(DEPTH)' PATH_CURRENT='$(PATH_CURRENT)')
897endif
[69]898
899# Include the config.kmk we found file (or the default one).
[988]900ifdef KBUILD_PROFILE_SELF
901 _KBUILD_TS_NOW := $(nanots )
902 $(info prof: $(int-sub $(_KBUILD_TS_NOW), $(_KBUILD_TS_HEADER_START)) - $(int-sub $(_KBUILD_TS_NOW), $(_KBUILD_TS_PREV)) - including $(_CFGFILE))
903 _KBUILD_TS_PREV := $(_KBUILD_TS_NOW)
[69]904
[988]905 include $(_CFGFILE)
[69]906
[988]907 _KBUILD_TS_NOW := $(nanots )
908 $(info prof: $(int-sub $(_KBUILD_TS_NOW), $(_KBUILD_TS_HEADER_START)) - $(int-sub $(_KBUILD_TS_NOW), $(_KBUILD_TS_PREV)) - included $(_CFGFILE))
909 _KBUILD_TS_PREV := $(_KBUILD_TS_NOW)
910else
911 include $(_CFGFILE)
912endif
913
914
915
[696]916#
[874]917# Finalize a the central path variables now that we've included the Config.kmk file.
918#
919# This prevents some trouble when users override the defaults for these
920# variables and uses relative paths or paths with incorrect case.
921#
922PATH_OUT := $(abspath $(PATH_OUT))
923PATH_OBJ := $(abspath $(PATH_OBJ))
924PATH_TARGET := $(abspath $(PATH_TARGET))
925PATH_INS := $(abspath $(PATH_INS))
926PATH_BIN := $(abspath $(PATH_BIN))
927PATH_DLL := $(abspath $(PATH_DLL))
928PATH_SYS := $(abspath $(PATH_SYS))
929PATH_LIB := $(abspath $(PATH_LIB))
930PATH_DOC := $(abspath $(PATH_DOC))
931
932
933#
[788]934# Setup the message style. The default one is inlined.
[776]935#
[788]936# See kBuild/msgstyles for more styles or use KBUILD_MSG_STYLE_PATHS
937# to create your own message style.
938#
[776]939KBUILD_MSG_STYLE ?= default
940ifeq ($(KBUILD_MSG_STYLE),default)
941 #
942 # The 'default' style.
943 #
944
945 ## Fetch starting.
946 # @param 1 Target name.
947 MSG_FETCH ?= $(call MSG_L1,Fetching $1...)
948 ## Re-fetch starting.
949 # @param 1 Target name.
950 MSG_REFETCH ?= $(call MSG_L1,Re-fetching $1...)
951 ## Downloading a fetch component.
952 # @param 1 Target name.
953 # @param 2 The source URL.
954 # @param 3 The destination file name.
955 MSG_FETCH_DL ?= $(call MSG_L1,Downloading $1 - $2,=> $3)
956 ## Checking a fetch component.
957 # @param 1 Target name.
958 # @param 2 The source URL.
959 # @param 3 The destination file name.
960 MSG_FETCH_CHK?= $(call MSG_L1,Checking $1 - $3, ($2))
961 ## Unpacking a fetch component.
962 # @param 1 Target name.
963 # @param 2 The archive file name.
964 # @param 3 The target directory.
965 MSG_FETCH_UP ?= $(call MSG_L1,Unpacking $1 - $2 => $3)
966 ## Fetch completed.
967 # @param 1 Target name.
968 MSG_FETCH_OK ?= $(call MSG_L1,Successfully fetched $1)
969 ## Unfetch a fetch target.
970 # @param 1 Target name.
971 MSG_UNFETCH ?= $(call MSG_L1,Unfetching $1...)
972 ## Compiling a source file.
973 # @param 1 Target name.
974 # @param 2 The source filename.
975 # @param 3 The primary link output file name.
[1256]976 # @param 4 The source type (C,CXX,OBJC,AS,RC,++).
[776]977 MSG_COMPILE ?= $(call MSG_L1,Compiling $1 - $2,=> $3)
[890]978 ## Tool
979 # @param 1 The tool name (bin2c,...)
980 # @param 2 Target name.
981 # @param 3 The source filename.
982 # @param 4 The primary output file name.
983 MSG_TOOL ?= $(call MSG_L1,$1 $2 - $3,=> $4)
984 ## Generate a file, typically a source file.
985 # @param 1 Target name if applicable.
986 # @param 2 Output file name.
987 # @param 3 What it's generated from
988 MSG_GENERATE ?= $(call MSG_L1,Generating $(if $1,$1 - )$2,$(if $3,from $3))
[776]989 ## Linking a bldprog/dll/program/sysmod target.
990 # @param 1 Target name.
991 # @param 2 The primary link output file name.
992 # @param 3 The link tool operation (LINK_LIBRARY,LINK_PROGRAM,LINK_DLL,LINK_SYSMOD,++).
993 MSG_LINK ?= $(call MSG_L1,Linking $1,=> $2)
[844]994 ## Merging a library into the target (during library linking).
995 # @param 1 Target name.
996 # @param 2 The output library name.
997 # @param 3 The input library name.
[845]998 MSG_AR_MERGE ?= $(call MSG_L1,Merging $3 into $1, ($2))
[776]999 ## Creating a directory (build).
1000 # @param 1 Directory name.
1001 MSG_MKDIR ?= $(call MSG_L2,Creating directory $1)
1002 ## Cleaning.
1003 MSG_CLEAN ?= $(call MSG_L1,Cleaning...)
1004 ## Nothing.
1005 MSG_NOTHING ?= $(call MSG_L1,Did nothing in $(CURDIR))
1006 ## Pass
1007 # @param 1 The pass name.
1008 MSG_PASS ?= $(call MSG_L1,Pass - $1)
1009 ## Installing a bldprog/lib/dll/program/sysmod target.
1010 # @param 1 Target name.
1011 # @param 2 The source filename.
1012 # @param 3 The destination file name.
1013 MSG_INST_TRG ?= $(call MSG_L1,Installing $1 => $3)
1014 ## Installing a file (install target).
1015 # @param 1 The source filename.
1016 # @param 2 The destination filename.
1017 MSG_INST_FILE?= $(call MSG_L1,Installing $2,(<= $1))
1018 ## Installing a symlink.
1019 # @param 1 Symlink
1020 # @param 2 Link target
1021 MSG_INST_SYM ?= $(call MSG_L1,Installing symlink $1,=> $2)
1022 ## Installing a directory.
1023 # @param 1 Directory name.
1024 MSG_INST_DIR ?= $(call MSG_L1,Installing directory $1)
1025
[788]1026else
1027 _KBUILD_MSG_STYLE_FILE := $(firstword $(foreach path, $(KBUILD_MSG_STYLE_PATHS) $(PATH_KBUILD)/msgstyles, $(wildcard $(path)/$(KBUILD_MSG_STYLE).kmk)))
1028 ifneq ($(_KBUILD_MSG_STYLE_FILE),)
1029 include $(_KBUILD_MSG_STYLE_FILE)
[776]1030 else
[788]1031 $(error kBuild: Can't find the style setup file for KBUILD_MSG_STYLE '$(KBUILD_MSG_STYLE)')
[776]1032 endif
1033endif
1034
1035
1036#
[696]1037# Message macros.
1038#
[748]1039# This is done after including Config.kmk as to allow for
[696]1040# KBUILD_QUIET and KBUILD_VERBOSE to be configurable.
1041#
1042ifdef KBUILD_QUIET
[776]1043 # No output
[696]1044 QUIET := @
1045 QUIET2:= @
1046 MSG_L1 =
1047 MSG_L2 =
1048else
1049 ifndef KBUILD_VERBOSE
[776]1050 # Default output level.
1051 QUIET := @
1052 QUIET2 := @
1053 MSG_L1 ?= @$(ECHO) "kBuild: $1"
1054 MSG_L2 =
1055 else ifeq ($(KBUILD_VERBOSE),1)
1056 # A bit more output
1057 QUIET := @
1058 QUIET2 := @
1059 MSG_L1 ?= @$(ECHO) "kBuild: $1 $2"
1060 MSG_L2 =
1061 else ifeq ($(KBUILD_VERBOSE),2)
1062 # Lot more output
1063 QUIET :=
1064 QUIET2 := @
1065 MSG_L1 ?= @$(ECHO) "kBuild: $1 $2"
1066 MSG_L2 ?= @$(ECHO) "kBuild: $1"
[696]1067 else
1068 # maximal output.
[776]1069 QUIET :=
1070 QUIET2 :=
1071 MSG_L1 ?= @$(ECHO) "kBuild: $1 $2"
1072 MSG_L2 ?= @$(ECHO) "kBuild: $1"
[696]1073 endif
1074endif
1075
[776]1076
[1403]1077#
1078# Validate any KBUILD_BLD_TYPES additions and finally the BUILD_TYPE.
1079#
1080if1of ($(KBUILD_BLD_TYPES), $(KBUILD_OSES))
1081 $(error kBuild: found KBUILD_BLD_TYPES in KBUILD_OSES!)
1082endif
1083if1of ($(KBUILD_BLD_TYPES), $(KBUILD_ARCHES))
1084 $(error kBuild: found KBUILD_BLD_TYPES in KBUILD_ARCHES!)
1085endif
1086if1of ($(KBUILD_OSES), $(KBUILD_ARCHES))
1087 $(error kBuild: found KBUILD_OSES in KBUILD_ARCHES!)
1088endif
1089ifn1of ($(BUILD_TYPE), $(KBUILD_BLD_TYPES))
1090 $(error kBuild: BUILD_TYPE(=$(BUILD_TYPE)) is not found in KBUILD_BLD_TYPES(=$(KBUILD_BLD_TYPES))!)
1091endif
1092
1093
1094
[988]1095ifdef KBUILD_PROFILE_SELF
1096 _KBUILD_TS_HEADER_END := $(nanots )
1097 $(info prof: $(int-sub $(_KBUILD_TS_HEADER_END), $(_KBUILD_TS_HEADER_START)) - $(int-sub $(_KBUILD_TS_HEADER_END), $(_KBUILD_TS_PREV)) - end of header.kmk)
1098 _KBUILD_TS_PREV := $(_KBUILD_TS_HEADER_END)
1099endif
1100
[69]1101# end-of-file-content
[72]1102__header_kmk__ := 1
[69]1103endif # __header_kmk__
[479]1104
Note: See TracBrowser for help on using the repository browser.