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
RevLine 
[69]1# $Id: header.kmk 723 2006-12-15 02:54:52Z bird $
2## @file
3#
4# kBuild - File included at top of makefile.
5#
[353]6# Copyright (c) 2004-2005 knut st. osmundsen <bird-srcspam@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
29
30#
31# default rule
32#
33all: all_recursive
34
35#
[380]36# The FORCE rule.
37#
38FORCE:
[414]39
[380]40#
[69]41# Try avoid inference rules.
42#
43.SUFFIXES:
44SUFFIXES :=
45
[72]46
[69]47#
[95]48# General purpose macros.
49#
[204]50
[95]51## get last word in a list.
52# @returns last word in $1.
53# @param $1 Word list.
54lastword = $(word $(words $(1)), $(1))
55
[380]56##
57# Newline character(s).
58define NL
[95]59
[380]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
[478]77STRCMP = $( todo )
[380]78
[95]79#
[585]80# Set default build type.
[69]81#
82ifndef BUILD_TYPE
[585]83 ifdef BUILD_MODE
84 # BUILD_MODE is legacy from the OS/2 build system. :)
85BUILD_TYPE := $(tolower $(BUILD_MODE))
86 else
[72]87BUILD_TYPE := release
[585]88 endif
[72]89endif
[69]90
91
92#
[72]93# Assert build platform.
[70]94#
[478]95ifndef BUILD_PLATFORM
96 $(error kBuild: BUILD_PLATFORM is undefined!)
97else
98 BUILD_PLATFORM := $(strip $(BUILD_PLATFORM))
[557]99 ifneq ($(words $(BUILD_PLATFORM))$(filter-out darwin freebsd l4 linux nt os2 win win32 win64,$(BUILD_PLATFORM)),1)
[478]100 # OS/2 (have uppercase legacy)
101 ifeq ($(BUILD_PLATFORM),OS2)
102 $(error kBuild: BUILD_PLATFORM must be all lowercase!)
103 endif
104 $(error kBuild: BUILD_PLATFORM value '$(BUILD_PLATFORM)' was not recognized!)
105 endif
[72]106endif
[70]107
[329]108# Fill in defaults if needed.
[353]109ifndef BUILD_PLATFORM_ARCH
[478]110 ifeq ($(filter-out win64,$(BUILD_PLATFORM)),)
111 BUILD_PLATFORM_ARCH := amd64
112 else
113 BUILD_PLATFORM_ARCH := x86
114 endif
[329]115endif
116ifndef BUILD_PLATFORM_CPU
[478]117 ifeq ($(filter-out amd64,$(BUILD_PLATFORM_ARCH)),)
118 BUILD_PLATFORM_CPU:= k8
119 else
120 BUILD_PLATFORM_CPU:= i586
121 endif
[329]122endif
[72]123
124
[70]125#
[72]126# Assert target platform.
127#
128ifndef BUILD_TARGET
129# not defined, set to the same as build platform
130BUILD_TARGET := $(BUILD_PLATFORM)
131else
[478]132 BUILD_TARGET := $(strip $(BUILD_TARGET))
[557]133 ifneq ($(words $(BUILD_TARGET))$(filter-out darwin freebsd l4 linux nt os2 win win32 win64,$(BUILD_TARGET)),1)
[478]134 # OS/2 (have uppercase legacy)
135 ifeq ($(BUILD_TARGET),OS2)
136 $(error kBuild: BUILD_TARGET must be all lowercase!)
137 endif
138 $(error kBuild: BUILD_TARGET value '$(BUILD_TARGET)' was not recognized!)
139 endif
[72]140endif
141
[329]142# Fill in defaults if needed.
143ifndef BUILD_TARGET_ARCH
[478]144 BUILD_TARGET_ARCH := x86
[329]145endif
146ifndef BUILD_TARGET_CPU
[478]147 BUILD_TARGET_CPU := i586
[329]148endif
[72]149
[266]150# Adjust the DEPTH definition first
151ifeq ($(strip $(DEPTH)),)
152DEPTH := .
153endif
[72]154
155#
[69]156# Common definitions.
157#
[306]158PATH_CURRENT := $(abspath $(CURDIR))
[472]159ifneq ($(strip $(SUB_DEPTH)),)
160PATH_SUB_CURRENT := $(abspath $(PATH_CURRENT)/$(SUB_DEPTH))
161else
162PATH_SUB_CURRENT := $(PATH_CURRENT)
163endif
[306]164PATH_ROOT := $(abspath $(PATH_CURRENT)/$(DEPTH))
165
[70]166# Subdirectory relative to the root.
[306]167ifneq ($(PATH_ROOT),$(PATH_CURRENT))
[472]168CURSUBDIR := $(patsubst $(PATH_ROOT)/%,%,$(PATH_SUB_CURRENT))
[266]169else
170CURSUBDIR := .
171endif
[306]172
[70]173# Output directories.
[242]174ifndef PATH_OUT_BASE
175PATH_OUT_BASE := $(PATH_ROOT)/out
176endif
[240]177ifndef PATH_OUT
[245]178ifdef BUILD_TARGET_SUB # (BUILD_TARGET_SUB is not currently recognized by kBuild in any other places.)
[464]179PATH_OUT := $(PATH_OUT_BASE)/$(BUILD_TARGET).$(BUILD_TARGET_ARCH).$(BUILD_TARGET_SUB)/$(BUILD_TYPE)
[245]180else
[464]181PATH_OUT := $(PATH_OUT_BASE)/$(BUILD_TARGET).$(BUILD_TARGET_ARCH)/$(BUILD_TYPE)
[240]182endif
[329]183endif # !define PATH_OUT
[353]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
[70]192
193# Usually kBuild is external to the source tree.
194ifndef PATH_KBUILD
195PATH_KBUILD := $(PATH_ROOT)/kBuild
196endif
[306]197PATH_KBUILD := $(abspath $(PATH_KBUILD))
[69]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
[72]203SUFF_DEP := .dep
[204]204MAKEFILE := $(firstword $(MAKEFILE_LIST))
[69]205
[72]206
[69]207#
[576]208# Check make version.
[69]209#
[576]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
[723]219 include $(PATH_KBUILD)/gnumake-header.kmk
[216]220endif
[673]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#
[672]227KMK_REVISION := $(patsubst %:,, $Rev: 723 $ )
[69]228
[576]229
[69]230#
[72]231# Build platform setup.
[69]232#
233# OS/2
[72]234ifeq ($(BUILD_PLATFORM),os2)
[83]235EXEC_X86_WIN32 := innopec.exe
[69]236HOSTSUFF_EXE := .exe
237endif
238
239# Linux
[72]240ifeq ($(BUILD_PLATFORM),linux)
[135]241EXEC_X86_WIN32 := wine
[69]242HOSTSUFF_EXE :=
243endif
[70]244
[547]245# Win, Win32, Win64, NT.
246ifeq ($(filter-out win32 win64 win nt,$(BUILD_PLATFORM)),)
[69]247EXEC_X86_WIN32 :=
248HOSTSUFF_EXE := .exe
249endif
250
[299]251# FreeBSD
252ifeq ($(BUILD_PLATFORM),freebsd)
253EXEC_X86_WIN32 := wine
254HOSTSUFF_EXE :=
255endif
[125]256
[557]257# Darwin / Mac OS X
258ifeq ($(BUILD_PLATFORM),darwin)
259EXEC_X86_WIN32 := false
260HOSTSUFF_EXE :=
261endif
262
[578]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)
[478]268 endif
[578]269 ifeq ($(wildcard $(PATH_KBUILD_BIN)/kmk_ash$(HOSTSUFF_EXE)),)
[653]270 ifeq ($(filter-out win64 win32 win nt ,$(BUILD_PLATFORM)),)
271 PATH_KBUILD_BIN := $(PATH_KBUILD)/bin/x86.win
[578]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
[478]278 endif
279endif
[299]280
[478]281
[73]282#
283# Build target setup.
284#
[480]285ifeq ($(filter-out win32 win64 win nt os2,$(BUILD_TARGET)),)
[73]286SUFF_OBJ := .obj
287SUFF_LIB := .lib
288SUFF_DLL := .dll
289SUFF_EXE := .exe
[86]290SUFF_SYS := .sys
[73]291SUFF_RES := .res
292endif
[480]293ifeq ($(BUILD_TARGET),l4)
[73]294SUFF_OBJ := .o
295SUFF_LIB := .a
[480]296SUFF_DLL := .s.so
[73]297SUFF_EXE :=
[86]298SUFF_SYS := .a
[73]299SUFF_RES :=
300endif
[557]301ifeq ($(BUILD_TARGET),darwin)
302SUFF_OBJ := .o
303SUFF_LIB := .a
304SUFF_DLL := .dylib
305SUFF_EXE :=
306SUFF_SYS := .a
307SUFF_RES :=
308endif
[480]309ifndef SUFF_OBJ
[296]310SUFF_OBJ := .o
311SUFF_LIB := .a
[480]312SUFF_DLL := .so
[296]313SUFF_EXE :=
314SUFF_SYS := .a
315SUFF_RES :=
316endif
[69]317
318#
319# Standard kBuild tools.
320#
[233]321ifeq ($(MAKE),kmk)
[578]322MAKE := $(PATH_KBUILD_BIN)/kmk$(HOSTSUFF_EXE)
[233]323endif
324
[578]325DEP_EXT := $(PATH_KBUILD_BIN)/kDep$(HOSTSUFF_EXE)
[380]326ifeq ($(filter kDep,$(KMK_BUILTIN)),kDep)
[397]327DEP := kmk_builtin_kDep
[230]328else
[380]329DEP := $(DEP_EXT)
[230]330endif
[69]331
[578]332DEP_IDB_EXT := $(PATH_KBUILD_BIN)/kDepIDB$(HOSTSUFF_EXE)
[397]333ifeq ($(filter kDepPre,$(KMK_BUILTIN)),kDepIDB)
334DEP_IDB := $(if kmk_builtin_kDepIDB
335else
336DEP_IDB := $(DEP_IDB_EXT)
337endif
338
[578]339DEP_PRE_EXT := $(PATH_KBUILD_BIN)/kDepPre$(HOSTSUFF_EXE)
[380]340ifeq ($(filter kDepPre,$(KMK_BUILTIN)),kDepPre)
341DEP_PRE := $(if kmk_builtin_kDepPre
342else
343DEP_PRE := $(DEP_PRE_EXT)
344endif
345
[578]346APPEND_EXT := $(PATH_KBUILD_BIN)/kmk_append$(HOSTSUFF_EXE)
[353]347ifeq ($(filter append,$(KMK_BUILTIN)),append)
[380]348APPEND := kmk_builtin_append
[353]349else
[380]350APPEND := $(APPEND_EXT)
[353]351endif
[69]352
[578]353CAT_EXT := $(PATH_KBUILD_BIN)/kmk_cat$(HOSTSUFF_EXE)
[380]354ifeq ($(filter cat,$(KMK_BUILTIN)),cat)
355CAT := kmk_builtin_cat
356else
357CAT := $(CAT_EXT)
358endif
[353]359
[578]360CP_EXT := $(PATH_KBUILD_BIN)/kmk_cp$(HOSTSUFF_EXE)
[380]361ifeq ($(filter cp,$(KMK_BUILTIN)),cp)
362CP := kmk_builtin_cp
363else
364CP := $(CP_EXT)
365endif
366
[578]367ECHO_EXT := $(PATH_KBUILD_BIN)/kmk_echo$(HOSTSUFF_EXE)
[380]368ifeq ($(filter echo,$(KMK_BUILTIN)),echo)
369ECHO := kmk_builtin_echo
370else
371ECHO := $(ECHO_EXT)
372endif
373
[578]374INSTALL_EXT := $(PATH_KBUILD_BIN)/kmk_install$(HOSTSUFF_EXE)
[380]375ifeq ($(filter install,$(KMK_BUILTIN)),install)
376INSTALL := kmk_builtin_install
377else
378INSTALL := $(INSTALL_EXT)
379endif
380
[578]381LN_EXT := $(PATH_KBUILD_BIN)/kmk_ln$(HOSTSUFF_EXE)
[380]382ifeq ($(filter ln,$(KMK_BUILTIN)),ln)
383LN := kmk_builtin_ln
384else
385LN := $(LN_EXT)
386endif
387
[578]388MKDIR_EXT := $(PATH_KBUILD_BIN)/kmk_mkdir$(HOSTSUFF_EXE)
[380]389ifeq ($(filter mkdir,$(KMK_BUILTIN)),mkdir)
390MKDIR := kmk_builtin_mkdir
391else
392MKDIR := $(MKDIR_EXT)
393endif
394
[578]395MV_EXT := $(PATH_KBUILD_BIN)/kmk_mv$(HOSTSUFF_EXE)
[380]396ifeq ($(filter mv,$(KMK_BUILTIN)),mv)
397MV := kmk_builtin_mv
398else
399MV := $(MV_EXT)
400endif
401
[578]402RM_EXT := $(PATH_KBUILD_BIN)/kmk_rm$(HOSTSUFF_EXE)
[380]403ifeq ($(filter rm,$(KMK_BUILTIN)),rm)
404RM := kmk_builtin_rm
405else
406RM := $(RM_EXT)
407endif
408
[601]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
[578]416SED_EXT := $(PATH_KBUILD_BIN)/kmk_sed$(HOSTSUFF_EXE)
[380]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.
[578]424ASH := $(PATH_KBUILD_BIN)/kmk_ash$(HOSTSUFF_EXE)
[380]425MAKESHELL := $(ASH)
426SHELL := $(ASH)
427export SHELL MAKESHELL
428
[414]429# Symlinking is problematic on some platforms...
[380]430LN_SYMLINK := $(LN) -s
431
[130]432## ABSPATH - make paths absolute.
[129]433# This implementation is clumsy and doesn't resolve '..' and '.' components.
[73]434#
[129]435# @param $1 The paths to make absolute.
[696]436# @obsolete Use the GNU make function $(abspath) directly now.
[306]437ABSPATH = $(abspath $(1))
[353]438
[130]439## DIRDEP - make create directory dependencies.
440#
441# @param $1 The paths to the directories which must be created.
[353]442DIRDEP = $(foreach path,$(patsubst %/,%,$(1)),$(path)/)
[129]443
[204]444
[129]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
[723]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
[129]493#
[353]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
[640]518## PROPS_TOOLS
519# This is a subset of the other PROPS
[641]520PROPS_TOOLS := TOOL CTOOL CXXTOOL ASTOOL RCTOOL ARTOOL LDTOOL FETCHTOOL UNPACKTOOL PATCHTOOL
[640]521
[353]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.
[641]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
[353]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
[660]534## PROPS_ACCUMULATE_R
535# The list of accumulative target properties where the right most value/flag
536# is the 'most significant'.
[353]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.
[660]539PROPS_ACCUMULATE_R := \
540 DEFS DEPS \
541 CFLAGS CDEFS \
542 CXXFLAGS CXXDEFS \
543 ASFLAGS ASDEFS \
544 RCFLAGS RCDEFS \
545 LDFLAGS \
[640]546 FETCHFLAGS UNPACKFLAGS PATCHFLAGS
[353]547
[660]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
[353]557
[662]558## PROPS_ALL
559# List of all the properties.
560PROPS_ALL = $(PROPS_SINGLE) $(PROPS_DEFERRED) $(PROPS_ACCUMULATE_L) $(PROPS_ACCUMULATE_R)
[660]561
[662]562
[353]563#
[662]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#
[353]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
[640]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
[353]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 :=
[380]644PASS_INSTALLS_vars := _INSTALLS_DIRS _INSTALLS
[353]645PASS_INSTALLS_pass := installs
646
647## PASS: packing
648# This pass processes custom packing rules.
649PASS_PACKING := Packing
[414]650PASS_PACKING_trgs :=
[417]651PASS_PACKING_vars := _PACKING
[353]652PASS_PACKING_pass := packing
[414]653#alias
654packing: pass_packing
[353]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.
[723]681PASSES := FETCHES PATCHES $(DEFAULT_PASSES) NOTHING CLEAN
[353]682
683
684#
[69]685# This is how we find the closest config.kmk.
686# It's a little hacky but I think it works fine.
[70]687#
688_CFGDIR := .
[78]689_CFGFILES := ./Config.kmk ./config.kmk
[69]690define def_include_config
[78]691$(eval _CFGDIR := $(_CFGDIR)/$(dir))
692_CFGFILES += $(_CFGDIR)/Config.kmk $(_CFGDIR)/config.kmk
[69]693endef
694# walk down the _RELATIVE_ path specified by DEPTH.
[78]695$(foreach dir,$(subst /, ,$(DEPTH)), $(eval $(def_include_config)) )
[69]696# add the default config file.
[78]697_CFGFILE := $(firstword $(wildcard $(_CFGFILES) $(FILE_KBUILD_CONFIG)))
[69]698_CFGFILES :=
699_CFGDIR :=
[416]700ifeq ($(_CFGFILE),)
701$(error kBuild: no Config.kmk file found! Check the DEPTH: DEPTH='$(DEPTH)' PATH_CURRENT='$(PATH_CURRENT)')
702endif
[69]703
704# Include the config.kmk we found file (or the default one).
705include $(_CFGFILE)
706
707
[696]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
[700]723 ifneq ($(filter --pretty-command-printing,$(MAKEFLAGS)),)
724 export KBUILD_VERBOSE := 1
725 endif
726 endif
727 ifndef KBUILD_VERBOSE
[696]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"
[699]738 ifneq ($(KBUILD_VERBOSE),all)
[696]739 QUIET2:= @
740 else
741 QUIET2:=
742 endif
743 endif
744endif
745
[69]746# end-of-file-content
[72]747__header_kmk__ := 1
[69]748endif # __header_kmk__
[479]749
Note: See TracBrowser for help on using the repository browser.