source: trunk/kBuild/subheader.kmk@ 725

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

Partial implementation of a _PATH target property for resolving relative paths. It's primarily intended for sub-makefile mode where we apply it to all targets automatically. TODOs: INCS, DEPs (source level) and SUBDIRS*.

  • Property svn:keywords set to Id
File size: 2.6 KB
RevLine 
[665]1# $Id: subheader.kmk 725 2006-12-15 05:18:47Z bird $
[472]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
27ifndef _SUB_MAKEFILE_STACK
[725]28 #
29 # The first time we just take the makefile context set by header.kmk.
30 #
31 include $(PATH_KBUILD)/header.kmk
32
[472]33else
[725]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))))
[472]69endif
70
[725]71$(call stack-push,_SUB_MAKEFILE_STACK,$(MAKEFILE_CURRENT))
72
Note: See TracBrowser for help on using the repository browser.