Index: /trunk/kBuild/header.kmk
===================================================================
--- /trunk/kBuild/header.kmk	(revision 2762)
+++ /trunk/kBuild/header.kmk	(revision 2763)
@@ -5,5 +5,5 @@
 
 #
-# Copyright (c) 2004-2014 knut st. osmundsen <bird-kBuild-spam-xiv@anduin.net>
+# Copyright (c) 2004-2015 knut st. osmundsen <bird-kBuild-spam-xiv@anduin.net>
 #
 # This file is part of kBuild.
@@ -1567,4 +1567,27 @@
 
 #
+# An internal define used by subheader.kmk and subfooter.kmk.
+# We keep them here to avoid redefining them for each sub-makefile.
+#
+define def_subfooter_header_target_pass
+ ifndef $(target)_PATH
+  ifndef $(target)_DEFPATH
+   $(target)_DEFPATH := $(PATH_SUB_CURRENT)
+  endif
+  $(call KB_FN_ASSIGN_DEPRECATED,$(target)_PATH,$($(target)_DEFPATH), $(target)_DEFPATH)
+ else ifndef $(target)_DEFPATH
+  $(target)_DEFPATH := $($(target)_PATH)
+ endif
+ ifndef $(target)_MAKEFILE
+  $(target)_MAKEFILE := $(MAKEFILE_CURRENT)
+ endif
+ ifndef $(target)_0_OUTDIR
+  $(target)_0_OUTDIR := $(call TARGET_PATH,$(target))
+  $(call KB_FN_ASSIGN_DEPRECATED,PATH_$(target),$($(target)_0_OUTDIR), $(target)_0_OUTDIR)
+ endif
+endef
+
+
+#
 # Validate any KBUILD_BLD_TYPES additions and finally the KBUILD_TYPE.
 #
Index: /trunk/kBuild/subfooter.kmk
===================================================================
--- /trunk/kBuild/subfooter.kmk	(revision 2762)
+++ /trunk/kBuild/subfooter.kmk	(revision 2763)
@@ -5,5 +5,5 @@
 
 #
-# Copyright (c) 2006-2014 knut st. osmundsen <bird-kBuild-spam-xiv@anduin.net>
+# Copyright (c) 2006-2015 knut st. osmundsen <bird-kBuild-spam-xiv@anduin.net>
 #
 # This file is part of kBuild.
@@ -42,23 +42,5 @@
 # Set the default path for all new targets.
 #
-define def_subheader
- ifndef $(target)_PATH
-  ifndef $(target)_DEFPATH
-   $(target)_DEFPATH := $(PATH_SUB_CURRENT)
-  endif
-  $(call KB_FN_ASSIGN_DEPRECATED,$(target)_PATH,$($(target)_DEFPATH),$(target)_DEFPATH)
- else ifndef $(target)_DEFPATH
-  $(target)_DEFPATH := $($(target)_PATH)
- endif
- ifndef $(target)_MAKEFILE
-  $(target)_MAKEFILE := $(MAKEFILE_CURRENT)
- endif
- ifndef $(target)_0_OUTDIR
-  $(target)_0_OUTDIR := $(call TARGET_PATH,$(target))
-  $(call KB_FN_ASSIGN_DEPRECATED,PATH_$(target),$($(target)_0_OUTDIR),$(target)_0_OUTDIR)
- endif
-endef
-
-# TODO: Wish there was an easy way of only enumerating only new targets...
+## @todo Wish there was an easy way of only enumerating only new targets...
 $(foreach target,\
 	$(ALL_TARGETS) \
@@ -74,6 +56,5 @@
 	$(INSTALLS)    $(INSTALLS.$(KBUILD_TARGET))     $(INSTALLS.$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH))    $(INSTALLS.$(KBUILD_TARGET_ARCH))    $(INSTALLS.$(KBUILD_TARGET_CPU))    $(INSTALLS.$(KBUILD_TYPE))    \
 	$(OTHERS)      $(OTHERS.$(KBUILD_TARGET))       $(OTHERS.$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH))      $(OTHERS.$(KBUILD_TARGET_ARCH))      $(OTHERS.$(KBUILD_TARGET_CPU))      $(OTHERS.$(KBUILD_TYPE))      \
-,$(if-expr defined($(target)_0_OUTDIR),,$(evalval def_subheader)))
-
+,$(if-expr defined($(target)_0_OUTDIR),,$(evalval def_subfooter_header_target_pass)))
 
 
Index: /trunk/kBuild/subheader.kmk
===================================================================
--- /trunk/kBuild/subheader.kmk	(revision 2762)
+++ /trunk/kBuild/subheader.kmk	(revision 2763)
@@ -5,5 +5,5 @@
 
 #
-# Copyright (c) 2006-2014 knut st. osmundsen <bird-kBuild-spam-xiv@anduin.net>
+# Copyright (c) 2006-2015 knut st. osmundsen <bird-kBuild-spam-xiv@anduin.net>
 #
 # This file is part of kBuild.
@@ -53,23 +53,5 @@
  # Set the default path and makefile for all new targets.
  #
- define def_subfooter
-  ifndef $(target)_PATH
-   ifndef $(target)_DEFPATH
-    $(target)_DEFPATH := $(PATH_SUB_CURRENT)
-   endif
-   $(call KB_FN_ASSIGN_DEPRECATED,$(target)_PATH,$($(target)_DEFPATH), $(target)_DEFPATH)
-  else ifndef $(target)_DEFPATH
-   $(target)_DEFPATH := $($(target)_PATH)
-  endif
-  ifndef $(target)_MAKEFILE
-   $(target)_MAKEFILE := $(MAKEFILE_CURRENT)
-  endif
-  ifndef $(target)_0_OUTDIR
-   $(target)_0_OUTDIR := $(call TARGET_PATH,$(target))
-   $(call KB_FN_ASSIGN_DEPRECATED,PATH_$(target),$($(target)_0_OUTDIR), $(target)_0_OUTDIR)
-  endif
- endef
-
- # TODO: Wish there was an easy way of only enumerating only new targets...
+ ## @todo Wish there was an easy way of only enumerating only new targets...
  $(foreach target,\
 	$(ALL_TARGETS) \
@@ -85,5 +67,5 @@
 	$(INSTALLS)    $(INSTALLS.$(KBUILD_TARGET))     $(INSTALLS.$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH))    $(INSTALLS.$(KBUILD_TARGET_ARCH))    $(INSTALLS.$(KBUILD_TARGET_CPU))    $(INSTALLS.$(KBUILD_TYPE))    \
 	$(OTHERS)      $(OTHERS.$(KBUILD_TARGET))       $(OTHERS.$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH))      $(OTHERS.$(KBUILD_TARGET_ARCH))      $(OTHERS.$(KBUILD_TARGET_CPU))      $(OTHERS.$(KBUILD_TYPE))      \
- ,$(if-expr defined($(target)_0_OUTDIR),,$(evalval def_subfooter)))
+ ,$(if-expr defined($(target)_0_OUTDIR),,$(evalval def_subfooter_header_target_pass)))
 
 
