source: trunk/kBuild/header.kmk@ 723

Last change on this file since 723 was 723, checked in by bird, 19 years ago

Kicked the gnumake compatibility crap into separate files to speed things up. Added a slow stack implementation.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id Revision
File size: 18.9 KB
Line 
1# $Id: header.kmk 723 2006-12-15 02:54:52Z bird $
2## @file
3#
4# kBuild - File included at top of makefile.
5#
6# Copyright (c) 2004-2005 knut st. osmundsen <bird-srcspam@anduin.net>
7#
8#
9# This file is part of kBuild.
10#
11# kBuild is free software; you can redistribute it and/or modify
12# it under the terms of the GNU General Public License as published by
13# the Free Software Foundation; either version 2 of the License, or
14# (at your option) any later version.
15#
16# kBuild is distributed in the hope that it will be useful,
17# but WITHOUT ANY WARRANTY; without even the implied warranty of
18# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19# GNU General Public License for more details.
20#
21# You should have received a copy of the GNU General Public License
22# along with kBuild; if not, write to the Free Software
23# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24#
25#
26
27ifndef __header_kmk__
28# start-of-file-content
29
30#
31# default rule
32#
33all: all_recursive
34
35#
36# The FORCE rule.
37#
38FORCE:
39
40#
41# Try avoid inference rules.
42#
43.SUFFIXES:
44SUFFIXES :=
45
46
47#
48# General purpose macros.
49#
50
51## get last word in a list.
52# @returns last word in $1.
53# @param $1 Word list.
54lastword = $(word $(words $(1)), $(1))
55
56##
57# Newline character(s).
58define NL
59
60
61endef
62
63##
64# Tab character.
65TAB := $(subst ., ,.)
66
67##
68# Space character.
69SP := $(subst ., ,.)
70
71##
72# Checks if two strings are equal.
73# @returns blank if equal
74# @returns non-blank if not equal.
75# @param $1 String 1.
76# @param $2 String 2
77STRCMP = $( todo )
78
79#
80# Set default build type.
81#
82ifndef BUILD_TYPE
83 ifdef BUILD_MODE
84 # BUILD_MODE is legacy from the OS/2 build system. :)
85BUILD_TYPE := $(tolower $(BUILD_MODE))
86 else
87BUILD_TYPE := release
88 endif
89endif
90
91
92#
93# Assert build platform.
94#
95ifndef BUILD_PLATFORM
96 $(error kBuild: BUILD_PLATFORM is undefined!)
97else
98 BUILD_PLATFORM := $(strip $(BUILD_PLATFORM))
99 ifneq ($(words $(BUILD_PLATFORM))$(filter-out darwin freebsd l4 linux nt os2 win win32 win64,$(BUILD_PLATFORM)),1)
100 # OS/2 (have uppercase legacy)
101 ifeq ($(BUILD_PLATFORM),OS2)
102 $(error kBuild: BUILD_PLATFORM must be all lowercase!)
103 endif
104 $(error kBuild: BUILD_PLATFORM value '$(BUILD_PLATFORM)' was not recognized!)
105 endif
106endif
107
108# Fill in defaults if needed.
109ifndef BUILD_PLATFORM_ARCH
110 ifeq ($(filter-out win64,$(BUILD_PLATFORM)),)
111 BUILD_PLATFORM_ARCH := amd64
112 else
113 BUILD_PLATFORM_ARCH := x86
114 endif
115endif
116ifndef BUILD_PLATFORM_CPU
117 ifeq ($(filter-out amd64,$(BUILD_PLATFORM_ARCH)),)
118 BUILD_PLATFORM_CPU:= k8
119 else
120 BUILD_PLATFORM_CPU:= i586
121 endif
122endif
123
124
125#
126# Assert target platform.
127#
128ifndef BUILD_TARGET
129# not defined, set to the same as build platform
130BUILD_TARGET := $(BUILD_PLATFORM)
131else
132 BUILD_TARGET := $(strip $(BUILD_TARGET))
133 ifneq ($(words $(BUILD_TARGET))$(filter-out darwin freebsd l4 linux nt os2 win win32 win64,$(BUILD_TARGET)),1)
134 # OS/2 (have uppercase legacy)
135 ifeq ($(BUILD_TARGET),OS2)
136 $(error kBuild: BUILD_TARGET must be all lowercase!)
137 endif
138 $(error kBuild: BUILD_TARGET value '$(BUILD_TARGET)' was not recognized!)
139 endif
140endif
141
142# Fill in defaults if needed.
143ifndef BUILD_TARGET_ARCH
144 BUILD_TARGET_ARCH := x86
145endif
146ifndef BUILD_TARGET_CPU
147 BUILD_TARGET_CPU := i586
148endif
149
150# Adjust the DEPTH definition first
151ifeq ($(strip $(DEPTH)),)
152DEPTH := .
153endif
154
155#
156# Common definitions.
157#
158PATH_CURRENT := $(abspath $(CURDIR))
159ifneq ($(strip $(SUB_DEPTH)),)
160PATH_SUB_CURRENT := $(abspath $(PATH_CURRENT)/$(SUB_DEPTH))
161else
162PATH_SUB_CURRENT := $(PATH_CURRENT)
163endif
164PATH_ROOT := $(abspath $(PATH_CURRENT)/$(DEPTH))
165
166# Subdirectory relative to the root.
167ifneq ($(PATH_ROOT),$(PATH_CURRENT))
168CURSUBDIR := $(patsubst $(PATH_ROOT)/%,%,$(PATH_SUB_CURRENT))
169else
170CURSUBDIR := .
171endif
172
173# Output directories.
174ifndef PATH_OUT_BASE
175PATH_OUT_BASE := $(PATH_ROOT)/out
176endif
177ifndef PATH_OUT
178ifdef BUILD_TARGET_SUB # (BUILD_TARGET_SUB is not currently recognized by kBuild in any other places.)
179PATH_OUT := $(PATH_OUT_BASE)/$(BUILD_TARGET).$(BUILD_TARGET_ARCH).$(BUILD_TARGET_SUB)/$(BUILD_TYPE)
180else
181PATH_OUT := $(PATH_OUT_BASE)/$(BUILD_TARGET).$(BUILD_TARGET_ARCH)/$(BUILD_TYPE)
182endif
183endif # !define PATH_OUT
184PATH_OBJ = $(PATH_OUT)/obj
185PATH_TARGET = $(PATH_OBJ)/$(CURSUBDIR)
186PATH_INS = $(PATH_OUT)
187PATH_BIN = $(PATH_INS)/bin
188PATH_DLL = $(PATH_INS)/bin
189PATH_SYS = $(PATH_INS)/bin
190PATH_LIB = $(PATH_INS)/lib
191PATH_DOC = $(PATH_INS)/doc
192
193# Usually kBuild is external to the source tree.
194ifndef PATH_KBUILD
195PATH_KBUILD := $(PATH_ROOT)/kBuild
196endif
197PATH_KBUILD := $(abspath $(PATH_KBUILD))
198# kBuild files which might be of interest.
199FILE_KBUILD_HEADER := $(PATH_KBUILD)/header.kmk
200FILE_KBUILD_CONFIG := $(PATH_KBUILD)/config.kmk
201FILE_KBUILD_FOOTER := $(PATH_KBUILD)/footer.kmk
202
203SUFF_DEP := .dep
204MAKEFILE := $(firstword $(MAKEFILE_LIST))
205
206
207#
208# Check make version.
209#
210ifdef KMK_VERSION
211 ifneq ($(KBUILD_VERSION_MAJOR).$(KBUILD_VERSION_MINOR),0.1)
212 ifneq ($(KBUILD_VERSION_MAJOR),0)
213 $(warning kBuild: kmk major version mismatch, expected '0' found '$(KBUILD_VERSION_MAJOR)'!)
214 else
215 $(warning kBuild: kmk minor version mismatch, expected '1' found '$(KBUILD_VERSION_MINOR)'!)
216 endif
217 endif
218else
219 include $(PATH_KBUILD)/gnumake-header.kmk
220endif
221
222
223#
224# The revision in which this file was last modified.
225# This can be useful when using development versions of kBuild.
226#
227KMK_REVISION := $(patsubst %:,, $Rev: 723 $ )
228
229
230#
231# Build platform setup.
232#
233# OS/2
234ifeq ($(BUILD_PLATFORM),os2)
235EXEC_X86_WIN32 := innopec.exe
236HOSTSUFF_EXE := .exe
237endif
238
239# Linux
240ifeq ($(BUILD_PLATFORM),linux)
241EXEC_X86_WIN32 := wine
242HOSTSUFF_EXE :=
243endif
244
245# Win, Win32, Win64, NT.
246ifeq ($(filter-out win32 win64 win nt,$(BUILD_PLATFORM)),)
247EXEC_X86_WIN32 :=
248HOSTSUFF_EXE := .exe
249endif
250
251# FreeBSD
252ifeq ($(BUILD_PLATFORM),freebsd)
253EXEC_X86_WIN32 := wine
254HOSTSUFF_EXE :=
255endif
256
257# Darwin / Mac OS X
258ifeq ($(BUILD_PLATFORM),darwin)
259EXEC_X86_WIN32 := false
260HOSTSUFF_EXE :=
261endif
262
263ifndef PATH_KBUILD_BIN
264 PATH_KBUILD_BIN := $(PATH_KBUILD)/bin/$(BUILD_PLATFORM_ARCH).$(BUILD_PLATFORM)
265 ifeq ($(wildcard $(PATH_KBUILD_BIN)/kmk_ash$(HOSTSUFF_EXE)),)
266 ifeq ($(BUILD_TARGET_ARCH),amd64)
267 PATH_KBUILD_BIN := $(PATH_KBUILD)/bin/x86.$(BUILD_PLATFORM)
268 endif
269 ifeq ($(wildcard $(PATH_KBUILD_BIN)/kmk_ash$(HOSTSUFF_EXE)),)
270 ifeq ($(filter-out win64 win32 win nt ,$(BUILD_PLATFORM)),)
271 PATH_KBUILD_BIN := $(PATH_KBUILD)/bin/x86.win
272 endif
273 endif
274 ifeq ($(wildcard $(PATH_KBUILD_BIN)/kmk_ash$(HOSTSUFF_EXE)),)
275 # give up
276 PATH_KBUILD_BIN := $(PATH_KBUILD)/bin/$(BUILD_PLATFORM_ARCH).$(BUILD_PLATFORM)
277 endif
278 endif
279endif
280
281
282#
283# Build target setup.
284#
285ifeq ($(filter-out win32 win64 win nt os2,$(BUILD_TARGET)),)
286SUFF_OBJ := .obj
287SUFF_LIB := .lib
288SUFF_DLL := .dll
289SUFF_EXE := .exe
290SUFF_SYS := .sys
291SUFF_RES := .res
292endif
293ifeq ($(BUILD_TARGET),l4)
294SUFF_OBJ := .o
295SUFF_LIB := .a
296SUFF_DLL := .s.so
297SUFF_EXE :=
298SUFF_SYS := .a
299SUFF_RES :=
300endif
301ifeq ($(BUILD_TARGET),darwin)
302SUFF_OBJ := .o
303SUFF_LIB := .a
304SUFF_DLL := .dylib
305SUFF_EXE :=
306SUFF_SYS := .a
307SUFF_RES :=
308endif
309ifndef SUFF_OBJ
310SUFF_OBJ := .o
311SUFF_LIB := .a
312SUFF_DLL := .so
313SUFF_EXE :=
314SUFF_SYS := .a
315SUFF_RES :=
316endif
317
318#
319# Standard kBuild tools.
320#
321ifeq ($(MAKE),kmk)
322MAKE := $(PATH_KBUILD_BIN)/kmk$(HOSTSUFF_EXE)
323endif
324
325DEP_EXT := $(PATH_KBUILD_BIN)/kDep$(HOSTSUFF_EXE)
326ifeq ($(filter kDep,$(KMK_BUILTIN)),kDep)
327DEP := kmk_builtin_kDep
328else
329DEP := $(DEP_EXT)
330endif
331
332DEP_IDB_EXT := $(PATH_KBUILD_BIN)/kDepIDB$(HOSTSUFF_EXE)
333ifeq ($(filter kDepPre,$(KMK_BUILTIN)),kDepIDB)
334DEP_IDB := $(if kmk_builtin_kDepIDB
335else
336DEP_IDB := $(DEP_IDB_EXT)
337endif
338
339DEP_PRE_EXT := $(PATH_KBUILD_BIN)/kDepPre$(HOSTSUFF_EXE)
340ifeq ($(filter kDepPre,$(KMK_BUILTIN)),kDepPre)
341DEP_PRE := $(if kmk_builtin_kDepPre
342else
343DEP_PRE := $(DEP_PRE_EXT)
344endif
345
346APPEND_EXT := $(PATH_KBUILD_BIN)/kmk_append$(HOSTSUFF_EXE)
347ifeq ($(filter append,$(KMK_BUILTIN)),append)
348APPEND := kmk_builtin_append
349else
350APPEND := $(APPEND_EXT)
351endif
352
353CAT_EXT := $(PATH_KBUILD_BIN)/kmk_cat$(HOSTSUFF_EXE)
354ifeq ($(filter cat,$(KMK_BUILTIN)),cat)
355CAT := kmk_builtin_cat
356else
357CAT := $(CAT_EXT)
358endif
359
360CP_EXT := $(PATH_KBUILD_BIN)/kmk_cp$(HOSTSUFF_EXE)
361ifeq ($(filter cp,$(KMK_BUILTIN)),cp)
362CP := kmk_builtin_cp
363else
364CP := $(CP_EXT)
365endif
366
367ECHO_EXT := $(PATH_KBUILD_BIN)/kmk_echo$(HOSTSUFF_EXE)
368ifeq ($(filter echo,$(KMK_BUILTIN)),echo)
369ECHO := kmk_builtin_echo
370else
371ECHO := $(ECHO_EXT)
372endif
373
374INSTALL_EXT := $(PATH_KBUILD_BIN)/kmk_install$(HOSTSUFF_EXE)
375ifeq ($(filter install,$(KMK_BUILTIN)),install)
376INSTALL := kmk_builtin_install
377else
378INSTALL := $(INSTALL_EXT)
379endif
380
381LN_EXT := $(PATH_KBUILD_BIN)/kmk_ln$(HOSTSUFF_EXE)
382ifeq ($(filter ln,$(KMK_BUILTIN)),ln)
383LN := kmk_builtin_ln
384else
385LN := $(LN_EXT)
386endif
387
388MKDIR_EXT := $(PATH_KBUILD_BIN)/kmk_mkdir$(HOSTSUFF_EXE)
389ifeq ($(filter mkdir,$(KMK_BUILTIN)),mkdir)
390MKDIR := kmk_builtin_mkdir
391else
392MKDIR := $(MKDIR_EXT)
393endif
394
395MV_EXT := $(PATH_KBUILD_BIN)/kmk_mv$(HOSTSUFF_EXE)
396ifeq ($(filter mv,$(KMK_BUILTIN)),mv)
397MV := kmk_builtin_mv
398else
399MV := $(MV_EXT)
400endif
401
402RM_EXT := $(PATH_KBUILD_BIN)/kmk_rm$(HOSTSUFF_EXE)
403ifeq ($(filter rm,$(KMK_BUILTIN)),rm)
404RM := kmk_builtin_rm
405else
406RM := $(RM_EXT)
407endif
408
409RMDIR_EXT := $(PATH_KBUILD_BIN)/kmk_rmdir$(HOSTSUFF_EXE)
410ifeq ($(filter rmdir,$(KMK_BUILTIN)),rmdir)
411RMDIR := kmk_builtin_rmdir
412else
413RMDIR := $(RMDIR_EXT)
414endif
415
416SED_EXT := $(PATH_KBUILD_BIN)/kmk_sed$(HOSTSUFF_EXE)
417ifeq ($(filter sed,$(KMK_BUILTIN)),sed)
418SED := kmk_builtin_sed
419else
420SED := $(SED_EXT)
421endif
422
423# Our default shell is the Almquist shell from *BSD.
424ASH := $(PATH_KBUILD_BIN)/kmk_ash$(HOSTSUFF_EXE)
425MAKESHELL := $(ASH)
426SHELL := $(ASH)
427export SHELL MAKESHELL
428
429# Symlinking is problematic on some platforms...
430LN_SYMLINK := $(LN) -s
431
432## ABSPATH - make paths absolute.
433# This implementation is clumsy and doesn't resolve '..' and '.' components.
434#
435# @param $1 The paths to make absolute.
436# @obsolete Use the GNU make function $(abspath) directly now.
437ABSPATH = $(abspath $(1))
438
439## DIRDEP - make create directory dependencies.
440#
441# @param $1 The paths to the directories which must be created.
442DIRDEP = $(foreach path,$(patsubst %/,%,$(1)),$(path)/)
443
444
445## Cygwin kludge.
446# This converts /cygdrive/x/% to x:%.
447#
448# @param $1 The paths to make native.
449# @remark This macro is pretty much obsolete since we don't use cygwin base make.
450ifneq ($(patsubst /cygdrive/%,%,$(CURDIR)),$(CURDIR))
451CYGPATHMIXED = $(foreach path,$(1)\
452 ,$(if $(patsubst /cygdrive/%,,$(path)),$(path),$(patsubst $(strip $(firstword $(subst /, ,$(patsubst /cygdrive/%,%,$(path)))))/%,$(strip $(firstword $(subst /, ,$(patsubst /cygdrive/%,%,$(path))))):/%,$(patsubst /cygdrive/%,%,$(path)))))
453else
454CYGPATHMIXED = $(1)
455endif
456
457
458ifneq ($(filter stack,$(KMK_FEATURES)),stack) ## @todo retire this to gnumake-header.kmk when all the programs have been recompiled.
459##
460# Pushes an item onto a 'stack' variable.
461# @param $1 The stack variable name
462# @param $2 What to push.
463stack-push = $(eval $1 +=$2)
464
465##
466# Removes the top element from a 'stack' variable.
467# @returns The popped element
468# @param $1 The stack variable name
469stack-pop = $(call stack-top,$1)$(call stack-popv,$1)
470
471##
472# Removes the top element from a 'stack' variable.
473# This does *NOT* return the top element, use
474# @param $1 The stack variable name
475# @remark This ain't very fast (that's why it's implemented in functions.c in kmk).
476define def_stack-popv_sub
477$1 :=$(__tmp)
478__tmp+=$(item)
479endef
480define def_stack-popv
481__tmp:=
482$(foreach item,$($1),$(eval $(value def_stack-popv_sub)))
483endef
484stack-popv = $(eval $(value def_stack-popv))
485
486##
487# Retrieves the top element from the 'stack' variable.
488# @param $1 The stack variable name
489stack-top = $(lastword $($1))
490endif
491
492
493#
494# Initialize some of the globals which the Config.kmk and
495# others can add stuff to if they like for processing in the footer.
496#
497
498## ALL_TARGET
499# This is the list of all targets.
500ALL_TARGETS :=
501
502## TEMPLATE_PATHS
503# List a paths (separated by space) where templates can be found.
504TEMPLATE_PATHS :=
505
506## TOOL_PATHS
507# List of paths (separated by space) where tools can be found.
508TOOL_PATHS :=
509
510## SDK_PATHS
511# List of paths (separated by space) where SDKs can be found.
512SDK_PATHS :=
513
514## Proritized list of the default makefile when walking subdirectories.
515# The user can overload this list.
516DEFAULT_MAKEFILE := Makefile.kmk makefile.kmk Makefile makefile
517
518## PROPS_TOOLS
519# This is a subset of the other PROPS
520PROPS_TOOLS := TOOL CTOOL CXXTOOL ASTOOL RCTOOL ARTOOL LDTOOL FETCHTOOL UNPACKTOOL PATCHTOOL
521
522## PROPS_SINGLE
523# The list of non-accumulative target properties.
524# A Config.kmk file can add it's own properties to this list and kBuild
525# will do the necessary inheritance from templates to targets.
526PROPS_SINGLE := $(PROPS_TOOLS) INST NOINST BLD_TYPE BLD_TRG BLD_TRG_ARCH BLD_TRG_CPU FETCHDIR \
527 OBJSUFF COBJSUFF CXXOBJSUFF ASOBJSUFF RCOBJSUFF SYSSUFF EXESUFF DLLSUFF LIBSUFF ARLIBSUFF
528
529## PROPS_DEFERRED
530# This list of non-accumulative target properties which are functions,
531# and thus should not be expanded until the very last moment.
532PROPS_DEFERRED := INSTFUN INSTALLER
533
534## PROPS_ACCUMULATE_R
535# The list of accumulative target properties where the right most value/flag
536# is the 'most significant'.
537# A Config.kmk file can add it's own properties to this list and kBuild
538# will do the necessary inheritance from templates to targets.
539PROPS_ACCUMULATE_R := \
540 DEFS DEPS \
541 CFLAGS CDEFS \
542 CXXFLAGS CXXDEFS \
543 ASFLAGS ASDEFS \
544 RCFLAGS RCDEFS \
545 LDFLAGS \
546 FETCHFLAGS UNPACKFLAGS PATCHFLAGS
547
548## PROPS_ACCUMULATE
549# The list of accumulative target properties where the left most value/flag
550# is the 'most significant'.
551# A Config.kmk file can add it's own properties to this list and kBuild
552# will do the necessary inheritance from templates to targets.
553PROPS_ACCUMULATE_L := \
554 SDKS SOURCES \
555 INCS CINCS CXXINCX ASINCS RCINCS \
556 LIBS LIBPATH
557
558## PROPS_ALL
559# List of all the properties.
560PROPS_ALL = $(PROPS_SINGLE) $(PROPS_DEFERRED) $(PROPS_ACCUMULATE_L) $(PROPS_ACCUMULATE_R)
561
562
563#
564# Here is a special 'hack' to prevent innocent environment variables being
565# picked up and treated as properties. (The most annoying example of why
566# this is necessary is the Visual C++ commandline with it's LIBPATH.)
567#
568# Define KBUILD_DONT_KILL_ENV_PROPS in the env. or on the commandline to
569# disable this 'hack'.
570#
571ifndef KBUILD_DONT_KILL_ENV_PROPS
572
573define def_nuke_environment_prop
574ifeq ($(origin $(prop)),environment)
575$(prop) =
576endif
577endef
578$(foreach prop,$(PROPS_ALL),$(eval $(value def_nuke_environment_prop)))
579
580endif
581
582
583#
584# Pass configuration.
585#
586# The PASS_<passname>_trgs variable is listing the targets.
587# The PASS_<passname>_vars variable is listing the target variables.
588# The PASS_<passname>_pass variable is the lowercased passname.
589#
590
591## PASS: fetches
592# This pass fetches and unpacks things needed to complete the build.
593PASS_FETCHES := Fetches
594PASS_FETCHES_trgs :=
595PASS_FETCHES_vars := _FETCHES
596PASS_FETCHES_pass := fetches
597
598## PASS: patches
599# This pass applies patches.
600PASS_PATCHES := Patches
601PASS_PATCHES_trgs :=
602PASS_PATCHES_vars := _PATCHES
603PASS_PATCHES_pass := patches
604
605## PASS: bldprogs
606# This pass builds targets which are required for building the rest.
607PASS_BLDPROGS := Build Programs
608PASS_BLDPROGS_trgs :=
609PASS_BLDPROGS_vars := _BLDPROGS
610PASS_BLDPROGS_pass := bldprogs
611
612## PASS: libraries
613# This pass builds library targets.
614PASS_LIBRARIES := Libraries
615PASS_LIBRARIES_trgs :=
616PASS_LIBRARIES_vars := _LIBS _IMPORT_LIBS _OTHER_LIBRARIES
617PASS_LIBRARIES_pass := libraries
618
619## PASS: binaries
620# This pass builds dll targets.
621PASS_DLLS := DLLs
622PASS_DLLS_trgs :=
623PASS_DLLS_vars := _DLLS _OTHER_DLLS
624PASS_DLLS_pass := dlls
625
626## PASS: binaries
627# This pass builds binary targets, i.e. programs, system modules and stuff.
628PASS_BINARIES := Programs
629PASS_BINARIES_trgs :=
630PASS_BINARIES_vars := _PROGRAMS _SYSMODS _OTHER_BINARIES
631PASS_BINARIES_pass := binaries
632
633## PASS: others
634# This pass builds other targets.
635PASS_OTHERS := Other Stuff
636PASS_OTHERS_trgs :=
637PASS_OTHERS_vars := _OTHERS
638PASS_OTHERS_pass := others
639
640## PASS: install
641# This pass installs the built entities to a sandbox area.
642PASS_INSTALLS := Install
643PASS_INSTALLS_trgs :=
644PASS_INSTALLS_vars := _INSTALLS_DIRS _INSTALLS
645PASS_INSTALLS_pass := installs
646
647## PASS: packing
648# This pass processes custom packing rules.
649PASS_PACKING := Packing
650PASS_PACKING_trgs :=
651PASS_PACKING_vars := _PACKING
652PASS_PACKING_pass := packing
653#alias
654packing: pass_packing
655
656## PASS: clean
657# This pass removes all generated files.
658PASS_CLEAN := Clean
659PASS_CLEAN_trgs := do-clean
660PASS_CLEAN_vars :=
661PASS_CLEAN_pass := clean
662# alias
663clean: pass_clean
664
665## PASS: nothing
666# This pass just walks the tree.
667PASS_NOTHING := Nothing
668PASS_NOTHING_trgs := do-nothing
669PASS_NOTHING_vars :=
670PASS_NOTHING_pass := nothing
671# alias
672nothing: pass_nothing
673
674## DEFAULT_PASSES
675# The default passes and their order.
676DEFAULT_PASSES := BLDPROGS LIBRARIES DLLS BINARIES OTHERS INSTALLS
677
678## PASSES
679# The passes that should be defined. This must include
680# all passes mentioned by DEFAULT_PASSES.
681PASSES := FETCHES PATCHES $(DEFAULT_PASSES) NOTHING CLEAN
682
683
684#
685# This is how we find the closest config.kmk.
686# It's a little hacky but I think it works fine.
687#
688_CFGDIR := .
689_CFGFILES := ./Config.kmk ./config.kmk
690define def_include_config
691$(eval _CFGDIR := $(_CFGDIR)/$(dir))
692_CFGFILES += $(_CFGDIR)/Config.kmk $(_CFGDIR)/config.kmk
693endef
694# walk down the _RELATIVE_ path specified by DEPTH.
695$(foreach dir,$(subst /, ,$(DEPTH)), $(eval $(def_include_config)) )
696# add the default config file.
697_CFGFILE := $(firstword $(wildcard $(_CFGFILES) $(FILE_KBUILD_CONFIG)))
698_CFGFILES :=
699_CFGDIR :=
700ifeq ($(_CFGFILE),)
701$(error kBuild: no Config.kmk file found! Check the DEPTH: DEPTH='$(DEPTH)' PATH_CURRENT='$(PATH_CURRENT)')
702endif
703
704# Include the config.kmk we found file (or the default one).
705include $(_CFGFILE)
706
707
708#
709# Message macros.
710#
711# This is done after including Config.kmk as to allow for
712# KBUILD_QUIET and KBUILD_VERBOSE to be configurable.
713#
714ifdef KBUILD_QUIET
715 # minimal output.
716 QUIET := @
717 QUIET2:= @
718 MSG_L1 =
719 MSG_L2 =
720 MSG_L3 =
721else
722 ifndef KBUILD_VERBOSE
723 ifneq ($(filter --pretty-command-printing,$(MAKEFLAGS)),)
724 export KBUILD_VERBOSE := 1
725 endif
726 endif
727 ifndef KBUILD_VERBOSE
728 QUIET := @
729 QUIET2:= @
730 MSG_L1 = @$(ECHO) "kBuild: $1"
731 MSG_L2 =
732 MSG_L3 =
733 else
734 # maximal output.
735 QUIET :=
736 MSG_L1 = @$(ECHO) "kBuild: $1 $2"
737 MSG_L2 = @$(ECHO) "kBuild: $1"
738 ifneq ($(KBUILD_VERBOSE),all)
739 QUIET2:= @
740 else
741 QUIET2:=
742 endif
743 endif
744endif
745
746# end-of-file-content
747__header_kmk__ := 1
748endif # __header_kmk__
749
Note: See TracBrowser for help on using the repository browser.