source: trunk/kBuild/header.kmk@ 672

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

KMK_REVISION experiment

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