1 | # $Id: subheader.kmk 725 2006-12-15 05:18:47Z bird $
|
---|
2 | ## @file
|
---|
3 | #
|
---|
4 | # kBuild - File included at top of a makefile or sub-makefile.
|
---|
5 | #
|
---|
6 | # Copyright (c) 2006 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 |
|
---|
27 | ifndef _SUB_MAKEFILE_STACK
|
---|
28 | #
|
---|
29 | # The first time we just take the makefile context set by header.kmk.
|
---|
30 | #
|
---|
31 | include $(PATH_KBUILD)/header.kmk
|
---|
32 |
|
---|
33 | else
|
---|
34 |
|
---|
35 | #
|
---|
36 | # Set the default path and makefile for all new targets.
|
---|
37 | #
|
---|
38 | define def_subfooter
|
---|
39 | ifndef $(target)_PATH
|
---|
40 | $(target)_PATH := $(PATH_SUB_CURRENT)
|
---|
41 | endif
|
---|
42 | ifndef $(target)_MAKEFILE
|
---|
43 | $(target)_MAKEFILE := $(MAKEFILE_CURRENT)
|
---|
44 | endif
|
---|
45 | endef
|
---|
46 |
|
---|
47 | $(foreach target,\
|
---|
48 | $(ALL_TARGETS) \
|
---|
49 | $(FETCHES) $(FETCHES.$(BUILD_TARGET)) $(FETCHES.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)) \
|
---|
50 | $(PATCHES) $(PATCHES.$(BUILD_TARGET)) $(PATCHES.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)) \
|
---|
51 | $(BLDPROGS) $(BLDPROGS.$(BUILD_PLATFORM)) $(BLDPROGS.$(BUILD_PLATFORM).$(BUILD_PLATFORM_ARCH)) \
|
---|
52 | $(LIBRARIES) $(LIBRARIES.$(BUILD_TARGET)) $(LIBRARIES.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)) \
|
---|
53 | $(IMPORT_LIBS) $(IMPORT_LIBS.$(BUILD_TARGET)) $(IMPORT_LIBS.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)) \
|
---|
54 | $(DLLS) $(DLLS.$(BUILD_TARGET)) $(DLLS.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)) \
|
---|
55 | $(PROGRAMS) $(PROGRAMS.$(BUILD_TARGET)) $(PROGRAMS.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)) \
|
---|
56 | $(SYSMODS) $(SYSMODS.$(BUILD_TARGET)) $(SYSMODS.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)) \
|
---|
57 | $(INSTALLS) $(INSTALLS.$(BUILD_TARGET)) $(INSTALLS.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)) \
|
---|
58 | $(OTHERS) $(OTHERS.$(BUILD_TARGET)) $(OTHERS.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)) \
|
---|
59 | ,$(eval $(def_subfooter)))
|
---|
60 |
|
---|
61 |
|
---|
62 | #
|
---|
63 | # Switch context.
|
---|
64 | #
|
---|
65 | __tmp := $(MAKEFILE_LIST)
|
---|
66 | $(call stack-popv,__tmp)
|
---|
67 | MAKEFILE_CURRENT := $(call stack-top,__tmp)
|
---|
68 | PATH_SUB_CURRENT := $(abspath $(patsubst %/,%,$(dir $(MAKEFILE_CURRENT))))
|
---|
69 | endif
|
---|
70 |
|
---|
71 | $(call stack-push,_SUB_MAKEFILE_STACK,$(MAKEFILE_CURRENT))
|
---|
72 |
|
---|