# $Id: subfooter.kmk 819 2007-02-01 02:28:30Z bird $ ## @file # # kBuild - File included at bottom of a makefile or sub-makefile. # # Copyright (c) 2006-2007 knut st. osmundsen # # # This file is part of kBuild. # # kBuild is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # kBuild is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with kBuild; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # # # # Sanity check. # ifdef __footer_kmk__ $(error kBuild: footer.kmk has already been included. Fix your sub-makefiles!) endif # # Set the default path for all new targets. # define def_subheader ifndef $(target)_PATH $(target)_PATH := $(PATH_SUB_CURRENT) endif ifndef $(target)_MAKEFILE $(target)_MAKEFILE := $(MAKEFILE_CURRENT) endif ifndef PATH_$(target) PATH_$(target) := $(call TARGET_PATH,$(target)) endif endef $(foreach target,\ $(ALL_TARGETS) \ $(FETCHES) $(FETCHES.$(BUILD_TARGET)) $(FETCHES.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)) \ $(PATCHES) $(PATCHES.$(BUILD_TARGET)) $(PATCHES.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)) \ $(BLDPROGS) $(BLDPROGS.$(BUILD_PLATFORM)) $(BLDPROGS.$(BUILD_PLATFORM).$(BUILD_PLATFORM_ARCH)) \ $(LIBRARIES) $(LIBRARIES.$(BUILD_TARGET)) $(LIBRARIES.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)) \ $(IMPORT_LIBS) $(IMPORT_LIBS.$(BUILD_TARGET)) $(IMPORT_LIBS.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)) \ $(DLLS) $(DLLS.$(BUILD_TARGET)) $(DLLS.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)) \ $(PROGRAMS) $(PROGRAMS.$(BUILD_TARGET)) $(PROGRAMS.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)) \ $(SYSMODS) $(SYSMODS.$(BUILD_TARGET)) $(SYSMODS.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)) \ $(INSTALLS) $(INSTALLS.$(BUILD_TARGET)) $(INSTALLS.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)) \ $(OTHERS) $(OTHERS.$(BUILD_TARGET)) $(OTHERS.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)) \ ,$(eval $(def_subheader))) ifneq ($(_SUB_MAKEFILE_STACK),) # # Switch back to the context of previous makefile on the stack. # MAKEFILE_CURRENT := $(call stack-pop,_SUB_MAKEFILE_STACK) PATH_SUB_CURRENT := $(abspath $(dir $(MAKEFILE_CURRENT))) else # # We've reached the end of the line, include the real footer. # include $(PATH_KBUILD)/footer.kmk endif