Index: trunk/kBuild/footer.kmk
===================================================================
--- trunk/kBuild/footer.kmk	(revision 1413)
+++ trunk/kBuild/footer.kmk	(revision 1414)
@@ -536,4 +536,5 @@
 # @param    trg                   Object to consider for inheriting.
 # @param    src_prefix            What to prefix the value found in EXTENDS with to get the object.
+# @param    load_function         Load function for stuff that needs
 # @param    properties            List of the properties with straight expansion.
 # @param    properties_now_l      List of the properties with immediate expansion, accumulating on the left side.
@@ -543,8 +544,23 @@
 # @param    properties_deferred_r List of the properties with deferred expansion (e.g. function), accumulating on the right side.
 define def_inherit
+
+# Load it.
+ifneq ($(load_function),)
+ loading := $(trg)
+ $(eval $(value $(load_function)))
+endif
+
 src := $(strip $($(trg)_EXTENDS))
 ifneq ($(src),)
  ifndef $(trg)_EXTENDS_STATUS_
   $(trg)_EXTENDS_STATUS_ := 0
+
+  # Load the source.
+  ifneq ($(load_function),)
+   loading := $(src)
+   $(eval $(value $(load_function)))
+  endif
+
+  # less typing.
   src := $(src_prefix)$(src)
 
@@ -769,4 +785,5 @@
 
 src_prefix :=
+load_function :=
 properties_deferred_l :=
 properties_deferred_r :=
@@ -848,4 +865,5 @@
 
 src_prefix := TEMPLATE_
+load_function :=
 properties :=
 properties_now_l :=
@@ -856,13 +874,7 @@
 $(foreach trg, $(addprefix TEMPLATE_,$(_TEMPLATES)),$(eval $(value def_inherit)))
 
-ifdef KBUILD_PROFILE_SELF
- _KBUILD_TS_NOW := $(nanots )
- $(info prof: $(int-sub $(_KBUILD_TS_NOW), $(_KBUILD_TS_HEADER_START)) - $(int-sub $(_KBUILD_TS_NOW), $(_KBUILD_TS_PREV)) - done template inheritance)
- _KBUILD_TS_PREV := $(_KBUILD_TS_NOW)
-endif
-
-
 # done inheriting.
 src_prefix :=
+load_function :=
 properties :=
 properties_now_l :=
@@ -871,4 +883,12 @@
 properties_deferred_l :=
 properties_deferred_r :=
+
+ifdef KBUILD_PROFILE_SELF
+ _KBUILD_TS_NOW := $(nanots )
+ $(info prof: $(int-sub $(_KBUILD_TS_NOW), $(_KBUILD_TS_HEADER_START)) - $(int-sub $(_KBUILD_TS_NOW), $(_KBUILD_TS_PREV)) - done template inheritance)
+ _KBUILD_TS_PREV := $(_KBUILD_TS_NOW)
+endif
+
+
 
 
@@ -1150,43 +1170,63 @@
 $(foreach target, $(_ALL_BUILD_PLATFORM_TARGETS), $(eval $(value def_tools_sdks_target)))
 
-
-# include TOOLS
-define def_tools_include
-ifndef TOOL_$(tool)
- TOOL_$(tool)_KMK_FILE := $(firstword $(foreach path, $(TOOL_PATHS) $(PATH_KBUILD)/tools, $(wildcard $(path)/$(tool).kmk)))
- ifeq ($(TOOL_$(tool)_KMK_FILE),)
-  $(error kBuild: Cannot find include file for the tool '$(tool)'! Searched: $(TOOL_PATHS) $(PATH_KBUILD)/tools)
+_TOOLS := $(sort $(_TOOLS))
+_SDKS := $(sort $(_SDKS))
+
+## Tool load function.
+# @param loading    The tool name
+define def_tools_load_function
+ifndef TOOL_$(loading)
+ TOOL_$(loading)_KMK_FILE := $(firstword $(foreach path, $(TOOL_PATHS) $(PATH_KBUILD)/tools, $(wildcard $(path)/$(loading).kmk)))
+ ifeq ($(TOOL_$(loading)_KMK_FILE),)
+  $(error kBuild: Cannot find include file for the tool '$(loading)'! Searched: $(TOOL_PATHS) $(PATH_KBUILD)/tools)
  endif
