source: trunk/kBuild/header.kmk@ 2726

Last change on this file since 2726 was 2726, checked in by bird, 11 years ago

s/PATH_DEVTOOLS/KBUILD_DEVTOOLS/g, (c) & e-mail updates.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 48.5 KB
Line 
1# $Id: header.kmk 2726 2014-02-26 23:23:54Z bird $
2## @file
3# kBuild - File included at top of a makefile.
4#
5
6#
7# Copyright (c) 2004-2014 knut st. osmundsen <bird-kBuild-spam-xiv@anduin.net>
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# As a special exception you are granted permission to include this file, via
27# the kmk include directive, as you wish without this in itself causing the
28# resulting makefile, program or whatever to be covered by the GPL license.
29# This exception does not however invalidate any other reasons why the makefile,
30# program, whatever should not be covered the GPL.
31#
32#
33
34ifndef __header_kmk__
35# start-of-file-content
36ifdef KBUILD_PROFILE_SELF
37 _KBUILD_TS_HEADER_START := $(nanots ) # just a dummy warm up query
38 $(info prof: since start - since previous -- event description)
39 ifeq ($(KBUILD_PROFILE_SELF),2)
40 $(info stat: $(make-stats ))
41 endif
42 _KBUILD_TS_HEADER_START := $(nanots )
43 _KBUILD_TS_PREV := $(_KBUILD_TS_HEADER_START)
44
45 _KBUILD_FMT_ELAPSED_EX = $(int-div $(int-add $(int-sub $1, $2),500000),1000000)ms
46 _KBUILD_FMT_ELAPSED = $(call _KBUILD_FMT_ELAPSED_EX,$(_KBUILD_TS_NOW),$1)
47
48define def_profile_self
49 _KBUILD_TS_NOW := $(nanots )
50 $(info prof: $(call _KBUILD_FMT_ELAPSED,$(_KBUILD_TS_HEADER_START)) - $(call _KBUILD_FMT_ELAPSED, $(_KBUILD_TS_PREV)) -- $(strip $1))
51 ifeq ($(KBUILD_PROFILE_SELF),2)
52 $(info stat: $(make-stats ))
53 endif
54 _KBUILD_TS_PREV := $(_KBUILD_TS_NOW)
55endef
56
57endif
58
59
60#
61# Check make version before we do anything else.
62#
63ifndef KMK_VERSION
64 $(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)
65endif
66ifneq ($(KBUILD_VERSION_MAJOR).$(KBUILD_VERSION_MINOR),0.1)
67 ifneq ($(KBUILD_VERSION_MAJOR),0)
68 $(warning kBuild: kmk major version mismatch! Expected '0' but found '$(KBUILD_VERSION_MAJOR)'!)
69 else
70 $(warning kBuild: kmk minor version mismatch! Expected '1' but found '$(KBUILD_VERSION_MINOR)'!)
71 endif
72else
73 if $(KBUILD_VERSION_PATCH) < 999
74 $(error kBuild: kmk version mismatch! Expected 0.1.999 or later. Actual version is $(KBUILD_VERSION).)
75 endif
76endif
77
78#
79# The revision in which this file was last modified.
80# This can be useful when using development versions of kBuild.
81#
82KMK_REVISION := $(patsubst %:,, $Rev: 2726 $ )
83
84
85#
86# Define the default goal.
87#
88.PHONY: all all_recursive
89all: all_recursive
90
91#
92# The phony FORCE target.
93#
94.PHONY: FORCE
95FORCE:
96
97
98#
99# Enable delete on error and second expansion of prerequisites and targets.
100#
101.DELETE_ON_ERROR:
102
103.SECONDEXPANSION:
104
105.SECONDTARGETEXPANSION:
106
107
108#
109# General purpose macros.
110#
111
112##
113# Newline character(s).
114define NL
115
116
117endef
118
119##
120# Tab character.
121TAB := $(subst ., ,.)
122
123##
124# Newline + tab characters (for generating commands).
125NLTAB = $(NL)$(TAB)
126
127##
128# Space character.
129SP := $(subst ., ,.)
130
131##
132# Hash character.
133define HASH
134#
135endef
136
137##
138# Colon character.
139COLON := :
140
141##
142# Semicolon character.
143SEMICOLON := ;
144
145##
146# Comma character.
147COMMA := ,
148
149##
150# Dot character.
151DOT := .
152
153##
154# Dollar character.
155DOLLAR := $$
156
157##
158# Equal character.
159EQUAL := =
160
161##
162# Percent character.
163PERCENT := %
164
165##
166# Single quote character.
167SQUOTE := '
168
169##
170# Double quote character.
171DQUOTE := "
172
173
174#
175# The list of standard build types in kBuild.
176#
177# This list can be extended in Config.kmk and it's possible to extend
178# (inherit) another build type.
179#
180KBUILD_BLD_TYPES := release profile debug
181
182
183#
184# The OSes, Architectures and CPUs that kBuild recognizes.
185#
186# When kBuild is ported to a new OS or architecture a unique keyword needs
187# to be assigned to it and added here. This strictness is required because
188# this keyword namespace is shared between OSes, architectures, cpus and
189# build types. (PORTME)
190#
191KBUILD_OSES := darwin dos dragonfly freebsd haiku l4 linux netbsd nt openbsd os2 solaris win os-agnostic
192KBUILD_ARCHES := x86 amd64 sparc32 sparc64 s390 s390x ppc32 ppc64 mips32 mips64 ia64 hppa32 hppa64 arm alpha
193KBUILD_ARCHES_64 := amd64 sparc64 s390x ppc64 mips64 ia64 hppa64 alpha
194KBUILD_ARCHES_32 := x86 sparc32 s390 ppc32 mips32 hppa32 arm
195
196
197#
198# Set default build type.
199#
200ifndef KBUILD_TYPE
201 ifdef BUILD_TYPE
202 KBUILD_TYPE := $(BUILD_TYPE)
203 endif
204else ifdef BUILD_TYPE
205 ifneq ($(KBUILD_TYPE),$(BUILD_TYPE))
206 ifeq ($(origin KBUILD_TYPE):$(origin BUILD_TYPE),environment:command line)
207 KBUILD_TYPE := $(BUILD_TYPE)
208 else ifneq ($(origin KBUILD_TYPE):$(origin BUILD_TYPE),command line:environment)
209 $(error kBuild: KBUILD_TYPE and BUILD_TYPE disagree.)
210 endif
211 endif
212endif
213override BUILD_TYPE = $(KBUILD_TYPE)
214
215ifndef KBUILD_TYPE
216 KBUILD_TYPE := release
217else
218 if1of ($(KBUILD_TYPE), $(KBUILD_OSES) $(KBUILD_ARCHES))
219 $(error kBuild: The KBUILD_TYPE value '$(KBUILD_TYPE)' is an OS or architecture!)
220 endif
221 ifneq (.$(words $(KBUILD_TYPE)).$(KBUILD_TYPE).,.1.$(strip $(KBUILD_TYPE)).)
222 $(error kBuild: The KBUILD_TYPE value '$(KBUILD_TYPE)' contains spaces/tabs!)
223 endif
224endif
225
226
227#
228# Host platform legacy
229# kmk deals with this, so this is only temporary until I've rebuilt everything.
230#
231ifndef KBUILD_HOST
232 KBUILD_HOST := $(BUILD_PLATFORM)
233endif
234ifndef KBUILD_HOST_ARCH
235 KBUILD_HOST_ARCH := $(BUILD_PLATFORM_ARCH)
236endif
237ifndef KBUILD_HOST_CPU
238 KBUILD_HOST_CPU := $(BUILD_PLATFORM_CPU)
239endif
240
241
242#
243# Assert valid build platform variables.
244#
245# All these are set by kmk so they shouldn't be any trouble
246# unless the user starts messing about with environment variables.
247#
248ifneq (.$(words $(KBUILD_HOST)).$(KBUILD_HOST).,.1.$(strip $(KBUILD_HOST)).)
249 $(error kBuild: The KBUILD_HOST value '$(KBUILD_HOST)' contains spaces/tabs!)
250endif
251ifneq ($(words $(filter $(KBUILD_HOST),$(KBUILD_OSES))),1)
252 $(error kBuild: KBUILD_HOST value '$(KBUILD_HOST)' is not recognized (valid: $(KBUILD_OSES)))
253endif
254
255ifneq (.$(words $(KBUILD_HOST_ARCH)).$(KBUILD_HOST_ARCH).,.1.$(strip $(KBUILD_HOST_ARCH)).)
256 $(error kBuild: The KBUILD_HOST_ARCH value '$(KBUILD_HOST_ARCH)' contains spaces/tabs!)
257endif
258ifneq ($(words $(filter $(KBUILD_HOST_ARCH),$(KBUILD_ARCHES))),1)
259 $(error kBuild: KBUILD_HOST_ARCH value '$(KBUILD_HOST_ARCH)' is not recognized (valid: $(KBUILD_ARCHES)))
260endif
261
262ifeq ($(strip $(KBUILD_HOST_CPU)),)
263 KBUILD_HOST_CPU := blend
264else
265 ifneq (.$(words $(KBUILD_HOST_CPU)).$(KBUILD_HOST_CPU).,.1.$(strip $(KBUILD_HOST_CPU)).)
266 $(error kBuild: The KBUILD_HOST_CPU value '$(KBUILD_HOST_CPU)' contains spaces/tabs!)
267 endif
268 if1of ($(KBUILD_HOST_CPU), $(KBUILD_OSES) $(KBUILD_ARCHES))
269 $(error kBuild: The KBUILD_HOST_CPU value '$(KBUILD_HOST_CPU)' was found in the OS or architecture keywords!)
270 endif
271 ifeq ($(KBUILD_HOST_CPU),$(KBUILD_TYPE))
272 $(error kBuild: The KBUILD_HOST_CPU value '$(KBUILD_HOST_CPU)' is the same as the KBUILD_TYPE!)
273 endif
274endif
275
276
277#
278# Deal with target platform legacy.
279#
280ifndef KBUILD_TARGET
281 ifdef BUILD_TARGET
282 KBUILD_TARGET := $(BUILD_TARGET)
283 endif
284else ifdef BUILD_TARGET
285 ifneq ($(KBUILD_TARGET),$(BUILD_TARGET))
286 ifeq ($(origin KBUILD_TARGET):$(origin BUILD_TARGET),environment:command line)
287 KBUILD_TARGET := $(BUILD_TARGET)
288 else ifneq ($(origin KBUILD_TARGET):$(origin BUILD_TARGET),command line:environment)
289 $(error kBuild: KBUILD_TARGET and BUILD_TARGET disagree)
290 endif
291 endif
292endif
293override BUILD_TARGET = $(KBUILD_TARGET)
294
295ifndef KBUILD_TARGET_ARCH
296 ifdef BUILD_TARGET_ARCH
297 KBUILD_TARGET_ARCH := $(BUILD_TARGET_ARCH)
298 endif
299else ifdef BUILD_TARGET_ARCH
300 ifneq ($(KBUILD_TARGET_ARCH),$(BUILD_TARGET_ARCH))
301 ifeq ($(origin KBUILD_TARGET_ARCH):$(origin BUILD_TARGET_ARCH),environment:command line)
302 KBUILD_TARGET_ARCH := $(BUILD_TARGET_ARCH)
303 else ifneq ($(origin KBUILD_TARGET_ARCH):$(origin BUILD_TARGET_ARCH),command line:environment)
304 $(error kBuild: KBUILD_TARGET_ARCH and BUILD_TARGET_ARCH disagree)
305 endif
306 endif
307endif
308override BUILD_TARGET_ARCH = $(KBUILD_TARGET_ARCH)
309
310ifndef KBUILD_TARGET_CPU
311 ifdef BUILD_TARGET_CPU
312 KBUILD_TARGET_CPU := $(BUILD_TARGET_CPU)
313 endif
314else ifdef BUILD_TARGET_CPU
315 ifneq ($(KBUILD_TARGET_CPU),$(BUILD_TARGET_CPU))
316 ifeq ($(origin KBUILD_TARGET_CPU):$(origin BUILD_TARGET_CPU),environment:command line)
317 KBUILD_TARGET_CPU := $(BUILD_TARGET_CPU)
318 else ifneq ($(origin KBUILD_TARGET_CPU):$(origin BUILD_TARGET_CPU),command line:environment)
319 $(error kBuild: KBUILD_TARGET_CPU and BUILD_TARGET_CPU disagree)
320 endif
321 endif
322endif
323override BUILD_TARGET_CPU = $(KBUILD_TARGET_CPU)
324
325
326#
327# Assert or set default target platform.
328# When not defined use the corresponding KBUILD_HOST value.
329#
330ifndef KBUILD_TARGET
331 KBUILD_TARGET := $(KBUILD_HOST)
332else
333 ifneq (.$(words $(KBUILD_TARGET)).$(KBUILD_TARGET).,.1.$(strip $(KBUILD_TARGET)).)
334 $(error kBuild: The KBUILD_TARGET value '$(KBUILD_TARGET)' contains spaces/tabs!)
335 endif
336 ifneq ($(words $(filter $(KBUILD_TARGET),$(KBUILD_OSES))),1)
337 $(error kBuild: KBUILD_TARGET value '$(KBUILD_TARGET)' is not recognized (valid: $(KBUILD_OSES)))
338 endif
339endif
340
341ifndef KBUILD_TARGET_ARCH
342 KBUILD_TARGET_ARCH := $(KBUILD_HOST_ARCH)
343else
344 ifneq (.$(words $(KBUILD_TARGET_ARCH)).$(KBUILD_TARGET_ARCH).,.1.$(strip $(KBUILD_TARGET_ARCH)).)
345 $(error kBuild: The KBUILD_TARGET_ARCH value '$(KBUILD_TARGET_ARCH)' contains spaces/tabs!)
346 endif
347 ifneq ($(words $(filter $(KBUILD_TARGET_ARCH),$(KBUILD_ARCHES))),1)
348 $(error kBuild: KBUILD_TARGET_ARCH value '$(KBUILD_TARGET_ARCH)' is not recognized (valid: $(KBUILD_ARCHES)))
349 endif
350endif
351
352ifndef KBUILD_TARGET_CPU
353 KBUILD_TARGET_CPU := $(KBUILD_HOST_CPU)
354else ifeq ($(strip $(KBUILD_TARGET_CPU)),)
355 ifeq ($(KBUILD_TARGET_ARCH),$(KBUILD_HOST_ARCH))
356 KBUILD_TARGET_CPU := $(KBUILD_HOST_CPU)
357 else
358 KBUILD_TARGET_CPU := blend
359 endif
360else
361 ifneq (.$(words $(KBUILD_TARGET_CPU)).$(KBUILD_TARGET_CPU).,.1.$(strip $(KBUILD_TARGET_CPU)).)
362 $(error kBuild: The KBUILD_TARGET_CPU value '$(KBUILD_TARGET_CPU)' contains spaces/tabs!)
363 endif
364 if1of ($(KBUILD_TARGET_CPU), $(KBUILD_OSES) $(KBUILD_ARCHES))
365 $(error kBuild: The KBUILD_TARGET_CPU value was found in the OS or architecture keywords!)
366 endif
367 ifeq ($(KBUILD_TARGET_CPU),$(KBUILD_TYPE))
368 $(error kBuild: The KBUILD_TARGET_CPU value '$(KBUILD_TARGET_CPU)' is the same as the KBUILD_TYPE!)
369 endif
370endif
371
372
373#
374# Paths and stuff.
375#
376
377# Adjust DEPTH first.
378DEPTH := $(strip $(DEPTH))
379ifeq ($(DEPTH),)
380 DEPTH := .
381endif
382
383## PATH_CURRENT is the current directory (getcwd).
384PATH_CURRENT := $(abspath $(CURDIR))
385## PATH_SUB_CURRENT points to current directory of the current makefile.
386# Meaning that it will change value as we enter and exit sub-makefiles.
387PATH_SUB_CURRENT := $(PATH_CURRENT)
388## PATH_ROOT points to the project root directory.
389PATH_ROOT := $(abspath $(PATH_CURRENT)/$(DEPTH))
390## PATH_SUB_ROOT points to the directory of the top-level makefile.
391ifneq ($(strip $(SUB_DEPTH)),)
392 SUB_DEPTH := $(strip $(SUB_DEPTH))
393 PATH_SUB_ROOT := $(abspath $(PATH_CURRENT)/$(SUB_DEPTH))
394else
395 PATH_SUB_ROOT := $(PATH_CURRENT)
396endif
397
398## CURSUBDIR is PATH_SUB_ROOT described relative to PATH_ROOT.
399# This variable is used to determin where the object files and other output goes.
400ifneq ($(PATH_ROOT),$(PATH_SUB_ROOT))
401 CURSUBDIR := $(patsubst $(PATH_ROOT)/%,%,$(PATH_SUB_ROOT))
402else
403 CURSUBDIR := .
404endif
405
406# Install directory layout. Relative to PATH_INS.
407KBUILD_INST_PATHS := BIN DLL SYS LIB DOC DEBUG SBIN LIBEXEC SHARE
408INST_BIN = bin/
409if1of ($(KBUILD_TARGET), win)
410INST_DLL = bin/
411else
412INST_DLL = lib/
413endif
414if1of ($(KBUILD_TARGET), os2 win)
415INST_SYS = drivers/
416else
417INST_SYS = kernel/
418endif
419INST_LIB = lib/
420INST_DOC = share/doc/
421INST_DEBUG = debug/
422INST_SBIN = sbin/
423INST_LIBEXEC = libexec/
424INST_SHARE = share/
425
426# Staging directory layout. Relative to PATH_STAGE.
427STAGE_BIN = $(INST_BIN)
428STAGE_DLL = $(INST_DLL)
429STAGE_SYS = $(INST_SYS)
430STAGE_LIB = $(INST_LIB)
431STAGE_DOC = $(INST_DOC)
432STAGE_DEBUG = $(INST_DEBUG)
433STAGE_SBIN = $(INST_SBIN)
434STAGE_LIBEXEC = $(INST_LIBEXEC)
435STAGE_SHARE = $(INST_SHARE)
436
437# Install and staging directory paths.
438$(foreach path, $(KBUILD_INST_PATHS), \
439 $(eval PATH_STAGE_$(path) = $$(patsubst %/,%,$$(PATH_STAGE)/$$(STAGE_$(path)))) \
440 $(eval PATH_INST_$(path) = $$(patsubst %/,%,$$(PATH_INS)/$$(INST_$(path)))) \
441)
442
443# Output directories.
444ifndef PATH_OUT_BASE
445 PATH_OUT_BASE := $(PATH_ROOT)/out
446endif
447ifndef PATH_OUT
448 ifdef BUILD_TARGET_SUB # (BUILD_TARGET_SUB is not currently recognized by kBuild in any other places - obsolete)
449 PATH_OUT = $(PATH_OUT_BASE)/$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH).$(BUILD_TARGET_SUB)/$(KBUILD_TYPE)
450 else
451 PATH_OUT = $(PATH_OUT_BASE)/$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)/$(KBUILD_TYPE)
452 endif
453endif # !define PATH_OUT
454PATH_OBJCACHE = $(PATH_OUT_BASE)/kObjCache
455PATH_OBJ = $(PATH_OUT)/obj
456PATH_TARGET = $(PATH_OBJ)/$(CURSUBDIR)
457PATH_STAGE = $(PATH_OUT)/stage
458ifndef PATH_INS
459 ifdef DESTROOT
460PATH_INS = $(DESTROOT)
461 else
462PATH_INS = $(PATH_OUT)/dist
463 endif
464endif
465
466# Tripwire obsolete PATH defines.
467PATH_BIN = $(error kBuild: PATH_BIN is obsoleted in kBuild 0.1.2. Use PATH_STAGE_BIN or PATH_INST_BIN instead)
468PATH_DLL = $(error kBuild: PATH_LIB is obsoleted in kBuild 0.1.2. Use PATH_STAGE_DLL or PATH_INST_DLL instead)
469PATH_LIB = $(error kBuild: PATH_LIB is obsoleted in kBuild 0.1.2. Use PATH_STAGE_LIB or PATH_INST_LIB instead)
470PATH_SYS = $(error kBuild: PATH_SYS is obsoleted in kBuild 0.1.2. Use PATH_STAGE_SYS or PATH_INST_SYS instead)
471PATH_DOC = $(error kBuild: PATH_DOC is obsoleted in kBuild 0.1.2. Use PATH_STAGE_DOC or PATH_INST_DOC instead)
472
473# Development tool tree.
474KBUILD_DEVTOOLS ?= $(if $(PATH_DEVTOOLS),$(PATH_DEVTOOLS),$(PATH_ROOT)/tools)
475KBUILD_DEVTOOLS_TRG ?= $(KBUILD_DEVTOOLS)/$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)
476KBUILD_DEVTOOLS_HST ?= $(KBUILD_DEVTOOLS)/$(KBUILD_HOST).$(KBUILD_HOST_ARCH)
477
478if1of ($(KBUILD_TARGET_ARCH), amd64 hppa64 mips64 ppc64 s390x sparc64)
479 ifeq ($(KBUILD_TARGET_ARCH),amd64)
480 KBUILD_DEVTOOLS_TRG_ALT ?= $(PATH_DEVTOOLS)/$(KBUILD_TARGET).x86
481 else ifeq ($(KBUILD_TARGET_ARCH),hppa64)
482 KBUILD_DEVTOOLS_TRG_ALT ?= $(PATH_DEVTOOLS)/$(KBUILD_TARGET).hppa32
483 else ifeq ($(KBUILD_TARGET_ARCH),mips64)
484 KBUILD_DEVTOOLS_TRG_ALT ?= $(PATH_DEVTOOLS)/$(KBUILD_TARGET).mips32
485 else ifeq ($(KBUILD_TARGET_ARCH),ppc64)
486 KBUILD_DEVTOOLS_TRG_ALT ?= $(PATH_DEVTOOLS)/$(KBUILD_TARGET).ppc32
487 else ifeq ($(KBUILD_TARGET_ARCH),s390x)
488 KBUILD_DEVTOOLS_TRG_ALT ?= $(PATH_DEVTOOLS)/$(KBUILD_TARGET).s390
489 else ifeq ($(KBUILD_TARGET_ARCH),sparc64)
490 KBUILD_DEVTOOLS_TRG_ALT ?= $(PATH_DEVTOOLS)/$(KBUILD_TARGET).sparc32
491 endif
492endif
493
494if1of ($(KBUILD_HOST_ARCH), amd64 hppa64 mips64 ppc64 s390x sparc64)
495 ifeq ($(KBUILD_HOST_ARCH),amd64)
496 KBUILD_DEVTOOLS_HST_ALT ?= $(PATH_DEVTOOLS)/$(KBUILD_HOST).x86
497 else ifeq ($(KBUILD_HOST_ARCH),hppa64)
498 KBUILD_DEVTOOLS_HST_ALT ?= $(PATH_DEVTOOLS)/$(KBUILD_HOST).hppa32
499 else ifeq ($(KBUILD_HOST_ARCH),mips64)
500 KBUILD_DEVTOOLS_HST_ALT ?= $(PATH_DEVTOOLS)/$(KBUILD_HOST).mips32
501 else ifeq ($(KBUILD_HOST_ARCH),ppc64)
502 KBUILD_DEVTOOLS_HST_ALT ?= $(PATH_DEVTOOLS)/$(KBUILD_HOST).ppc32
503 else ifeq ($(KBUILD_HOST_ARCH),s390x)
504 KBUILD_DEVTOOLS_HST_ALT ?= $(PATH_DEVTOOLS)/$(KBUILD_HOST).s390
505 else ifeq ($(KBUILD_HOST_ARCH),sparc64)
506 KBUILD_DEVTOOLS_HST_ALT ?= $(PATH_DEVTOOLS)/$(KBUILD_HOST).sparc32
507 endif
508endif
509
510# Deprecated legacy names.
511PATH_DEVTOOLS ?= $(KBUILD_DEVTOOLS)
512PATH_DEVTOOLS_TRG ?= $(KBUILD_DEVTOOLS_TRG)
513PATH_DEVTOOLS_TRG_ALT ?= $(KBUILD_DEVTOOLS_TRG_ALT)
514PATH_DEVTOOLS_HST ?= $(KBUILD_DEVTOOLS_HST)
515PATH_DEVTOOLS_HST_ALT ?= $(KBUILD_DEVTOOLS_HST_ALT)
516
517# KBUILD_PATH / PATH_KBUILD is determined by kmk.
518ifndef KBUILD_PATH
519 KBUILD_PATH := $(PATH_KBUILD)
520endif
521ifeq ($(strip $(KBUILD_PATH)),)
522 $(error kBuild: KBUILD_PATH is missing or empty! kmk is supposed to set it.)
523endif
524# KBUILD_BIN_PATH / PATH_KBUILD_BIN is determined by kmk.
525ifndef KBUILD_BIN_PATH
526 KBUILD_BIN_PATH := $(PATH_KBUILD_BIN)
527endif
528ifeq ($(strip $(KBUILD_BIN_PATH)),)
529 $(error kBuild: KBUILD_BIN_PATH is missing or empty! kmk is supposed to set it.)
530endif
531
532# kBuild files which might be of interest.
533FILE_KBUILD_HEADER := $(KBUILD_PATH)/header.kmk
534#FILE_KBUILD_CONFIG := $(KBUILD_PATH)/config.kmk
535FILE_KBUILD_FOOTER := $(KBUILD_PATH)/footer.kmk
536FILE_KBUILD_SUB_HEADER := $(KBUILD_PATH)/subheader.kmk
537FILE_KBUILD_SUB_FOOTER := $(KBUILD_PATH)/subfooter.kmk
538
539## MAKEFILE is the name of the main makefile.
540MAKEFILE := $(firstword $(MAKEFILE_LIST))
541## MAKEFILE_CURRENT is the name of the current makefile.
542# This is updated everything a sub-makefile is included.
543MAKEFILE_CURRENT := $(MAKEFILE)
544
545
546## @todo this should be done via SUFF_XYZ.target/host...
547
548#
549# Build platform setup.
550# (PORTME)
551#
552if1of ($(KBUILD_HOST), win nt)
553# Win, Win32, Win64, NT.
554EXEC_X86_WIN32 :=
555HOSTSUFF_EXE := .exe
556
557# OS/2.
558else ifeq ($(KBUILD_HOST),os2)
559EXEC_X86_WIN32 := innopec.exe
560HOSTSUFF_EXE := .exe
561
562else if1of ($(KBUILD_HOST), freebsd dragonfly linux openbsd netbsd)
563# Unix (like) systems with wine.
564EXEC_X86_WIN32 := wine
565HOSTSUFF_EXE :=
566
567else
568# Unix (like) systems without wine.
569EXEC_X86_WIN32 := false
570HOSTSUFF_EXE :=
571endif
572
573
574#
575# Build target setup.
576# (PORTME)
577#
578SUFF_DEP := .dep
579SUFF_BIN :=
580if1of ($(KBUILD_TARGET), win nt os2)
581SUFF_OBJ := .obj
582SUFF_LIB := .lib
583SUFF_DLL := .dll
584SUFF_EXE := .exe
585SUFF_SYS := .sys
586SUFF_RES := .res
587else ifeq ($(KBUILD_TARGET),l4)
588SUFF_OBJ := .o
589SUFF_LIB := .a
590SUFF_DLL := .s.so
591SUFF_EXE :=
592SUFF_SYS := .a
593SUFF_RES :=
594else ifeq ($(KBUILD_TARGET),darwin)
595SUFF_OBJ := .o
596SUFF_LIB := .a
597SUFF_DLL := .dylib
598SUFF_EXE :=
599SUFF_SYS :=
600SUFF_RES :=
601else
602SUFF_OBJ := .o
603SUFF_LIB := .a
604SUFF_DLL := .so
605SUFF_EXE :=
606 if1of ($(KBUILD_TARGET), dragonfly freebsd linux netbsd openbsd) ## @todo check netbsd and openbsd.
607SUFF_SYS := .ko
608 else
609SUFF_SYS :=
610 endif
611SUFF_RES :=
612endif
613
614#
615# Standard kBuild tools.
616#
617ifeq ($(KMK),kmk)
618KMK := $(KBUILD_BIN_PATH)/kmk$(HOSTSUFF_EXE)
619endif
620MAKE := $(KMK)
621
622GMAKE := $(KBUILD_BIN_PATH)/kmk_gmake$(HOSTSUFF_EXE)
623
624#DEP_EXT := $(KBUILD_BIN_PATH)/kDep$(HOSTSUFF_EXE)
625#DEP_INT := $(KBUILD_BIN_PATH)/kDep$(HOSTSUFF_EXE)
626#DEP := $(DEP_INT)
627
628DEP_IDB_EXT := $(KBUILD_BIN_PATH)/kDepIDB$(HOSTSUFF_EXE)
629DEP_IDB_INT := kmk_builtin_kDepIDB
630DEP_IDB := $(DEP_IDB_INT)
631
632DEP_PRE := $(KBUILD_BIN_PATH)/kDepPre$(HOSTSUFF_EXE)
633
634KOBJCACHE_EXT := $(KBUILD_BIN_PATH)/kObjCache$(HOSTSUFF_EXE)
635KOBJCACHE := $(KOBJCACHE_EXT)
636
637APPEND_EXT := $(KBUILD_BIN_PATH)/kmk_append$(HOSTSUFF_EXE)
638APPEND_INT := kmk_builtin_append
639APPEND := $(APPEND_INT)
640
641CAT_EXT := $(KBUILD_BIN_PATH)/kmk_cat$(HOSTSUFF_EXE)
642CAT_INT := kmk_builtin_cat
643CAT := $(CAT_INT)
644
645CHMOD_EXT := $(KBUILD_BIN_PATH)/kmk_chmod$(HOSTSUFF_EXE)
646CHMOD_INT := kmk_builtin_chmod
647CHMOD := $(CHMOD_INT)
648
649CMP_EXT := $(KBUILD_BIN_PATH)/kmk_cmp$(HOSTSUFF_EXE)
650CMP_INT := kmk_builtin_cmp
651CMP := $(CMP_INT)
652
653CP_EXT := $(KBUILD_BIN_PATH)/kmk_cp$(HOSTSUFF_EXE)
654CP_INT := kmk_builtin_cp
655CP := $(CP_INT)
656
657ECHO_EXT := $(KBUILD_BIN_PATH)/kmk_echo$(HOSTSUFF_EXE)
658ECHO_INT := kmk_builtin_echo
659ECHO := $(ECHO_INT)
660
661EXPR_EXT := $(KBUILD_BIN_PATH)/kmk_expr$(HOSTSUFF_EXE)
662EXPR_INT := kmk_builtin_expr
663EXPR := $(EXPR_INT)
664
665INSTALL_EXT := $(KBUILD_BIN_PATH)/kmk_install$(HOSTSUFF_EXE)
666INSTALL_INT := kmk_builtin_install
667INSTALL := $(INSTALL_INT)
668
669LN_EXT := $(KBUILD_BIN_PATH)/kmk_ln$(HOSTSUFF_EXE)
670LN_INT := kmk_builtin_ln
671LN := $(LN_INT)
672
673MD5SUM_EXT := $(KBUILD_BIN_PATH)/kmk_md5sum$(HOSTSUFF_EXE)
674MD5SUM_INT := kmk_builtin_md5sum
675MD5SUM := $(MD5SUM_INT)
676
677MKDIR_EXT := $(KBUILD_BIN_PATH)/kmk_mkdir$(HOSTSUFF_EXE)
678MKDIR_INT := kmk_builtin_mkdir
679MKDIR := $(MKDIR_INT)
680
681MV_EXT := $(KBUILD_BIN_PATH)/kmk_mv$(HOSTSUFF_EXE)
682MV_INT := kmk_builtin_mv
683MV := $(MV_INT)
684
685PRINTF_EXT := $(KBUILD_BIN_PATH)/kmk_printf$(HOSTSUFF_EXE)
686PRINTF_INT := kmk_builtin_printf
687PRINTF := $(PRINTF_INT)
688
689REDIRECT_EXT:= $(KBUILD_BIN_PATH)/kmk_redirect$(HOSTSUFF_EXE)
690REDIRECT_INT:= $(REDIRECT_EXT)
691REDIRECT := $(REDIRECT_INT)
692
693RM_EXT := $(KBUILD_BIN_PATH)/kmk_rm$(HOSTSUFF_EXE)
694RM_INT := kmk_builtin_rm
695RM := $(RM_INT)
696
697RMDIR_EXT := $(KBUILD_BIN_PATH)/kmk_rmdir$(HOSTSUFF_EXE)
698RMDIR_INT := kmk_builtin_rmdir
699RMDIR := $(RMDIR_INT)
700
701SED_EXT := $(KBUILD_BIN_PATH)/kmk_sed$(HOSTSUFF_EXE)
702SED_INT := $(SED_EXT)
703SED := $(SED_EXT)
704
705SLEEP_INT := kmk_builtin_sleep
706SLEEP_EXT := $(KBUILD_BIN_PATH)/kmk_sleep$(HOSTSUFF_EXE)
707SLEEP := $(SLEEP_EXT)
708
709TEST_EXT := $(KBUILD_BIN_PATH)/kmk_test$(HOSTSUFF_EXE)
710TEST_INT := kmk_builtin_test
711TEST := $(TEST_INT)
712
713TIME_EXT := $(KBUILD_BIN_PATH)/kmk_time$(HOSTSUFF_EXE)
714TIME_INT := $(TIME_EXT)
715TIME := $(TIME_INT)
716
717# Our default shell is the Almquist shell from *BSD.
718ASH := $(KBUILD_BIN_PATH)/kmk_ash$(HOSTSUFF_EXE)
719MAKESHELL := $(ASH)
720SHELL := $(ASH)
721export SHELL MAKESHELL
722
723# Symlinking is problematic on some platforms...
724LN_SYMLINK := $(LN) -s
725
726# When copying to the staging area, use hard links to save time and space.
727ifndef KBUILD_NO_HARD_LINKING
728 INSTALL_STAGING := $(INSTALL) --hard-link-files-when-possible
729else
730 INSTALL_STAGING := $(INSTALL)
731endif
732
733
734#
735# Some Functions.
736# The lower cased ones are either fallbacks or candidates for functions.c.
737#
738
739## ABSPATH - make paths absolute.
740# This implementation is clumsy and doesn't resolve '..' and '.' components.
741#
742# @param $1 The paths to make absolute.
743# @obsolete Use the GNU make function $(abspath) directly now.
744ABSPATH = $(abspath $(1))$(warning ABSPATH is deprecated, use abspath directly!)
745
746## DIRDEP - make create directory dependencies.
747#
748# @param $1 The paths to the directories which must be created.
749DIRDEP = $(foreach path,$(patsubst %/,%,$(1)),$(path)/)
750
751## Cygwin kludge.
752# This converts /cygdrive/x/% to x:%.
753#
754# @param $1 The paths to make native.
755# @remark This macro is pretty much obsolete since we don't use cygwin base make.
756ifneq ($(patsubst /cygdrive/%,%,$(CURDIR)),$(CURDIR))
757 CYGPATHMIXED = $(foreach path,$(1)\
758 ,$(if $(patsubst /cygdrive/%,,$(path)),$(path),$(patsubst $(strip $(firstword $(subst /, ,$(patsubst /cygdrive/%,%,$(path)))))/%,$(strip $(firstword $(subst /, ,$(patsubst /cygdrive/%,%,$(path))))):/%,$(patsubst /cygdrive/%,%,$(path)))))
759else
760 CYGPATHMIXED = $(1)
761endif
762
763## Removes the drive letter from a path (if it has one)
764# @param $1 the path
765no-drive = $(word $(words $(subst :, ,$(1))),$(subst :, ,$(1)))
766
767## Removes the root slash from a path (if it has one)
768# @param $1 the path
769no-root-slash = $(patsubst /%,%,$(1))
770
771##
772# Similar to firstword, except it returns the value of first defined variable.
773# @param $1 list of variables to probe.
774define FIRST-DEFINED-VAR
775local .RETURN := $(strip $(firstdefined $1, value))
776endef
777
778## Figure out where to put object files.
779# @param $1 real target name.
780# @param $2 normalized main target
781TARGET_BASE = $(PATH_TARGET)/$(2)/$(call no-root-slash,$(call no-drive,$(1)))
782
783## Figure out where to put object files.
784# @param $1 normalized main target
785TARGET_PATH = $(PATH_TARGET)/$(1)
786
787##
788# Checks if the specified short option ($1) is found in the flags ($2),
789# assuming getopt style options.
790#
791# @returns $3 if present, $4 not.
792#
793# @param $1 The option (single char!).
794# @param $2 The option arguments.
795# @param $3 Eval and return if present.
796# @param $4 Eval and return if not present.
797#
798# @todo May confuse option values starting with '-' for options.
799# @remarks Invoke like this: $(evalcall KB_FN_OPT_TEST_SHORT,d,$(flags),present,not-present)
800#
801define KB_FN_OPT_TEST_SHORT
802local options := $(translate $(strip $(filter -%,$(filter-out --%,$2))),$(SP)-,)
803local .RETURN := $(if-expr $(pos $1,$(options)) != 0,$3,$4)
804endef
805
806##
807# Checks if the specified long option ($1) is found in the flags ($2),
808# assuming getopt style options.
809#
810# @returns $3 if present, $4 not.
811#
812# @param $1 The long option, dashes included. No % chars.
813# @param $2 The option arguments.
814# @param $3 Eval and return if present.
815# @param $4 Eval and return if not present.
816#
817# @todo May confuse option values starting with '--' for options.
818# @remarks Invoke like this: $(evalcall KBFN_OPT_TEST_SHORT,--defined,$(flags),present,not-present)
819#
820define KB_FN_OPT_TEST_LONG
821local options := $(filter-out =delete=%,$(subst :, =delete=,$(subst =, =delete=,$2)))
822local .RETURN := $(if-expr "$(filter $1,$(options))" != "",$3,$4)
823endef
824
825##
826# Checks if the specified short ($1) or long ($2) option is found in the flags ($2),
827# assuming getopt style options.
828#
829# @returns $4 if present, $5 not.
830#
831# @param $1 The short option (single char!).
832# @param $2 The long option, dashes included. No % chars.
833# @param $3 The option arguments.
834# @param $4 Eval and return if present.
835# @param $5 Eval and return if not present.
836#
837# @todo May confuse option values starting with '--' for options.
838# @remarks Invoke like this: $(evalcall KB_FN_OPT_TEST_SHORT_LONG,d,--defined,$(flags),present,not-present)
839#
840define KB_FN_OPT_TEST_SHORT_LONG
841local short_options := $(translate $(strip $(filter -%,$(filter-out --%,$3))),$(SP)-,)
842local long_options := $(filter-out =delete=%,$(subst :, =delete=,$(subst =, =delete=,$3)))
843local .RETURN := $(if-expr $(pos $1,$(short_options)) != 0 || "$(filter $2,$(long_options))" != "",$4,$5)
844endef
845
846##
847# Make an assignment to a deprecated variable.
848#
849# @param $1 The variable name.
850# @param $2 The value.
851# @param $3 The variable to use instead.
852#
853ifdef KBUILD_WITH_DEPREATED_AS_ERROR
854 KB_FN_ASSIGN_DEPRECATED = $(eval $(subst :,$$(COLON),$1) = $2$$(error $1 is deprecated, use $3 instead))
855else
856 KB_FN_ASSIGN_DEPRECATED = $(eval $(subst :,$$(COLON),$1) = $2$$(warning $1 is deprecated, use $3 instead))
857endif
858
859##
860# Show an assertion message.
861#
862# @param $1 The assertion name.
863# @param $2 The details.
864#
865define KB_FN_ASSERT_MSG
866$(info !! kBuild $1 Assertion Failed !!)
867ifdef target
868 $(info !! target: $(target))
869 local varloc := $(where $(target))
870 if "$(varloc)" == "undefined"
871 local varloc := $(where $(target)_TEMPLATE)
872 endif
873 if "$(varloc)" == "undefined"
874 local varloc := $(where $(target)_SOURCES)
875 endif
876 if "$(varloc)" == "undefined"
877 local varloc := $(where $(target)_EXTENDS)
878 endif
879 if "$(varloc)" == "undefined"
880 local varloc := $(where target)
881 endif
882 ifneq ($(varloc),)
883 $(info !! location: $(varloc))
884 else
885 $(info !! probable location: $($(target)_DEFPATH)/Makefile.kmk)
886 endif
887endif
888$(info !! $2)
889$(error fixme)
890endef
891
892##
893# Throw an error if the given path $1 isn't absolute and assertions are enabled.
894#
895# @param $1 The name of the path variable to check.
896#
897ifdef KBUILD_INTERNAL_STRICT
898 KB_FN_ASSERT_ABSPATH = $(if-expr "$(abspath $($(strip $1)))" != "$(strip $($(strip $1)))",\
899 $(evalcall KB_FN_ASSERT_MSG,abspath,$1 is:$(NLTAB)'$($(strip $1))'$(NLTAB)expected:$(NLTAB)'$(abspath $($(strip $1)))'))
900else
901 KB_FN_ASSERT_ABSPATH :=
902endif
903
904
905#
906# Initialize some of the globals which the Config.kmk and
907# others can add stuff to if they like for processing in the footer.
908#
909
910## KBUILD_TEMPLATE_PATHS
911# List a paths (separated by space) where templates can be found.
912KBUILD_TEMPLATE_PATHS :=
913
914## KBUILD_TOOL_PATHS
915# List of paths (separated by space) where tools can be found.
916KBUILD_TOOL_PATHS :=
917
918## KBUILD_SDK_PATHS
919# List of paths (separated by space) where SDKs can be found.
920KBUILD_SDK_PATHS :=
921
922## KBUILD_UNIT_PATHS
923# List of paths (separated by space) where units (USES) can be found.
924KBUILD_UNIT_PATHS :=
925
926## KBUILD_DEFAULT_PATHS
927# List of paths (separated by space) to search for stuff as a last resort.
928KBUILD_DEFAULT_PATHS :=
929
930## Proritized list of the default makefile when walking subdirectories.
931# The user can overload this list.
932DEFAULT_MAKEFILE := Makefile.kmk makefile.kmk Makefile makefile
933
934## KBUILD_SRC_HANDLERS
935# The list of source handlers, pair of extension and handler.
936# The user can overload this list to provide additional or custom
937# handlers. On a per-target/template see SRC_HANDLERS.
938KBUILD_SRC_HANDLERS := \
939 .c:def_src_handler_c \
940 .C:def_src_handler_c \
941.cxx:def_src_handler_cxx \
942.CXX:def_src_handler_cxx \
943.cpp:def_src_handler_cxx \
944.CPP:def_src_handler_cxx \
945 .cc:def_src_handler_cxx \
946 .CC:def_src_handler_cxx \
947 .m:def_src_handler_objc \
948 .M:def_src_handler_objcxx \
949 .mm:def_src_handler_objcxx \
950.asm:def_src_handler_asm \
951.ASM:def_src_handler_asm \
952 .s:def_src_handler_asm \
953 .S:def_src_handler_asm \
954 .rc:def_src_handler_rc \
955.obj:def_src_handler_obj \
956 .o:def_src_handler_obj \
957.res:def_src_handler_obj
958
959## PROPS_TOOLS
960# This is a subset of PROPS_SINGLE.
961PROPS_TOOLS := TOOL CTOOL CXXTOOL OBJCTOOL OBJCXXTOOL ASTOOL RCTOOL ARTOOL LDTOOL FETCHTOOL UNPACKTOOL PATCHTOOL
962
963## PROPS_SINGLE
964# The list of non-accumulative target properties.
965# A Config.kmk file can add it's own properties to this list and kBuild
966# will do the necessary inheritance for templates, sdks, tools and targets.
967PROPS_SINGLE := $(PROPS_TOOLS) TEMPLATE INSTTYPE INST STAGE NOINST BLD_TYPE BLD_TRG BLD_TRG_ARCH BLD_TRG_CPU FETCHDIR \
968 OBJSUFF COBJSUFF CXXOBJSUFF OBJCOBJSUFF OBJCXXOBJSUFF ASOBJSUFF RCOBJSUFF SYSSUFF BINSUFF EXESUFF DLLSUFF LIBSUFF ARLIBSUFF \
969 MODE UID GID LD_DEBUG DEBUG_INSTTYPE DEBUG_INST DEBUG_STAGE
970## PROPS_SINGLE_LNK
971# Subset of PROPS_SINGLE which applies to all linkable targets.
972PROPS_SINGLE_LNK := $(filter-out FETCHTOOL UNPACKTOOL PATCHTOOL FETCHDIR, $(PROPS_SINGLE))
973
974## PROPS_DEFERRED
975# This list of non-accumulative target properties which are or may be
976# functions, and thus should not be expanded until the very last moment.
977PROPS_DEFERRED := INSTFUN INSTALLER PRE_CMDS POST_CMDS PRE_INST_CMDS POST_INST_CMDS \
978 PRE_FILE_CMDS POST_FILE_CMDS PRE_SYMLINK_CMDS POST_SYMLINK_CMDS PRE_DIRECTORY_CMDS POST_DIRECTORY_CMDS \
979 NAME SONAME
980
981## PROPS_ACCUMULATE_R
982# The list of accumulative target properties where the right most value/flag
983# is the 'most significant'.
984# A Config.kmk file can add it's own properties to this list and kBuild
985# will do the necessary inheritance from templates to targets.
986PROPS_ACCUMULATE_R := \
987 DEPS LNK_DEPS ORDERDEPS LNK_ORDERDEPS DEFS \
988 ARFLAGS \
989 CFLAGS CDEFS \
990 CXXFLAGS CXXDEFS \
991 OBJCFLAGS OBJCDEFS \
992 OBJCXXFLAGS OBJCXXDEFS \
993 ASFLAGS ASDEFS \
994 RCFLAGS RCDEFS \
995 LDFLAGS \
996 IDFLAGS IFFLAGS EXEC_IFFLAGS ISFLAGS \
997 FETCHFLAGS UNPACKFLAGS PATCHFLAGS
998## PROPS_ACCUMULATE_R_LNK
999# Subset of PROPS_ACCUMULATE_R which applies to all linkable targets.
1000PROPS_ACCUMULATE_R_LNK := $(filter-out ARFLAGS LDFLAGS EXEC_IFFLAGS FETCHFLAGS UNPACKFLAGS PATCHFLAGS, $(PROPS_ACCUMULATE_R))
1001
1002## PROPS_ACCUMULATE
1003# The list of accumulative target properties where the left most value/flag
1004# is the 'most significant'.
1005# A Config.kmk file can add it's own properties to this list and kBuild
1006# will do the necessary inheritance from templates to targets.
1007PROPS_ACCUMULATE_L := \
1008 SDKS USES SOURCES EXEC_SOURCES SRC_HANDLERS INTERMEDIATES \
1009 INCS CINCS CXXINCS OBJCINCS OBJCXXINCS ASINCS RCINCS \
1010 LIBS LIBPATH \
1011 DIRS BLDDIRS CLEAN
1012## PROPS_ACCUMULATE_L_LNK
1013# Subset of PROPS_ACCUMULATE_L which applies to all linkable targets.
1014PROPS_ACCUMULATE_L_LNK := $(filter-out LIBS LIBPATH EXEC_SOURCES DIRS, $(PROPS_ACCUMULATE_L))
1015
1016## PROPS_ALL
1017# List of all the properties.
1018PROPS_ALL = $(PROPS_SINGLE) $(PROPS_DEFERRED) $(PROPS_ACCUMULATE_L) $(PROPS_ACCUMULATE_R)
1019
1020## @name Properties valid on programs (BLDPROGS and PROGRAMS)
1021## @{
1022PROPS_PROGRAMS_SINGLE := $(PROPS_SINGLE_LNK) LDTOOL EXESUFF
1023PROPS_PROGRAMS_DEFERRED := $(PROPS_DEFERRED)
1024PROPS_PROGRAMS_ACCUMULATE_R := $(PROPS_ACCUMULATE_R_LNK) LDFLAGS
1025PROPS_PROGRAMS_ACCUMULATE_L := $(PROPS_ACCUMULATE_L_LNK) LIBS LIBPATH
1026## @}
1027
1028## @name Properties valid on libraries (LIBRARIES and IMPORT_LIBS)
1029## @{
1030PROPS_LIBRARIES_SINGLE := $(PROPS_SINGLE_LNK) ARTOOL LIBSUFF ARLIBSUFF LIBSUFF
1031PROPS_LIBRARIES_DEFERRED := $(filter-out SONAME,$(PROPS_DEFERRED))
1032PROPS_LIBRARIES_ACCUMULATE_R := $(PROPS_ACCUMULATE_R_LNK) ARFLAGS
1033PROPS_LIBRARIES_ACCUMULATE_L := $(PROPS_ACCUMULATE_L_LNK)
1034## @}
1035
1036## @name Properties valid on dlls (DLLS)
1037## @{
1038PROPS_DLLS_SINGLE := $(PROPS_SINGLE_LNK) LDTOOL DLLSUFF LIBSUFF
1039PROPS_DLLS_DEFERRED := $(PROPS_DEFERRED)
1040PROPS_DLLS_ACCUMULATE_R := $(PROPS_ACCUMULATE_R_LNK) LDFLAGS
1041PROPS_DLLS_ACCUMULATE_L := $(PROPS_ACCUMULATE_L_LNK) LIBS LIBPATH
1042## @}
1043
1044## @name Properties valid on system modules (SYSMODS)
1045## @{
1046PROPS_SYSMODS_SINGLE := $(PROPS_SINGLE_LNK) LDTOOL SYSSUFF
1047PROPS_SYSMODS_DEFERRED := $(PROPS_DEFERRED)
1048PROPS_SYSMODS_ACCUMULATE_R := $(PROPS_ACCUMULATE_R_LNK) LDFLAGS
1049PROPS_SYSMODS_ACCUMULATE_L := $(PROPS_ACCUMULATE_L_LNK) LIBS LIBPATH
1050## @}
1051
1052## @name Properties valid on misc binaries (MISCBINS)
1053## @{
1054PROPS_MISCBINS_SINGLE := $(PROPS_SINGLE_LNK) LDTOOL BINSUFF
1055PROPS_MISCBINS_DEFERRED := $(PROPS_DEFERRED)
1056PROPS_MISCBINS_ACCUMULATE_R := $(PROPS_ACCUMULATE_R_LNK) LDFLAGS
1057PROPS_MISCBINS_ACCUMULATE_L := $(PROPS_ACCUMULATE_L_LNK) LIBS LIBPATH
1058## @}
1059
1060## @name Properties valid on installs (INSTALLS)
1061## @{
1062PROPS_INSTALLS_SINGLE := TOOL TEMPLATE INSTTYPE INST STAGE NOINST BLD_TYPE BLD_TRG BLD_TRG_ARCH BLD_TRG_CPU MODE UID GID
1063PROPS_INSTALLS_DEFERRED := INSTFUN INSTALLER PRE_FILE_CMDS POST_FILE_CMDS PRE_SYMLINK_CMDS POST_SYMLINK_CMDS \
1064 PRE_DIRECTORY_CMDS POST_DIRECTORY_CMDS
1065PROPS_INSTALLS_ACCUMULATE_R := DEPS ORDERDEPS GOALS INST_ONLY_GOALS STAGE_ONLY_GOALS IFFLAGS EXEC_IFFLAGS
1066PROPS_INSTALLS_ACCUMULATE_L := SOURCES EXEC_SOURCES DIRS CLEAN
1067## @}
1068
1069## @name Properties valid on fetches (FETCHES)
1070## @{
1071PROPS_FETCHES_SINGLE := TOOL TEMPLATE FETCHTOOL UNPACKTOOL PATCHTOOL INST FETCHDIR
1072PROPS_FETCHES_DEFERRED :=
1073PROPS_FETCHES_ACCUMULATE_R := FETCHFLAGS UNPACKFLAGS PATCHFLAGS
1074PROPS_FETCHES_ACCUMULATE_L := SOURCES CLEAN
1075## @}
1076
1077## KBUILD_COMPILE_CATEGTORIES
1078# Tools categories for compiling.
1079KBUILD_COMPILE_CATEGTORIES := AS C CXX OBJC OBJCXX RC
1080
1081## KBUILD_GENERIC_CATEGORIES
1082# Generic tool categories.
1083KBUILD_GENERIC_CATEGORIES := FETCH UNPACK PATCH $(addprefix LINK_,LIBRARY PROGRAM DLL SYSMOD MISCBIN)
1084
1085## PROPS_TOOLS_ONLY
1086# Properties found only on tools.
1087# This is expanded in a deferred manner, so it will pick up changes made to
1088# KBUILD_COMPILE_CATEGTORIES and KBUILD_GENERIC_CATEGORIES made by units.
1089PROPS_TOOLS_ONLY = \
1090 $(foreach cat, $(KBUILD_COMPILE_CATEGTORIES), \
1091 COMPILE_$(cat)_CMDS \
1092 COMPILE_$(cat)_OUTPUT \
1093 COMPILE_$(cat)_OUTPUT_MAYBE \
1094 COMPILE_$(cat)_DEPEND \
1095 COMPILE_$(cat)_DEPORD \
1096 COMPILE_$(cat)_USES_KOBJCACHE ) \
1097 $(foreach cat, $(KBUILD_GENERIC_CATEGORIES), \
1098 $(cat)_CMDS \
1099 $(cat)_OUTPUT \
1100 $(cat)_OUTPUT_MAYBE \
1101 $(cat)_DEPEND \
1102 $(cat)_DEPORD ))
1103
1104
1105#
1106# Here is a special 'hack' to prevent innocent environment variables being
1107# picked up and treated as properties. (The most annoying example of why
1108# this is necessary is the Visual C++ commandline with it's LIBPATH.)
1109#
1110# Define KBUILD_DONT_KILL_ENV_PROPS in the env. or on the commandline to
1111# disable this 'hack'.
1112#
1113ifndef KBUILD_DONT_KILL_ENV_PROPS
1114
1115define def_nuke_environment_prop
1116ifeq ($(origin $(prop)),environment)
1117$(prop) =
1118endif
1119endef
1120$(foreach prop, $(PROPS_ALL) \
1121 FETCHES PATCHES BLDPROGS LIBRARIES IMPORT_LIBS DLLS PROGRAMS SYSMODS MISCBINS INSTALLS OTHERS \
1122 SUBDIRS MAKEFILES BLDDIRS \
1123 ,$(eval $(value def_nuke_environment_prop)))
1124
1125endif # KBUILD_DONT_KILL_ENV_PROPS
1126
1127
1128#
1129# Pass configuration.
1130#
1131# The PASS_<passname>_trgs variable is listing the targets.
1132# The PASS_<passname>_vars variable is listing the target variables.
1133# The PASS_<passname>_pass variable is the lowercased passname.
1134#
1135
1136## PASS: fetches
1137# This pass fetches and unpacks things needed to complete the build.
1138PASS_FETCHES := Fetches
1139PASS_FETCHES_trgs :=
1140PASS_FETCHES_vars := _FETCHES
1141PASS_FETCHES_pass := fetches
1142
1143## PASS: patches
1144# This pass applies patches.
1145PASS_PATCHES := Patches
1146PASS_PATCHES_trgs :=
1147PASS_PATCHES_vars := _PATCHES
1148PASS_PATCHES_pass := patches
1149
1150## PASS: bldprogs
1151# This pass builds targets which are required for building the rest.
1152PASS_BLDPROGS := Build Programs
1153PASS_BLDPROGS_trgs :=
1154PASS_BLDPROGS_vars := _BLDPROGS
1155PASS_BLDPROGS_pass := bldprogs
1156
1157## PASS: libraries
1158# This pass builds library targets.
1159PASS_LIBRARIES := Libraries
1160PASS_LIBRARIES_trgs :=
1161PASS_LIBRARIES_vars := _LIBS _IMPORT_LIBS _OTHER_LIBRARIES
1162PASS_LIBRARIES_pass := libraries
1163
1164## PASS: binaries
1165# This pass builds dll targets.
1166PASS_DLLS := DLLs
1167PASS_DLLS_trgs :=
1168PASS_DLLS_vars := _DLLS _OTHER_DLLS
1169PASS_DLLS_pass := dlls
1170
1171## PASS: binaries
1172# This pass builds binary targets, i.e. programs, system modules and stuff.
1173PASS_BINARIES := Programs
1174PASS_BINARIES_trgs :=
1175PASS_BINARIES_vars := _PROGRAMS _SYSMODS _MISC_BINS _OTHER_BINARIES
1176PASS_BINARIES_pass := binaries
1177
1178## PASS: others
1179# This pass builds other targets.
1180PASS_OTHERS := Other Stuff
1181PASS_OTHERS_trgs :=
1182PASS_OTHERS_vars := _OTHERS
1183PASS_OTHERS_pass := others
1184
1185## PASS: staging
1186# This pass installs the built entities to a sandbox area.
1187## @todo split this up into build install (to sandbox) and real installation.
1188PASS_STAGING := Staging
1189PASS_STAGING_trgs :=
1190PASS_STAGING_vars := _STAGE_DIRS _INSTALLS _STAGE_FILES _DEBUG_STAGE_DIRS _DEBUG_STAGE_FILES
1191PASS_STAGING_pass := staging
1192
1193## PASS: install
1194# This pass installs the built entities to where they will be used (using
1195# DESTROOT or PATH_INS to indicate where this is).
1196PASS_INSTALLS := Install
1197PASS_INSTALLS_trgs :=
1198PASS_INSTALLS_vars := _INSTALLS_DIRS _INSTALLS_FILES _DEBUG_INSTALL_DIRS _DEBUG_INSTALL_FILES
1199PASS_INSTALLS_pass := installs
1200
1201## PASS: testing
1202# This pass processes custom rules for executing tests.
1203PASS_TESTING := Tests
1204PASS_TESTING_trgs :=
1205PASS_TESTING_vars := _TESTING
1206PASS_TESTING_pass := testing
1207
1208## PASS: packing
1209# This pass processes custom packing rules.
1210PASS_PACKING := Packing
1211PASS_PACKING_trgs :=
1212PASS_PACKING_vars := _PACKING
1213PASS_PACKING_pass := packing
1214
1215## PASS: clean
1216# This pass removes all generated files.
1217PASS_CLEAN := Clean
1218PASS_CLEAN_trgs := do-clean
1219PASS_CLEAN_vars :=
1220PASS_CLEAN_pass := clean
1221
1222## PASS: nothing
1223# This pass just walks the tree.
1224PASS_NOTHING := Nothing
1225PASS_NOTHING_trgs := do-nothing
1226PASS_NOTHING_vars :=
1227PASS_NOTHING_pass := nothing
1228
1229## DEFAULT_PASSES
1230# The default passes and their order.
1231DEFAULT_PASSES := BLDPROGS LIBRARIES DLLS BINARIES OTHERS STAGING
1232
1233## PASSES
1234# The passes that should be defined. This must include
1235# all passes mentioned by DEFAULT_PASSES.
1236PASSES := FETCHES PATCHES $(DEFAULT_PASSES) INSTALLS TESTING PACKING CLEAN NOTHING
1237
1238
1239#
1240# Check for --pretty-command-printing before including the Config.kmk
1241# so that anyone overriding the message macros can take the implied
1242# verbosity level change into account.
1243#
1244ifndef KBUILD_VERBOSE
1245 ifndef KBUILD_QUIET
1246 ifeq ($(KMK_OPTS_PRETTY_COMMAND_PRINTING),1)
1247 export KBUILD_VERBOSE := 2
1248 endif
1249 endif
1250endif
1251
1252
1253#
1254# Legacy variable translation.
1255# These will be eliminated when switching to the next version.
1256#
1257ifdef USE_KOBJCACHE
1258 ifndef KBUILD_USE_KOBJCACHE
1259 export KBUILD_USE_KOBJCACHE := $(USE_KOBJCACHE)
1260 endif
1261endif
1262
1263
1264#
1265# Library path searching hints (target OS + arch).
1266#
1267# KBUILD_LIB_SEARCH_SUBS - Subdirs typically containing the right libraries.
1268# KBUILD_LIB_SEARCH_ROOTS - Roots to search for library subdirs.
1269# KBUILD_LIB_SEARCH_PATHS - ROOTS + SUBS.
1270#
1271ifeq ($(KBUILD_TARGET),darwin)
1272 KBUILD_LIB_SEARCH_ROOTS := \
1273 /usr/ \
1274 /Developer/usr/
1275 KBUILD_LIB_SEARCH_SUBS := lib/
1276
1277else if1of ($(KBUILD_TARGET), freebsd netbsd openbsd dragonfly)
1278 KBUILD_LIB_SEARCH_ROOTS := \
1279 / \
1280 /usr/ \
1281 /usr/local/
1282 KBUILD_LIB_SEARCH_SUBS := lib/
1283
1284else ifeq ($(KBUILD_TARGET),linux)
1285 ifeq ($(realpath /bin),/usr/bin)
1286 KBUILD_LIB_SEARCH_ROOTS := \
1287 /usr/ \
1288 / \
1289 /usr/local/
1290 else
1291 KBUILD_LIB_SEARCH_ROOTS := \
1292 / \
1293 /usr/ \
1294 /usr/local/
1295 endif
1296 ifeq ($(KBUILD_TARGET_ARCH),amd64)
1297 KBUILD_LIB_SEARCH_SUBS := \
1298 lib/x86_64-linux-gnu/ \
1299 lib64/ \
1300 lib/
1301 else ifeq ($(KBUILD_TARGET_ARCH),x86)
1302 KBUILD_LIB_SEARCH_SUBS := \
1303 lib/i686-linux-gnu/ \
1304 lib/i386-linux-gnu/ \
1305 lib32/ \
1306 lib/
1307 else
1308 KBUILD_LIB_SEARCH_SUBS := lib/
1309 endif
1310
1311else ifeq ($(KBUILD_TARGET),solaris)
1312 KBUILD_LIB_SEARCH_ROOTS := \
1313 / \
1314 /usr/ \
1315 /usr/sfw/ \
1316 /usr/local/ \
1317 /sw/
1318 ifeq ($(KBUILD_TARGET_ARCH),amd64)
1319 KBUILD_LIB_SEARCH_SUBS := lib/amd64/ lib/
1320 else ifeq ($(KBUILD_TARGET_ARCH),sparc64)
1321 KBUILD_LIB_SEARCH_SUBS := lib/sparcv9/ lib/
1322 else
1323 KBUILD_LIB_SEARCH_SUBS := lib/
1324 endif
1325
1326else
1327 KBUILD_LIB_SEARCH_SUBS :=
1328 KBUILD_LIB_SEARCH_ROOTS :=
1329endif
1330KBUILD_LIB_SEARCH_PATHS := $(foreach root, $(KBUILD_LIB_SEARCH_ROOTS), $(addprefix $(root),$(KBUILD_LIB_SEARCH_SUBS)))
1331
1332
1333#
1334# This is how we find the closest config.kmk.
1335# It's a little hacky but I think it works fine.
1336#
1337_CFGDIR := .
1338_CFGFILES := ./Config.kmk ./config.kmk
1339define def_include_config
1340$(eval _CFGDIR := $(_CFGDIR)/$(dir))
1341_CFGFILES += $(_CFGDIR)/Config.kmk $(_CFGDIR)/config.kmk
1342endef
1343# walk down the _RELATIVE_ path specified by DEPTH.
1344$(foreach dir,$(subst /, ,$(DEPTH)), $(eval $(def_include_config)) )
1345# add the default config file.
1346_CFGFILE := $(firstword $(wildcard $(_CFGFILES) $(FILE_KBUILD_CONFIG)))
1347_CFGFILES :=
1348_CFGDIR :=
1349ifeq ($(_CFGFILE),)
1350$(error kBuild: no Config.kmk file found! Check the DEPTH: DEPTH='$(DEPTH)' PATH_CURRENT='$(PATH_CURRENT)')
1351endif
1352
1353# Include the config.kmk we found file (or the default one).
1354ifdef KBUILD_PROFILE_SELF
1355 $(evalcall def_profile_self, including $(_CFGFILE))
1356 include $(_CFGFILE)
1357 $(evalcall def_profile_self, included $(_CFGFILE))
1358else
1359 include $(_CFGFILE)
1360endif
1361
1362
1363
1364#
1365# Finalize a the central path variables now that we've included the Config.kmk file.
1366#
1367# This prevents some trouble when users override the defaults for these
1368# variables and uses relative paths or paths with incorrect case.
1369#
1370PATH_OUT_BASE := $(abspath $(PATH_OUT_BASE))
1371PATH_OUT := $(abspath $(PATH_OUT))
1372PATH_OBJ := $(abspath $(PATH_OBJ))
1373PATH_TARGET := $(abspath $(PATH_TARGET))
1374PATH_INS := $(abspath $(PATH_INS))
1375PATH_STAGE := $(abspath $(PATH_STAGE))
1376
1377# Finalize the install and staging directory layouts.
1378define def_kbuild_finalize_inst
1379local val := $(strip $($(y)_$(x)))
1380ifeq ($(val),)
1381 $(error kBuild: '$(y)_$(x)' is set to an empty value.)
1382endif
1383ifneq ($(words $(val)),1)
1384 $(error kBuild: The '$(y)_$(x)' value '$(val)' should not contain spaces.)
1385endif
1386ifneq ($(pos \,$(val)), 0)
1387 $(error kBuild: The '$(y)_$(x)' value '$(val)' contains DOS slashes: not allowed.)
1388endif
1389ifneq ($(pos $(COLON),$(val)), 0)
1390 $(error kBuild: The '$(y)_$(x)' value '$(val)' contains colon: not allowed.)
1391endif
1392ifneq ($(substr $(val),-1), /)
1393 $(error kBuild: The '$(y)_$(x)' value '$(val)' has no trailing slash.)
1394endif
1395if $(pos /../,$(val)) != 0 || "$(substr $(val), 3)" == "../"
1396 $(error kBuild: The '$(y)_$(x)' value '$(val)' contains dot-dot escape.)
1397endif
1398$($(y)_$(x) := $(val)
1399
1400local val := $(strip $(PATH_$(y)_$(x)))
1401ifeq ($(val),)
1402 $(error kBuild: 'PATH_$(y)_$(x)' is set to an empty value.)
1403endif
1404PATH_$(y)_$(x) := $(val)
1405endef
1406$(foreach y, INST STAGE, $(foreach x, $(KBUILD_INST_PATHS), $(evalcall def_kbuild_finalize_inst)))
1407
1408# No abspath for devtools since they might've been referenced already and we
1409# don't want conflicting variable expansions.
1410KBUILD_DEVTOOLS := $(KBUILD_DEVTOOLS)
1411KBUILD_DEVTOOLS_TRG := $(KBUILD_DEVTOOLS_TRG)
1412KBUILD_DEVTOOLS_TRG_ALT := $(KBUILD_DEVTOOLS_TRG_ALT)
1413KBUILD_DEVTOOLS_HST := $(KBUILD_DEVTOOLS_HST)
1414KBUILD_DEVTOOLS_HST_ALT := $(KBUILD_DEVTOOLS_HST_ALT)
1415
1416
1417#
1418# Setup the message style. The default one is inlined.
1419#
1420# See kBuild/msgstyles for more styles or use KBUILD_MSG_STYLE_PATHS
1421# to create your own message style.
1422#
1423KBUILD_MSG_STYLE ?= default
1424ifeq ($(KBUILD_MSG_STYLE),default)
1425 #
1426 # The 'default' style.
1427 #
1428
1429 ## Fetch starting.
1430 # @param 1 Target name.
1431 MSG_FETCH ?= $(call MSG_L1,Fetching $1...)
1432 ## Re-fetch starting.
1433 # @param 1 Target name.
1434 MSG_REFETCH ?= $(call MSG_L1,Re-fetching $1...)
1435 ## Downloading a fetch component.
1436 # @param 1 Target name.
1437 # @param 2 The source URL.
1438 # @param 3 The destination file name.
1439 MSG_FETCH_DL ?= $(call MSG_L1,Downloading $1 - $2,=> $3)
1440 ## Checking a fetch component.
1441 # @param 1 Target name.
1442 # @param 2 The source URL.
1443 # @param 3 The destination file name.
1444 MSG_FETCH_CHK?= $(call MSG_L1,Checking $1 - $3, ($2))
1445 ## Unpacking a fetch component.
1446 # @param 1 Target name.
1447 # @param 2 The archive file name.
1448 # @param 3 The target directory.
1449 MSG_FETCH_UP ?= $(call MSG_L1,Unpacking $1 - $2 => $3)
1450 ## Fetch completed.
1451 # @param 1 Target name.
1452 MSG_FETCH_OK ?= $(call MSG_L1,Successfully fetched $1)
1453 ## Unfetch a fetch target.
1454 # @param 1 Target name.
1455 MSG_UNFETCH ?= $(call MSG_L1,Unfetching $1...)
1456 ## Compiling a source file.
1457 # @param 1 Target name.
1458 # @param 2 The source filename.
1459 # @param 3 The primary link output file name.
1460 # @param 4 The source type (C,CXX,OBJC,AS,RC,++).
1461 MSG_COMPILE ?= $(call MSG_L1,Compiling $1 - $2,=> $3)
1462 ## Tool
1463 # @param 1 The tool name (bin2c,...)
1464 # @param 2 Target name.
1465 # @param 3 The source filename.
1466 # @param 4 The primary output file name.
1467 MSG_TOOL ?= $(call MSG_L1,$1 $2 - $3,=> $4)
1468 ## Generate a file, typically a source file.
1469 # @param 1 Target name if applicable.
1470 # @param 2 Output file name.
1471 # @param 3 What it's generated from
1472 MSG_GENERATE ?= $(call MSG_L1,Generating $(if $1,$1 - )$2,$(if $3,from $3))
1473 ## Linking a bldprog/dll/program/sysmod target.
1474 # @param 1 Target name.
1475 # @param 2 The primary link output file name.
1476 # @param 3 The link tool operation (LINK_LIBRARY,LINK_PROGRAM,LINK_DLL,LINK_SYSMOD,++).
1477 MSG_LINK ?= $(call MSG_L1,Linking $1,=> $2)
1478 ## Merging a library into the target (during library linking).
1479 # @param 1 Target name.
1480 # @param 2 The output library name.
1481 # @param 3 The input library name.
1482 MSG_AR_MERGE ?= $(call MSG_L1,Merging $3 into $1, ($2))
1483 ## Creating a directory (build).
1484 # @param 1 Directory name.
1485 MSG_MKDIR ?= $(call MSG_L2,Creating directory $1)
1486 ## Cleaning.
1487 MSG_CLEAN ?= $(call MSG_L1,Cleaning...)
1488 ## Nothing.
1489 MSG_NOTHING ?= $(call MSG_L1,Did nothing in $(CURDIR))
1490 ## Pass
1491 # @param 1 The pass name.
1492 MSG_PASS ?= $(call MSG_L1,Pass - $1)
1493 ## Installing a bldprog/lib/dll/program/sysmod target.
1494 # @param 1 Target name.
1495 # @param 2 The source filename.
1496 # @param 3 The destination file name.
1497 MSG_INST_TRG ?= $(call MSG_L1,Installing $1 => $3)
1498 ## Installing a file (install target).
1499 # @param 1 The source filename.
1500 # @param 2 The destination filename.
1501 MSG_INST_FILE?= $(call MSG_L1,Installing $2,(<= $1))
1502 ## Installing a symlink.
1503 # @param 1 Symlink
1504 # @param 2 Link target
1505 MSG_INST_SYM ?= $(call MSG_L1,Installing symlink $1,=> $2)
1506 ## Installing a directory.
1507 # @param 1 Directory name.
1508 MSG_INST_DIR ?= $(call MSG_L1,Installing directory $1)
1509
1510else
1511 _KBUILD_MSG_STYLE_FILE := $(firstword $(foreach path, $(KBUILD_MSG_STYLE_PATHS) $(KBUILD_PATH)/msgstyles, $(wildcard $(path)/$(KBUILD_MSG_STYLE).kmk)))
1512 ifneq ($(_KBUILD_MSG_STYLE_FILE),)
1513 include $(_KBUILD_MSG_STYLE_FILE)
1514 else
1515 $(error kBuild: Can't find the style setup file for KBUILD_MSG_STYLE '$(KBUILD_MSG_STYLE)')
1516 endif
1517endif
1518
1519
1520#
1521# Message macros.
1522#
1523# This is done after including Config.kmk as to allow for
1524# KBUILD_QUIET and KBUILD_VERBOSE to be configurable.
1525#
1526ifdef KBUILD_QUIET
1527 # No output
1528 QUIET := @
1529 QUIET2:= @
1530 MSG_L1 =
1531 MSG_L2 =
1532else
1533 ifndef KBUILD_VERBOSE
1534 # Default output level.
1535 QUIET := @
1536 QUIET2 := @
1537 MSG_L1 ?= %@$(ECHO) "kBuild: $1"
1538 MSG_L2 =
1539 else ifeq ($(KBUILD_VERBOSE),1)
1540 # A bit more output
1541 QUIET := @
1542 QUIET2 := @
1543 MSG_L1 ?= %@$(ECHO) "kBuild: $1 $2"
1544 MSG_L2 =
1545 else ifeq ($(KBUILD_VERBOSE),2)
1546 # Lot more output
1547 QUIET :=
1548 QUIET2 := @
1549 MSG_L1 ?= %@$(ECHO) "kBuild: $1 $2"
1550 MSG_L2 ?= %@$(ECHO) "kBuild: $1"
1551 else
1552 # maximal output.
1553 QUIET :=
1554 QUIET2 :=
1555 MSG_L1 ?= %@$(ECHO) "kBuild: $1 $2"
1556 MSG_L2 ?= %@$(ECHO) "kBuild: $1"
1557 endif
1558endif
1559
1560
1561#
1562# Validate any KBUILD_BLD_TYPES additions and finally the KBUILD_TYPE.
1563#
1564if1of ($(KBUILD_BLD_TYPES), $(KBUILD_OSES))
1565 $(error kBuild: found KBUILD_BLD_TYPES in KBUILD_OSES!)
1566endif
1567if1of ($(KBUILD_BLD_TYPES), $(KBUILD_ARCHES))
1568 $(error kBuild: found KBUILD_BLD_TYPES in KBUILD_ARCHES!)
1569endif
1570if1of ($(KBUILD_OSES), $(KBUILD_ARCHES))
1571 $(error kBuild: found KBUILD_OSES in KBUILD_ARCHES!)
1572endif
1573ifn1of ($(KBUILD_TYPE), $(KBUILD_BLD_TYPES))
1574 $(error kBuild: KBUILD_TYPE(=$(KBUILD_TYPE)) is not found in KBUILD_BLD_TYPES(=$(KBUILD_BLD_TYPES))!)
1575endif
1576
1577
1578
1579ifdef KBUILD_PROFILE_SELF
1580 $(evalcall def_profile_self, end of header.kmk)
1581 _KBUILD_TS_HEADER_END := $(_KBUILD_TS_PREV)
1582endif
1583
1584# end-of-file-content
1585__header_kmk__ := 1
1586endif # !__header_kmk__
1587
Note: See TracBrowser for help on using the repository browser.