Index: trunk/kBuild/footer.kmk
===================================================================
--- trunk/kBuild/footer.kmk	(revision 104)
+++ trunk/kBuild/footer.kmk	(revision 105)
@@ -68,10 +68,10 @@
 # @param    $3      tooltype
 _SOURCE_TOOL = $(strip $(firstword \
-	$($1_$2_$(3)TOOL.$(BUILD_TARGET)) 	$($1_$2_TOOL.$(BUILD_TARGET)) \
-	$($1_$2_$(3)TOOL) $($1_$2_TOOL) \
-	$($1_$(3)TOOL.$(BUILD_TARGET)) $($1_TOOL.$(BUILD_TARGET)) \
-	$($1_$(3)TOOL) $($1_TOOL) \
-	$($2_$(3)TOOL.$(BUILD_TARGET)) $($2_TOOL.$(BUILD_TARGET)) \
-	$($2_$(3)TOOL) $($2_TOOL) \
+	$($(1)_$(2)_$(3)TOOL.$(BUILD_TARGET)) $($(1)_$(2)_TOOL.$(BUILD_TARGET)) \
+	$($(1)_$(2)_$(3)TOOL) $($1_$2_TOOL) \
+	$($(1)_$(3)TOOL.$(BUILD_TARGET)) $($(1)_TOOL.$(BUILD_TARGET)) \
+	$($(1)_$(3)TOOL) $($1_TOOL) \
+	$($(2)_$(3)TOOL.$(BUILD_TARGET)) $($(2)_TOOL.$(BUILD_TARGET)) \
+	$($(2)_$(3)TOOL) $($(2)_TOOL) \
 	$($(3)TOOL.$(BUILD_TARGET)) $(TOOL.$(BUILD_TARGET)) \
 	$($(3)TOOL) $(TOOL) ))
@@ -129,5 +129,5 @@
 ifndef $(target)_$(prop)
 ifdef $(prop)
-$(target)_$(prop) := $($(prop))
+$$(eval $(target)_$(prop) := $($(prop)))
 endif
 endif
@@ -142,15 +142,15 @@
 ifdef $(target)_TEMPLATE
 ifndef TEMPLATE_$($(target)_TEMPLATE)_TOOL
-$(foreach prop,TOOL, $(eval $(def_inherit_defaults_one)))
+$$(foreach prop,TOOL, $$(eval $$(def_inherit_defaults_one)))
 endif
 ifndef TEMPLATE_$($(target)_TEMPLATE)_SDKS
-$(foreach prop,SDKS, $(eval $(def_inherit_defaults_one)))
+$$(foreach prop,SDKS, $$(eval $$(def_inherit_defaults_one)))
 endif
 else
-$(foreach prop,TEMPLATE TOOL SDKS,$(eval $(def_inherit_defaults_one)))
+$$(foreach prop,TEMPLATE TOOL SDKS, $$(eval $$(def_inherit_defaults_one)))
 endif
 endef
 # Inherit default properties.
-$(foreach target, $(ALL_TARGETS), $(eval $(def_inherit_defaults)))
+$(foreach target, $(ALL_TARGETS),$(eval $(def_inherit_defaults)))
 
 
@@ -162,10 +162,12 @@
 ifdef TEMPLATE_$($(target)_TEMPLATE)_$(prop)
 ifndef $(target)_$(prop)
-$(eval $(target)_$(prop) := $(TEMPLATE_$($(target)_TEMPLATE)_$(prop)))
+#$$ (warning dbg1: $(target)_$(prop):='$(TEMPLATE_$($(target)_TEMPLATE)_$(prop))' TEMPLATE_$($(target)_TEMPLATE)_$(prop))
+$$(target)_$$(prop) := $$(TEMPLATE_$$($$(target)_TEMPLATE)_$$(prop))
 endif
 endif
 ifdef TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(BUILD_TARGET)
 ifndef $(target)_$(prop).$(BUILD_TARGET)
-$(eval $(target)_$(prop).$(BUILD_TARGET) := $(TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(BUILD_TARGET)))
+#$$ (warning dbg2: $(target)_$(prop).$(BUILD_TARGET)="TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(BUILD_TARGET)" TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(BUILD_TARGET))
+$$(target)_$$(prop).$$(BUILD_TARGET) := $$(TEMPLATE_$$($$(target)_TEMPLATE)_$$(prop).$$(BUILD_TARGET))
 endif
 endif