- include $(TOOL_$(tool)_KMK_FILE)
- ifndef TOOL_$(tool)
-  $(warning kBuild: TOOL_$(tool) was not by $(TOOL_$(tool)_KMK_FILE)!)
+ include $(TOOL_$(loading)_KMK_FILE)
+ ifndef TOOL_$(loading)
+  $(warning kBuild: TOOL_$(loading) was not defined by $(TOOL_$(loading)_KMK_FILE)!)
  endif
 endif
 endef # def_tools_include
 
-_TOOLS := $(sort $(_TOOLS))
-$(foreach tool, $(_TOOLS), $(eval $(value def_tools_include)))
-
-## @todo TOOL_X_EXTENDS
-
-
-# include SDKS
-define def_sdks_include_one
-ifndef SDK_$(sdk)
- SDK_$(sdk)_KMK_FILE := $(firstword $(foreach path, $(SDK_PATHS) $(PATH_KBUILD)/sdks, $(wildcard $(path)/$(sdk).kmk)))
- ifeq ($(SDK_$(sdk)_KMK_FILE),)
-  $(error kBuild: Cannot find include file for the SDK '$(sdk)'! Searched: $(SDK_PATHS) $(PATH_KBUILD)/sdks)
+## SDK load function.
+# @param loading    The tool name
+define def_sdk_load_function
+ifndef SDK_$(loading)
+ SDK_$(loading)_KMK_FILE := $(firstword $(foreach path, $(SDK_PATHS) $(PATH_KBUILD)/sdks, $(wildcard $(path)/$(loading).kmk)))
+ ifeq ($(SDK_$(loading)_KMK_FILE),)
+  $(error kBuild: Cannot find include file for the SDK '$(loading)'! Searched: $(SDK_PATHS) $(PATH_KBUILD)/sdks)
  endif
- include $(SDK_$(sdk)_KMK_FILE)
- ifndef SDK_$(sdk)
-  $(warning kBuild: SDK_$(sdk) was not defined by $(SDK_$(sdk)_KMK_FILE)!)
+ include $(SDK_$(loading)_KMK_FILE)
+ ifndef SDK_$(loading)
+  $(warning kBuild: SDK_$(loading) was not defined by $(SDK_$(loading)_KMK_FILE)!)
  endif
 endif
-endef # def_sdks_include_one
-
-_SDKS := $(sort $(_SDKS))
-$(foreach sdk, $(_SDKS), $(eval $(value def_sdks_include_one)))
-
-## @todo Execute SDKS and TOOL inhertiance.
+endef # def_sdk_load_function
+
+
+properties :=
+properties_now_l :=
+properties_now_r :=
+properties_deferred   := $(PROPS_SINGLE) $(PROPS_DEFERRED)
+properties_deferred_l := $(PROPS_ACCUMULATE_L)
+properties_deferred_r := $(PROPS_ACCUMULATE_R)
+
+src_prefix := TOOL_
+load_function := def_tools_load_function
+$(foreach trg, $(_TOOLS), $(eval $(value def_inherit)))
+
+src_prefix := SDK_
+load_function := def_sdk_load_function
+$(foreach trg, $(_SDKS) , $(eval $(value def_inherit)))
+
+# done inheriting.
+src_prefix :=
+load_function :=
+properties :=
+properties_now_l :=
+properties_now_r :=
+properties_deferred :=
+properties_deferred_l :=
+properties_deferred_r :=
+
 
 ifdef KBUILD_PROFILE_SELF
@@ -1196,5 +1236,5 @@
 endif
 
-## @todo SDK_X_EXTENDS
+
 
 #
