source: trunk/kBuild/header.kmk@ 724

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

simpler implementation.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id Revision
File size: 18.8 KB
RevLine 
[69]1# $Id: header.kmk 724 2006-12-15 03:03:59Z 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: 724 $ )
[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).
[724]476stack-popv = $(eval $1:=$(wordlist 1,$(words $(wordlist 2,9999,$($1))),$($1)))
[723]477
478##
479# Retrieves the top element from the 'stack' variable.
480# @param $1 The stack variable name
481stack-top = $(lastword $($1))
482endif
483
484
[129]485#
[353]486# Initialize some of the globals which the Config.kmk and
487# others can add stuff to if they like for processing in the footer.
488#
489
490## ALL_TARGET
491# This is the list of all targets.
492ALL_TARGETS :=
493
494## TEMPLATE_PATHS
495# List a paths (separated by space) where templates can be found.
496TEMPLATE_PATHS :=
497
498## TOOL_PATHS
499# List of paths (separated by space) where tools can be found.
500TOOL_PATHS :=
501
502## SDK_PATHS
503# List of paths (separated by space) where SDKs can be found.
504SDK_PATHS :=
505
506## Proritized list of the default makefile when walking subdirectories.
507# The user can overload this list.
508DEFAULT_MAKEFILE := Makefile.kmk makefile.kmk Makefile makefile
509
[640]510## PROPS_TOOLS
511# This is a subset of the other PROPS
[641]512PROPS_TOOLS := TOOL CTOOL CXXTOOL ASTOOL RCTOOL ARTOOL LDTOOL FETCHTOOL UNPACKTOOL PATCHTOOL
[640]513
[353]514## PROPS_SINGLE
515# The list of non-accumulative target properties.
516# A Config.kmk file can add it's own properties to this list and kBuild
517# will do the necessary inheritance from templates to targets.
[641]518PROPS_SINGLE := $(PROPS_TOOLS) INST NOINST BLD_TYPE BLD_TRG BLD_TRG_ARCH BLD_TRG_CPU FETCHDIR \
519 OBJSUFF COBJSUFF CXXOBJSUFF ASOBJSUFF RCOBJSUFF SYSSUFF EXESUFF DLLSUFF LIBSUFF ARLIBSUFF
[353]520
521## PROPS_DEFERRED
522# This list of non-accumulative target properties which are functions,
523# and thus should not be expanded until the very last moment.
524PROPS_DEFERRED := INSTFUN INSTALLER
525
[660]526## PROPS_ACCUMULATE_R
527# The list of accumulative target properties where the right most value/flag
528# is the 'most significant'.
[353]529# A Config.kmk file can add it's own properties to this list and kBuild
530# will do the necessary inheritance from templates to targets.
[660]531PROPS_ACCUMULATE_R := \
532 DEFS DEPS \
533 CFLAGS CDEFS \
534 CXXFLAGS CXXDEFS \
535 ASFLAGS ASDEFS \
536 RCFLAGS RCDEFS \
537 LDFLAGS \
[640]538 FETCHFLAGS UNPACKFLAGS PATCHFLAGS
[353]539
[660]540## PROPS_ACCUMULATE
541# The list of accumulative target properties where the left most value/flag
542# is the 'most significant'.
543# A Config.kmk file can add it's own properties to this list and kBuild
544# will do the necessary inheritance from templates to targets.
545PROPS_ACCUMULATE_L := \
546 SDKS SOURCES \
547 INCS CINCS CXXINCX ASINCS RCINCS \
548 LIBS LIBPATH
[353]549
[662]550## PROPS_ALL
551# List of all the properties.
552PROPS_ALL = $(PROPS_SINGLE) $(PROPS_DEFERRED) $(PROPS_ACCUMULATE_L) $(PROPS_ACCUMULATE_R)
[660]553
[662]554
[353]555#
[662]556# Here is a special 'hack' to prevent innocent environment variables being
557# picked up and treated as properties. (The most annoying example of why
558# this is necessary is the Visual C++ commandline with it's LIBPATH.)
559#
560# Define KBUILD_DONT_KILL_ENV_PROPS in the env. or on the commandline to
561# disable this 'hack'.
562#
563ifndef KBUILD_DONT_KILL_ENV_PROPS
564
565define def_nuke_environment_prop
566ifeq ($(origin $(prop)),environment)
567$(prop) =
568endif
569endef
570$(foreach prop,$(PROPS_ALL),$(eval $(value def_nuke_environment_prop)))
571
572endif
573
574
575#
[353]576# Pass configuration.
577#
578# The PASS_<passname>_trgs variable is listing the targets.
579# The PASS_<passname>_vars variable is listing the target variables.
580# The PASS_<passname>_pass variable is the lowercased passname.
581#
582
[640]583## PASS: fetches
584# This pass fetches and unpacks things needed to complete the build.
585PASS_FETCHES := Fetches
586PASS_FETCHES_trgs :=
587PASS_FETCHES_vars := _FETCHES
588PASS_FETCHES_pass := fetches
589
590## PASS: patches
591# This pass applies patches.
592PASS_PATCHES := Patches
593PASS_PATCHES_trgs :=
594PASS_PATCHES_vars := _PATCHES
595PASS_PATCHES_pass := patches
596
[353]597## PASS: bldprogs
598# This pass builds targets which are required for building the rest.
599PASS_BLDPROGS := Build Programs
600PASS_BLDPROGS_trgs :=
601PASS_BLDPROGS_vars := _BLDPROGS
602PASS_BLDPROGS_pass := bldprogs
603
604## PASS: libraries
605# This pass builds library targets.
606PASS_LIBRARIES := Libraries
607PASS_LIBRARIES_trgs :=
608PASS_LIBRARIES_vars := _LIBS _IMPORT_LIBS _OTHER_LIBRARIES
609PASS_LIBRARIES_pass := libraries
610
611## PASS: binaries
612# This pass builds dll targets.
613PASS_DLLS := DLLs
614PASS_DLLS_trgs :=
615PASS_DLLS_vars := _DLLS _OTHER_DLLS
616PASS_DLLS_pass := dlls
617
618## PASS: binaries
619# This pass builds binary targets, i.e. programs, system modules and stuff.
620PASS_BINARIES := Programs
621PASS_BINARIES_trgs :=
622PASS_BINARIES_vars := _PROGRAMS _SYSMODS _OTHER_BINARIES
623PASS_BINARIES_pass := binaries
624
625## PASS: others
626# This pass builds other targets.
627PASS_OTHERS := Other Stuff
628PASS_OTHERS_trgs :=
629PASS_OTHERS_vars := _OTHERS
630PASS_OTHERS_pass := others
631
632## PASS: install
633# This pass installs the built entities to a sandbox area.
634PASS_INSTALLS := Install
635PASS_INSTALLS_trgs :=
[380]636PASS_INSTALLS_vars := _INSTALLS_DIRS _INSTALLS
[353]637PASS_INSTALLS_pass := installs
638
639## PASS: packing
640# This pass processes custom packing rules.
641PASS_PACKING := Packing
[414]642PASS_PACKING_trgs :=
[417]643PASS_PACKING_vars := _PACKING
[353]644PASS_PACKING_pass := packing
[414]645#alias
646packing: pass_packing
[353]647
648## PASS: clean
649# This pass removes all generated files.
650PASS_CLEAN := Clean
651PASS_CLEAN_trgs := do-clean
652PASS_CLEAN_vars :=
653PASS_CLEAN_pass := clean
654# alias
655clean: pass_clean
656
657## PASS: nothing
658# This pass just walks the tree.
659PASS_NOTHING := Nothing
660PASS_NOTHING_trgs := do-nothing
661PASS_NOTHING_vars :=
662PASS_NOTHING_pass := nothing
663# alias
664nothing: pass_nothing
665
666## DEFAULT_PASSES
667# The default passes and their order.
668DEFAULT_PASSES := BLDPROGS LIBRARIES DLLS BINARIES OTHERS INSTALLS
669
670## PASSES
671# The passes that should be defined. This must include
672# all passes mentioned by DEFAULT_PASSES.
[723]673PASSES := FETCHES PATCHES $(DEFAULT_PASSES) NOTHING CLEAN
[353]674
675
676#
[69]677# This is how we find the closest config.kmk.
678# It's a little hacky but I think it works fine.
[70]679#
680_CFGDIR := .
[78]681_CFGFILES := ./Config.kmk ./config.kmk
[69]682define def_include_config
[78]683$(eval _CFGDIR := $(_CFGDIR)/$(dir))
684_CFGFILES += $(_CFGDIR)/Config.kmk $(_CFGDIR)/config.kmk
[69]685endef
686# walk down the _RELATIVE_ path specified by DEPTH.
[78]687$(foreach dir,$(subst /, ,$(DEPTH)), $(eval $(def_include_config)) )
[69]688# add the default config file.
[78]689_CFGFILE := $(firstword $(wildcard $(_CFGFILES) $(FILE_KBUILD_CONFIG)))
[69]690_CFGFILES :=
691_CFGDIR :=
[416]692ifeq ($(_CFGFILE),)
693$(error kBuild: no Config.kmk file found! Check the DEPTH: DEPTH='$(DEPTH)' PATH_CURRENT='$(PATH_CURRENT)')
694endif
[69]695
696# Include the config.kmk we found file (or the default one).
697include $(_CFGFILE)
698
699
[696]700#
701# Message macros.
702#
703# This is done after including Config.kmk as to allow for
704# KBUILD_QUIET and KBUILD_VERBOSE to be configurable.
705#
706ifdef KBUILD_QUIET
707 # minimal output.
708 QUIET := @
709 QUIET2:= @
710 MSG_L1 =
711 MSG_L2 =
712 MSG_L3 =
713else
714 ifndef KBUILD_VERBOSE
[700]715 ifneq ($(filter --pretty-command-printing,$(MAKEFLAGS)),)
716 export KBUILD_VERBOSE := 1
717 endif
718 endif
719 ifndef KBUILD_VERBOSE
[696]720 QUIET := @
721 QUIET2:= @
722 MSG_L1 = @$(ECHO) "kBuild: $1"
723 MSG_L2 =
724 MSG_L3 =
725 else
726 # maximal output.
727 QUIET :=
728 MSG_L1 = @$(ECHO) "kBuild: $1 $2"
729 MSG_L2 = @$(ECHO) "kBuild: $1"
[699]730 ifneq ($(KBUILD_VERBOSE),all)
[696]731 QUIET2:= @
732 else
733 QUIET2:=
734 endif
735 endif
736endif
737
[69]738# end-of-file-content
[72]739__header_kmk__ := 1
[69]740endif # __header_kmk__
[479]741
Note: See TracBrowser for help on using the repository browser.