Index: trunk/kBuild/footer.kmk
===================================================================
--- trunk/kBuild/footer.kmk	(revision 551)
+++ trunk/kBuild/footer.kmk	(revision 552)
@@ -117,4 +117,5 @@
 # @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)) \
@@ -177,4 +178,5 @@
 #           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)))))))
@@ -234,21 +236,42 @@
 define def_template_extends_prop
 ifndef TEMPLATE_$(template)_$(prop)
-ifdef TEMPLATE_$(parent)_$(prop)
+ ifdef TEMPLATE_$(parent)_$(prop)
 TEMPLATE_$(template)_$(prop) = $$(TEMPLATE_$(parent)_$(prop))
-endif
-endif
-endef
+ endif
+endif
+endef
+
 
 define def_template_extends
 ifdef TEMPLATE_$(template)_EXTENDS
-parent := $(strip $(TEMPLATE_$(template)_EXTENDS))
-
-$(foreach prop, $(PROPS_SINGLE) $(PROPS_ACCUMULATE) $(PROPS_DEFERRED)\
-$(addsuffix .$(BUILD_TARGET),                      $(PROPS_SINGLE) $(PROPS_ACCUMULATE) $(PROPS_DEFERRED))\
-$(addsuffix .$(BUILD_TARGET).$(BUILD_TARGET_ARCH), $(PROPS_SINGLE) $(PROPS_ACCUMULATE) $(PROPS_DEFERRED))\
-$(addsuffix .$(BUILD_TARGET_ARCH),                 $(PROPS_SINGLE) $(PROPS_ACCUMULATE) $(PROPS_DEFERRED))\
-$(addsuffix .$(BUILD_TARGET_CPU),                  $(PROPS_SINGLE) $(PROPS_ACCUMULATE) $(PROPS_DEFERRED))\
-$(addsuffix .$(BUILD_TYPE),                        $(PROPS_SINGLE) $(PROPS_ACCUMULATE) $(PROPS_DEFERRED))\
-,$(eval $(def_template_extends_prop))) # exploits the 2 evaluation, so no value!
+ ifndef TEMPLATE_$(template)_EXTENDS_STATUS_
+  TEMPLATE_$(template)_EXTENDS_STATUS_ := 0
+  parent := $(strip $(TEMPLATE_$(template)_EXTENDS))
+
+  # recursivly process the parent if it's inherting from somebody too.
+  ifdef TEMPLATE_$(parent)_EXTENDS
+   ifneq ($(TEMPLATE_$(template)_EXTENDS_STATUS_),42)
+    # foreach will create 'template' in a new variable context hiding our current variable.
+    $(foreach template, $(TEMPLATE_$(parent)_EXTENDS), $(eval $(value def_template_extends)))
+    parent := $(strip $(TEMPLATE_$(template)_EXTENDS))
+   endif
+  endif
+
+  # inherit properties.
+  $(foreach prop, $(PROPS_SINGLE) $(PROPS_ACCUMULATE) $(PROPS_DEFERRED)\
+  $(addsuffix .$(BUILD_TARGET),                      $(PROPS_SINGLE) $(PROPS_ACCUMULATE) $(PROPS_DEFERRED))\
+  $(addsuffix .$(BUILD_TARGET).$(BUILD_TARGET_ARCH), $(PROPS_SINGLE) $(PROPS_ACCUMULATE) $(PROPS_DEFERRED))\
+  $(addsuffix .$(BUILD_TARGET_ARCH),                 $(PROPS_SINGLE) $(PROPS_ACCUMULATE) $(PROPS_DEFERRED))\
+  $(addsuffix .$(BUILD_TARGET_CPU),                  $(PROPS_SINGLE) $(PROPS_ACCUMULATE) $(PROPS_DEFERRED))\
+  $(addsuffix .$(BUILD_TYPE),                        $(PROPS_SINGLE) $(PROPS_ACCUMULATE) $(PROPS_DEFERRED))\
+  ,$(eval $(def_template_extends_prop))) # exploits the 2 evaluation, so no value!
+
+  TEMPLATE_$(template)_EXTENDS_STATUS_ := 42
+ else
+  # protect against inheritance loops.
+  ifneq ($(TEMPLATE_$(template)_EXTENDS_STATUS_),42)
+   $(error kBuild: inheritance loop! template=$(template))
+  endif
+ endif
 endif
 endef
