Index: trunk/kBuild/footer.kmk
===================================================================
--- trunk/kBuild/footer.kmk	(revision 726)
+++ trunk/kBuild/footer.kmk	(revision 729)
@@ -123,37 +123,4 @@
 # Basic macros
 #
-
-## Figure out the tool for a source
-# @param    target       source file
-# @param    source       normalized main target
-# @param    type         tooltype
-# @param    bld_trg      build target.
-# @param    bld_trg_arch build target architecture.
-# @remark 	Obsoleted by kBuild helpers in kmk. Only required for gmake compatbility.
-_SOURCE_TOOL = $(strip $(firstword \
-	$($(target)_$(source)_$(type)TOOL.$(bld_trg).$(bld_trg_arch)) \
-	$($(target)_$(source)_$(type)TOOL.$(bld_trg)) \
-	$($(target)_$(source)_$(type)TOOL) \
-	$($(target)_$(source)_TOOL.$(bld_trg).$(bld_trg_arch)) \
-	$($(target)_$(source)_TOOL.$(bld_trg)) \
-	$($(target)_$(source)_TOOL) \
-	$($(source)_$(type)TOOL.$(bld_trg).$(bld_trg_arch)) \
-	$($(source)_$(type)TOOL.$(bld_trg)) \
-	$($(source)_$(type)TOOL) \
-	$($(source)_TOOL.$(bld_trg).$(bld_trg_arch)) \
-	$($(source)_TOOL.$(bld_trg)) \
-	$($(source)_TOOL) \
-	$($(target)_$(type)TOOL.$(bld_trg).$(bld_trg_arch)) \
-	$($(target)_$(type)TOOL.$(bld_trg)) \
-	$($(target)_$(type)TOOL) \
-	$($(target)_TOOL.$(bld_trg).$(bld_trg_arch)) \
-	$($(target)_TOOL.$(bld_trg)) \
-	$($(target)_TOOL) \
-	$($(type)TOOL.$(bld_trg).$(bld_trg_arch)) \
-	$($(type)TOOL.$(bld_trg)) \
-	$($(type)TOOL) \
-	$(TOOL.$(bld_trg).$(bld_trg_arch)) \
-	$(TOOL.$(bld_trg)) \
-	$(TOOL) ))
 
 ## Figure out the tool for a target.
@@ -193,14 +160,4 @@
 ,$(if $(subst :$(call no-root-slash,$(call no-drive,$(_fix_path))):,,:$(_fix_path):),$(_fix_path),$(abspath $2/$(_fix_path))))
 endif
-
-## Figure out where to put object files.
-# @param    $1      source file
-# @param    $2      normalized main target
-# @remark There are two major hacks here:
-#           1. Source files in the output directory are translated into a gen/ subdir.
-#         	2. Catch anyone specifying $(PATH_SUB_CURRENT)/sourcefile.c.
-# @remark 	obsoleted by kBuild helpers in kmk. Only required for gmake compatbility.
-_OBJECT_BASE = $(PATH_TARGET)/$(2)/$(call no-root-slash,$(call no-drive,$(basename \
-	$(patsubst $(PATH_ROOT)/%,%,$(patsubst $(PATH_SUB_CURRENT)/%,%,$(patsubst $(PATH_TARGET)/$(2)/%,gen/%,$(1)))))))
 
 ## Figure out where to put object files.
@@ -930,5 +887,5 @@
 $(out): $(comp-vars _TARGET_$(target)_DIGEST_PREV,_TARGET_$(target)_DIGEST,FORCE) | $(call DIRDEP,$(inst))
 	$$(QUIET)$$(RM) -f $$@
