source: trunk/kBuild/header.kmk@ 472

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

New feature: Sub-Makefile.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 17.0 KB
RevLine 
[69]1# $Id: header.kmk 472 2006-07-15 04:33:50Z 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
77STRCMP = $(
78
[95]79#
[72]80# Assert build type.
[69]81#
82ifndef BUILD_TYPE
83ifndef BUILD_MODE
[72]84$(error kBuild: You must define BUILD_TYPE!)
[69]85endif
86BUILD_TYPE := $(BUILD_MODE)
87endif
[72]88ifeq ($(BUILD_TYPE),DEBUG)
89BUILD_TYPE := debug
90endif
91ifeq ($(BUILD_TYPE),RELEASE)
92BUILD_TYPE := release
93endif
94ifeq ($(BUILD_TYPE),PROFILE)
95BUILD_TYPE := profile
96endif
[69]97
98
99#
[72]100# Assert build platform.
[70]101#
[72]102_BUILD_PLATFORM_OK := 0
[271]103# OS/2 (have uppercase legacy)
[72]104ifeq ($(BUILD_PLATFORM),OS2)
[271]105override BUILD_PLATFORM := os2
[72]106endif
107ifeq ($(BUILD_PLATFORM),os2)
108_BUILD_PLATFORM_OK := 1
109endif
[70]110
[72]111# Linux
112ifeq ($(BUILD_PLATFORM),LINUX)
[88]113$(error kBuild: BUILD_PLATFORM must be all lowercase!)
[72]114endif
115ifeq ($(BUILD_PLATFORM),linux)
116_BUILD_PLATFORM_OK := 1
117endif
118
119# Win32
120ifeq ($(BUILD_PLATFORM),WIN32)
[88]121$(error kBuild: BUILD_PLATFORM must be all lowercase!)
[72]122endif
[83]123ifeq ($(BUILD_PLATFORM),win32)
[72]124_BUILD_PLATFORM_OK := 1
125endif
126
[438]127# Win64
128ifeq ($(BUILD_PLATFORM),WIN64)
129$(error kBuild: BUILD_PLATFORM must be all lowercase!)
130endif
131ifeq ($(BUILD_PLATFORM),win64)
132_BUILD_PLATFORM_OK := 1
133endif
134
[292]135# L4
136ifeq ($(BUILD_PLATFORM),L4)
137$(error kBuild: BUILD_PLATFORM must be all lowercase!)
138endif
139ifeq ($(BUILD_PLATFORM),l4)
140_BUILD_PLATFORM_OK := 1
141endif
142
[299]143# FreeBSD
144ifeq ($(BUILD_PLATFORM),FreeBSD)
145$(error kBuild: BUILD_PLATFORM must be all lowercase!)
146endif
147ifeq ($(BUILD_PLATFORM),freebsd)
148_BUILD_PLATFORM_OK := 1
149endif
150
[72]151ifeq ($(_BUILD_PLATFORM_OK),0)
152$(error kBuild: BUILD_PLATFORM value '$(BUILD_PLATFORM)' was not recongized!)
153endif
[329]154
155# Fill in defaults if needed.
[353]156ifndef BUILD_PLATFORM_ARCH
[438]157ifeq ($(filter-out win64,$(BUILD_PLATFORM)),)
158BUILD_PLATFORM_ARCH := amd64
159else
[95]160BUILD_PLATFORM_ARCH := x86
[329]161endif
[438]162endif
[329]163ifndef BUILD_PLATFORM_CPU
[438]164ifeq ($(filter-out amd64,$(BUILD_PLATFORM_ARCH)),)
165BUILD_PLATFORM_CPU := k8
166else
[95]167BUILD_PLATFORM_CPU := i586
[329]168endif
[438]169endif
[72]170
171
[70]172#
[72]173# Assert target platform.
174#
175ifndef BUILD_TARGET
176# not defined, set to the same as build platform
177BUILD_TARGET := $(BUILD_PLATFORM)
178else
179_BUILD_TARGET_OK := 0
180# OS/2
181ifeq ($(BUILD_TARGET),OS2)
[88]182$(error kBuild: BUILD_TARGET must be all lowercase!)
[72]183endif
184ifeq ($(BUILD_TARGET),os2)
185_BUILD_TARGET_OK := 1
186endif
187
188# Linux
189ifeq ($(BUILD_TARGET),LINUX)
[88]190$(error kBuild: BUILD_TARGET must be all lowercase!)
[72]191endif
192ifeq ($(BUILD_TARGET),linux)
193_BUILD_TARGET_OK := 1
194endif
195
196# Win32
197ifeq ($(BUILD_TARGET),WIN32)
[88]198$(error kBuild: BUILD_TARGET must be all lowercase!)
[72]199endif
[77]200ifeq ($(BUILD_TARGET),win32)
[72]201_BUILD_TARGET_OK := 1
202endif
203
[438]204# Win64
205ifeq ($(BUILD_TARGET),WIN64)
206$(error kBuild: BUILD_TARGET must be all lowercase!)
207endif
208ifeq ($(BUILD_TARGET),win64)
209_BUILD_TARGET_OK := 1
210endif
211
[292]212# L4
213ifeq ($(BUILD_TARGET),L4)
214$(error kBuild: BUILD_TARGET must be all lowercase!)
215endif
216ifeq ($(BUILD_TARGET),l4)
217_BUILD_TARGET_OK := 1
218endif
219
[299]220# FreeBSD
221ifeq ($(BUILD_TARGET),FreeBSD)
222$(error kBuild: BUILD_TARGET must be all lowercase!)
223endif
224ifeq ($(BUILD_TARGET),freebsd)
225_BUILD_TARGET_OK := 1
226endif
227
[72]228ifeq ($(_BUILD_TARGET_OK),0)
229$(error kBuild: BUILD_TARGET value '$(BUILD_TARGET)' was not recongized!)
230endif
231endif
[329]232
233# Fill in defaults if needed.
234ifndef BUILD_TARGET_ARCH
[78]235BUILD_TARGET_ARCH := x86
[329]236endif
237ifndef BUILD_TARGET_CPU
[78]238BUILD_TARGET_CPU := i586
[329]239endif
[72]240
[266]241# Adjust the DEPTH definition first
242ifeq ($(strip $(DEPTH)),)
243DEPTH := .
244endif
[72]245
246#
[69]247# Common definitions.
248#
[306]249ifeq ($(filter abspath,$(KMK_FEATURES)),abspath)
[472]250
[306]251PATH_CURRENT := $(abspath $(CURDIR))
[472]252ifneq ($(strip $(SUB_DEPTH)),)
253PATH_SUB_CURRENT := $(abspath $(PATH_CURRENT)/$(SUB_DEPTH))
254else
255PATH_SUB_CURRENT := $(PATH_CURRENT)
256endif
[306]257PATH_ROOT := $(abspath $(PATH_CURRENT)/$(DEPTH))
258
259else
260
[69]261PATH_CURRENT := $(CURDIR)
[472]262PATH_SUB_CURRENT := $(PATH_CURRENT)
263ifneq ($(strip $(SUB_DEPTH)),)
264ifneq ($(SUB_DEPTH),.)
265$(foreach d,$(subst /, ,$(SUB_DEPTH)), $(eval PATH_SUB_CURRENT := $(patsubst %/,%,$(dir $(PATH_SUB_CURRENT)))) )
266endif
267endif
[85]268PATH_ROOT := $(PATH_CURRENT)
[70]269ifneq ($(DEPTH),.)
270$(foreach d,$(subst /, ,$(DEPTH)), $(eval PATH_ROOT := $(patsubst %/,%,$(dir $(PATH_ROOT)))) )
[69]271endif
[306]272
273endif
[472]274
[70]275# Subdirectory relative to the root.
[306]276ifneq ($(PATH_ROOT),$(PATH_CURRENT))
[472]277CURSUBDIR := $(patsubst $(PATH_ROOT)/%,%,$(PATH_SUB_CURRENT))
[266]278else
279CURSUBDIR := .
280endif
[306]281
[70]282# Output directories.
[242]283ifndef PATH_OUT_BASE
284PATH_OUT_BASE := $(PATH_ROOT)/out
285endif
[240]286ifndef PATH_OUT
[245]287ifdef BUILD_TARGET_SUB # (BUILD_TARGET_SUB is not currently recognized by kBuild in any other places.)
[464]288PATH_OUT := $(PATH_OUT_BASE)/$(BUILD_TARGET).$(BUILD_TARGET_ARCH).$(BUILD_TARGET_SUB)/$(BUILD_TYPE)
[245]289else
[464]290PATH_OUT := $(PATH_OUT_BASE)/$(BUILD_TARGET).$(BUILD_TARGET_ARCH)/$(BUILD_TYPE)
[240]291endif
[329]292endif # !define PATH_OUT
[353]293PATH_OBJ = $(PATH_OUT)/obj
294PATH_TARGET = $(PATH_OBJ)/$(CURSUBDIR)
295PATH_INS = $(PATH_OUT)
296PATH_BIN = $(PATH_INS)/bin
297PATH_DLL = $(PATH_INS)/bin
298PATH_SYS = $(PATH_INS)/bin
299PATH_LIB = $(PATH_INS)/lib
300PATH_DOC = $(PATH_INS)/doc
[70]301
302# Usually kBuild is external to the source tree.
303ifndef PATH_KBUILD
304PATH_KBUILD := $(PATH_ROOT)/kBuild
305endif
[306]306ifeq ($(filter abspath,$(KMK_FEATURES)),abspath)
307PATH_KBUILD := $(abspath $(PATH_KBUILD))
308endif
[69]309# kBuild files which might be of interest.
310FILE_KBUILD_HEADER := $(PATH_KBUILD)/header.kmk
311FILE_KBUILD_CONFIG := $(PATH_KBUILD)/config.kmk
312FILE_KBUILD_FOOTER := $(PATH_KBUILD)/footer.kmk
313
[72]314SUFF_DEP := .dep
[204]315MAKEFILE := $(firstword $(MAKEFILE_LIST))
[69]316
[72]317
[69]318#
319# Get rid of the GNU Make default stuff
320#
[230]321ifndef KMK_VERSION
[69]322include $(PATH_KBUILD)/StampOutPredefines.kmk
[216]323endif
[69]324
325#
[72]326# Build platform setup.
[69]327#
[329]328PATH_TOOLS := $(PATH_KBUILD)/bin/$(BUILD_PLATFORM_ARCH).$(BUILD_PLATFORM)
329
[69]330# OS/2
[72]331ifeq ($(BUILD_PLATFORM),os2)
[83]332EXEC_X86_WIN32 := innopec.exe
[69]333HOSTSUFF_EXE := .exe
334endif
335
336# Linux
[72]337ifeq ($(BUILD_PLATFORM),linux)
[135]338EXEC_X86_WIN32 := wine
[69]339HOSTSUFF_EXE :=
340endif
[70]341
[438]342# Win32 & Win64
343ifeq ($(filter-out win32 win64,$(BUILD_TARGET)),)
[69]344EXEC_X86_WIN32 :=
345HOSTSUFF_EXE := .exe
346endif
347
[299]348# FreeBSD
349ifeq ($(BUILD_PLATFORM),freebsd)
350EXEC_X86_WIN32 := wine
351HOSTSUFF_EXE :=
352endif
[125]353
[299]354
[73]355#
356# Build target setup.
357#
358ifeq ($(BUILD_TARGET),os2)
359SUFF_OBJ := .obj
360SUFF_LIB := .lib
361SUFF_DLL := .dll
362SUFF_EXE := .exe
[86]363SUFF_SYS := .sys
[73]364SUFF_RES := .res
365endif
[438]366ifeq ($(filter-out win32 win64,$(BUILD_TARGET)),)
[73]367SUFF_OBJ := .obj
368SUFF_LIB := .lib
369SUFF_DLL := .dll
370SUFF_EXE := .exe
[86]371SUFF_SYS := .sys
[73]372SUFF_RES := .res
373endif
374ifeq ($(BUILD_TARGET),linux)
375SUFF_OBJ := .o
376SUFF_LIB := .a
377SUFF_DLL := .so
378SUFF_EXE :=
[86]379SUFF_SYS := .a
[73]380SUFF_RES :=
381endif
[296]382ifeq ($(BUILD_TARGET),l4)
383SUFF_OBJ := .o
384SUFF_LIB := .a
385SUFF_DLL := .s.so
386SUFF_EXE :=
387SUFF_SYS := .a
388SUFF_RES :=
389endif
[69]390
391#
392# Standard kBuild tools.
393#
[233]394ifeq ($(MAKE),kmk)
[380]395MAKE := $(PATH_TOOLS)/kmk$(HOSTSUFF_EXE)
[233]396endif
397
[380]398DEP_EXT := $(PATH_TOOLS)/kDep$(HOSTSUFF_EXE)
399ifeq ($(filter kDep,$(KMK_BUILTIN)),kDep)
[397]400DEP := kmk_builtin_kDep
[230]401else
[380]402DEP := $(DEP_EXT)
[230]403endif
[69]404
[397]405DEP_IDB_EXT := $(PATH_TOOLS)/kDepIDB$(HOSTSUFF_EXE)
406ifeq ($(filter kDepPre,$(KMK_BUILTIN)),kDepIDB)
407DEP_IDB := $(if kmk_builtin_kDepIDB
408else
409DEP_IDB := $(DEP_IDB_EXT)
410endif
411
[380]412DEP_PRE_EXT := $(PATH_TOOLS)/kDepPre$(HOSTSUFF_EXE)
413ifeq ($(filter kDepPre,$(KMK_BUILTIN)),kDepPre)
414DEP_PRE := $(if kmk_builtin_kDepPre
415else
416DEP_PRE := $(DEP_PRE_EXT)
417endif
418
419APPEND_EXT := $(PATH_TOOLS)/kmk_append$(HOSTSUFF_EXE)
[353]420ifeq ($(filter append,$(KMK_BUILTIN)),append)
[380]421APPEND := kmk_builtin_append
[353]422else
[380]423APPEND := $(APPEND_EXT)
[353]424endif
[69]425
[380]426CAT_EXT := $(PATH_TOOLS)/kmk_cat$(HOSTSUFF_EXE)
427ifeq ($(filter cat,$(KMK_BUILTIN)),cat)
428CAT := kmk_builtin_cat
429else
430CAT := $(CAT_EXT)
431endif
[353]432
[380]433CP_EXT := $(PATH_TOOLS)/kmk_cp$(HOSTSUFF_EXE)
434ifeq ($(filter cp,$(KMK_BUILTIN)),cp)
435CP := kmk_builtin_cp
436else
437CP := $(CP_EXT)
438endif
439
440ECHO_EXT := $(PATH_TOOLS)/kmk_echo$(HOSTSUFF_EXE)
441ifeq ($(filter echo,$(KMK_BUILTIN)),echo)
442ECHO := kmk_builtin_echo
443else
444ECHO := $(ECHO_EXT)
445endif
446
447INSTALL_EXT := $(PATH_TOOLS)/kmk_install$(HOSTSUFF_EXE)
448ifeq ($(filter install,$(KMK_BUILTIN)),install)
449INSTALL := kmk_builtin_install
450else
451INSTALL := $(INSTALL_EXT)
452endif
453
454LN_EXT := $(PATH_TOOLS)/kmk_ln$(HOSTSUFF_EXE)
455ifeq ($(filter ln,$(KMK_BUILTIN)),ln)
456LN := kmk_builtin_ln
457else
458LN := $(LN_EXT)
459endif
460
461MKDIR_EXT := $(PATH_TOOLS)/kmk_mkdir$(HOSTSUFF_EXE)
462ifeq ($(filter mkdir,$(KMK_BUILTIN)),mkdir)
463MKDIR := kmk_builtin_mkdir
464else
465MKDIR := $(MKDIR_EXT)
466endif
467
468MV_EXT := $(PATH_TOOLS)/kmk_mv$(HOSTSUFF_EXE)
469ifeq ($(filter mv,$(KMK_BUILTIN)),mv)
470MV := kmk_builtin_mv
471else
472MV := $(MV_EXT)
473endif
474
475RM_EXT := $(PATH_TOOLS)/kmk_rm$(HOSTSUFF_EXE)
476ifeq ($(filter rm,$(KMK_BUILTIN)),rm)
477RM := kmk_builtin_rm
478else
479RM := $(RM_EXT)
480endif
481
482SED_EXT := $(PATH_TOOLS)/kmk_sed$(HOSTSUFF_EXE)
483ifeq ($(filter sed,$(KMK_BUILTIN)),sed)
484SED := kmk_builtin_sed
485else
486SED := $(SED_EXT)
487endif
488
489# Our default shell is the Almquist shell from *BSD.
490ASH := $(PATH_TOOLS)/kmk_ash$(HOSTSUFF_EXE)
491MAKESHELL := $(ASH)
492SHELL := $(ASH)
493export SHELL MAKESHELL
494
[414]495# Symlinking is problematic on some platforms...
[380]496LN_SYMLINK := $(LN) -s
497
498
499
[69]500#
[73]501# Message macros.
[204]502#
503
[73]504ifndef BUILD_QUIET
[75]505ifdef BUILD_DEBUG
506BUILD_VERBOSE := 9
507endif
[230]508MSG_L1 = @$(ECHO) "kBuild: $1"
[73]509ifdef BUILD_VERBOSE
[230]510MSG_L2 = @$(ECHO) "kBuild: $1"
[75]511QUIET :=
[73]512else
[75]513QUIET := @
[73]514MSG_L2 =
515endif
516ifdef BUILD_DEBUG
[230]517MSG_L3 = @$(ECHO) "kBuild: $1"
[73]518else
519MSG_L3 =
520endif
521else
[75]522QUIET :=
[73]523MSG_L1 =
524MSG_L2 =
525MSG_L3 =
526endif
527
[130]528## ABSPATH - make paths absolute.
[129]529# This implementation is clumsy and doesn't resolve '..' and '.' components.
[73]530#
[129]531# @param $1 The paths to make absolute.
[306]532ifeq ($(filter abspath,$(KMK_FEATURES)),abspath)
533ABSPATH = $(abspath $(1))
534else
[129]535ABSPATH = $(foreach path,$(1)\
536 ,$(strip $(if $(subst <,,$(firstword $(subst /, ,<$(path)))),\
537 $(if $(patsubst %:,,$(firstword $(subst :,: ,$(path)))),$(PATH_CURRENT)/$(path),$(path)),\
538 $(path))))
[306]539endif
[353]540
[130]541## DIRDEP - make create directory dependencies.
542#
543# @param $1 The paths to the directories which must be created.
[438]544ifeq ($(filter-out win32 win64,$(BUILD_PLATFORM)),)
[353]545DIRDEP = $(patsubst %/,%,$(1))
546else
547DIRDEP = $(foreach path,$(patsubst %/,%,$(1)),$(path)/)
548endif
[129]549
[204]550
[129]551## Cygwin kludge.
552# This converts /cygdrive/x/% to x:%.
553#
554# @param $1 The paths to make native.
555# @remark This macro is pretty much obsolete since we don't use cygwin base make.
556ifneq ($(patsubst /cygdrive/%,%,$(CURDIR)),$(CURDIR))
557CYGPATHMIXED = $(foreach path,$(1)\
558 ,$(if $(patsubst /cygdrive/%,,$(path)),$(path),$(patsubst $(strip $(firstword $(subst /, ,$(patsubst /cygdrive/%,%,$(path)))))/%,$(strip $(firstword $(subst /, ,$(patsubst /cygdrive/%,%,$(path))))):/%,$(patsubst /cygdrive/%,%,$(path)))))
559else
560CYGPATHMIXED = $(1)
561endif
562
563#
[353]564# Initialize some of the globals which the Config.kmk and
565# others can add stuff to if they like for processing in the footer.
566#
567
568## ALL_TARGET
569# This is the list of all targets.
570ALL_TARGETS :=
571
572## TEMPLATE_PATHS
573# List a paths (separated by space) where templates can be found.
574TEMPLATE_PATHS :=
575
576## TOOL_PATHS
577# List of paths (separated by space) where tools can be found.
578TOOL_PATHS :=
579
580## SDK_PATHS
581# List of paths (separated by space) where SDKs can be found.
582SDK_PATHS :=
583
584## Proritized list of the default makefile when walking subdirectories.
585# The user can overload this list.
586DEFAULT_MAKEFILE := Makefile.kmk makefile.kmk Makefile makefile
587
588## PROPS_SINGLE
589# The list of non-accumulative target properties.
590# A Config.kmk file can add it's own properties to this list and kBuild
591# will do the necessary inheritance from templates to targets.
592PROPS_SINGLE := TOOL ARTOOL CTOOL CXXTOOL ASTOOL LDTOOL INST NOINST
593
594## PROPS_DEFERRED
595# This list of non-accumulative target properties which are functions,
596# and thus should not be expanded until the very last moment.
597PROPS_DEFERRED := INSTFUN INSTALLER
598
599## PROPS_ACCUMULATE
600# The list of accumulative target properties.
601# A Config.kmk file can add it's own properties to this list and kBuild
602# will do the necessary inheritance from templates to targets.
603PROPS_ACCUMULATE := \
[444]604 SDKS DEFS DEPS INCS SOURCES \
[353]605 COPTS CFLAGS CDEFS CINCS CXXOPTS CXXFLAGS CXXDEFS CXXINCS \
606 ASOPTS ASFLAGS ASDEFS ASINCS \
607 LDFLAGS LIBS LIBPATH \
608 BLD_TYPE BLD_TRG BLD_TRG_ARCH BLD_TRG_CPU \
609 SYSSUFF EXESUFF DLLSUFF LIBSUFF ARLIBSUFF \
610
611
612## PROPS_TOOLS
613# This is a subset of the other PROPS
614PROPS_TOOLS := TOOL CTOOL CXXTOOL ASTOOL ARTOOL LDTOOL
615
616
617#
618# Pass configuration.
619#
620# The PASS_<passname>_trgs variable is listing the targets.
621# The PASS_<passname>_vars variable is listing the target variables.
622# The PASS_<passname>_pass variable is the lowercased passname.
623#
624
625## PASS: bldprogs
626# This pass builds targets which are required for building the rest.
627PASS_BLDPROGS := Build Programs
628PASS_BLDPROGS_trgs :=
629PASS_BLDPROGS_vars := _BLDPROGS
630PASS_BLDPROGS_pass := bldprogs
631
632## PASS: libraries
633# This pass builds library targets.
634PASS_LIBRARIES := Libraries
635PASS_LIBRARIES_trgs :=
636PASS_LIBRARIES_vars := _LIBS _IMPORT_LIBS _OTHER_LIBRARIES
637PASS_LIBRARIES_pass := libraries
638
639## PASS: binaries
640# This pass builds dll targets.
641PASS_DLLS := DLLs
642PASS_DLLS_trgs :=
643PASS_DLLS_vars := _DLLS _OTHER_DLLS
644PASS_DLLS_pass := dlls
645
646## PASS: binaries
647# This pass builds binary targets, i.e. programs, system modules and stuff.
648PASS_BINARIES := Programs
649PASS_BINARIES_trgs :=
650PASS_BINARIES_vars := _PROGRAMS _SYSMODS _OTHER_BINARIES
651PASS_BINARIES_pass := binaries
652
653## PASS: others
654# This pass builds other targets.
655PASS_OTHERS := Other Stuff
656PASS_OTHERS_trgs :=
657PASS_OTHERS_vars := _OTHERS
658PASS_OTHERS_pass := others
659
660## PASS: install
661# This pass installs the built entities to a sandbox area.
662PASS_INSTALLS := Install
663PASS_INSTALLS_trgs :=
[380]664PASS_INSTALLS_vars := _INSTALLS_DIRS _INSTALLS
[353]665PASS_INSTALLS_pass := installs
666
667## PASS: packing
668# This pass processes custom packing rules.
669PASS_PACKING := Packing
[414]670PASS_PACKING_trgs :=
[417]671PASS_PACKING_vars := _PACKING
[353]672PASS_PACKING_pass := packing
[414]673#alias
674packing: pass_packing
[353]675
676## PASS: clean
677# This pass removes all generated files.
678PASS_CLEAN := Clean
679PASS_CLEAN_trgs := do-clean
680PASS_CLEAN_vars :=
681PASS_CLEAN_pass := clean
682# alias
683clean: pass_clean
684
685## PASS: nothing
686# This pass just walks the tree.
687PASS_NOTHING := Nothing
688PASS_NOTHING_trgs := do-nothing
689PASS_NOTHING_vars :=
690PASS_NOTHING_pass := nothing
691# alias
692nothing: pass_nothing
693
694## DEFAULT_PASSES
695# The default passes and their order.
696DEFAULT_PASSES := BLDPROGS LIBRARIES DLLS BINARIES OTHERS INSTALLS
697
698## PASSES
699# The passes that should be defined. This must include
700# all passes mentioned by DEFAULT_PASSES.
701PASSES := $(DEFAULT_PASSES) NOTHING CLEAN
702
703
704#
[69]705# This is how we find the closest config.kmk.
706# It's a little hacky but I think it works fine.
[70]707#
708_CFGDIR := .
[78]709_CFGFILES := ./Config.kmk ./config.kmk
[69]710define def_include_config
[78]711$(eval _CFGDIR := $(_CFGDIR)/$(dir))
712_CFGFILES += $(_CFGDIR)/Config.kmk $(_CFGDIR)/config.kmk
[69]713endef
714# walk down the _RELATIVE_ path specified by DEPTH.
[78]715$(foreach dir,$(subst /, ,$(DEPTH)), $(eval $(def_include_config)) )
[69]716# add the default config file.
[78]717_CFGFILE := $(firstword $(wildcard $(_CFGFILES) $(FILE_KBUILD_CONFIG)))
[69]718_CFGFILES :=
719_CFGDIR :=
[416]720ifeq ($(_CFGFILE),)
721$(error kBuild: no Config.kmk file found! Check the DEPTH: DEPTH='$(DEPTH)' PATH_CURRENT='$(PATH_CURRENT)')
722endif
[69]723
724# Include the config.kmk we found file (or the default one).
725include $(_CFGFILE)
726
727
728# end-of-file-content
[72]729__header_kmk__ := 1
[69]730endif # __header_kmk__
Note: See TracBrowser for help on using the repository browser.