@@ -495,5 +518,5 @@
 ## wrapper the compile command dependency check.
 ifndef NO_COMPILE_CMDS_DEPS
- ifdef NEW_KMK
+ ifneq ($(filter comp-vars,$(KMK_FEATURES)),)
 _DEP_COMPILE_CMDS = $(comp-vars $(target)_$(source)_CMDS_PREV_,$(target)_$(source)_CMDS_,FORCE)
  else
@@ -595,4 +618,5 @@
 # @param    bld_trg_arch  Build target arch.
 # @param    bld_trg_cpu   Build target cpu.
+# @remark 	obsoleted by kBuild helpers in kmk. Only required for gmake compatbility.
 #
 define def_target_source_c_cpp_asm_old
@@ -868,4 +892,5 @@
 	$($(target)_$(source)_$(type)FLAGS.$(bld_trg).$(bld_trg_arch))\
 	$($(target)_$(source)_$(type)FLAGS.$(bld_trg_cpu))
+# this isn't 100% in sync with kBuild, but it doesn't matter as it's only for gmake now.
 objsuff     := $(firstword \
 	$($(target)_$(source)_OBJSUFF.$(bld_trg).$(bld_trg_arch))\
@@ -966,5 +991,5 @@
 def_target_source_c_cpp_asm_new = $(kb-src-one x)
 
-ifdef NEW_KMK
+ifneq ($(filter kb-src-one,$(KMK_FEATURES)),)
 def_target_source_c_cpp_asm_var = def_target_source_c_cpp_asm_new
 else
Index: trunk/kBuild/header.kmk
===================================================================
--- trunk/kBuild/header.kmk	(revision 551)
+++ trunk/kBuild/header.kmk	(revision 552)
@@ -163,6 +163,4 @@
 # Common definitions.
 #
-ifeq ($(filter abspath,$(KMK_FEATURES)),abspath)
-
 PATH_CURRENT        := $(abspath $(CURDIR))
 ifneq ($(strip $(SUB_DEPTH)),)
@@ -172,20 +170,4 @@
 endif
 PATH_ROOT           := $(abspath $(PATH_CURRENT)/$(DEPTH))
-
-else
-
-PATH_CURRENT        := $(CURDIR)
-PATH_SUB_CURRENT    := $(PATH_CURRENT)
-ifneq ($(strip $(SUB_DEPTH)),)
-ifneq ($(SUB_DEPTH),.)
-$(foreach d,$(subst /, ,$(SUB_DEPTH)), $(eval PATH_SUB_CURRENT := $(patsubst %/,%,$(dir $(PATH_SUB_CURRENT)))) )
-endif
-endif
-PATH_ROOT           := $(PATH_CURRENT)
-ifneq ($(DEPTH),.)
-$(foreach d,$(subst /, ,$(DEPTH)), $(eval PATH_ROOT := $(patsubst %/,%,$(dir $(PATH_ROOT)))) )
-endif
-
-endif
 
 # Subdirectory relative to the root.
@@ -220,7 +202,5 @@
 PATH_KBUILD         := $(PATH_ROOT)/kBuild
 endif
-ifeq ($(filter abspath,$(KMK_FEATURES)),abspath)
 PATH_KBUILD         := $(abspath $(PATH_KBUILD))
-endif
 # kBuild files which might be of interest.
 FILE_KBUILD_HEADER  := $(PATH_KBUILD)/header.kmk
@@ -455,12 +435,5 @@
 #
 # @param	$1	The paths to make absolute.
-ifeq ($(filter abspath,$(KMK_FEATURES)),abspath)
 ABSPATH = $(abspath $(1))
-else
-ABSPATH = $(foreach path,$(1)\
-            ,$(strip $(if $(subst <,,$(firstword $(subst /, ,<$(path)))),\
-                      $(if $(patsubst %:,,$(firstword $(subst :,: ,$(path)))),$(PATH_CURRENT)/$(path),$(path)),\
-                      $(path))))
-endif
 
 ## DIRDEP - make create directory dependencies.