-	$$(call MSG_L1,$$(if $$(_TARGET_$(target)_DIGEST),$$(if $$(wildcard $(out).lst),Re-fetching,Fetching),Removing) $(target)...)
+	$$(call MSG_L1,$$(if $$(wildcard $(out).lst),$$(if $$(_TARGET_$(target)_DIGEST),Re-fetching,Removing),Fetching) $(target)...)
 	$$(QUIET)$$(if $$(wildcard $(out).lst      ),$$(MAKE) -f $(MAKEFILE) --no-print-directory $(out)_unfetched)
 	$$(QUIET)$$(if  $$(_TARGET_$(target)_DIGEST),$$(MAKE) -f $(MAKEFILE) --no-print-directory $(out).lst,$$(RMDIR) -p --ignore-fail-on-non-empty --ignore-fail-on-not-exist $$(dir $$@))
@@ -1127,5 +1084,5 @@
 # @param    bld_trg_arch  Build target arch.
 # @param    bld_trg_cpu   Build target cpu.
-def_target_source_c_cpp_asm_rc_new = $(kb-src-one x)
+def_target_source_c_cpp_asm_rc_new = $(kb-src-one )
 ifneq ($(filter kb-src-one,$(KMK_FEATURES)),)
  def_target_source_c_cpp_asm_rc_var = def_target_source_c_cpp_asm_rc_new
@@ -1139,27 +1096,4 @@
 # @param    much-more...
 define def_target_sources
-
-# Apply any default path on the sources first.
-ifneq ($(defpath),)
- ifdef $(target)_SOURCES
-  $(target)_SOURCES := $(call abspathex,$($(target)_SOURCES),$(defpath))
- endif
- ifdef $(target)_SOURCES.$(bld_trg)
-  $(target)_SOURCES.$(bld_trg) := $(call abspathex,$($(target)_SOURCES.$(bld_trg)),$(defpath))
- endif
- ifdef $(target)_SOURCES.$(bld_trg).$(bld_trg_arch)
-  $(target)_SOURCES.$(bld_trg).$(bld_trg_arch) := $(call abspathex,$($(target)_SOURCES.$(bld_trg).$(bld_trg_arch)),$(defpath))
- endif
- ifdef $(target)_SOURCES.$(bld_trg_arch)
-  $(target)_SOURCES.$(bld_trg_arch) := $(call abspathex,$($(target)_SOURCES.$(bld_trg_arch)),$(defpath))
- endif
- ifdef $(target)_SOURCES.$(bld_trg_cpu)
-  $(target)_SOURCES.$(bld_trg_cpu) := $(call abspathex,$($(target)_SOURCES.$(bld_trg_cpu)),$(defpath))
- endif
- ifdef $(target)_SOURCES.$(bld_type)
-  $(target)_SOURCES.$(bld_type) := $(call abspathex,$($(target)_SOURCES.$(bld_type)),$(defpath))
- endif
-endif
-
 #$ (warning def_target_sources)
 # C sources
@@ -1194,5 +1128,5 @@
 # @param	$(definst)  The default _INST value.
 # @param	$(typevar)  The name of the variable with all the root targets of its type.
-# @obsolete Only library uses this now.
+# @remark   Only library uses this now.
 define def_target_install_pluss
 ifndef $(target)_NOINST
Index: trunk/kBuild/gnumake-footer.kmk
===================================================================
--- trunk/kBuild/gnumake-footer.kmk	(revision 726)
+++ trunk/kBuild/gnumake-footer.kmk	(revision 729)
@@ -24,4 +24,47 @@
 #
 #
