| 1 | # $Id: subfooter.kmk 1547 2008-04-22 02:02:09Z bird $ | 
|---|
| 2 | ## @file | 
|---|
| 3 | # kBuild - File included at bottom 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 | # | 
|---|
| 35 | # Sanity check. | 
|---|
| 36 | # | 
|---|
| 37 | ifdef __footer_kmk__ | 
|---|
| 38 | $(error kBuild: footer.kmk has already been included. Fix your sub-makefiles!) | 
|---|
| 39 | endif | 
|---|
| 40 |  | 
|---|
| 41 | # | 
|---|
| 42 | # Set the default path for all new targets. | 
|---|
| 43 | # | 
|---|
| 44 | define def_subheader | 
|---|
| 45 | ifndef $(target)_PATH | 
|---|
| 46 | $(target)_PATH := $(PATH_SUB_CURRENT) | 
|---|
| 47 | endif | 
|---|
| 48 | ifndef $(target)_MAKEFILE | 
|---|
| 49 | $(target)_MAKEFILE := $(MAKEFILE_CURRENT) | 
|---|
| 50 | endif | 
|---|
| 51 | ifndef PATH_$(target) | 
|---|
| 52 | PATH_$(target) := $(call TARGET_PATH,$(target)) | 
|---|
| 53 | endif | 
|---|
| 54 | endef | 
|---|
| 55 |  | 
|---|
| 56 | $(foreach target,\ | 
|---|
| 57 | $(ALL_TARGETS) \ | 
|---|
| 58 | $(FETCHES)     $(FETCHES.$(BUILD_TARGET))       $(FETCHES.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)) \ | 
|---|
| 59 | $(PATCHES)     $(PATCHES.$(BUILD_TARGET))       $(PATCHES.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)) \ | 
|---|
| 60 | $(BLDPROGS)    $(BLDPROGS.$(BUILD_PLATFORM))    $(BLDPROGS.$(BUILD_PLATFORM).$(BUILD_PLATFORM_ARCH)) \ | 
|---|
| 61 | $(LIBRARIES)   $(LIBRARIES.$(BUILD_TARGET))     $(LIBRARIES.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)) \ | 
|---|
| 62 | $(IMPORT_LIBS) $(IMPORT_LIBS.$(BUILD_TARGET))   $(IMPORT_LIBS.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)) \ | 
|---|
| 63 | $(DLLS)        $(DLLS.$(BUILD_TARGET))          $(DLLS.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)) \ | 
|---|
| 64 | $(PROGRAMS)    $(PROGRAMS.$(BUILD_TARGET))      $(PROGRAMS.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)) \ | 
|---|
| 65 | $(SYSMODS)     $(SYSMODS.$(BUILD_TARGET))       $(SYSMODS.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)) \ | 
|---|
| 66 | $(INSTALLS)    $(INSTALLS.$(BUILD_TARGET))      $(INSTALLS.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)) \ | 
|---|
| 67 | $(OTHERS)      $(OTHERS.$(BUILD_TARGET))        $(OTHERS.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)) \ | 
|---|
| 68 | ,$(eval $(def_subheader))) | 
|---|
| 69 |  | 
|---|
| 70 |  | 
|---|
| 71 |  | 
|---|
| 72 | ifneq ($(_SUB_MAKEFILE_STACK),) | 
|---|
| 73 | # | 
|---|
| 74 | # Switch back to the context of previous makefile on the stack. | 
|---|
| 75 | # | 
|---|
| 76 | MAKEFILE_CURRENT := $(stack-pop _SUB_MAKEFILE_STACK) | 
|---|
| 77 | PATH_SUB_CURRENT := $(abspath $(dir $(MAKEFILE_CURRENT))) | 
|---|
| 78 |  | 
|---|
| 79 | else | 
|---|
| 80 | # | 
|---|
| 81 | # We've reached the end of the line, include the real footer. | 
|---|
| 82 | # | 
|---|
| 83 | include $(PATH_KBUILD)/footer.kmk | 
|---|
| 84 |  | 
|---|
| 85 | endif | 
|---|
| 86 |  | 
|---|