source: trunk/kBuild/header.kmk@ 771

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

nuke some more environment variables. (fixes the problem with PROGRAMS on OS/2, ++)

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id Revision
File size: 19.7 KB
Line 
1# $Id: header.kmk 762 2007-01-18 23:31:58Z bird $
2## @file
3#
4# kBuild - File included at top of makefile.
5#
6# Copyright (c) 2004-2005 knut st. osmundsen <bird-srcspam@anduin.net>
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#
36# The FORCE rule.
37#
38FORCE:
39
40#
41# Try avoid inference rules.
42#
43.SUFFIXES:
44SUFFIXES :=
45
46
47#
48# General purpose macros.
49#
50
51## get last word in a list.
52# @returns last word in $1.
53# @param $1 Word list.
54lastword = $(word $(words $(1)), $(1))
55
56##
57# Newline character(s).
58define NL
59
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 = $( todo )
78
79#
80# Set default build type.
81#
82ifndef BUILD_TYPE
83 ifdef BUILD_MODE
84 # BUILD_MODE is legacy from the OS/2 build system. :)
85BUILD_TYPE := $(tolower $(BUILD_MODE))
86 else
87BUILD_TYPE := release
88 endif
89endif
90
91
92#
93# Assert build platform.
94#
95ifndef BUILD_PLATFORM
96 $(error kBuild: BUILD_PLATFORM is undefined!)
97else
98 BUILD_PLATFORM := $(strip $(BUILD_PLATFORM))
99 ifneq ($(words $(BUILD_PLATFORM))$(filter-out darwin freebsd l4 linux nt os2 win win32 win64,$(BUILD_PLATFORM)),1)
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
106endif
107
108# Fill in defaults if needed.
109ifndef BUILD_PLATFORM_ARCH
110 ifeq ($(filter-out win64,$(BUILD_PLATFORM)),)
111 BUILD_PLATFORM_ARCH := amd64
112 else
113 BUILD_PLATFORM_ARCH := x86
114 endif
115endif
116ifndef BUILD_PLATFORM_CPU
117 ifeq ($(filter-out amd64,$(BUILD_PLATFORM_ARCH)),)
118 BUILD_PLATFORM_CPU:= k8
119 else
120 BUILD_PLATFORM_CPU:= i586
121 endif
122endif
123
124
125#
126# Assert target platform.
127#
128ifndef BUILD_TARGET
129# not defined, set to the same as build platform
130BUILD_TARGET := $(BUILD_PLATFORM)
131else
132 BUILD_TARGET := $(strip $(BUILD_TARGET))
133 ifneq ($(words $(BUILD_TARGET))$(filter-out darwin freebsd l4 linux nt os2 win win32 win64,$(BUILD_TARGET)),1)
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
140endif
141
142# Fill in defaults if needed.
143ifndef BUILD_TARGET_ARCH
144 BUILD_TARGET_ARCH := x86
145endif
146ifndef BUILD_TARGET_CPU
147 BUILD_TARGET_CPU := i586
148endif
149
150# Adjust the DEPTH definition first
151ifeq ($(strip $(DEPTH)),)
152DEPTH := .
153endif
154
155#
156# Common definitions.
157#
158## PATH_CURRENT is the current directory (getcwd).
159PATH_CURRENT := $(abspath $(CURDIR))
160## PATH_SUB_CURRENT points to current directory of the current makefile.
161# Meaning that it will change value as we enter and exit sub-makefiles.
162PATH_SUB_CURRENT := $(PATH_CURRENT)
163## PATH_ROOT points to the project root directory.
164PATH_ROOT := $(abspath $(PATH_CURRENT)/$(DEPTH))
165## PATH_SUB_ROOT points to the directory of the top-level makefile.
166ifneq ($(strip $(SUB_DEPTH)),)
167 PATH_SUB_ROOT := $(abspath $(PATH_CURRENT)/$(SUB_DEPTH))
168else
169 PATH_SUB_ROOT := $(PATH_CURRENT)
170endif
171
172## CURSUBDIR is PATH_SUB_ROOT described relative to PATH_ROOT.
173# This variable is used to determin where the object files and other output goes.
174ifneq ($(PATH_ROOT),$(PATH_CURRENT))
175CURSUBDIR := $(patsubst $(PATH_ROOT)/%,%,$(PATH_SUB_ROOT))
176else
177CURSUBDIR := .
178endif
179
180# Output directories.
181ifndef PATH_OUT_BASE
182 PATH_OUT_BASE := $(PATH_ROOT)/out
183endif
184ifndef PATH_OUT
185 ifdef BUILD_TARGET_SUB # (BUILD_TARGET_SUB is not currently recognized by kBuild in any other places.)
186 PATH_OUT := $(PATH_OUT_BASE)/$(BUILD_TARGET).$(BUILD_TARGET_ARCH).$(BUILD_TARGET_SUB)/$(BUILD_TYPE)
187 else
188 PATH_OUT := $(PATH_OUT_BASE)/$(BUILD_TARGET).$(BUILD_TARGET_ARCH)/$(BUILD_TYPE)
189 endif
190endif # !define PATH_OUT
191PATH_OBJ = $(PATH_OUT)/obj
192PATH_TARGET = $(PATH_OBJ)/$(CURSUBDIR)
193PATH_INS = $(PATH_OUT)
194PATH_BIN = $(PATH_INS)/bin
195PATH_DLL = $(PATH_INS)/bin
196PATH_SYS = $(PATH_INS)/bin
197PATH_LIB = $(PATH_INS)/lib
198PATH_DOC = $(PATH_INS)/doc
199
200# Usually kBuild is external to the source tree.
201ifndef PATH_KBUILD
202 PATH_KBUILD := $(PATH_ROOT)/kBuild
203endif
204PATH_KBUILD := $(abspath $(PATH_KBUILD))
205# kBuild files which might be of interest.
206FILE_KBUILD_HEADER := $(PATH_KBUILD)/header.kmk
207#FILE_KBUILD_CONFIG := $(PATH_KBUILD)/config.kmk
208FILE_KBUILD_FOOTER := $(PATH_KBUILD)/footer.kmk
209
210SUFF_DEP := .dep
211## MAKEFILE is the name of the main makefile.
212MAKEFILE := $(firstword $(MAKEFILE_LIST))
213## MAKEFILE_CURRENT is the name of the current makefile.
214# This is updated everything a sub-makefile is included.
215MAKEFILE_CURRENT := $(MAKEFILE)
216
217
218#
219# Check make version.
220#
221ifdef KMK_VERSION
222 ifneq ($(KBUILD_VERSION_MAJOR).$(KBUILD_VERSION_MINOR),0.1)
223 ifneq ($(KBUILD_VERSION_MAJOR),0)
224 $(warning kBuild: kmk major version mismatch, expected '0' found '$(KBUILD_VERSION_MAJOR)'!)
225 else
226 $(warning kBuild: kmk minor version mismatch, expected '1' found '$(KBUILD_VERSION_MINOR)'!)
227 endif
228 endif
229else
230 include $(PATH_KBUILD)/gnumake-header.kmk
231endif
232
233
234#
235# The revision in which this file was last modified.
236# This can be useful when using development versions of kBuild.
237#
238KMK_REVISION := $(patsubst %:,, $Rev: 762 $ )
239
240
241#
242# Build platform setup.
243#
244# OS/2
245ifeq ($(BUILD_PLATFORM),os2)
246EXEC_X86_WIN32 := innopec.exe
247HOSTSUFF_EXE := .exe
248endif
249
250# Linux
251ifeq ($(BUILD_PLATFORM),linux)
252EXEC_X86_WIN32 := wine
253HOSTSUFF_EXE :=
254endif
255
256# Win, Win32, Win64, NT.
257ifeq ($(filter-out win32 win64 win nt,$(BUILD_PLATFORM)),)
258EXEC_X86_WIN32 :=
259HOSTSUFF_EXE := .exe
260endif
261
262# FreeBSD
263ifeq ($(BUILD_PLATFORM),freebsd)
264EXEC_X86_WIN32 := wine
265HOSTSUFF_EXE :=
266endif
267
268# Darwin / Mac OS X
269ifeq ($(BUILD_PLATFORM),darwin)
270EXEC_X86_WIN32 := false
271HOSTSUFF_EXE :=
272endif
273
274ifndef PATH_KBUILD_BIN
275 PATH_KBUILD_BIN := $(PATH_KBUILD)/bin/$(BUILD_PLATFORM).$(BUILD_PLATFORM_ARCH)
276 ifeq ($(wildcard $(PATH_KBUILD_BIN)/kmk_ash$(HOSTSUFF_EXE)),)
277 ifeq ($(BUILD_TARGET_ARCH),amd64)
278 PATH_KBUILD_BIN := $(PATH_KBUILD)/bin/$(BUILD_PLATFORM).x86
279 endif
280 ifeq ($(wildcard $(PATH_KBUILD_BIN)/kmk_ash$(HOSTSUFF_EXE)),)
281 ifeq ($(filter-out win64 win32 win nt ,$(BUILD_PLATFORM)),)
282 PATH_KBUILD_BIN := $(PATH_KBUILD)/bin/win.x86
283 endif
284 endif
285 ifeq ($(wildcard $(PATH_KBUILD_BIN)/kmk_ash$(HOSTSUFF_EXE)),)
286 # give up
287 PATH_KBUILD_BIN := $(PATH_KBUILD)/bin/$(BUILD_PLATFORM).$(BUILD_PLATFORM_ARCH)
288 endif
289 endif
290endif
291
292
293#
294# Build target setup.
295#
296ifeq ($(filter-out win32 win64 win nt os2,$(BUILD_TARGET)),)
297SUFF_OBJ := .obj
298SUFF_LIB := .lib
299SUFF_DLL := .dll
300SUFF_EXE := .exe
301SUFF_SYS := .sys
302SUFF_RES := .res
303endif
304ifeq ($(BUILD_TARGET),l4)
305SUFF_OBJ := .o
306SUFF_LIB := .a
307SUFF_DLL := .s.so
308SUFF_EXE :=
309SUFF_SYS := .a
310SUFF_RES :=
311endif
312ifeq ($(BUILD_TARGET),darwin)
313SUFF_OBJ := .o
314SUFF_LIB := .a
315SUFF_DLL := .dylib
316SUFF_EXE :=
317SUFF_SYS :=
318SUFF_RES :=
319endif
320ifndef SUFF_OBJ
321SUFF_OBJ := .o
322SUFF_LIB := .a
323SUFF_DLL := .so
324SUFF_EXE :=
325SUFF_SYS := .a
326SUFF_RES :=
327endif
328
329#
330# Standard kBuild tools.
331#
332ifeq ($(MAKE),kmk)
333MAKE := $(PATH_KBUILD_BIN)/kmk$(HOSTSUFF_EXE)
334endif
335
336DEP_EXT := $(PATH_KBUILD_BIN)/kDep$(HOSTSUFF_EXE)
337ifeq ($(filter kDep,$(KMK_BUILTIN)),kDep)
338DEP := kmk_builtin_kDep
339else
340DEP := $(DEP_EXT)
341endif
342
343DEP_IDB_EXT := $(PATH_KBUILD_BIN)/kDepIDB$(HOSTSUFF_EXE)
344ifeq ($(filter kDepPre,$(KMK_BUILTIN)),kDepIDB)
345DEP_IDB := $(if kmk_builtin_kDepIDB
346else
347DEP_IDB := $(DEP_IDB_EXT)
348endif
349
350DEP_PRE_EXT := $(PATH_KBUILD_BIN)/kDepPre$(HOSTSUFF_EXE)
351ifeq ($(filter kDepPre,$(KMK_BUILTIN)),kDepPre)
352DEP_PRE := $(if kmk_builtin_kDepPre
353else
354DEP_PRE := $(DEP_PRE_EXT)
355endif
356
357APPEND_EXT := $(PATH_KBUILD_BIN)/kmk_append$(HOSTSUFF_EXE)
358ifeq ($(filter append,$(KMK_BUILTIN)),append)
359APPEND := kmk_builtin_append
360else
361APPEND := $(APPEND_EXT)
362endif
363
364CAT_EXT := $(PATH_KBUILD_BIN)/kmk_cat$(HOSTSUFF_EXE)
365ifeq ($(filter cat,$(KMK_BUILTIN)),cat)
366CAT := kmk_builtin_cat
367else
368CAT := $(CAT_EXT)
369endif
370
371CP_EXT := $(PATH_KBUILD_BIN)/kmk_cp$(HOSTSUFF_EXE)
372ifeq ($(filter cp,$(KMK_BUILTIN)),cp)
373CP := kmk_builtin_cp
374else
375CP := $(CP_EXT)
376endif
377
378ECHO_EXT := $(PATH_KBUILD_BIN)/kmk_echo$(HOSTSUFF_EXE)
379ifeq ($(filter echo,$(KMK_BUILTIN)),echo)
380ECHO := kmk_builtin_echo
381else
382ECHO := $(ECHO_EXT)
383endif
384
385INSTALL_EXT := $(PATH_KBUILD_BIN)/kmk_install$(HOSTSUFF_EXE)
386ifeq ($(filter install,$(KMK_BUILTIN)),install)
387INSTALL := kmk_builtin_install
388else
389INSTALL := $(INSTALL_EXT)
390endif
391
392LN_EXT := $(PATH_KBUILD_BIN)/kmk_ln$(HOSTSUFF_EXE)
393ifeq ($(filter ln,$(KMK_BUILTIN)),ln)
394LN := kmk_builtin_ln
395else
396LN := $(LN_EXT)
397endif
398
399MKDIR_EXT := $(PATH_KBUILD_BIN)/kmk_mkdir$(HOSTSUFF_EXE)
400ifeq ($(filter mkdir,$(KMK_BUILTIN)),mkdir)
401MKDIR := kmk_builtin_mkdir
402else
403MKDIR := $(MKDIR_EXT)
404endif
405
406MV_EXT := $(PATH_KBUILD_BIN)/kmk_mv$(HOSTSUFF_EXE)
407ifeq ($(filter mv,$(KMK_BUILTIN)),mv)
408MV := kmk_builtin_mv
409else
410MV := $(MV_EXT)
411endif
412
413RM_EXT := $(PATH_KBUILD_BIN)/kmk_rm$(HOSTSUFF_EXE)
414ifeq ($(filter rm,$(KMK_BUILTIN)),rm)
415RM := kmk_builtin_rm
416else
417RM := $(RM_EXT)
418endif
419
420RMDIR_EXT := $(PATH_KBUILD_BIN)/kmk_rmdir$(HOSTSUFF_EXE)
421ifeq ($(filter rmdir,$(KMK_BUILTIN)),rmdir)
422RMDIR := kmk_builtin_rmdir
423else
424RMDIR := $(RMDIR_EXT)
425endif
426
427SED_EXT := $(PATH_KBUILD_BIN)/kmk_sed$(HOSTSUFF_EXE)
428ifeq ($(filter sed,$(KMK_BUILTIN)),sed)
429SED := kmk_builtin_sed
430else
431SED := $(SED_EXT)
432endif
433
434# Our default shell is the Almquist shell from *BSD.
435ASH := $(PATH_KBUILD_BIN)/kmk_ash$(HOSTSUFF_EXE)
436MAKESHELL := $(ASH)
437SHELL := $(ASH)
438export SHELL MAKESHELL
439
440# Symlinking is problematic on some platforms...
441LN_SYMLINK := $(LN) -s
442
443
444#
445# Some Functions.
446# The lower cased ones are either fallbacks or candidates for functions.c.
447#
448
449## ABSPATH - make paths absolute.
450# This implementation is clumsy and doesn't resolve '..' and '.' components.
451#
452# @param $1 The paths to make absolute.
453# @obsolete Use the GNU make function $(abspath) directly now.
454ABSPATH = $(abspath $(1))
455
456## DIRDEP - make create directory dependencies.
457#
458# @param $1 The paths to the directories which must be created.
459DIRDEP = $(foreach path,$(patsubst %/,%,$(1)),$(path)/)
460
461## Cygwin kludge.
462# This converts /cygdrive/x/% to x:%.
463#
464# @param $1 The paths to make native.
465# @remark This macro is pretty much obsolete since we don't use cygwin base make.
466ifneq ($(patsubst /cygdrive/%,%,$(CURDIR)),$(CURDIR))
467 CYGPATHMIXED = $(foreach path,$(1)\
468 ,$(if $(patsubst /cygdrive/%,,$(path)),$(path),$(patsubst $(strip $(firstword $(subst /, ,$(patsubst /cygdrive/%,%,$(path)))))/%,$(strip $(firstword $(subst /, ,$(patsubst /cygdrive/%,%,$(path))))):/%,$(patsubst /cygdrive/%,%,$(path)))))
469else
470 CYGPATHMIXED = $(1)
471endif
472
473ifneq ($(filter abspathex,$(KMK_FEATURES)),abspathex) ## @todo Retire this to gnumake-header.kmk when it has been implemented.
474## Converts an relative path to an absolute path using the given CWD.
475# @returns absolute path.
476# @param $1 The path to fixup.
477# @param $2 The CWD to use.
478abspathex = $(foreach _fix_path,$1\
479,$(if $(subst :$(call no-root-slash,$(call no-drive,$(_fix_path))):,,:$(_fix_path):),$(_fix_path),$(abspath $2/$(_fix_path))))
480endif
481
482## Removes the drive letter from a path (if it has one)
483# @param $1 the path
484no-drive = $(word $(words $(subst :, ,$(1))),$(subst :, ,$(1)))
485
486## Removes the root slash from a path (if it has one)
487# @param $1 the path
488no-root-slash = $(patsubst /%,%,$(1))
489
490## Figure out where to put object files.
491# @param $1 real target name.
492# @param $2 normalized main target
493TARGET_BASE = $(PATH_TARGET)/$(2)/$(call no-root-slash,$(call no-drive,$(1)))
494
495## Figure out where to put object files.
496# @param $1 normalized main target
497TARGET_PATH = $(PATH_TARGET)/$(1)
498
499
500#
501# Initialize some of the globals which the Config.kmk and
502# others can add stuff to if they like for processing in the footer.
503#
504
505## ALL_TARGET
506# This is the list of all targets.
507ALL_TARGETS :=
508
509## TEMPLATE_PATHS
510# List a paths (separated by space) where templates can be found.
511TEMPLATE_PATHS :=
512
513## TOOL_PATHS
514# List of paths (separated by space) where tools can be found.
515TOOL_PATHS :=
516
517## SDK_PATHS
518# List of paths (separated by space) where SDKs can be found.
519SDK_PATHS :=
520
521## Proritized list of the default makefile when walking subdirectories.
522# The user can overload this list.
523DEFAULT_MAKEFILE := Makefile.kmk makefile.kmk Makefile makefile
524
525## PROPS_TOOLS
526# This is a subset of the other PROPS
527PROPS_TOOLS := TOOL CTOOL CXXTOOL ASTOOL RCTOOL ARTOOL LDTOOL FETCHTOOL UNPACKTOOL PATCHTOOL
528
529## PROPS_SINGLE
530# The list of non-accumulative target properties.
531# A Config.kmk file can add it's own properties to this list and kBuild
532# will do the necessary inheritance from templates to targets.
533PROPS_SINGLE := $(PROPS_TOOLS) INST NOINST BLD_TYPE BLD_TRG BLD_TRG_ARCH BLD_TRG_CPU FETCHDIR \
534 OBJSUFF COBJSUFF CXXOBJSUFF ASOBJSUFF RCOBJSUFF SYSSUFF EXESUFF DLLSUFF LIBSUFF ARLIBSUFF
535
536## PROPS_DEFERRED
537# This list of non-accumulative target properties which are functions,
538# and thus should not be expanded until the very last moment.
539PROPS_DEFERRED := INSTFUN INSTALLER
540
541## PROPS_ACCUMULATE_R
542# The list of accumulative target properties where the right 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_R := \
547 DEFS DEPS \
548 CFLAGS CDEFS \
549 CXXFLAGS CXXDEFS \
550 ASFLAGS ASDEFS \
551 RCFLAGS RCDEFS \
552 LDFLAGS \
553 FETCHFLAGS UNPACKFLAGS PATCHFLAGS
554
555## PROPS_ACCUMULATE
556# The list of accumulative target properties where the left most value/flag
557# is the 'most significant'.
558# A Config.kmk file can add it's own properties to this list and kBuild
559# will do the necessary inheritance from templates to targets.
560PROPS_ACCUMULATE_L := \
561 SDKS SOURCES \
562 INCS CINCS CXXINCX ASINCS RCINCS \
563 LIBS LIBPATH
564
565## PROPS_ALL
566# List of all the properties.
567PROPS_ALL = $(PROPS_SINGLE) $(PROPS_DEFERRED) $(PROPS_ACCUMULATE_L) $(PROPS_ACCUMULATE_R)
568
569
570#
571# Here is a special 'hack' to prevent innocent environment variables being
572# picked up and treated as properties. (The most annoying example of why
573# this is necessary is the Visual C++ commandline with it's LIBPATH.)
574#
575# Define KBUILD_DONT_KILL_ENV_PROPS in the env. or on the commandline to
576# disable this 'hack'.
577#
578ifndef KBUILD_DONT_KILL_ENV_PROPS
579
580define def_nuke_environment_prop
581ifeq ($(origin $(prop)),environment)
582$(prop) =
583endif
584endef
585$(foreach prop, $(PROPS_ALL) \
586 FETCHES PATCHES BLDPROGS LIBRARIES IMPORT_LIBS DLLS PROGRAMS SYSMODS INSTALLS OTHERS \
587 SUBDIRS MAKEFILES \
588 ,$(eval $(value def_nuke_environment_prop)))
589
590endif
591
592
593#
594# Pass configuration.
595#
596# The PASS_<passname>_trgs variable is listing the targets.
597# The PASS_<passname>_vars variable is listing the target variables.
598# The PASS_<passname>_pass variable is the lowercased passname.
599#
600
601## PASS: fetches
602# This pass fetches and unpacks things needed to complete the build.
603PASS_FETCHES := Fetches
604PASS_FETCHES_trgs :=
605PASS_FETCHES_vars := _FETCHES
606PASS_FETCHES_pass := fetches
607
608## PASS: patches
609# This pass applies patches.
610PASS_PATCHES := Patches
611PASS_PATCHES_trgs :=
612PASS_PATCHES_vars := _PATCHES
613PASS_PATCHES_pass := patches
614
615## PASS: bldprogs
616# This pass builds targets which are required for building the rest.
617PASS_BLDPROGS := Build Programs
618PASS_BLDPROGS_trgs :=
619PASS_BLDPROGS_vars := _BLDPROGS
620PASS_BLDPROGS_pass := bldprogs
621
622## PASS: libraries
623# This pass builds library targets.
624PASS_LIBRARIES := Libraries
625PASS_LIBRARIES_trgs :=
626PASS_LIBRARIES_vars := _LIBS _IMPORT_LIBS _OTHER_LIBRARIES
627PASS_LIBRARIES_pass := libraries
628
629## PASS: binaries
630# This pass builds dll targets.
631PASS_DLLS := DLLs
632PASS_DLLS_trgs :=
633PASS_DLLS_vars := _DLLS _OTHER_DLLS
634PASS_DLLS_pass := dlls
635
636## PASS: binaries
637# This pass builds binary targets, i.e. programs, system modules and stuff.
638PASS_BINARIES := Programs
639PASS_BINARIES_trgs :=
640PASS_BINARIES_vars := _PROGRAMS _SYSMODS _OTHER_BINARIES
641PASS_BINARIES_pass := binaries
642
643## PASS: others
644# This pass builds other targets.
645PASS_OTHERS := Other Stuff
646PASS_OTHERS_trgs :=
647PASS_OTHERS_vars := _OTHERS
648PASS_OTHERS_pass := others
649
650## PASS: install
651# This pass installs the built entities to a sandbox area.
652PASS_INSTALLS := Install
653PASS_INSTALLS_trgs :=
654PASS_INSTALLS_vars := _INSTALLS_DIRS _INSTALLS
655PASS_INSTALLS_pass := installs
656
657## PASS: packing
658# This pass processes custom packing rules.
659PASS_PACKING := Packing
660PASS_PACKING_trgs :=
661PASS_PACKING_vars := _PACKING
662PASS_PACKING_pass := packing
663#alias
664packing: pass_packing
665
666## PASS: clean
667# This pass removes all generated files.
668PASS_CLEAN := Clean
669PASS_CLEAN_trgs := do-clean
670PASS_CLEAN_vars :=
671PASS_CLEAN_pass := clean
672# alias
673clean: pass_clean
674
675## PASS: nothing
676# This pass just walks the tree.
677PASS_NOTHING := Nothing
678PASS_NOTHING_trgs := do-nothing
679PASS_NOTHING_vars :=
680PASS_NOTHING_pass := nothing
681# alias
682nothing: pass_nothing
683
684## DEFAULT_PASSES
685# The default passes and their order.
686DEFAULT_PASSES := BLDPROGS LIBRARIES DLLS BINARIES OTHERS INSTALLS
687
688## PASSES
689# The passes that should be defined. This must include
690# all passes mentioned by DEFAULT_PASSES.
691PASSES := FETCHES PATCHES $(DEFAULT_PASSES) NOTHING CLEAN
692
693
694#
695# This is how we find the closest config.kmk.
696# It's a little hacky but I think it works fine.
697#
698_CFGDIR := .
699_CFGFILES := ./Config.kmk ./config.kmk
700define def_include_config
701$(eval _CFGDIR := $(_CFGDIR)/$(dir))
702_CFGFILES += $(_CFGDIR)/Config.kmk $(_CFGDIR)/config.kmk
703endef
704# walk down the _RELATIVE_ path specified by DEPTH.
705$(foreach dir,$(subst /, ,$(DEPTH)), $(eval $(def_include_config)) )
706# add the default config file.
707_CFGFILE := $(firstword $(wildcard $(_CFGFILES) $(FILE_KBUILD_CONFIG)))
708_CFGFILES :=
709_CFGDIR :=
710ifeq ($(_CFGFILE),)
711$(error kBuild: no Config.kmk file found! Check the DEPTH: DEPTH='$(DEPTH)' PATH_CURRENT='$(PATH_CURRENT)')
712endif
713
714# Include the config.kmk we found file (or the default one).
715include $(_CFGFILE)
716
717
718#
719# Message macros.
720#
721# This is done after including Config.kmk as to allow for
722# KBUILD_QUIET and KBUILD_VERBOSE to be configurable.
723#
724ifdef KBUILD_QUIET
725 # minimal output.
726 QUIET := @
727 QUIET2:= @
728 MSG_L1 =
729 MSG_L2 =
730 MSG_L3 =
731else
732 ifndef KBUILD_VERBOSE
733 ifneq ($(filter --pretty-command-printing,$(MAKEFLAGS)),)
734 export KBUILD_VERBOSE := 1
735 endif
736 endif
737 ifndef KBUILD_VERBOSE
738 QUIET := @
739 QUIET2:= @
740 MSG_L1 = @$(ECHO) "kBuild: $1"
741 MSG_L2 =
742 MSG_L3 =
743 else
744 # maximal output.
745 QUIET :=
746 MSG_L1 = @$(ECHO) "kBuild: $1 $2"
747 MSG_L2 = @$(ECHO) "kBuild: $1"
748 ifneq ($(KBUILD_VERBOSE),all)
749 QUIET2:= @
750 else
751 QUIET2:=
752 endif
753 endif
754endif
755
756# end-of-file-content
757__header_kmk__ := 1
758endif # __header_kmk__
759
760
Note: See TracBrowser for help on using the repository browser.