source: trunk/kBuild/header.kmk@ 1501

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

Mark all, all_recursive and FORCE as .PHONY (saves kmk a few stat calls).

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