+
+## Figure out the tool for a source
+# @param    target       source file
+# @param    source       normalized main target
+# @param    type         tooltype
+# @param    bld_trg      build target.
+# @param    bld_trg_arch build target architecture.
+# @remark 	Obsoleted by kBuild helpers in kmk. Only required for gmake compatbility.
+_SOURCE_TOOL = $(strip $(firstword \
+	$($(target)_$(source)_$(type)TOOL.$(bld_trg).$(bld_trg_arch)) \
+	$($(target)_$(source)_$(type)TOOL.$(bld_trg)) \
+	$($(target)_$(source)_$(type)TOOL) \
+	$($(target)_$(source)_TOOL.$(bld_trg).$(bld_trg_arch)) \
+	$($(target)_$(source)_TOOL.$(bld_trg)) \
+	$($(target)_$(source)_TOOL) \
+	$($(source)_$(type)TOOL.$(bld_trg).$(bld_trg_arch)) \
+	$($(source)_$(type)TOOL.$(bld_trg)) \
+	$($(source)_$(type)TOOL) \
+	$($(source)_TOOL.$(bld_trg).$(bld_trg_arch)) \
+	$($(source)_TOOL.$(bld_trg)) \
+	$($(source)_TOOL) \
+	$($(target)_$(type)TOOL.$(bld_trg).$(bld_trg_arch)) \
+	$($(target)_$(type)TOOL.$(bld_trg)) \
+	$($(target)_$(type)TOOL) \
+	$($(target)_TOOL.$(bld_trg).$(bld_trg_arch)) \
+	$($(target)_TOOL.$(bld_trg)) \
+	$($(target)_TOOL) \
+	$($(type)TOOL.$(bld_trg).$(bld_trg_arch)) \
+	$($(type)TOOL.$(bld_trg)) \
+	$($(type)TOOL) \
+	$(TOOL.$(bld_trg).$(bld_trg_arch)) \
+	$(TOOL.$(bld_trg)) \
+	$(TOOL) ))
+
+## Figure out where to put object files.
+# @param    $1      source file
+# @param    $2      normalized main target
+# @remark There are two major hacks here:
+#           1. Source files in the output directory are translated into a gen/ subdir.
+#         	2. Catch anyone specifying $(PATH_SUB_CURRENT)/sourcefile.c.
+# @remark 	obsoleted by kBuild helpers in kmk. Only required for gmake compatbility.
+_OBJECT_BASE = $(PATH_TARGET)/$(2)/$(call no-root-slash,$(call no-drive,$(basename \
+	$(patsubst $(PATH_ROOT)/%,%,$(patsubst $(PATH_SUB_CURRENT)/%,%,$(patsubst $(PATH_TARGET)/$(2)/%,gen/%,$(1)))))))
 
 
Index: trunk/kBuild/subfooter.kmk
===================================================================
--- trunk/kBuild/subfooter.kmk	(revision 726)
+++ trunk/kBuild/subfooter.kmk	(revision 729)
@@ -57,5 +57,5 @@
 #
 MAKEFILE_CURRENT := $(call stack-pop,_SUB_MAKEFILE_STACK)
-PATH_SUB_CURRENT := $(abspath $(patsubst %/,%,$(dir $(MAKEFILE_CURRENT))))
+PATH_SUB_CURRENT := $(abspath $(dir $(MAKEFILE_CURRENT)))
 
 #
@@ -66,2 +66,3 @@
 endif
 
+
Index: trunk/kBuild/subheader.kmk
===================================================================
--- trunk/kBuild/subheader.kmk	(revision 726)
+++ trunk/kBuild/subheader.kmk	(revision 729)
@@ -25,10 +25,12 @@
 #
 
-ifndef _SUB_MAKEFILE_STACK
+ifndef _SUB_MAKEFILE_NOT_FIRST
+
  #
  # The first time we just take the makefile context set by header.kmk.
  #
+ _SUB_MAKEFILE_NOT_FIRST := 1
  include $(PATH_KBUILD)/header.kmk
-
+ 
 else
 
@@ -63,10 +65,13 @@
  # Switch context.
  #
+
+ # push the current old makefile onto the stack.
+ $(call stack-push,_SUB_MAKEFILE_STACK,$(MAKEFILE_CURRENT))
+
+ # the current makefile is the 2nd from the end of the MAKEFILE_LIST (we're the last one).
  __tmp := $(MAKEFILE_LIST)
  $(call stack-popv,__tmp)
  MAKEFILE_CURRENT := $(call stack-top,__tmp)
- PATH_SUB_CURRENT := $(abspath $(patsubst %/,%,$(dir $(MAKEFILE_CURRENT))))
+ PATH_SUB_CURRENT := $(abspath $(dir $(MAKEFILE_CURRENT)))
 endif
 
-$(call stack-push,_SUB_MAKEFILE_STACK,$(MAKEFILE_CURRENT))
-
