[665] | 1 | # $Id: subheader.kmk 729 2006-12-17 02:12:07Z 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 |
|
---|
[729] | 27 | ifndef _SUB_MAKEFILE_NOT_FIRST
|
---|
| 28 |
|
---|
[725] | 29 | #
|
---|
| 30 | # The first time we just take the makefile context set by header.kmk.
|
---|
| 31 | #
|
---|
[729] | 32 | _SUB_MAKEFILE_NOT_FIRST := 1
|
---|
[725] | 33 | include $(PATH_KBUILD)/header.kmk
|
---|
[729] | 34 |
|
---|
[472] | 35 | else
|
---|
[725] | 36 |
|
---|
| 37 | #
|
---|
| 38 | # Set the default path and makefile for all new targets.
|
---|
| 39 | #
|
---|
| 40 | define def_subfooter
|
---|
| 41 | ifndef $(target)_PATH
|
---|
| 42 | $(target)_PATH := $(PATH_SUB_CURRENT)
|
---|
| 43 | endif
|
---|
| 44 | ifndef $(target)_MAKEFILE
|
---|
| 45 | $(target)_MAKEFILE := $(MAKEFILE_CURRENT)
|
---|
| 46 | endif
|
---|
| 47 | endef
|
---|
| 48 |
|
---|
| 49 | $(foreach target,\
|
---|
| 50 | $(ALL_TARGETS) \
|
---|
| 51 | $(FETCHES) $(FETCHES.$(BUILD_TARGET)) $(FETCHES.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)) \
|
---|
| 52 | $(PATCHES) $(PATCHES.$(BUILD_TARGET)) $(PATCHES.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)) \
|
---|
| 53 | $(BLDPROGS) $(BLDPROGS.$(BUILD_PLATFORM)) $(BLDPROGS.$(BUILD_PLATFORM).$(BUILD_PLATFORM_ARCH)) \
|
---|
| 54 | $(LIBRARIES) $(LIBRARIES.$(BUILD_TARGET)) $(LIBRARIES.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)) \
|
---|
| 55 | $(IMPORT_LIBS) $(IMPORT_LIBS.$(BUILD_TARGET)) $(IMPORT_LIBS.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)) \
|
---|
| 56 | $(DLLS) $(DLLS.$(BUILD_TARGET)) $(DLLS.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)) \
|
---|
| 57 | $(PROGRAMS) $(PROGRAMS.$(BUILD_TARGET)) $(PROGRAMS.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)) \
|
---|
| 58 | $(SYSMODS) $(SYSMODS.$(BUILD_TARGET)) $(SYSMODS.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)) \
|
---|
| 59 | $(INSTALLS) $(INSTALLS.$(BUILD_TARGET)) $(INSTALLS.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)) \
|
---|
| 60 | $(OTHERS) $(OTHERS.$(BUILD_TARGET)) $(OTHERS.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)) \
|
---|
| 61 | ,$(eval $(def_subfooter)))
|
---|
| 62 |
|
---|
| 63 |
|
---|
| 64 | #
|
---|
| 65 | # Switch context.
|
---|
| 66 | #
|
---|
[729] | 67 |
|
---|
| 68 | # push the current old makefile onto the stack.
|
---|
| 69 | $(call stack-push,_SUB_MAKEFILE_STACK,$(MAKEFILE_CURRENT))
|
---|
| 70 |
|
---|
| 71 | # the current makefile is the 2nd from the end of the MAKEFILE_LIST (we're the last one).
|
---|
[725] | 72 | __tmp := $(MAKEFILE_LIST)
|
---|
| 73 | $(call stack-popv,__tmp)
|
---|
| 74 | MAKEFILE_CURRENT := $(call stack-top,__tmp)
|
---|
[729] | 75 | PATH_SUB_CURRENT := $(abspath $(dir $(MAKEFILE_CURRENT)))
|
---|
[472] | 76 | endif
|
---|
| 77 |
|
---|