@@ -177,14 +179,19 @@
 define def_inherit_template_one_accumulate
 ifdef TEMPLATE_$($(target)_TEMPLATE)_$(prop)
-$(eval $(target)_$(prop) := $($(target)_$(prop)) $(TEMPLATE_$($(target)_TEMPLATE)_$(prop)))
+#$$ (warning dbg3: TEMPLATE_$($(target)_TEMPLATE)_$(prop) $(target)_$(prop)=$($(target)_$(prop)) $(TEMPLATE_$($(target)_TEMPLATE)_$(prop)))
+$$(eval $(target)_$(prop) := $($(target)_$(prop)) $(TEMPLATE_$($(target)_TEMPLATE)_$(prop)))
+#$$ (warning dbg3: $(target)_$(prop)=$($(target)_$(prop)))
 endif
 ifdef TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(BUILD_TARGET)
-$(eval $(target)_$(prop).$(BUILD_TARGET) := $($(target)_$(prop).$(BUILD_TARGET)) $(TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(BUILD_TARGET)))
+#$$ (warning dbg4: TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(BUILD_TARGET))
+$$(eval $(target)_$(prop).$(BUILD_TARGET) := $($(target)_$(prop).$(BUILD_TARGET)) $(TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(BUILD_TARGET)))
 endif
 ifdef TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(BUILD_TARGET_CPU)
-$(eval $(target)_$(prop).$(BUILD_TARGET_CPU) := $($(target)_$(prop).$(BUILD_TARGET)) $(TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(BUILD_TARGET_CPU)))
+#$$ (warning dbg5: TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(BUILD_TARGET_CPU))
+$$(eval $(target)_$(prop).$(BUILD_TARGET_CPU) := $($(target)_$(prop).$(BUILD_TARGET)) $(TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(BUILD_TARGET_CPU)))
 endif
 ifdef TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(BUILD_TARGET_ARCH)
-$(eval $(target)_$(prop).$(BUILD_TARGET_ARCH) := $($(target)_$(prop).$(BUILD_TARGET)) $(TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(BUILD_TARGET_ARCH)))
+#$$ (warning dbg6: TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(BUILD_TARGET_ARCH))
+$$(eval $(target)_$(prop).$(BUILD_TARGET_ARCH) := $($(target)_$(prop).$(BUILD_TARGET)) $(TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(BUILD_TARGET_ARCH)))
 endif
 endef
@@ -193,12 +200,11 @@
 # @param    $(target)    Target name.
 define def_inherit_template
-$(foreach prop, TOOL ARTOOL CTOOL CXXTOOL ASTOOL LDTOOL\
-	,$(eval $(def_inherit_template_one)))
-$(foreach prop,SDKS DEFS INCS COPTS CFLAGS CDEFS CINCS CXXOPTS CXXFLAGS CXXDEFS CXXINCS ASOPTS ASFLAGS ASDEFS ASINCS LDFLAGS LIBS LIBPATH \
-	,$(eval $(def_inherit_template_one_accumulate)))
+$$(foreach prop, TOOL ARTOOL CTOOL CXXTOOL ASTOOL LDTOOL\
+	,$$(eval $$(def_inherit_template_one)))
+$$(foreach prop,SDKS DEFS INCS COPTS CFLAGS CDEFS CINCS CXXOPTS CXXFLAGS CXXDEFS CXXINCS ASOPTS ASFLAGS ASDEFS ASINCS LDFLAGS LIBS LIBPATH \
+	,$$(eval $$(def_inherit_template_one_accumulate)))
 endef
 # Inherit template properties
-$(foreach target, $(ALL_TARGETS), $(eval $(def_inherit_template)))
-
+$(foreach target, $(ALL_TARGETS),$(eval $(def_inherit_template)))
 
 
@@ -283,6 +289,7 @@
 #
 # @remark   I've no clue why I've to $(eval ..) everything in this define. MAKE bug?
+# @remark	I now have a clue. Have to use $$ if not.
 define def_target_source_c_cpp_asm
-#$ (warning dbg: def_target_source_c_cpp_asm: source=$(source) target=$(target) type=$(type))
+#$ (warning dbg: def_target_source_c_cpp_asm: source='$(source)' target='$(target)' type='$(type)')
 
 $(eval tool:=$(call _SOURCE_TOOL,$(source),$(target),$(type)))
