| 1 | # $Id: subfooter.kmk 819 2007-02-01 02:28:30Z bird $
 | 
|---|
| 2 | ## @file
 | 
|---|
| 3 | #
 | 
|---|
| 4 | # kBuild - File included at bottom of a makefile or sub-makefile.
 | 
|---|
| 5 | #
 | 
|---|
| 6 | # Copyright (c) 2006-2007 knut st. osmundsen <bird-kBuild-spam@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 | #
 | 
|---|
| 28 | # Sanity check.
 | 
|---|
| 29 | #
 | 
|---|
| 30 | ifdef __footer_kmk__
 | 
|---|
| 31 |  $(error kBuild: footer.kmk has already been included. Fix your sub-makefiles!)
 | 
|---|
| 32 | endif
 | 
|---|
| 33 | 
 | 
|---|
| 34 | #
 | 
|---|
| 35 | # Set the default path for all new targets.
 | 
|---|
| 36 | #
 | 
|---|
| 37 | define def_subheader
 | 
|---|
| 38 |  ifndef $(target)_PATH
 | 
|---|
| 39 |   $(target)_PATH := $(PATH_SUB_CURRENT)
 | 
|---|
| 40 |  endif
 | 
|---|
| 41 |  ifndef $(target)_MAKEFILE
 | 
|---|
| 42 |   $(target)_MAKEFILE := $(MAKEFILE_CURRENT)
 | 
|---|
| 43 |  endif
 | 
|---|
| 44 |  ifndef PATH_$(target)
 | 
|---|
| 45 |   PATH_$(target) := $(call TARGET_PATH,$(target))
 | 
|---|
| 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_subheader)))
 | 
|---|
| 62 | 
 | 
|---|
| 63 | 
 | 
|---|
| 64 | 
 | 
|---|
| 65 | ifneq ($(_SUB_MAKEFILE_STACK),)
 | 
|---|
| 66 |  #
 | 
|---|
| 67 |  # Switch back to the context of previous makefile on the stack.
 | 
|---|
| 68 |  #
 | 
|---|
| 69 |  MAKEFILE_CURRENT := $(call stack-pop,_SUB_MAKEFILE_STACK)
 | 
|---|
| 70 |  PATH_SUB_CURRENT := $(abspath $(dir $(MAKEFILE_CURRENT)))
 | 
|---|
| 71 | 
 | 
|---|
| 72 | else
 | 
|---|
| 73 |  #
 | 
|---|
| 74 |  # We've reached the end of the line, include the real footer.
 | 
|---|
| 75 |  #
 | 
|---|
| 76 |  include $(PATH_KBUILD)/footer.kmk
 | 
|---|
| 77 | 
 | 
|---|
| 78 | endif
 | 
|---|
| 79 | 
 | 
|---|