source: trunk/kBuild/header.kmk@ 594

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

BUILD_TYPE defaults to 'release'. BUILD_MODE is the only variant needing lowercasing.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 16.0 KB
RevLine 
[69]1# $Id: header.kmk 585 2006-11-24 05:14:13Z 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
219 # Vanilla GNU Make. Only supported for kBuild bootstrapping. Disable some features to make it work.
220 NO_COMPILE_CMDS_DEPS:= 1
221 NO_LINK_CMDS_DEPS := 1
222 sinclude $(PATH_KBUILD)/StampOutPredefines.kmk
223 ifndef IS_BOOTSTRAPPING_KBUILD_NOW
224 $(warning kBuild: Using vanilla GNU make isn't safe for anything but kBuild bootstrapping!)
225 endif
[216]226endif
[69]227
[576]228
[69]229#
[72]230# Build platform setup.
[69]231#
232# OS/2
[72]233ifeq ($(BUILD_PLATFORM),os2)
[83]234EXEC_X86_WIN32 := innopec.exe
[69]235HOSTSUFF_EXE := .exe
236endif
237
238# Linux
[72]239ifeq ($(BUILD_PLATFORM),linux)
[135]240EXEC_X86_WIN32 := wine
[69]241HOSTSUFF_EXE :=
242endif
[70]243
[547]244# Win, Win32, Win64, NT.
245ifeq ($(filter-out win32 win64 win nt,$(BUILD_PLATFORM)),)
[69]246EXEC_X86_WIN32 :=
247HOSTSUFF_EXE := .exe
248endif
249
[299]250# FreeBSD
251ifeq ($(BUILD_PLATFORM),freebsd)
252EXEC_X86_WIN32 := wine
253HOSTSUFF_EXE :=
254endif
[125]255
[557]256# Darwin / Mac OS X
257ifeq ($(BUILD_PLATFORM),darwin)
258EXEC_X86_WIN32 := false
259HOSTSUFF_EXE :=
260endif
261
[578]262ifndef PATH_KBUILD_BIN
263 PATH_KBUILD_BIN := $(PATH_KBUILD)/bin/$(BUILD_PLATFORM_ARCH).$(BUILD_PLATFORM)
264 ifeq ($(wildcard $(PATH_KBUILD_BIN)/kmk_ash$(HOSTSUFF_EXE)),)
265 ifeq ($(BUILD_TARGET_ARCH),amd64)
266 PATH_KBUILD_BIN := $(PATH_KBUILD)/bin/x86.$(BUILD_PLATFORM)
[478]267 endif
[578]268 ifeq ($(wildcard $(PATH_KBUILD_BIN)/kmk_ash$(HOSTSUFF_EXE)),)
269 ifeq ($(filter-out win64 win nt ,$(BUILD_PLATFORM)),)
270 PATH_KBUILD_BIN := $(PATH_KBUILD)/bin/x86.win32
271 endif
272 endif
273 ifeq ($(wildcard $(PATH_KBUILD_BIN)/kmk_ash$(HOSTSUFF_EXE)),)
274 # give up
275 PATH_KBUILD_BIN := $(PATH_KBUILD)/bin/$(BUILD_PLATFORM_ARCH).$(BUILD_PLATFORM)
276 endif
[478]277 endif
278endif
[299]279
[478]280
[73]281#
282# Build target setup.
283#
[480]284ifeq ($(filter-out win32 win64 win nt os2,$(BUILD_TARGET)),)
[73]285SUFF_OBJ := .obj
286SUFF_LIB := .lib
287SUFF_DLL := .dll
288SUFF_EXE := .exe
[86]289SUFF_SYS := .sys
[73]290SUFF_RES := .res
291endif
[480]292ifeq ($(BUILD_TARGET),l4)
[73]293SUFF_OBJ := .o
294SUFF_LIB := .a
[480]295SUFF_DLL := .s.so
[73]296SUFF_EXE :=
[86]297SUFF_SYS := .a
[73]298SUFF_RES :=
299endif
[557]300ifeq ($(BUILD_TARGET),darwin)
301SUFF_OBJ := .o
302SUFF_LIB := .a
303SUFF_DLL := .dylib
304SUFF_EXE :=
305SUFF_SYS := .a
306SUFF_RES :=
307endif
[480]308ifndef SUFF_OBJ
[296]309SUFF_OBJ := .o
310SUFF_LIB := .a
[480]311SUFF_DLL := .so
[296]312SUFF_EXE :=
313SUFF_SYS := .a
314SUFF_RES :=
315endif
[69]316
317#
318# Standard kBuild tools.
319#
[233]320ifeq ($(MAKE),kmk)
[578]321MAKE := $(PATH_KBUILD_BIN)/kmk$(HOSTSUFF_EXE)
[233]322endif
323
[578]324DEP_EXT := $(PATH_KBUILD_BIN)/kDep$(HOSTSUFF_EXE)
[380]325ifeq ($(filter kDep,$(KMK_BUILTIN)),kDep)
[397]326DEP := kmk_builtin_kDep
[230]327else
[380]328DEP := $(DEP_EXT)
[230]329endif
[69]330
[578]331DEP_IDB_EXT := $(PATH_KBUILD_BIN)/kDepIDB$(HOSTSUFF_EXE)
[397]332ifeq ($(filter kDepPre,$(KMK_BUILTIN)),kDepIDB)
333DEP_IDB := $(if kmk_builtin_kDepIDB
334else
335DEP_IDB := $(DEP_IDB_EXT)
336endif
337
[578]338DEP_PRE_EXT := $(PATH_KBUILD_BIN)/kDepPre$(HOSTSUFF_EXE)
[380]339ifeq ($(filter kDepPre,$(KMK_BUILTIN)),kDepPre)
340DEP_PRE := $(if kmk_builtin_kDepPre
341else
342DEP_PRE := $(DEP_PRE_EXT)
343endif
344
[578]345APPEND_EXT := $(PATH_KBUILD_BIN)/kmk_append$(HOSTSUFF_EXE)
[353]346ifeq ($(filter append,$(KMK_BUILTIN)),append)
[380]347APPEND := kmk_builtin_append
[353]348else
[380]349APPEND := $(APPEND_EXT)
[353]350endif
[69]351
[578]352CAT_EXT := $(PATH_KBUILD_BIN)/kmk_cat$(HOSTSUFF_EXE)
[380]353ifeq ($(filter cat,$(KMK_BUILTIN)),cat)
354CAT := kmk_builtin_cat
355else
356CAT := $(CAT_EXT)
357endif
[353]358
[578]359CP_EXT := $(PATH_KBUILD_BIN)/kmk_cp$(HOSTSUFF_EXE)
[380]360ifeq ($(filter cp,$(KMK_BUILTIN)),cp)
361CP := kmk_builtin_cp
362else
363CP := $(CP_EXT)
364endif
365
[578]366ECHO_EXT := $(PATH_KBUILD_BIN)/kmk_echo$(HOSTSUFF_EXE)
[380]367ifeq ($(filter echo,$(KMK_BUILTIN)),echo)
368ECHO := kmk_builtin_echo
369else
370ECHO := $(ECHO_EXT)
371endif
372
[578]373INSTALL_EXT := $(PATH_KBUILD_BIN)/kmk_install$(HOSTSUFF_EXE)
[380]374ifeq ($(filter install,$(KMK_BUILTIN)),install)
375INSTALL := kmk_builtin_install
376else
377INSTALL := $(INSTALL_EXT)
378endif
379
[578]380LN_EXT := $(PATH_KBUILD_BIN)/kmk_ln$(HOSTSUFF_EXE)
[380]381ifeq ($(filter ln,$(KMK_BUILTIN)),ln)
382LN := kmk_builtin_ln
383else
384LN := $(LN_EXT)
385endif
386
[578]387MKDIR_EXT := $(PATH_KBUILD_BIN)/kmk_mkdir$(HOSTSUFF_EXE)
[380]388ifeq ($(filter mkdir,$(KMK_BUILTIN)),mkdir)
389MKDIR := kmk_builtin_mkdir
390else
391MKDIR := $(MKDIR_EXT)
392endif
393
[578]394MV_EXT := $(PATH_KBUILD_BIN)/kmk_mv$(HOSTSUFF_EXE)
[380]395ifeq ($(filter mv,$(KMK_BUILTIN)),mv)
396MV := kmk_builtin_mv
397else
398MV := $(MV_EXT)
399endif
400
[578]401RM_EXT := $(PATH_KBUILD_BIN)/kmk_rm$(HOSTSUFF_EXE)
[380]402ifeq ($(filter rm,$(KMK_BUILTIN)),rm)
403RM := kmk_builtin_rm
404else
405RM := $(RM_EXT)
406endif
407
[578]408SED_EXT := $(PATH_KBUILD_BIN)/kmk_sed$(HOSTSUFF_EXE)
[380]409ifeq ($(filter sed,$(KMK_BUILTIN)),sed)
410SED := kmk_builtin_sed
411else
412SED := $(SED_EXT)
413endif
414
415# Our default shell is the Almquist shell from *BSD.
[578]416ASH := $(PATH_KBUILD_BIN)/kmk_ash$(HOSTSUFF_EXE)
[380]417MAKESHELL := $(ASH)
418SHELL := $(ASH)
419export SHELL MAKESHELL
420
[414]421# Symlinking is problematic on some platforms...
[380]422LN_SYMLINK := $(LN) -s
423
424
425
[69]426#
[73]427# Message macros.
[204]428#
429
[73]430ifndef BUILD_QUIET
[75]431ifdef BUILD_DEBUG
432BUILD_VERBOSE := 9
433endif
[230]434MSG_L1 = @$(ECHO) "kBuild: $1"
[73]435ifdef BUILD_VERBOSE
[230]436MSG_L2 = @$(ECHO) "kBuild: $1"
[75]437QUIET :=
[73]438else
[75]439QUIET := @
[73]440MSG_L2 =
441endif
442ifdef BUILD_DEBUG
[230]443MSG_L3 = @$(ECHO) "kBuild: $1"
[73]444else
445MSG_L3 =
446endif
447else
[75]448QUIET :=
[73]449MSG_L1 =
450MSG_L2 =
451MSG_L3 =
452endif
453
[130]454## ABSPATH - make paths absolute.
[129]455# This implementation is clumsy and doesn't resolve '..' and '.' components.
[73]456#
[129]457# @param $1 The paths to make absolute.
[306]458ABSPATH = $(abspath $(1))
[353]459
[130]460## DIRDEP - make create directory dependencies.
461#
462# @param $1 The paths to the directories which must be created.
[353]463DIRDEP = $(foreach path,$(patsubst %/,%,$(1)),$(path)/)
[129]464
[204]465
[129]466## Cygwin kludge.
467# This converts /cygdrive/x/% to x:%.
468#
469# @param $1 The paths to make native.
470# @remark This macro is pretty much obsolete since we don't use cygwin base make.
471ifneq ($(patsubst /cygdrive/%,%,$(CURDIR)),$(CURDIR))
472CYGPATHMIXED = $(foreach path,$(1)\
473 ,$(if $(patsubst /cygdrive/%,,$(path)),$(path),$(patsubst $(strip $(firstword $(subst /, ,$(patsubst /cygdrive/%,%,$(path)))))/%,$(strip $(firstword $(subst /, ,$(patsubst /cygdrive/%,%,$(path))))):/%,$(patsubst /cygdrive/%,%,$(path)))))
474else
475CYGPATHMIXED = $(1)
476endif
477
478#
[353]479# Initialize some of the globals which the Config.kmk and
480# others can add stuff to if they like for processing in the footer.
481#
482
483## ALL_TARGET
484# This is the list of all targets.
485ALL_TARGETS :=
486
487## TEMPLATE_PATHS
488# List a paths (separated by space) where templates can be found.
489TEMPLATE_PATHS :=
490
491## TOOL_PATHS
492# List of paths (separated by space) where tools can be found.
493TOOL_PATHS :=
494
495## SDK_PATHS
496# List of paths (separated by space) where SDKs can be found.
497SDK_PATHS :=
498
499## Proritized list of the default makefile when walking subdirectories.
500# The user can overload this list.
501DEFAULT_MAKEFILE := Makefile.kmk makefile.kmk Makefile makefile
502
503## PROPS_SINGLE
504# The list of non-accumulative target properties.
505# A Config.kmk file can add it's own properties to this list and kBuild
506# will do the necessary inheritance from templates to targets.
507PROPS_SINGLE := TOOL ARTOOL CTOOL CXXTOOL ASTOOL LDTOOL INST NOINST
508
509## PROPS_DEFERRED
510# This list of non-accumulative target properties which are functions,
511# and thus should not be expanded until the very last moment.
512PROPS_DEFERRED := INSTFUN INSTALLER
513
514## PROPS_ACCUMULATE
515# The list of 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.
518PROPS_ACCUMULATE := \
[444]519 SDKS DEFS DEPS INCS SOURCES \
[353]520 COPTS CFLAGS CDEFS CINCS CXXOPTS CXXFLAGS CXXDEFS CXXINCS \
521 ASOPTS ASFLAGS ASDEFS ASINCS \
522 LDFLAGS LIBS LIBPATH \
523 BLD_TYPE BLD_TRG BLD_TRG_ARCH BLD_TRG_CPU \
524 SYSSUFF EXESUFF DLLSUFF LIBSUFF ARLIBSUFF \
525
526
527## PROPS_TOOLS
528# This is a subset of the other PROPS
529PROPS_TOOLS := TOOL CTOOL CXXTOOL ASTOOL ARTOOL LDTOOL
530
531
532#
533# Pass configuration.
534#
535# The PASS_<passname>_trgs variable is listing the targets.
536# The PASS_<passname>_vars variable is listing the target variables.
537# The PASS_<passname>_pass variable is the lowercased passname.
538#
539
540## PASS: bldprogs
541# This pass builds targets which are required for building the rest.
542PASS_BLDPROGS := Build Programs
543PASS_BLDPROGS_trgs :=
544PASS_BLDPROGS_vars := _BLDPROGS
545PASS_BLDPROGS_pass := bldprogs
546
547## PASS: libraries
548# This pass builds library targets.
549PASS_LIBRARIES := Libraries
550PASS_LIBRARIES_trgs :=
551PASS_LIBRARIES_vars := _LIBS _IMPORT_LIBS _OTHER_LIBRARIES
552PASS_LIBRARIES_pass := libraries
553
554## PASS: binaries
555# This pass builds dll targets.
556PASS_DLLS := DLLs
557PASS_DLLS_trgs :=
558PASS_DLLS_vars := _DLLS _OTHER_DLLS
559PASS_DLLS_pass := dlls
560
561## PASS: binaries
562# This pass builds binary targets, i.e. programs, system modules and stuff.
563PASS_BINARIES := Programs
564PASS_BINARIES_trgs :=
565PASS_BINARIES_vars := _PROGRAMS _SYSMODS _OTHER_BINARIES
566PASS_BINARIES_pass := binaries
567
568## PASS: others
569# This pass builds other targets.
570PASS_OTHERS := Other Stuff
571PASS_OTHERS_trgs :=
572PASS_OTHERS_vars := _OTHERS
573PASS_OTHERS_pass := others
574
575## PASS: install
576# This pass installs the built entities to a sandbox area.
577PASS_INSTALLS := Install
578PASS_INSTALLS_trgs :=
[380]579PASS_INSTALLS_vars := _INSTALLS_DIRS _INSTALLS
[353]580PASS_INSTALLS_pass := installs
581
582## PASS: packing
583# This pass processes custom packing rules.
584PASS_PACKING := Packing
[414]585PASS_PACKING_trgs :=
[417]586PASS_PACKING_vars := _PACKING
[353]587PASS_PACKING_pass := packing
[414]588#alias
589packing: pass_packing
[353]590
591## PASS: clean
592# This pass removes all generated files.
593PASS_CLEAN := Clean
594PASS_CLEAN_trgs := do-clean
595PASS_CLEAN_vars :=
596PASS_CLEAN_pass := clean
597# alias
598clean: pass_clean
599
600## PASS: nothing
601# This pass just walks the tree.
602PASS_NOTHING := Nothing
603PASS_NOTHING_trgs := do-nothing
604PASS_NOTHING_vars :=
605PASS_NOTHING_pass := nothing
606# alias
607nothing: pass_nothing
608
609## DEFAULT_PASSES
610# The default passes and their order.
611DEFAULT_PASSES := BLDPROGS LIBRARIES DLLS BINARIES OTHERS INSTALLS
612
613## PASSES
614# The passes that should be defined. This must include
615# all passes mentioned by DEFAULT_PASSES.
616PASSES := $(DEFAULT_PASSES) NOTHING CLEAN
617
618
619#
[69]620# This is how we find the closest config.kmk.
621# It's a little hacky but I think it works fine.
[70]622#
623_CFGDIR := .
[78]624_CFGFILES := ./Config.kmk ./config.kmk
[69]625define def_include_config
[78]626$(eval _CFGDIR := $(_CFGDIR)/$(dir))
627_CFGFILES += $(_CFGDIR)/Config.kmk $(_CFGDIR)/config.kmk
[69]628endef
629# walk down the _RELATIVE_ path specified by DEPTH.
[78]630$(foreach dir,$(subst /, ,$(DEPTH)), $(eval $(def_include_config)) )
[69]631# add the default config file.
[78]632_CFGFILE := $(firstword $(wildcard $(_CFGFILES) $(FILE_KBUILD_CONFIG)))
[69]633_CFGFILES :=
634_CFGDIR :=
[416]635ifeq ($(_CFGFILE),)
636$(error kBuild: no Config.kmk file found! Check the DEPTH: DEPTH='$(DEPTH)' PATH_CURRENT='$(PATH_CURRENT)')
637endif
[69]638
639# Include the config.kmk we found file (or the default one).
640include $(_CFGFILE)
641
642
643# end-of-file-content
[72]644__header_kmk__ := 1
[69]645endif # __header_kmk__
[479]646
Note: See TracBrowser for help on using the repository browser.