source: trunk/kBuild/subheader.kmk@ 1621

Last change on this file since 1621 was 1547, checked in by bird, 17 years ago

License clearification.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 3.3 KB
Line 
1# $Id: subheader.kmk 1547 2008-04-22 02:02:09Z bird $
2## @file
3# kBuild - File included at top of a makefile or sub-makefile.
4#
5
6#
7# Copyright (c) 2006-2008 knut st. osmundsen <bird-kBuild-spam@anduin.net>
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# As a special exception you are granted permission to include this file, via
27# the kmk include directive, as you wish without this in itself causing the
28# resulting makefile, program or whatever to be covered by the GPL license.
29# This exception does not however invalidate any other reasons why the makefile,
30# program, whatever should not be covered the GPL.
31#
32
33#
34# Sanity check.
35#
36ifdef __footer_kmk__
37$(error kBuild: footer.kmk has already been included. Fix your sub-makefiles!)
38endif
39
40ifndef _SUB_MAKEFILE_NOT_FIRST
41
42 #
43 # The first time we just take the makefile context set by header.kmk.
44 #
45 _SUB_MAKEFILE_NOT_FIRST := 1
46 include $(PATH_KBUILD)/header.kmk
47
48else
49
50 #
51 # Set the default path and makefile for all new targets.
52 #
53 define def_subfooter
54 ifndef $(target)_PATH
55 $(target)_PATH := $(PATH_SUB_CURRENT)
56 endif
57 ifndef $(target)_MAKEFILE
58 $(target)_MAKEFILE := $(MAKEFILE_CURRENT)
59 endif
60 ifndef PATH_$(target)
61 PATH_$(target) := $(call TARGET_PATH,$(target))
62 endif
63 endef
64
65 $(foreach target,\
66 $(ALL_TARGETS) \
67 $(FETCHES) $(FETCHES.$(BUILD_TARGET)) $(FETCHES.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)) \
68 $(PATCHES) $(PATCHES.$(BUILD_TARGET)) $(PATCHES.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)) \
69 $(BLDPROGS) $(BLDPROGS.$(BUILD_PLATFORM)) $(BLDPROGS.$(BUILD_PLATFORM).$(BUILD_PLATFORM_ARCH)) \
70 $(LIBRARIES) $(LIBRARIES.$(BUILD_TARGET)) $(LIBRARIES.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)) \
71 $(IMPORT_LIBS) $(IMPORT_LIBS.$(BUILD_TARGET)) $(IMPORT_LIBS.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)) \
72 $(DLLS) $(DLLS.$(BUILD_TARGET)) $(DLLS.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)) \
73 $(PROGRAMS) $(PROGRAMS.$(BUILD_TARGET)) $(PROGRAMS.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)) \
74 $(SYSMODS) $(SYSMODS.$(BUILD_TARGET)) $(SYSMODS.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)) \
75 $(INSTALLS) $(INSTALLS.$(BUILD_TARGET)) $(INSTALLS.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)) \
76 $(OTHERS) $(OTHERS.$(BUILD_TARGET)) $(OTHERS.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)) \
77 ,$(eval $(def_subfooter)))
78
79
80 #
81 # Switch context.
82 #
83
84 # push the current old makefile onto the stack.
85 $(stack-push _SUB_MAKEFILE_STACK,$(MAKEFILE_CURRENT))
86
87 # the current makefile is the 2nd from the end of the MAKEFILE_LIST (we're the last one).
88 __tmp := $(MAKEFILE_LIST)
89 $(stack-popv __tmp)
90 MAKEFILE_CURRENT := $(stack-top __tmp)
91 PATH_SUB_CURRENT := $(abspath $(dir $(MAKEFILE_CURRENT)))
92endif
93
Note: See TracBrowser for help on using the repository browser.