Index: /trunk/kBuild/footer.kmk
===================================================================
--- /trunk/kBuild/footer.kmk	(revision 1503)
+++ /trunk/kBuild/footer.kmk	(revision 1504)
@@ -4,5 +4,5 @@
 # kBuild - File included at top of makefile.
 #
-# Copyright (c) 2004-2007 knut st. osmundsen <bird-kBuild-spam@anduin.net>
+# Copyright (c) 2004-2008 knut st. osmundsen <bird-kBuild-spam@anduin.net>
 #
 #
@@ -40,14 +40,14 @@
 
 # All targets of each types.
-_ALL_BLDPROGS    := $(BLDPROGS)    $(BLDPROGS.$(BUILD_PLATFORM))    $(BLDPROGS.$(BUILD_PLATFORM).$(BUILD_PLATFORM_ARCH))    $(BLDPROGS.$(BUILD_PLATFORM_ARCH))  $(BLDPROGS.$(BUILD_PLATFORM_CPU))   $(BLDPROGS.$(BUILD_TYPE))
-_ALL_LIBRARIES   := $(LIBRARIES)   $(LIBRARIES.$(BUILD_TARGET))     $(LIBRARIES.$(BUILD_TARGET).$(BUILD_TARGET_ARCH))       $(LIBRARIES.$(BUILD_TARGET_ARCH))   $(LIBRARIES.$(BUILD_TARGET_CPU))    $(LIBRARIES.$(BUILD_TYPE))
-_ALL_IMPORT_LIBS := $(IMPORT_LIBS) $(IMPORT_LIBS.$(BUILD_TARGET))   $(IMPORT_LIBS.$(BUILD_TARGET).$(BUILD_TARGET_ARCH))     $(IMPORT_LIBS.$(BUILD_TARGET_ARCH)) $(IMPORT_LIBS.$(BUILD_TARGET_CPU))  $(IMPORT_LIBS.$(BUILD_TYPE))
-_ALL_DLLS        := $(DLLS)        $(DLLS.$(BUILD_TARGET))          $(DLLS.$(BUILD_TARGET).$(BUILD_TARGET_ARCH))            $(DLLS.$(BUILD_TARGET_ARCH))        $(DLLS.$(BUILD_TARGET_CPU))         $(DLLS.$(BUILD_TYPE))
-_ALL_PROGRAMS    := $(PROGRAMS)    $(PROGRAMS.$(BUILD_TARGET))      $(PROGRAMS.$(BUILD_TARGET).$(BUILD_TARGET_ARCH))        $(PROGRAMS.$(BUILD_TARGET_ARCH))    $(PROGRAMS.$(BUILD_TARGET_CPU))     $(PROGRAMS.$(BUILD_TYPE))
-_ALL_SYSMODS     := $(SYSMODS)     $(SYSMODS.$(BUILD_TARGET))       $(SYSMODS.$(BUILD_TARGET).$(BUILD_TARGET_ARCH))         $(SYSMODS.$(BUILD_TARGET_ARCH))     $(SYSMODS.$(BUILD_TARGET_CPU))      $(SYSMODS.$(BUILD_TYPE))
-_ALL_OTHERS      := $(OTHERS)      $(OTHERS.$(BUILD_TARGET))        $(OTHERS.$(BUILD_TARGET).$(BUILD_TARGET_ARCH))          $(OTHERS.$(BUILD_TARGET_ARCH))      $(OTHERS.$(BUILD_TARGET_CPU))       $(OTHERS.$(BUILD_TYPE))
-_ALL_INSTALLS    := $(INSTALLS)    $(INSTALLS.$(BUILD_TARGET))      $(INSTALLS.$(BUILD_TARGET).$(BUILD_TARGET_ARCH))        $(INSTALLS.$(BUILD_TARGET_ARCH))    $(INSTALLS.$(BUILD_TARGET_CPU))     $(INSTALLS.$(BUILD_TYPE))
-_ALL_FETCHES     := $(FETCHES)     $(FETCHES.$(BUILD_TARGET))       $(FETCHES.$(BUILD_TARGET).$(BUILD_TARGET_ARCH))         $(FETCHES.$(BUILD_TARGET_ARCH))     $(FETCHES.$(BUILD_TARGET_CPU))      $(FETCHES.$(BUILD_TYPE))
-_ALL_PATCHES     := $(PATCHES)     $(PATCHES.$(BUILD_TARGET))       $(PATCHES.$(BUILD_TARGET).$(BUILD_TARGET_ARCH))         $(PATCHES.$(BUILD_TARGET_ARCH))     $(PATCHES.$(BUILD_TARGET_CPU))      $(PATCHES.$(BUILD_TYPE))
+_ALL_BLDPROGS    := $(BLDPROGS)    $(BLDPROGS.$(KBUILD_HOST))        $(BLDPROGS.$(KBUILD_HOST).$(KBUILD_HOST_ARCH))            $(BLDPROGS.$(KBUILD_HOST_ARCH))      $(BLDPROGS.$(KBUILD_HOST_CPU))       $(BLDPROGS.$(KBUILD_TYPE))
+_ALL_LIBRARIES   := $(LIBRARIES)   $(LIBRARIES.$(KBUILD_TARGET))     $(LIBRARIES.$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH))       $(LIBRARIES.$(KBUILD_TARGET_ARCH))   $(LIBRARIES.$(KBUILD_TARGET_CPU))    $(LIBRARIES.$(KBUILD_TYPE))
+_ALL_IMPORT_LIBS := $(IMPORT_LIBS) $(IMPORT_LIBS.$(KBUILD_TARGET))   $(IMPORT_LIBS.$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH))     $(IMPORT_LIBS.$(KBUILD_TARGET_ARCH)) $(IMPORT_LIBS.$(KBUILD_TARGET_CPU))  $(IMPORT_LIBS.$(KBUILD_TYPE))
+_ALL_DLLS        := $(DLLS)        $(DLLS.$(KBUILD_TARGET))          $(DLLS.$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH))            $(DLLS.$(KBUILD_TARGET_ARCH))        $(DLLS.$(KBUILD_TARGET_CPU))         $(DLLS.$(KBUILD_TYPE))
+_ALL_PROGRAMS    := $(PROGRAMS)    $(PROGRAMS.$(KBUILD_TARGET))      $(PROGRAMS.$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH))        $(PROGRAMS.$(KBUILD_TARGET_ARCH))    $(PROGRAMS.$(KBUILD_TARGET_CPU))     $(PROGRAMS.$(KBUILD_TYPE))
+_ALL_SYSMODS     := $(SYSMODS)     $(SYSMODS.$(KBUILD_TARGET))       $(SYSMODS.$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH))         $(SYSMODS.$(KBUILD_TARGET_ARCH))     $(SYSMODS.$(KBUILD_TARGET_CPU))      $(SYSMODS.$(KBUILD_TYPE))
+_ALL_OTHERS      := $(OTHERS)      $(OTHERS.$(KBUILD_TARGET))        $(OTHERS.$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH))          $(OTHERS.$(KBUILD_TARGET_ARCH))      $(OTHERS.$(KBUILD_TARGET_CPU))       $(OTHERS.$(KBUILD_TYPE))
+_ALL_INSTALLS    := $(INSTALLS)    $(INSTALLS.$(KBUILD_TARGET))      $(INSTALLS.$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH))        $(INSTALLS.$(KBUILD_TARGET_ARCH))    $(INSTALLS.$(KBUILD_TARGET_CPU))     $(INSTALLS.$(KBUILD_TYPE))
+_ALL_FETCHES     := $(FETCHES)     $(FETCHES.$(KBUILD_TARGET))       $(FETCHES.$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH))         $(FETCHES.$(KBUILD_TARGET_ARCH))     $(FETCHES.$(KBUILD_TARGET_CPU))      $(FETCHES.$(KBUILD_TYPE))
+_ALL_PATCHES     := $(PATCHES)     $(PATCHES.$(KBUILD_TARGET))       $(PATCHES.$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH))         $(PATCHES.$(KBUILD_TARGET_ARCH))     $(PATCHES.$(KBUILD_TARGET_CPU))      $(PATCHES.$(KBUILD_TYPE))
 
 # all targets.
@@ -64,6 +64,6 @@
 	$(_ALL_OTHERS)
 
-# all $(BUILD_TARGET) targets.
-_ALL_BUILD_TARGET_TARGETS = \
+# all $(KBUILD_TARGET) targets.
+_ALL_TARGET_TARGETS = \
 	$(_ALL_FETCHES) \
 	$(_ALL_PATCHES) \
@@ -76,6 +76,6 @@
 	$(_ALL_OTHERS)
 
-# all $(BUILD_PLATFORM) targets.
-_ALL_BUILD_PLATFORM_TARGETS = \
+# all $(KBUILD_HOST) targets.
+_ALL_HOST_TARGETS = \
 	$(_ALL_BLDPROGS)
 
@@ -628,7 +628,7 @@
 define def_templates_load_function
 ifndef TEMPLATE_$(loading)
- TEMPLATE_$(loading)_KMK_FILE := $(firstword $(foreach path, $(KBUILD_TEMPLATE_PATHS) $(PATH_KBUILD)/templates $(KBUILD_DEFAULT_PATHS), $(wildcard $(path)/$(loading).kmk)))
+ TEMPLATE_$(loading)_KMK_FILE := $(firstword $(foreach path, $(KBUILD_TEMPLATE_PATHS) $(KBUILD_PATH)/templates $(KBUILD_DEFAULT_PATHS), $(wildcard $(path)/$(loading).kmk)))
  ifeq ($(TEMPLATE_$(loading)_KMK_FILE),)
-  $(error kBuild: Cannot find include file for the template '$(loading)'! Searched: $(KBUILD_TEMPLATE_PATHS) $(PATH_KBUILD)/templates $(KBUILD_DEFAULT_PATHS))
+  $(error kBuild: Cannot find include file for the template '$(loading)'! Searched: $(KBUILD_TEMPLATE_PATHS) $(KBUILD_PATH)/templates $(KBUILD_DEFAULT_PATHS))
  endif
  include $(TEMPLATE_$(loading)_KMK_FILE)
@@ -649,8 +649,8 @@
 # might not be 100% accurate... :-/
 #
-_BLD_TYPES   := $(BUILD_TYPE)
-_BLD_TARGETS := $(BUILD_TARGET) $(BUILD_PLATFORMS)
-_BLD_ARCHES  := $(BUILD_TARGET_ARCH) $(BUILD_PLATFORM_ARCH)
-_BLD_CPUS    := $(BUILD_TARGET_CPU) $(BUILD_PLATFORM_CPU)
+_BLD_TYPES   := $(KBUILD_TYPE)
+_BLD_TARGETS := $(KBUILD_TARGET) $(KBUILD_HOSTS)
+_BLD_ARCHES  := $(KBUILD_TARGET_ARCH) $(KBUILD_HOST_ARCH)
+_BLD_CPUS    := $(KBUILD_TARGET_CPU) $(KBUILD_HOST_CPU)
 
 define def_collect_bld_xyz
@@ -819,5 +819,5 @@
 properties_now_r    := $(PROPS_LIBRARIES_ACCUMULATE_R)
 properties_deferred := $(PROPS_LIBRARIES_DEFERRED)
-if1of ($(BUILD_TARGET), nt os2 win)
+if1of ($(KBUILD_TARGET), nt os2 win)
  $(foreach trg, $(_ALL_LIBRARIES) $(_ALL_IMPORT_LIBS),$(evalval def_inherit))
 else
@@ -830,5 +830,5 @@
 properties_now_r    := $(PROPS_DLLS_ACCUMULATE_R)
 properties_deferred := $(PROPS_DLLS_DEFERRED)
-if1of ($(BUILD_TARGET), nt os2 win)
+if1of ($(KBUILD_TARGET), nt os2 win)
  $(foreach trg, $(_ALL_DLLS),$(evalval def_inherit))
 else
@@ -979,6 +979,6 @@
 $(target)_$(prop) += $$(TEMPLATE_$($(target)_TEMPLATE)_$(prop))
 endif
-ifdef TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(BUILD_TYPE)
-$(target)_$(prop).$(BUILD_TYPE) += $$(TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(BUILD_TYPE))
+ifdef TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(KBUILD_TYPE)
+$(target)_$(prop).$(KBUILD_TYPE) += $$(TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(KBUILD_TYPE))
 endif
 ifdef TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg)
@@ -1003,6 +1003,6 @@
 $(target)_$(prop) <=$$(TEMPLATE_$($(target)_TEMPLATE)_$(prop))
 endif
-ifdef TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(BUILD_TYPE)
-$(target)_$(prop).$(BUILD_TYPE) <=$$(TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(BUILD_TYPE))
+ifdef TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(KBUILD_TYPE)
+$(target)_$(prop).$(KBUILD_TYPE) <=$$(TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(KBUILD_TYPE))
 endif
 ifdef TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg)
@@ -1046,13 +1046,13 @@
 
 # Inherit template properties
-bld_trg := $(BUILD_TARGET)
-bld_trg_arch := $(BUILD_TARGET_ARCH)
-bld_trg_cpu := $(BUILD_TARGET_CPU)
-$(foreach target, $(_ALL_BUILD_TARGET_TARGETS),$(evalval def_inherit_template))
-
-bld_trg := $(BUILD_PLATFORM)
-bld_trg_arch := $(BUILD_PLATFORM_ARCH)
-bld_trg_cpu := $(BUILD_PLATFORM_CPU)
-$(foreach target, $(_ALL_BUILD_PLATFORM_TARGETS),$(evalval def_inherit_template))
+bld_trg := $(KBUILD_TARGET)
+bld_trg_arch := $(KBUILD_TARGET_ARCH)
+bld_trg_cpu := $(KBUILD_TARGET_CPU)
+$(foreach target, $(_ALL_TARGET_TARGETS),$(evalval def_inherit_template))
+
+bld_trg := $(KBUILD_HOST)
+bld_trg_arch := $(KBUILD_HOST_ARCH)
+bld_trg_cpu := $(KBUILD_HOST_CPU)
+$(foreach target, $(_ALL_HOST_TARGETS),$(evalval def_inherit_template))
 
 ifdef KBUILD_PROFILE_SELF
@@ -1070,10 +1070,10 @@
 # that should be included.
 #
-_TOOLS := $(TOOL.$(BUILD_TARGET))   $(TOOL.$(BUILD_TARGET_ARCH))   $(TOOL.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)) \
-          $(TOOL.$(BUILD_PLATFORM)) $(TOOL.$(BUILD_PLATFORM_ARCH)) $(TOOL.$(BUILD_PLATFORM).$(BUILD_PLATFORM_ARCH)) \
+_TOOLS := $(TOOL.$(KBUILD_TARGET))   $(TOOL.$(KBUILD_TARGET_ARCH))   $(TOOL.$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)) \
+          $(TOOL.$(KBUILD_HOST)) $(TOOL.$(KBUILD_HOST_ARCH)) $(TOOL.$(KBUILD_HOST).$(KBUILD_HOST_ARCH)) \
 	  $(TOOL)
-_SDKS  := $(SDKS.$(BUILD_TARGET))   $(SDKS.$(BUILD_TARGET_ARCH))   $(SDKS.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)) \
-          $(SDKS.$(BUILD_PLATFORM)) $(SDKS.$(BUILD_PLATFORM_ARCH)) $(SDKS.$(BUILD_PLATFORM).$(BUILD_PLATFORM_ARCH)) \
-	  $(SDKS.$(BUILD_TYPE)) \
+_SDKS  := $(SDKS.$(KBUILD_TARGET))   $(SDKS.$(KBUILD_TARGET_ARCH))   $(SDKS.$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)) \
+          $(SDKS.$(KBUILD_HOST)) $(SDKS.$(KBUILD_HOST_ARCH)) $(SDKS.$(KBUILD_HOST).$(KBUILD_HOST_ARCH)) \
+	  $(SDKS.$(KBUILD_TYPE)) \
 	  $(SDKS)
 define def_tools_sdks_target_source
@@ -1094,6 +1094,6 @@
 	$($(source)_SDKS.$(_bld_trg_arch)) \
 	$($(target)_$(source)_SDKS.$(_bld_trg_arch)) \
-	$($(source)_SDKS.$(BUILD_TYPE)) \
-	$($(target)_$(source)_SDKS.$(BUILD_TYPE)) \
+	$($(source)_SDKS.$(KBUILD_TYPE)) \
+	$($(target)_$(source)_SDKS.$(KBUILD_TYPE)) \
 	$($(source)_SDKS) \
 	$($(target)_$(source)_SDKS))
@@ -1101,5 +1101,5 @@
 
 define def_tools_sdks_target
-local _bld_type := $(firstword $($(target)_BLD_TYPE) $(BUILD_TYPE))
+local _bld_type := $(firstword $($(target)_BLD_TYPE) $(KBUILD_TYPE))
 local _bld_trg := $(firstword $($(target)_BLD_TRG) $(bld_trg))
 local _bld_trg_arch := $(firstword $($(target)_BLD_TRG_ARCH) $(bld_trg_arch))
@@ -1127,5 +1127,5 @@
 
 define def_tools_srcname_target
-local _bld_type := $(firstword $($(target)_BLD_TYPE) $(BUILD_TYPE))
+local _bld_type := $(firstword $($(target)_BLD_TYPE) $(KBUILD_TYPE))
 local _bld_trg := $(firstword $($(target)_BLD_TRG) $(bld_trg))
 local _bld_trg_arch := $(firstword $($(target)_BLD_TRG_ARCH) $(bld_trg_arch))
@@ -1142,14 +1142,14 @@
 endef # def_tools_srcname_target
 
-bld_trg := $(BUILD_TARGET)
-bld_trg_arch := $(BUILD_TARGET_ARCH)
-bld_trg_cpu := $(BUILD_TARGET_CPU)
-$(foreach target, $(_ALL_BUILD_TARGET_TARGETS), $(evalval def_tools_sdks_target))
+bld_trg := $(KBUILD_TARGET)
+bld_trg_arch := $(KBUILD_TARGET_ARCH)
+bld_trg_cpu := $(KBUILD_TARGET_CPU)
+$(foreach target, $(_ALL_TARGET_TARGETS), $(evalval def_tools_sdks_target))
 $(foreach target, $(_ALL_SRCNAME_TARGETS), $(evalval def_tools_srcname_target))
 
-bld_trg := $(BUILD_PLATFORM)
-bld_trg_arch := $(BUILD_PLATFORM_ARCH)
-bld_trg_cpu := $(BUILD_PLATFORM_CPU)
-$(foreach target, $(_ALL_BUILD_PLATFORM_TARGETS), $(evalval def_tools_sdks_target))
+bld_trg := $(KBUILD_HOST)
+bld_trg_arch := $(KBUILD_HOST_ARCH)
+bld_trg_cpu := $(KBUILD_HOST_CPU)
+$(foreach target, $(_ALL_HOST_TARGETS), $(evalval def_tools_sdks_target))
 
 _TOOLS := $(sort $(_TOOLS))
@@ -1160,7 +1160,7 @@
 define def_tools_load_function
 ifndef TOOL_$(loading)
- TOOL_$(loading)_KMK_FILE := $(firstword $(foreach path, $(KBUILD_TOOL_PATHS) $(PATH_KBUILD)/tools $(KBUILD_DEFAULT_PATHS), $(wildcard $(path)/$(loading).kmk)))
+ TOOL_$(loading)_KMK_FILE := $(firstword $(foreach path, $(KBUILD_TOOL_PATHS) $(KBUILD_PATH)/tools $(KBUILD_DEFAULT_PATHS), $(wildcard $(path)/$(loading).kmk)))
  ifeq ($(TOOL_$(loading)_KMK_FILE),)
-  $(error kBuild: Cannot find include file for the tool '$(loading)'! Searched: $(KBUILD_TOOL_PATHS) $(PATH_KBUILD)/tools $(KBUILD_DEFAULT_PATHS))
+  $(error kBuild: Cannot find include file for the tool '$(loading)'! Searched: $(KBUILD_TOOL_PATHS) $(KBUILD_PATH)/tools $(KBUILD_DEFAULT_PATHS))
  endif
  include $(TOOL_$(loading)_KMK_FILE)
@@ -1175,7 +1175,7 @@
 define def_sdk_load_function
 ifndef SDK_$(loading)
- SDK_$(loading)_KMK_FILE := $(firstword $(foreach path, $(KBUILD_SDK_PATHS) $(PATH_KBUILD)/sdks $(KBUILD_DEFAULT_PATHS), $(wildcard $(path)/$(loading).kmk)))
+ SDK_$(loading)_KMK_FILE := $(firstword $(foreach path, $(KBUILD_SDK_PATHS) $(KBUILD_PATH)/sdks $(KBUILD_DEFAULT_PATHS), $(wildcard $(path)/$(loading).kmk)))
  ifeq ($(SDK_$(loading)_KMK_FILE),)
-  $(error kBuild: Cannot find include file for the SDK '$(loading)'! Searched: $(KBUILD_SDK_PATHS) $(PATH_KBUILD)/sdks $(KBUILD_DEFAULT_PATHS))
+  $(error kBuild: Cannot find include file for the SDK '$(loading)'! Searched: $(KBUILD_SDK_PATHS) $(KBUILD_PATH)/sdks $(KBUILD_DEFAULT_PATHS))
  endif
  include $(SDK_$(loading)_KMK_FILE)
@@ -1244,5 +1244,5 @@
 define def_pass1_link_common
 
-local bld_type    := $(firstword $($(target)_BLD_TYPE)     $(BUILD_TYPE))
+local bld_type    := $(firstword $($(target)_BLD_TYPE)     $(KBUILD_TYPE))
 local bld_trg     := $(firstword $($(target)_BLD_TRG)      $(BUILD_$(bld_trg_base_var)))
 local bld_trg_arch:= $(firstword $($(target)_BLD_TRG_ARCH) $(BUILD_$(bld_trg_base_var)_ARCH))
@@ -1312,5 +1312,5 @@
 tool_prefix := LD
 bld_trg_base_var := PLATFORM
-$(foreach target, $(BLDPROGS) $(BLDPROGS.$(BUILD_PLATFORM)) $(BLDPROGS.$(BUILD_PLATFORM).$(BUILD_PLATFORM_ARCH)), \
+$(foreach target, $(BLDPROGS) $(BLDPROGS.$(KBUILD_HOST)) $(BLDPROGS.$(KBUILD_HOST).$(KBUILD_HOST_ARCH)), \
 	$(evalval def_pass1_bldprog))
 
@@ -1324,5 +1324,5 @@
 tool_prefix := AR
 bld_trg_base_var := TARGET
-$(foreach target, $(LIBRARIES) $(LIBRARIES.$(BUILD_TARGET)) $(LIBRARIES.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)), \
+$(foreach target, $(LIBRARIES) $(LIBRARIES.$(KBUILD_TARGET)) $(LIBRARIES.$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)), \
 	$(evalval def_pass1_link_common))
 
@@ -1336,5 +1336,5 @@
 tool_prefix := LD
 bld_trg_base_var := TARGET
-$(foreach target, $(DLLS) $(DLLS.$(BUILD_TARGET)) $(DLLS.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)), \
+$(foreach target, $(DLLS) $(DLLS.$(KBUILD_TARGET)) $(DLLS.$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)), \
 	$(evalval def_pass1_link_common))
 
@@ -1346,5 +1346,5 @@
 #   - On other platforms they are fake DLLs.
 #
-if1of ($(BUILD_TARGET), nt os2 win win64 win32)
+if1of ($(KBUILD_TARGET), nt os2 win win64 win32)
  EXT     := LIB
  EXTPRE  :=
@@ -1352,5 +1352,5 @@
  tool_prefix := AR
  bld_trg_base_var := TARGET
- $(foreach target, $(IMPORT_LIBS) $(IMPORT_LIBS.$(BUILD_TARGET)) $(IMPORT_LIBS.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)), \
+ $(foreach target, $(IMPORT_LIBS) $(IMPORT_LIBS.$(KBUILD_TARGET)) $(IMPORT_LIBS.$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)), \
 	$(evalval def_pass1_link_common))
 else
@@ -1360,5 +1360,5 @@
  tool_prefix := LD
  bld_trg_base_var := TARGET
- $(foreach target, $(IMPORT_LIBS) $(IMPORT_LIBS.$(BUILD_TARGET)) $(IMPORT_LIBS.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)), \
+ $(foreach target, $(IMPORT_LIBS) $(IMPORT_LIBS.$(KBUILD_TARGET)) $(IMPORT_LIBS.$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)), \
 	$(evalval def_pass1_link_common))
 endif
@@ -1373,5 +1373,5 @@
 tool_prefix := LD
 bld_trg_base_var := TARGET
-$(foreach target, $(PROGRAMS) $(PROGRAMS.$(BUILD_TARGET)) $(PROGRAMS.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)), \
+$(foreach target, $(PROGRAMS) $(PROGRAMS.$(KBUILD_TARGET)) $(PROGRAMS.$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)), \
 	$(evalval def_pass1_link_common))
 
@@ -1385,5 +1385,5 @@
 tool_prefix := LD
 bld_trg_base_var := TARGET
-$(foreach target, $(SYSMODS) $(SYSMODS.$(BUILD_TARGET)) $(SYSMODS.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)), \
+$(foreach target, $(SYSMODS) $(SYSMODS.$(KBUILD_TARGET)) $(SYSMODS.$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)), \
 	$(evalval def_pass1_link_common))
 
@@ -1394,13 +1394,13 @@
 #
 define def_pass1_install
-local bld_type    := $(firstword $($(target)_BLD_TYPE)     $(BUILD_TYPE))
-local bld_trg     := $(firstword $($(target)_BLD_TRG)      $(BUILD_TARGET))
-local bld_trg_arch:= $(firstword $($(target)_BLD_TRG_ARCH) $(BUILD_TARGET_ARCH))
-local bld_trg_cpu := $(firstword $($(target)_BLD_TRG_CPU)  $(BUILD_TARGET_CPU))
+local bld_type    := $(firstword $($(target)_BLD_TYPE)     $(KBUILD_TYPE))
+local bld_trg     := $(firstword $($(target)_BLD_TRG)      $(KBUILD_TARGET))
+local bld_trg_arch:= $(firstword $($(target)_BLD_TRG_ARCH) $(KBUILD_TARGET_ARCH))
+local bld_trg_cpu := $(firstword $($(target)_BLD_TRG_CPU)  $(KBUILD_TARGET_CPU))
 # TARGET_*
 TARGET_$(target) := $(PATH_TARGET)/$(target).ins
 # INSTARGET_ later.
 endef
-$(foreach target, $(INSTALLS) $(INSTALLS.$(BUILD_TARGET)) $(INSTALLS.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)), \
+$(foreach target, $(INSTALLS) $(INSTALLS.$(KBUILD_TARGET)) $(INSTALLS.$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)), \
 	$(evalval def_pass1_install))
 
@@ -1761,6 +1761,6 @@
 
 # The 'sources'.
-#$ (warning dbg fetch: target=$(target) sources=$($(target)_SOURCES) $($(target)_SOURCES.$(BUILD_TYPE)) $($(target)_SOURCES.$(BUILD_TARGET)) $($(target)_SOURCES.$(BUILD_TARGET_ARCH)) $($(target)_SOURCES.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)))
-$(foreach source,$($(target)_SOURCES) $($(target)_SOURCES.$(BUILD_TYPE)) $($(target)_SOURCES.$(BUILD_TARGET)) $($(target)_SOURCES.$(BUILD_TARGET_ARCH)) $($(target)_SOURCES.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)),\
+#$ (warning dbg fetch: target=$(target) sources=$($(target)_SOURCES) $($(target)_SOURCES.$(KBUILD_TYPE)) $($(target)_SOURCES.$(KBUILD_TARGET)) $($(target)_SOURCES.$(KBUILD_TARGET_ARCH)) $($(target)_SOURCES.$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)))
+$(foreach source,$($(target)_SOURCES) $($(target)_SOURCES.$(KBUILD_TYPE)) $($(target)_SOURCES.$(KBUILD_TARGET)) $($(target)_SOURCES.$(KBUILD_TARGET_ARCH)) $($(target)_SOURCES.$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)),\
 	$(evalval def_fetch_src))
 
@@ -1786,7 +1786,7 @@
 
 # Walk the FETCH target lists.
-bld_trg := $(BUILD_TARGET)
-bld_trg_arch := $(BUILD_TARGET_ARCH)
-$(foreach target, $(FETCHES) $(FETCHES.$(BUILD_TARGET)) $(FETCHES.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)), \
+bld_trg := $(KBUILD_TARGET)
+bld_trg_arch := $(KBUILD_TARGET_ARCH)
+$(foreach target, $(FETCHES) $(FETCHES.$(KBUILD_TARGET)) $(FETCHES.$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)), \
 	$(evalval def_fetch))
 
@@ -1818,5 +1818,5 @@
 #define def_patch
 #
-#$(foreach source,$($(target)_SOURCES) $($(target)_SOURCES.$(BUILD_TYPE)) $($(target)_SOURCES.$(BUILD_TARGET)) $($(target)_SOURCES.$(BUILD_TARGET_ARCH)) $($(target)_SOURCES.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)),\
+#$(foreach source,$($(target)_SOURCES) $($(target)_SOURCES.$(KBUILD_TYPE)) $($(target)_SOURCES.$(KBUILD_TARGET)) $($(target)_SOURCES.$(KBUILD_TARGET_ARCH)) $($(target)_SOURCES.$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)),\
 #	$(evalval def_patch_src))
 #
@@ -1824,5 +1824,5 @@
 #endef
 #
-#$(foreach target, $(PATCHES) $(PATCHES.$(BUILD_TARGET)) $(PATCHES.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)), \
+#$(foreach target, $(PATCHES) $(PATCHES.$(KBUILD_TARGET)) $(PATCHES.$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)), \
 #	$(evalval def_patch))
 #
@@ -2052,8 +2052,8 @@
 # library basics
 ## @todo prefix
-local bld_type    := $(firstword $($(target)_BLD_TYPE)     $(BUILD_TYPE))
-local bld_trg     := $(firstword $($(target)_BLD_TRG)      $(BUILD_TARGET))
-local bld_trg_arch:= $(firstword $($(target)_BLD_TRG_ARCH) $(BUILD_TARGET_ARCH))
-local bld_trg_cpu := $(firstword $($(target)_BLD_TRG_CPU)  $(BUILD_TARGET_CPU))
+local bld_type    := $(firstword $($(target)_BLD_TYPE)     $(KBUILD_TYPE))
+local bld_trg     := $(firstword $($(target)_BLD_TRG)      $(KBUILD_TARGET))
+local bld_trg_arch:= $(firstword $($(target)_BLD_TRG_ARCH) $(KBUILD_TARGET_ARCH))
+local bld_trg_cpu := $(firstword $($(target)_BLD_TRG_CPU)  $(KBUILD_TARGET_CPU))
 local tool        := $(call _TARGET_TOOL,$(target),AR)
 ifeq ($(tool),)
@@ -2242,5 +2242,5 @@
 tool_do := LINK_LIBRARY
 mode := 0644
-$(foreach target, $(LIBRARIES) $(LIBRARIES.$(BUILD_TARGET)) $(LIBRARIES.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)), $(evalval def_lib))
+$(foreach target, $(LIBRARIES) $(LIBRARIES.$(KBUILD_TARGET)) $(LIBRARIES.$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)), $(evalval def_lib))
 
 ifdef KBUILD_PROFILE_SELF
@@ -2265,5 +2265,5 @@
 define def_link_common
 # basics
-local bld_type    := $(firstword $($(target)_BLD_TYPE)     $(BUILD_TYPE))
+local bld_type    := $(firstword $($(target)_BLD_TYPE)     $(KBUILD_TYPE))
 local bld_trg     := $(firstword $($(target)_BLD_TRG)      $(BUILD_$(bld_trg_base_var)))
 local bld_trg_arch:= $(firstword $($(target)_BLD_TRG_ARCH) $(BUILD_$(bld_trg_base_var)_ARCH))
@@ -2608,5 +2608,5 @@
 mode    := 0755
 bld_trg_base_var := PLATFORM
-$(foreach target, $(BLDPROGS) $(BLDPROGS.$(BUILD_PLATFORM)) $(BLDPROGS.$(BUILD_PLATFORM).$(BUILD_PLATFORM_ARCH)), $(evalval def_bldprog))
+$(foreach target, $(BLDPROGS) $(BLDPROGS.$(KBUILD_HOST)) $(BLDPROGS.$(KBUILD_HOST).$(KBUILD_HOST_ARCH)), $(evalval def_bldprog))
 
 ifdef KBUILD_PROFILE_SELF
@@ -2630,5 +2630,5 @@
 mode    := 0644
 bld_trg_base_var := TARGET
-$(foreach target, $(DLLS) $(DLLS.$(BUILD_TARGET)) $(DLLS.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)), $(evalval def_link_common))
+$(foreach target, $(DLLS) $(DLLS.$(KBUILD_TARGET)) $(DLLS.$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)), $(evalval def_link_common))
 
 ifdef KBUILD_PROFILE_SELF
@@ -2650,14 +2650,14 @@
 mode    := 0644
 bld_trg_base_var := TARGET
-ifeq ($(filter-out nt os2 win win64 win32,$(BUILD_TARGET)),)
+ifeq ($(filter-out nt os2 win win64 win32,$(KBUILD_TARGET)),)
  EXT     := LIB
  tool_do := LINK_LIBRARY
  definst := $(PATH_LIB)
- $(foreach target, $(IMPORT_LIBS) $(IMPORT_LIBS.$(BUILD_TARGET)) $(IMPORT_LIBS.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)), $(evalval def_lib))
+ $(foreach target, $(IMPORT_LIBS) $(IMPORT_LIBS.$(KBUILD_TARGET)) $(IMPORT_LIBS.$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)), $(evalval def_lib))
 else
  EXT     := DLL
  tool_do := LINK_DLL
  definst := $(PATH_DLL)
- $(foreach target, $(IMPORT_LIBS) $(IMPORT_LIBS.$(BUILD_TARGET)) $(IMPORT_LIBS.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)), $(evalval def_link_common))
+ $(foreach target, $(IMPORT_LIBS) $(IMPORT_LIBS.$(KBUILD_TARGET)) $(IMPORT_LIBS.$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)), $(evalval def_link_common))
 endif
 
@@ -2682,5 +2682,5 @@
 mode    := 0755
 bld_trg_base_var := TARGET
-$(foreach target, $(PROGRAMS) $(PROGRAMS.$(BUILD_TARGET)) $(PROGRAMS.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)), $(evalval def_link_common))
+$(foreach target, $(PROGRAMS) $(PROGRAMS.$(KBUILD_TARGET)) $(PROGRAMS.$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)), $(evalval def_link_common))
 
 ifdef KBUILD_PROFILE_SELF
@@ -2704,5 +2704,5 @@
 mode    := 0644
 bld_trg_base_var := TARGET
-$(foreach target, $(SYSMODS) $(SYSMODS.$(BUILD_TARGET)) $(SYSMODS.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)), $(evalval def_link_common))
+$(foreach target, $(SYSMODS) $(SYSMODS.$(KBUILD_TARGET)) $(SYSMODS.$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)), $(evalval def_link_common))
 
 ifdef KBUILD_PROFILE_SELF
@@ -2717,5 +2717,5 @@
 # OTHERS
 #
-_OTHERS = $(OTHERS) $(OTHERS.$(BUILD_TARGET)) $(OTHERS.$(BUILD_TARGET).$(BUILD_TARGET_ARCH))
+_OTHERS = $(OTHERS) $(OTHERS.$(KBUILD_TARGET)) $(OTHERS.$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH))
 
 
@@ -2984,8 +2984,8 @@
 define def_install
 # the basics.
-local bld_type  := $(firstword $($(target)_BLD_TYPE)     $(BUILD_TYPE))
-local bld_trg   := $(firstword $($(target)_BLD_TRG)      $(BUILD_TARGET))
-local bld_trg_arch:= $(firstword $($(target)_BLD_TRG_ARCH) $(BUILD_TARGET_ARCH))
-local bld_trg_cpu := $(firstword $($(target)_BLD_TRG_CPU)  $(BUILD_TARGET_CPU))
+local bld_type  := $(firstword $($(target)_BLD_TYPE)     $(KBUILD_TYPE))
+local bld_trg   := $(firstword $($(target)_BLD_TRG)      $(KBUILD_TARGET))
+local bld_trg_arch:= $(firstword $($(target)_BLD_TRG_ARCH) $(KBUILD_TARGET_ARCH))
+local bld_trg_cpu := $(firstword $($(target)_BLD_TRG_CPU)  $(KBUILD_TARGET_CPU))
 
 INSTARGET_$(target) := $($(target)_GOALS)
@@ -3016,5 +3016,5 @@
 
 ## process all install targets
-$(foreach target, $(INSTALLS) $(INSTALLS.$(BUILD_TARGET)) $(INSTALLS.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)), \
+$(foreach target, $(INSTALLS) $(INSTALLS.$(KBUILD_TARGET)) $(INSTALLS.$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)), \
 	$(evalval def_install))
 
@@ -3030,5 +3030,5 @@
 # PACKING
 #
-_PACKING += $(PACKING) $(PACKING.$(BUILD_TARGET)) $(PACKING.$(BUILD_TARGET).$(BUILD_TARGET_ARCH))
+_PACKING += $(PACKING) $(PACKING.$(KBUILD_TARGET)) $(PACKING.$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH))
 
 
@@ -3110,18 +3110,18 @@
 # @param	$(PASS)		Uppercase pass name.
 define def_pass_old
-$(eval SUBDIRS_$(PASS)          ?= $(SUBDIRS)          $(SUBDIRS.$(BUILD_TARGET))           $(SUBDIRS.$(BUILD_TARGET).$(BUILD_TARGET_ARCH))          )
-$(eval SUBDIRS_AFTER_$(PASS)    ?= $(SUBDIRS_AFTER)    $(SUBDIRS_AFTER.$(BUILD_TARGET))     $(SUBDIRS_AFTER.$(BUILD_TARGET).$(BUILD_TARGET_ARCH))    )
-$(eval MAKEFILES_BEFORE_$(PASS) ?= $(MAKEFILES_BEFORE) $(MAKEFILES_BEFORE.$(BUILD_TARGET))  $(MAKEFILES_BEFORE.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)) )
-$(eval MAKEFILES_AFTER_$(PASS)  ?= $(MAKEFILES_AFTER)  $(MAKEFILES_AFTER.$(BUILD_TARGET))   $(MAKEFILES_AFTER.$(BUILD_TARGET).$(BUILD_TARGET_ARCH))  )
+$(eval SUBDIRS_$(PASS)          ?= $(SUBDIRS)          $(SUBDIRS.$(KBUILD_TARGET))           $(SUBDIRS.$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH))          )
+$(eval SUBDIRS_AFTER_$(PASS)    ?= $(SUBDIRS_AFTER)    $(SUBDIRS_AFTER.$(KBUILD_TARGET))     $(SUBDIRS_AFTER.$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH))    )
+$(eval MAKEFILES_BEFORE_$(PASS) ?= $(MAKEFILES_BEFORE) $(MAKEFILES_BEFORE.$(KBUILD_TARGET))  $(MAKEFILES_BEFORE.$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)) )
+$(eval MAKEFILES_AFTER_$(PASS)  ?= $(MAKEFILES_AFTER)  $(MAKEFILES_AFTER.$(KBUILD_TARGET))   $(MAKEFILES_AFTER.$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH))  )
 
 $(eval tag:=_before)
 $(eval dep:=)
-$(foreach subdir,$(SUBDIRS_$(PASS))            $(SUBDIRS_$(PASS).$(BUILD_TARGET))           $(SUBDIRS_$(PASS).$(BUILD_TARGET).$(BUILD_TARGET_ARCH))         ,$(eval $(def_pass_subdir)))
-$(foreach makefile,$(MAKEFILES_BEFORE_$(PASS)) $(MAKEFILES_BEFORE_$(PASS).$(BUILD_TARGET))  $(MAKEFILES_BEFORE_$(PASS).$(BUILD_TARGET).$(BUILD_TARGET_ARCH)),$(eval $(def_pass_makefile)))
+$(foreach subdir,$(SUBDIRS_$(PASS))            $(SUBDIRS_$(PASS).$(KBUILD_TARGET))           $(SUBDIRS_$(PASS).$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH))         ,$(eval $(def_pass_subdir)))
+$(foreach makefile,$(MAKEFILES_BEFORE_$(PASS)) $(MAKEFILES_BEFORE_$(PASS).$(KBUILD_TARGET))  $(MAKEFILES_BEFORE_$(PASS).$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)),$(eval $(def_pass_makefile)))
 
 $(eval tag:=_after)
 $(eval dep:=pass_$(pass)_doit)
-$(foreach subdir,$(SUBDIRS_AFTER_$(PASS))      $(SUBDIRS_AFTER_$(PASS).$(BUILD_TARGET))     $(SUBDIRS_AFTER_$(PASS).$(BUILD_TARGET).$(BUILD_TARGET_ARCH))   ,$(eval $(def_pass_subdir)))
-$(foreach makefile,$(MAKEFILES_AFTER_$(PASS))  $(MAKEFILES_AFTER_$(PASS).$(BUILD_TARGET))   $(MAKEFILES_AFTER_$(PASS).$(BUILD_TARGET).$(BUILD_TARGET_ARCH)) ,$(eval $(def_pass_makefile)))
+$(foreach subdir,$(SUBDIRS_AFTER_$(PASS))      $(SUBDIRS_AFTER_$(PASS).$(KBUILD_TARGET))     $(SUBDIRS_AFTER_$(PASS).$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH))   ,$(eval $(def_pass_subdir)))
+$(foreach makefile,$(MAKEFILES_AFTER_$(PASS))  $(MAKEFILES_AFTER_$(PASS).$(KBUILD_TARGET))   $(MAKEFILES_AFTER_$(PASS).$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)) ,$(eval $(def_pass_makefile)))
 
 .NOTPARALLEL: pass_$(pass)_before pass_$(pass)_after
@@ -3136,18 +3136,18 @@
 
 define def_pass
-$(eval SUBDIRS_$(PASS)          ?= $(SUBDIRS)          $(SUBDIRS.$(BUILD_TARGET))          $(SUBDIRS.$(BUILD_TARGET.$(BUILD_TARGET_ARCH)))          )
-$(eval SUBDIRS_AFTER_$(PASS)    ?= $(SUBDIRS_AFTER)    $(SUBDIRS_AFTER.$(BUILD_TARGET))    $(SUBDIRS_AFTER.$(BUILD_TARGET).$(BUILD_TARGET_ARCH))    )
-$(eval MAKEFILES_BEFORE_$(PASS) ?= $(MAKEFILES_BEFORE) $(MAKEFILES_BEFORE.$(BUILD_TARGET)) $(MAKEFILES_BEFORE.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)) )
-$(eval MAKEFILES_AFTER_$(PASS)  ?= $(MAKEFILES_AFTER)  $(MAKEFILES_AFTER.$(BUILD_TARGET))  $(MAKEFILES_AFTER.$(BUILD_TARGET).$(BUILD_TARGET_ARCH))  )
+$(eval SUBDIRS_$(PASS)          ?= $(SUBDIRS)          $(SUBDIRS.$(KBUILD_TARGET))          $(SUBDIRS.$(KBUILD_TARGET.$(KBUILD_TARGET_ARCH)))          )
+$(eval SUBDIRS_AFTER_$(PASS)    ?= $(SUBDIRS_AFTER)    $(SUBDIRS_AFTER.$(KBUILD_TARGET))    $(SUBDIRS_AFTER.$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH))    )
+$(eval MAKEFILES_BEFORE_$(PASS) ?= $(MAKEFILES_BEFORE) $(MAKEFILES_BEFORE.$(KBUILD_TARGET)) $(MAKEFILES_BEFORE.$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)) )
+$(eval MAKEFILES_AFTER_$(PASS)  ?= $(MAKEFILES_AFTER)  $(MAKEFILES_AFTER.$(KBUILD_TARGET))  $(MAKEFILES_AFTER.$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH))  )
 
 $(eval tag:=_before)
 $(eval dep:=)
-$(foreach subdir,$(SUBDIRS_$(PASS))            $(SUBDIRS_$(PASS).$(BUILD_TARGET))          $(SUBDIRS_$(PASS).$(BUILD_TARGET).$(BUILD_TARGET_ARCH))         ,$(eval $(def_pass_subdir)))
-$(foreach makefile,$(MAKEFILES_BEFORE_$(PASS)) $(MAKEFILES_BEFORE_$(PASS).$(BUILD_TARGET)) $(MAKEFILES_BEFORE_$(PASS).$(BUILD_TARGET).$(BUILD_TARGET_ARCH)),$(eval $(def_pass_makefile)))
+$(foreach subdir,$(SUBDIRS_$(PASS))            $(SUBDIRS_$(PASS).$(KBUILD_TARGET))          $(SUBDIRS_$(PASS).$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH))         ,$(eval $(def_pass_subdir)))
+$(foreach makefile,$(MAKEFILES_BEFORE_$(PASS)) $(MAKEFILES_BEFORE_$(PASS).$(KBUILD_TARGET)) $(MAKEFILES_BEFORE_$(PASS).$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)),$(eval $(def_pass_makefile)))
 
 $(eval tag:=_after)
 $(eval dep:=pass_$(pass)_doit)
-$(foreach subdir,$(SUBDIRS_AFTER_$(PASS))      $(SUBDIRS_AFTER_$(PASS).$(BUILD_TARGET))    $(SUBDIRS_AFTER_$(PASS).$(BUILD_TARGET).$(BUILD_TARGET_ARCH))   ,$(eval $(def_pass_subdir)))
-$(foreach makefile,$(MAKEFILES_AFTER_$(PASS))  $(MAKEFILES_AFTER_$(PASS).$(BUILD_TARGET))  $(MAKEFILES_AFTER_$(PASS).$(BUILD_TARGET).$(BUILD_TARGET_ARCH)) ,$(eval $(def_pass_makefile)))
+$(foreach subdir,$(SUBDIRS_AFTER_$(PASS))      $(SUBDIRS_AFTER_$(PASS).$(KBUILD_TARGET))    $(SUBDIRS_AFTER_$(PASS).$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH))   ,$(eval $(def_pass_subdir)))
+$(foreach makefile,$(MAKEFILES_AFTER_$(PASS))  $(MAKEFILES_AFTER_$(PASS).$(KBUILD_TARGET))  $(MAKEFILES_AFTER_$(PASS).$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)) ,$(eval $(def_pass_makefile)))
 
 ifdef KBUILD_SAFE_PARALLEL
@@ -3253,5 +3253,5 @@
 	@$(ECHO) "  INSTARGET_$(target)=$(INSTARGET_$(target))" $(NLTAB)\
 $(foreach prop,$(PROPS_SINGLE) $(PROPS_ACCUMULATE_L) $(PROPS_ACCUMULATE_R) OBJS_ CLEAN, \
-	$(eval _tmp:=$(firstword $($(target)_BLD_TRG) $(BUILD_TARGET))) \
+	$(eval _tmp:=$(firstword $($(target)_BLD_TRG) $(KBUILD_TARGET))) \
 	$(if $($(target)_$(prop).$(_tmp)),\
 		@$(ECHO) "  $(target)_$(prop).$(_tmp)=$($(target)_$(prop).$(_tmp))" $(NLTAB)) \
@@ -3259,5 +3259,5 @@
 )\
 $(foreach prop,$(PROPS_DEFERRED), \
-	$(eval _tmp:=$(firstword $($(target)_BLD_TRG) $(BUILD_TARGET))) \
+	$(eval _tmp:=$(firstword $($(target)_BLD_TRG) $(KBUILD_TARGET))) \
 	$(if $(value $(target)_$(prop).$(_tmp)),\
 		@$(ECHO) '  $(target)_$(prop).$(_tmp)=$(value $(TARGET)_$(prop).$(_tmp))' $(NLTAB)) \
Index: /trunk/kBuild/header.kmk
===================================================================
--- /trunk/kBuild/header.kmk	(revision 1503)
+++ /trunk/kBuild/header.kmk	(revision 1504)
@@ -4,5 +4,5 @@
 # kBuild - File included at top of a makefile.
 #
-# Copyright (c) 2004-2007 knut st. osmundsen <bird-kBuild-spam@anduin.net>
+# Copyright (c) 2004-2008 knut st. osmundsen <bird-kBuild-spam@anduin.net>
 #
 #
@@ -49,6 +49,6 @@
  endif
 else
- ifneq ($(int-ge $(KBUILD_VERSION_PATCH),2),1)
-  $(warning kBuild: kmk version mismatch! Expected 0.1.2 or later. Actual version is $(KBUILD_VERSION_MAJOR).$(KBUILD_VERSION_MINOR).$(KBUILD_VERSION_PATCH).)
+ ifneq ($(int-ge $(KBUILD_VERSION_PATCH),3),1)
+  $(warning kBuild: kmk version mismatch! Expected 0.1.3 or later. Actual version is $(KBUILD_VERSION_MAJOR).$(KBUILD_VERSION_MINOR).$(KBUILD_VERSION_PATCH).)
  endif
 endif
@@ -160,13 +160,43 @@
 # Set default build type.
 #
-ifndef BUILD_TYPE
- BUILD_TYPE := release
-else
- if1of ($(BUILD_TYPE), $(KBUILD_OSES) $(KBUILD_ARCHES))
-  $(error kBuild: The BUILD_TYPE value '$(BUILD_TYPE)' is an OS or architecture!)
- endif
- ifneq (.$(words $(BUILD_TYPE)).$(BUILD_TYPE).,.1.$(strip $(BUILD_TYPE)).)
-  $(error kBuild: The BUILD_TYPE value '$(BUILD_TYPE)' contains spaces/tabs!)
- endif
+ifndef KBUILD_TYPE
+ ifdef BUILD_TYPE
+  KBUILD_TYPE := $(BUILD_TYPE)
+ endif
+else ifdef BUILD_TYPE
+ ifneq ($(KBUILD_TYPE),$(BUILD_TYPE))
+  ifeq ($(origin KBUILD_TYPE):$(origin BUILD_TYPE),environment:command line)
+   KBUILD_TYPE := $(BUILD_TYPE)
+  else ifneq ($(origin KBUILD_TYPE):$(origin BUILD_TYPE),command line:environment)
+   $(error kBuild: KBUILD_TYPE and BUILD_TYPE disagree.)
+  endif
+ endif
+endif
+override BUILD_TYPE = $(KBUILD_TYPE)
+
+ifndef KBUILD_TYPE
+ KBUILD_TYPE := release
+else
+ if1of ($(KBUILD_TYPE), $(KBUILD_OSES) $(KBUILD_ARCHES))
+  $(error kBuild: The KBUILD_TYPE value '$(KBUILD_TYPE)' is an OS or architecture!)
+ endif
+ ifneq (.$(words $(KBUILD_TYPE)).$(KBUILD_TYPE).,.1.$(strip $(KBUILD_TYPE)).)
+  $(error kBuild: The KBUILD_TYPE value '$(KBUILD_TYPE)' contains spaces/tabs!)
+ endif
+endif
+
+
+#
+# Host platform legacy 
+# kmk deals with this, so this is only temporary until I've rebuilt everything.
+#
+ifndef KBUILD_HOST
+ KBUILD_HOST := $(BUILD_PLATFORM)
+endif
+ifndef KBUILD_HOST_ARCH
+ KBUILD_HOST_ARCH := $(BUILD_PLATFORM_ARCH)
+endif
+ifndef KBUILD_HOST_CPU
+ KBUILD_HOST_CPU := $(BUILD_PLATFORM_CPU)
 endif
 
@@ -178,76 +208,125 @@
 # unless the user starts messing about with environment variables.
 #
-ifneq (.$(words $(BUILD_PLATFORM)).$(BUILD_PLATFORM).,.1.$(strip $(BUILD_PLATFORM)).)
- $(error kBuild: The BUILD_PLATFORM value '$(BUILD_PLATFORM)' contains spaces/tabs!)
-endif
-ifneq ($(words $(filter $(BUILD_PLATFORM),$(KBUILD_OSES))),1)
- $(error kBuild: BUILD_PLATFORM value '$(BUILD_PLATFORM)' is not recognized (valid: $(KBUILD_OSES)))
-endif
-
-ifneq (.$(words $(BUILD_PLATFORM_ARCH)).$(BUILD_PLATFORM_ARCH).,.1.$(strip $(BUILD_PLATFORM_ARCH)).)
- $(error kBuild: The BUILD_PLATFORM_ARCH value '$(BUILD_PLATFORM_ARCH)' contains spaces/tabs!)
-endif
-ifneq ($(words $(filter $(BUILD_PLATFORM_ARCH),$(KBUILD_ARCHES))),1)
- $(error kBuild: BUILD_PLATFORM_ARCH value '$(BUILD_PLATFORM_ARCH)' is not recognized (valid: $(KBUILD_ARCHES)))
-endif
-
-ifeq ($(strip $(BUILD_PLATFORM_CPU)),)
- BUILD_PLATFORM_CPU := blend
-else
- ifneq (.$(words $(BUILD_PLATFORM_CPU)).$(BUILD_PLATFORM_CPU).,.1.$(strip $(BUILD_PLATFORM_CPU)).)
-  $(error kBuild: The BUILD_PLATFORM_CPU value '$(BUILD_PLATFORM_CPU)' contains spaces/tabs!)
- endif
- if1of ($(BUILD_PLATFORM_CPU), $(KBUILD_OSES) $(BUILD_ARCHES))
-  $(error kBuild: The BUILD_PLATFORM_CPU value '$(BUILD_PLATFORM_CPU)' was found in the OS or architecture keywords!)
- endif
- ifeq ($(BUILD_PLATFORM_CPU),$(BUILD_TYPE))
-  $(error kBuild: The BUILD_PLATFORM_CPU value '$(BUILD_PLATFORM_CPU)' is the same as the BUILD_TYPE!)
- endif
-endif
+ifneq (.$(words $(KBUILD_HOST)).$(KBUILD_HOST).,.1.$(strip $(KBUILD_HOST)).)
+ $(error kBuild: The KBUILD_HOST value '$(KBUILD_HOST)' contains spaces/tabs!)
+endif
+ifneq ($(words $(filter $(KBUILD_HOST),$(KBUILD_OSES))),1)
+ $(error kBuild: KBUILD_HOST value '$(KBUILD_HOST)' is not recognized (valid: $(KBUILD_OSES)))
+endif
+
+ifneq (.$(words $(KBUILD_HOST_ARCH)).$(KBUILD_HOST_ARCH).,.1.$(strip $(KBUILD_HOST_ARCH)).)
+ $(error kBuild: The KBUILD_HOST_ARCH value '$(KBUILD_HOST_ARCH)' contains spaces/tabs!)
+endif
+ifneq ($(words $(filter $(KBUILD_HOST_ARCH),$(KBUILD_ARCHES))),1)
+ $(error kBuild: KBUILD_HOST_ARCH value '$(KBUILD_HOST_ARCH)' is not recognized (valid: $(KBUILD_ARCHES)))
+endif
+
+ifeq ($(strip $(KBUILD_HOST_CPU)),)
+ KBUILD_HOST_CPU := blend
+else
+ ifneq (.$(words $(KBUILD_HOST_CPU)).$(KBUILD_HOST_CPU).,.1.$(strip $(KBUILD_HOST_CPU)).)
+  $(error kBuild: The KBUILD_HOST_CPU value '$(KBUILD_HOST_CPU)' contains spaces/tabs!)
+ endif
+ if1of ($(KBUILD_HOST_CPU), $(KBUILD_OSES) $(BUILD_ARCHES))
+  $(error kBuild: The KBUILD_HOST_CPU value '$(KBUILD_HOST_CPU)' was found in the OS or architecture keywords!)
+ endif
+ ifeq ($(KBUILD_HOST_CPU),$(KBUILD_TYPE))
+  $(error kBuild: The KBUILD_HOST_CPU value '$(KBUILD_HOST_CPU)' is the same as the KBUILD_TYPE!)
+ endif
+endif
+
+
+#
+# Deal with target platform legacy.
+#
+ifndef KBUILD_TARGET
+ ifdef BUILD_TARGET
+  KBUILD_TARGET := $(BUILD_TARGET)
+ endif
+else ifdef BUILD_TARGET
+ ifneq ($(KBUILD_TARGET),$(BUILD_TARGET))
+  ifeq ($(origin KBUILD_TARGET):$(origin BUILD_TARGET),environment:command line)
+   KBUILD_TARGET := $(BUILD_TARGET)
+  else ifneq ($(origin KBUILD_TARGET):$(origin BUILD_TARGET),command line:environment)
+   $(error kBuild: KBUILD_TARGET and BUILD_TARGET disagree) 
+  endif
+ endif
+endif
+override BUILD_TARGET = $(KBUILD_TARGET)
+
+ifndef KBUILD_TARGET_ARCH
+ ifdef BUILD_TARGET_ARCH
+  KBUILD_TARGET_ARCH := $(BUILD_TARGET_ARCH)
+ endif
+else ifdef BUILD_TARGET_ARCH
+ ifneq ($(KBUILD_TARGET_ARCH),$(BUILD_TARGET_ARCH))
+  ifeq ($(origin KBUILD_TARGET_ARCH):$(origin BUILD_TARGET_ARCH),environment:command line)
+   KBUILD_TARGET_ARCH := $(BUILD_TARGET_ARCH)
+  else ifneq ($(origin KBUILD_TARGET_ARCH):$(origin BUILD_TARGET_ARCH),command line:environment)
+   $(error kBuild: KBUILD_TARGET_ARCH and BUILD_TARGET_ARCH disagree) 
+  endif
+ endif
+endif
+override BUILD_TARGET_ARCH = $(KBUILD_TARGET_ARCH)
+
+ifndef KBUILD_TARGET_CPU
+ ifdef BUILD_TARGET_CPU
+  KBUILD_TARGET_CPU := $(BUILD_TARGET_CPU)
+ endif
+else ifdef BUILD_TARGET_CPU
+ ifneq ($(KBUILD_TARGET_CPU),$(BUILD_TARGET_CPU))
+  ifeq ($(origin KBUILD_TARGET_CPU):$(origin BUILD_TARGET_CPU),environment:command line)
+   KBUILD_TARGET_CPU := $(BUILD_TARGET_CPU)
+  else ifneq ($(origin KBUILD_TARGET_CPU):$(origin BUILD_TARGET_CPU),command line:environment)
+   $(error kBuild: KBUILD_TARGET_CPU and BUILD_TARGET_CPU disagree) 
+  endif
+ endif
+endif
+override BUILD_TARGET_CPU = $(KBUILD_TARGET_CPU)
 
 
 #
 # Assert or set default target platform.
-# When not defined use the corresponding BUILD_PLATFORM value.
-#
-ifndef BUILD_TARGET
- BUILD_TARGET := $(BUILD_PLATFORM)
-else
- ifneq (.$(words $(BUILD_TARGET)).$(BUILD_TARGET).,.1.$(strip $(BUILD_TARGET)).)
-  $(error kBuild: The BUILD_TARGET value '$(BUILD_TARGET)' contains spaces/tabs!)
- endif
- ifneq ($(words $(filter $(BUILD_TARGET),$(KBUILD_OSES))),1)
-  $(error kBuild: BUILD_TARGET value '$(BUILD_TARGET)' is not recognized (valid: $(KBUILD_OSES)))
- endif
-endif
-
-ifndef BUILD_TARGET_ARCH
- BUILD_TARGET_ARCH := $(BUILD_PLATFORM_ARCH)
-else
- ifneq (.$(words $(BUILD_TARGET_ARCH)).$(BUILD_TARGET_ARCH).,.1.$(strip $(BUILD_TARGET_ARCH)).)
-  $(error kBuild: The BUILD_TARGET_ARCH value '$(BUILD_TARGET_ARCH)' contains spaces/tabs!)
- endif
- ifneq ($(words $(filter $(BUILD_TARGET_ARCH),$(KBUILD_ARCHES))),1)
-  $(error kBuild: BUILD_TARGET_ARCH value '$(BUILD_TARGET_ARCH)' is not recognized (valid: $(KBUILD_ARCHES)))
- endif
-endif
-
-ifndef BUILD_TARGET_CPU
- BUILD_TARGET_CPU := $(BUILD_PLATFORM_CPU)
-else ifeq ($(strip $(BUILD_TARGET_CPU)),)
- ifeq ($(BUILD_TARGET_ARCH),$(BUILD_PLATFORM_ARCH))
-  BUILD_TARGET_CPU := $(BUILD_PLATFORM_CPU)
+# When not defined use the corresponding KBUILD_HOST value.
+#
+ifndef KBUILD_TARGET
+ KBUILD_TARGET := $(KBUILD_HOST)
+else
+ ifneq (.$(words $(KBUILD_TARGET)).$(KBUILD_TARGET).,.1.$(strip $(KBUILD_TARGET)).)
+  $(error kBuild: The KBUILD_TARGET value '$(KBUILD_TARGET)' contains spaces/tabs!)
+ endif
+ ifneq ($(words $(filter $(KBUILD_TARGET),$(KBUILD_OSES))),1)
+  $(error kBuild: KBUILD_TARGET value '$(KBUILD_TARGET)' is not recognized (valid: $(KBUILD_OSES)))
+ endif
+endif
+
+ifndef KBUILD_TARGET_ARCH
+ KBUILD_TARGET_ARCH := $(KBUILD_HOST_ARCH)
+else
+ ifneq (.$(words $(KBUILD_TARGET_ARCH)).$(KBUILD_TARGET_ARCH).,.1.$(strip $(KBUILD_TARGET_ARCH)).)
+  $(error kBuild: The KBUILD_TARGET_ARCH value '$(KBUILD_TARGET_ARCH)' contains spaces/tabs!)
+ endif
+ ifneq ($(words $(filter $(KBUILD_TARGET_ARCH),$(KBUILD_ARCHES))),1)
+  $(error kBuild: KBUILD_TARGET_ARCH value '$(KBUILD_TARGET_ARCH)' is not recognized (valid: $(KBUILD_ARCHES)))
+ endif
+endif
+
+ifndef KBUILD_TARGET_CPU
+ KBUILD_TARGET_CPU := $(KBUILD_HOST_CPU)
+else ifeq ($(strip $(KBUILD_TARGET_CPU)),)
+ ifeq ($(KBUILD_TARGET_ARCH),$(KBUILD_HOST_ARCH))
+  KBUILD_TARGET_CPU := $(KBUILD_HOST_CPU)
  else
-  BUILD_TARGET_CPU := blend
- endif
-else
- ifneq (.$(words $(BUILD_TARGET_CPU)).$(BUILD_TARGET_CPU).,.1.$(strip $(BUILD_TARGET_CPU)).)
-  $(error kBuild: The BUILD_TARGET_CPU value '$(BUILD_TARGET_CPU)' contains spaces/tabs!)
- endif
- if1of ($(BUILD_TARGET_CPU), $(KBUILD_OSES) $(BUILD_ARCHES))
-  $(error kBuild: The BUILD_TARGET_CPU value was found in the OS or architecture keywords!)
- endif
- ifeq ($(BUILD_TARGET_CPU),$(BUILD_TYPE))
-  $(error kBuild: The BUILD_TARGET_CPU value '$(BUILD_TARGET_CPU)' is the same as the BUILD_TYPE!)
+  KBUILD_TARGET_CPU := blend
+ endif
+else
+ ifneq (.$(words $(KBUILD_TARGET_CPU)).$(KBUILD_TARGET_CPU).,.1.$(strip $(KBUILD_TARGET_CPU)).)
+  $(error kBuild: The KBUILD_TARGET_CPU value '$(KBUILD_TARGET_CPU)' contains spaces/tabs!)
+ endif
+ if1of ($(KBUILD_TARGET_CPU), $(KBUILD_OSES) $(BUILD_ARCHES))
+  $(error kBuild: The KBUILD_TARGET_CPU value was found in the OS or architecture keywords!)
+ endif
+ ifeq ($(KBUILD_TARGET_CPU),$(KBUILD_TYPE))
+  $(error kBuild: The KBUILD_TARGET_CPU value '$(KBUILD_TARGET_CPU)' is the same as the KBUILD_TYPE!)
  endif
 endif
@@ -292,8 +371,8 @@
 endif
 ifndef PATH_OUT
- ifdef BUILD_TARGET_SUB # (BUILD_TARGET_SUB is not currently recognized by kBuild in any other places.)
-  PATH_OUT          := $(PATH_OUT_BASE)/$(BUILD_TARGET).$(BUILD_TARGET_ARCH).$(BUILD_TARGET_SUB)/$(BUILD_TYPE)
+ ifdef BUILD_TARGET_SUB # (BUILD_TARGET_SUB is not currently recognized by kBuild in any other places - obsolete)
+  PATH_OUT          := $(PATH_OUT_BASE)/$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH).$(BUILD_TARGET_SUB)/$(KBUILD_TYPE)
  else
-  PATH_OUT          := $(PATH_OUT_BASE)/$(BUILD_TARGET).$(BUILD_TARGET_ARCH)/$(BUILD_TYPE)
+  PATH_OUT          := $(PATH_OUT_BASE)/$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)/$(KBUILD_TYPE)
  endif
 endif # !define PATH_OUT
@@ -308,17 +387,23 @@
 PATH_DOC             = $(PATH_INS)/doc
 
-# PATH_KBUILD is determined by kmk.
-ifeq ($(strip $(PATH_KBUILD)),)
- $(error kBuild: PATH_KBUILD is missing or empty! kmk is supposed to set it.)
-endif
-# PATH_KBUILD_BIN is determined by kmk.
-ifeq ($(strip $(PATH_KBUILD_BIN)),)
- $(error kBuild: PATH_KBUILD_BIN is missing or empty! kmk is supposed to set it.)
+# KBUILD_PATH / PATH_KBUILD is determined by kmk.
+ifndef KBUILD_PATH
+ KBUILD_PATH := $(PATH_KBUILD)
+endif
+ifeq ($(strip $(KBUILD_PATH)),)
+ $(error kBuild: KBUILD_PATH is missing or empty! kmk is supposed to set it.)
+endif
+# KBUILD_BIN_PATH / PATH_KBUILD_BIN is determined by kmk.
+ifndef KBUILD_BIN_PATH
+ KBUILD_BIN_PATH := $(PATH_KBUILD_BIN)
+endif
+ifeq ($(strip $(KBUILD_BIN_PATH)),)
+ $(error kBuild: KBUILD_BIN_PATH is missing or empty! kmk is supposed to set it.)
 endif
 
 # kBuild files which might be of interest.
-FILE_KBUILD_HEADER  := $(PATH_KBUILD)/header.kmk
-#FILE_KBUILD_CONFIG  := $(PATH_KBUILD)/config.kmk
-FILE_KBUILD_FOOTER  := $(PATH_KBUILD)/footer.kmk
+FILE_KBUILD_HEADER  := $(KBUILD_PATH)/header.kmk
+#FILE_KBUILD_CONFIG  := $(KBUILD_PATH)/config.kmk
+FILE_KBUILD_FOOTER  := $(KBUILD_PATH)/footer.kmk
 
 ## MAKEFILE is the name of the main makefile.
@@ -335,5 +420,5 @@
 
 # OS/2
-ifeq ($(BUILD_PLATFORM),os2)
+ifeq ($(KBUILD_HOST),os2)
 EXEC_X86_WIN32      := innopec.exe
 HOSTSUFF_EXE        := .exe
@@ -341,5 +426,5 @@
 
 # Linux
-ifeq ($(BUILD_PLATFORM),linux)
+ifeq ($(KBUILD_HOST),linux)
 EXEC_X86_WIN32      := wine
 HOSTSUFF_EXE        :=
@@ -347,5 +432,5 @@
 
 # Win, Win32, Win64, NT.
-if1of ($(BUILD_PLATFORM), win nt)
+if1of ($(KBUILD_HOST), win nt)
 EXEC_X86_WIN32      :=
 HOSTSUFF_EXE        := .exe
@@ -353,5 +438,5 @@
 
 # FreeBSD
-ifeq ($(BUILD_PLATFORM),freebsd)
+ifeq ($(KBUILD_HOST),freebsd)
 EXEC_X86_WIN32      := wine
 HOSTSUFF_EXE        :=
@@ -359,5 +444,5 @@
 
 # Darwin / Mac OS X
-ifeq ($(BUILD_PLATFORM),darwin)
+ifeq ($(KBUILD_HOST),darwin)
 EXEC_X86_WIN32      := false
 HOSTSUFF_EXE        :=
@@ -365,5 +450,5 @@
 
 # Solaris
-ifeq ($(BUILD_PLATFORM),solaris)
+ifeq ($(KBUILD_HOST),solaris)
 EXEC_X86_WIN32      := false
 HOSTSUFF_EXE        :=
@@ -376,5 +461,5 @@
 #
 SUFF_DEP    := .dep
-if1of ($(BUILD_TARGET), win nt os2)
+if1of ($(KBUILD_TARGET), win nt os2)
 SUFF_OBJ    := .obj
 SUFF_LIB    := .lib
@@ -383,5 +468,5 @@
 SUFF_SYS    := .sys
 SUFF_RES    := .res
-else ifeq ($(BUILD_TARGET),l4)
+else ifeq ($(KBUILD_TARGET),l4)
 SUFF_OBJ    := .o
 SUFF_LIB    := .a
@@ -390,5 +475,5 @@
 SUFF_SYS    := .a
 SUFF_RES    :=
-else ifeq ($(BUILD_TARGET),darwin)
+else ifeq ($(KBUILD_TARGET),darwin)
 SUFF_OBJ    := .o
 SUFF_LIB    := .a
@@ -402,5 +487,5 @@
 SUFF_DLL    := .so
 SUFF_EXE    :=
- if1of ($(BUILD_TARGET), freebsd linux netbsd openbsd) ## @todo check netbsd and openbsd.
+ if1of ($(KBUILD_TARGET), freebsd linux netbsd openbsd) ## @todo check netbsd and openbsd.
 SUFF_SYS    := .ko
  else
@@ -414,11 +499,11 @@
 #
 ifeq ($(KMK),kmk)
-KMK         := $(PATH_KBUILD_BIN)/kmk$(HOSTSUFF_EXE)
+KMK         := $(KBUILD_BIN_PATH)/kmk$(HOSTSUFF_EXE)
 endif
 MAKE        := $(KMK)
 
-GMAKE       := $(PATH_KBUILD_BIN)/kmk_gmake$(HOSTSUFF_EXE)
-
-DEP_EXT     := $(PATH_KBUILD_BIN)/kDep$(HOSTSUFF_EXE)
+GMAKE       := $(KBUILD_BIN_PATH)/kmk_gmake$(HOSTSUFF_EXE)
+
+DEP_EXT     := $(KBUILD_BIN_PATH)/kDep$(HOSTSUFF_EXE)
 if1of (kDep, $(KMK_BUILTIN))
 DEP         := kmk_builtin_kDep
@@ -427,5 +512,5 @@
 endif
 
-DEP_IDB_EXT := $(PATH_KBUILD_BIN)/kDepIDB$(HOSTSUFF_EXE)
+DEP_IDB_EXT := $(KBUILD_BIN_PATH)/kDepIDB$(HOSTSUFF_EXE)
 if1of (kDepIDB, $(KMK_BUILTIN))
 DEP_IDB     := kmk_builtin_kDepIDB
@@ -434,5 +519,5 @@
 endif
 
-DEP_PRE_EXT := $(PATH_KBUILD_BIN)/kDepPre$(HOSTSUFF_EXE)
+DEP_PRE_EXT := $(KBUILD_BIN_PATH)/kDepPre$(HOSTSUFF_EXE)
 if1of (kDepPre, $(KMK_BUILTIN))
 DEP_PRE     := kmk_builtin_kDepPre
@@ -441,5 +526,5 @@
 endif
 
-KOBJCACHE_EXT := $(PATH_KBUILD_BIN)/kObjCache$(HOSTSUFF_EXE)
+KOBJCACHE_EXT := $(KBUILD_BIN_PATH)/kObjCache$(HOSTSUFF_EXE)
 if1of (kObjCache, $(KMK_BUILTIN))
 KOBJCACHE   := kmk_builtin_kObjCache
@@ -448,38 +533,38 @@
 endif
 
-APPEND_EXT  := $(PATH_KBUILD_BIN)/kmk_append$(HOSTSUFF_EXE)
+APPEND_EXT  := $(KBUILD_BIN_PATH)/kmk_append$(HOSTSUFF_EXE)
 APPEND      := kmk_builtin_append
 
-CAT_EXT     := $(PATH_KBUILD_BIN)/kmk_cat$(HOSTSUFF_EXE)
+CAT_EXT     := $(KBUILD_BIN_PATH)/kmk_cat$(HOSTSUFF_EXE)
 CAT         := kmk_builtin_cat
 
-CMP_EXT     := $(PATH_KBUILD_BIN)/kmk_cmp$(HOSTSUFF_EXE)
+CMP_EXT     := $(KBUILD_BIN_PATH)/kmk_cmp$(HOSTSUFF_EXE)
 CMP         := kmk_builtin_cmp
 
-CP_EXT      := $(PATH_KBUILD_BIN)/kmk_cp$(HOSTSUFF_EXE)
+CP_EXT      := $(KBUILD_BIN_PATH)/kmk_cp$(HOSTSUFF_EXE)
 CP          := kmk_builtin_cp
 
-ECHO_EXT    := $(PATH_KBUILD_BIN)/kmk_echo$(HOSTSUFF_EXE)
+ECHO_EXT    := $(KBUILD_BIN_PATH)/kmk_echo$(HOSTSUFF_EXE)
 ECHO        := kmk_builtin_echo
 
-INSTALL_EXT := $(PATH_KBUILD_BIN)/kmk_install$(HOSTSUFF_EXE)
+INSTALL_EXT := $(KBUILD_BIN_PATH)/kmk_install$(HOSTSUFF_EXE)
 INSTALL     := kmk_builtin_install
 
-LN_EXT      := $(PATH_KBUILD_BIN)/kmk_ln$(HOSTSUFF_EXE)
+LN_EXT      := $(KBUILD_BIN_PATH)/kmk_ln$(HOSTSUFF_EXE)
 LN          := kmk_builtin_ln
 
-MD5SUM_EXT  := $(PATH_KBUILD_BIN)/kmk_md5sum$(HOSTSUFF_EXE)
+MD5SUM_EXT  := $(KBUILD_BIN_PATH)/kmk_md5sum$(HOSTSUFF_EXE)
 MD5SUM      := kmk_builtin_md5sum
 
-MKDIR_EXT   := $(PATH_KBUILD_BIN)/kmk_mkdir$(HOSTSUFF_EXE)
+MKDIR_EXT   := $(KBUILD_BIN_PATH)/kmk_mkdir$(HOSTSUFF_EXE)
 MKDIR       := kmk_builtin_mkdir
 
-MV_EXT      := $(PATH_KBUILD_BIN)/kmk_mv$(HOSTSUFF_EXE)
+MV_EXT      := $(KBUILD_BIN_PATH)/kmk_mv$(HOSTSUFF_EXE)
 MV          := kmk_builtin_mv
 
-PRINTF_EXT  := $(PATH_KBUILD_BIN)/kmk_printf$(HOSTSUFF_EXE)
+PRINTF_EXT  := $(KBUILD_BIN_PATH)/kmk_printf$(HOSTSUFF_EXE)
 PRINTF      := kmk_builtin_printf
 
-REDIRECT_EXT:= $(PATH_KBUILD_BIN)/kmk_redirect$(HOSTSUFF_EXE)
+REDIRECT_EXT:= $(KBUILD_BIN_PATH)/kmk_redirect$(HOSTSUFF_EXE)
 if1of (redirect, $(KMK_BUILTIN))
 REDIRECT    := kmk_builtin_redirect
@@ -488,11 +573,11 @@
 endif
 
-RM_EXT      := $(PATH_KBUILD_BIN)/kmk_rm$(HOSTSUFF_EXE)
+RM_EXT      := $(KBUILD_BIN_PATH)/kmk_rm$(HOSTSUFF_EXE)
 RM          := kmk_builtin_rm
 
-RMDIR_EXT   := $(PATH_KBUILD_BIN)/kmk_rmdir$(HOSTSUFF_EXE)
+RMDIR_EXT   := $(KBUILD_BIN_PATH)/kmk_rmdir$(HOSTSUFF_EXE)
 RMDIR       := kmk_builtin_rmdir
 
-SED_EXT     := $(PATH_KBUILD_BIN)/kmk_sed$(HOSTSUFF_EXE)
+SED_EXT     := $(KBUILD_BIN_PATH)/kmk_sed$(HOSTSUFF_EXE)
 if1of (sed, $(KMK_BUILTIN))
 SED_INT     := kmk_builtin_sed
@@ -502,9 +587,9 @@
 SED         := $(SED_EXT)
 
-TEST_EXT    := $(PATH_KBUILD_BIN)/kmk_test$(HOSTSUFF_EXE)
+TEST_EXT    := $(KBUILD_BIN_PATH)/kmk_test$(HOSTSUFF_EXE)
 TEST        := kmk_builtin_test
 
 # Our default shell is the Almquist shell from *BSD.
-ASH         := $(PATH_KBUILD_BIN)/kmk_ash$(HOSTSUFF_EXE)
+ASH         := $(KBUILD_BIN_PATH)/kmk_ash$(HOSTSUFF_EXE)
 MAKESHELL   := $(ASH)
 SHELL       := $(ASH)
@@ -1028,5 +1113,5 @@
 
 else
- _KBUILD_MSG_STYLE_FILE := $(firstword $(foreach path, $(KBUILD_MSG_STYLE_PATHS) $(PATH_KBUILD)/msgstyles, $(wildcard $(path)/$(KBUILD_MSG_STYLE).kmk)))
+ _KBUILD_MSG_STYLE_FILE := $(firstword $(foreach path, $(KBUILD_MSG_STYLE_PATHS) $(KBUILD_PATH)/msgstyles, $(wildcard $(path)/$(KBUILD_MSG_STYLE).kmk)))
  ifneq ($(_KBUILD_MSG_STYLE_FILE),)
   include $(_KBUILD_MSG_STYLE_FILE)
@@ -1079,5 +1164,5 @@
 
 #
-# Validate any KBUILD_BLD_TYPES additions and finally the BUILD_TYPE.
+# Validate any KBUILD_BLD_TYPES additions and finally the KBUILD_TYPE.
 #
 if1of ($(KBUILD_BLD_TYPES), $(KBUILD_OSES))
@@ -1090,6 +1175,6 @@
  $(error kBuild: found KBUILD_OSES in KBUILD_ARCHES!)
 endif
-ifn1of ($(BUILD_TYPE), $(KBUILD_BLD_TYPES))
- $(error kBuild: BUILD_TYPE(=$(BUILD_TYPE)) is not found in KBUILD_BLD_TYPES(=$(KBUILD_BLD_TYPES))!)
+ifn1of ($(KBUILD_TYPE), $(KBUILD_BLD_TYPES))
+ $(error kBuild: KBUILD_TYPE(=$(KBUILD_TYPE)) is not found in KBUILD_BLD_TYPES(=$(KBUILD_BLD_TYPES))!)
 endif
 
Index: /trunk/kBuild/sdks/DXSDK.kmk
===================================================================
--- /trunk/kBuild/sdks/DXSDK.kmk	(revision 1503)
+++ /trunk/kBuild/sdks/DXSDK.kmk	(revision 1504)
@@ -2,5 +2,5 @@
 ## @file
 #
-# kBuild SDK - The Microsoft Direct X SDK, targeting $(BUILD_TARGET).
+# kBuild SDK - The Microsoft Direct X SDK, targeting $(KBUILD_TARGET).
 #
 # Copyright (c) 2006-2007 knut st. osmundsen <bird-kBuild-spam@anduin.net>
@@ -25,5 +25,5 @@
 #
 
-SDK_DXSDK := The Microsoft Direct X SDK, targeting $(BUILD_TARGET)
+SDK_DXSDK := The Microsoft Direct X SDK, targeting $(KBUILD_TARGET)
 
 # SDK Specific Properties
@@ -53,5 +53,5 @@
 PATH_SDK_DXSDK_LIB.x86 ?= $(PATH_SDK_DXSDK)/Lib/x86
 PATH_SDK_DXSDK_LIB.amd64 ?= $(PATH_SDK_DXSDK)/Lib/x64
-PATH_SDK_DXSDK_LIB ?= $(PATH_SDK_DXSDK_LIB.$(BUILD_TARGET_ARCH))
+PATH_SDK_DXSDK_LIB ?= $(PATH_SDK_DXSDK_LIB.$(KBUILD_TARGET_ARCH))
 
 # General Properties used by kBuild
Index: /trunk/kBuild/sdks/LIBSDL.kmk
===================================================================
--- /trunk/kBuild/sdks/LIBSDL.kmk	(revision 1503)
+++ /trunk/kBuild/sdks/LIBSDL.kmk	(revision 1504)
@@ -2,5 +2,5 @@
 ## @file
 #
-# kBuild SDK - Simple DirectMedia Layer, targeting $(BUILD_TARGET).
+# kBuild SDK - Simple DirectMedia Layer, targeting $(KBUILD_TARGET).
 #
 # Copyright (c) 2006-2007 knut st. osmundsen <bird-kBuild-spam@anduin.net>
@@ -25,5 +25,5 @@
 #
 
-SDK_LIBSDL := Simple DirectMedia Layer, targeting $(BUILD_TARGET).
+SDK_LIBSDL := Simple DirectMedia Layer, targeting $(KBUILD_TARGET).
 
 # SDK Specific Properties
@@ -39,5 +39,5 @@
 
   # Darwin might have a framework for it.
-  ifeq ($(BUILD_TARGET),darwin)
+  ifeq ($(KBUILD_TARGET),darwin)
    PATH_SDK_LIBSDL := $(firstword $(wildcard \
 	/System/Library/Frameworks/SDL.frameworks/SDL \
@@ -52,5 +52,5 @@
   ifeq ($(PATH_SDK_LIBSDL),)
    # Search in the typical unix places.
-   ifeq ($(filter-out %64,$(BUILD_TARGET_ARCH)),)
+   ifeq ($(filter-out %64,$(KBUILD_TARGET_ARCH)),)
     PATH_SDK_LIBSDL := $(firstword $(wildcard \
 	/lib64/libSDL.* \
@@ -93,5 +93,5 @@
 else
  PATH_SDK_LIBSDL := $(PATH_SDK_LIBSDL)
- ifeq ($(BUILD_TARGET),darwin)
+ ifeq ($(KBUILD_TARGET),darwin)
   # Check if it's the framework or not.
   _SDK_LIBSDK_IS_FRAMEWORK := $(if $(wildcard $(PATH_SDK_LIBSDL)/Headers/SDL.h),yes)
@@ -103,5 +103,5 @@
 # varies quite a bit, thus this kludge.
 #
-ifeq ($(BUILD_TARGET),os2)
+ifeq ($(KBUILD_TARGET),os2)
  LIB_SDK_LIBSDL_SDLMAIN  ?=
  DLL_SDK_LIBSDL_SDL      ?= $(PATH_SDK_LIBSDL)/SDL/SDL12.dll
@@ -132,5 +132,5 @@
  	$(PATH_SDK_LIBSDL)/SDLTTF
 
-else ifeq ($(BUILD_TARGET),win) # ASSUMES VC++ on windows, sorry.
+else ifeq ($(KBUILD_TARGET),win) # ASSUMES VC++ on windows, sorry.
  LIB_SDK_LIBSDL_SDLMAIN  ?= $(PATH_SDK_LIBSDL)/lib/SDLmain.lib
  LIB_SDK_LIBSDL_SDL      ?= $(PATH_SDK_LIBSDL)/lib/SDL.lib
@@ -152,5 +152,5 @@
  	$(PATH_SDK_LIBSDL)/lib
 
-else ifeq ($(BUILD_TARGET).$(_SDK_LIBSDK_IS_FRAMEWORK),darwin.yes)
+else ifeq ($(KBUILD_TARGET).$(_SDK_LIBSDK_IS_FRAMEWORK),darwin.yes)
  # darwin + framework
  LIB_SDK_LIBSDL_SDLMAIN  ?= $(NO_SUCH_VARIABLE)
Index: /trunk/kBuild/sdks/W2K3DDK.kmk
===================================================================
--- /trunk/kBuild/sdks/W2K3DDK.kmk	(revision 1503)
+++ /trunk/kBuild/sdks/W2K3DDK.kmk	(revision 1504)
@@ -2,5 +2,5 @@
 ## @file
 #
-# kBuild SDK - The Microsoft Windows 2003 DDK, targeting $(BUILD_TARGET).
+# kBuild SDK - The Microsoft Windows 2003 DDK, targeting $(KBUILD_TARGET).
 #
 # Copyright (c) 2006-2007 knut st. osmundsen <bird-kBuild-spam@anduin.net>
@@ -25,5 +25,5 @@
 #
 
-SDK_W2K3DDK := The Microsoft Windows 2003 DDK, targeting $(BUILD_TARGET).
+SDK_W2K3DDK := The Microsoft Windows 2003 DDK, targeting $(KBUILD_TARGET).
 
 # SDK Specific Properties
@@ -60,5 +60,5 @@
 PATH_SDK_W2K3DDK_LIB.amd64 ?= $(PATH_SDK_W2K3DDK)/lib/wnet/AMD64
 PATH_SDK_W2K3DDK_LIB.x86 ?= $(PATH_SDK_W2K3DDK)/lib/wnet/i386
-PATH_SDK_W2K3DDK_LIB ?= $(PATH_SDK_W2K3DDK_LIB.$(BUILD_TARGET_ARCH))
+PATH_SDK_W2K3DDK_LIB ?= $(PATH_SDK_W2K3DDK_LIB.$(KBUILD_TARGET_ARCH))
 
 # General Properties used by kBuild
Index: /trunk/kBuild/sdks/WINPSDK.kmk
===================================================================
--- /trunk/kBuild/sdks/WINPSDK.kmk	(revision 1503)
+++ /trunk/kBuild/sdks/WINPSDK.kmk	(revision 1504)
@@ -2,5 +2,5 @@
 ## @file
 #
-# kBuild SDK - The Windows Platform SDK, targeting (BUILD_TARGET).
+# kBuild SDK - The Windows Platform SDK, targeting (KBUILD_TARGET).
 #
 # Copyright (c) 2006-2007 knut st. osmundsen <bird-kBuild-spam@anduin.net>
@@ -25,5 +25,5 @@
 #
 
-SDK_WINPSDK := The Windows Platform SDK, targeting (BUILD_TARGET).
+SDK_WINPSDK := The Windows Platform SDK, targeting (KBUILD_TARGET).
 
 # SDK Specific Properties
@@ -62,5 +62,5 @@
 PATH_SDK_WINPSDK_LIB.amd64 := $(firstword $(wildcard $(PATH_SDK_WINPSDK)/[Ll][Ii][Bb]/[Aa][Mm][Dd]64 $(PATH_SDK_WINPSDK)/[Ll][Ii][Bb]/[xX]64) $(PATH_SDK_WINPSDK)/Lib/AMD64)
 endif
-PATH_SDK_WINPSDK_LIB ?= $(PATH_SDK_WINPSDK_LIB.$(BUILD_TARGET_ARCH))
+PATH_SDK_WINPSDK_LIB ?= $(PATH_SDK_WINPSDK_LIB.$(KBUILD_TARGET_ARCH))
 
 ifndef PATH_SDK_WINPSDK_BIN
Index: /trunk/kBuild/sdks/WINPSDKINCS.kmk
===================================================================
--- /trunk/kBuild/sdks/WINPSDKINCS.kmk	(revision 1503)
+++ /trunk/kBuild/sdks/WINPSDKINCS.kmk	(revision 1504)
@@ -2,5 +2,5 @@
 ## @file
 #
-# kBuild SDK - The Windows Platform SDK, targeting (BUILD_TARGET) but
+# kBuild SDK - The Windows Platform SDK, targeting (KBUILD_TARGET) but
 #              without any libraries or LIBPATH properties.
 #              Basically for finding specstrings.h when using the DDK.
@@ -27,5 +27,5 @@
 #
 
-SDK_WINPSDKINCS := The Windows Platform SDK, targeting (BUILD_TARGET) but \
+SDK_WINPSDKINCS := The Windows Platform SDK, targeting (KBUILD_TARGET) but \
 	without any library or LIBPATH properties. \
 	Basically for finding specstrings.h when using the DDK.
@@ -69,5 +69,5 @@
 PATH_SDK_WINPSDKINCS_LIB.amd64 := $(firstword $(wildcard $(PATH_SDK_WINPSDKINCS)/[Ll][Ii][Bb]/[Aa][Mm][Dd]64) $(PATH_SDK_WINPSDKINCS)/Lib/AMD64)
 endif
-PATH_SDK_WINPSDKINCS_LIB ?= $(PATH_SDK_WINPSDKINCS_LIB.$(BUILD_TARGET_ARCH))
+PATH_SDK_WINPSDKINCS_LIB ?= $(PATH_SDK_WINPSDKINCS_LIB.$(KBUILD_TARGET_ARCH))
 
 ifndef PATH_SDK_WINPSDKINCS_BIN
Index: /trunk/kBuild/tools/GCC.kmk
===================================================================
--- /trunk/kBuild/tools/GCC.kmk	(revision 1503)
+++ /trunk/kBuild/tools/GCC.kmk	(revision 1504)
@@ -36,8 +36,8 @@
 TOOL_GCC_LDFLAGS.dll.os2 ?= -Zdll
 TOOL_GCC_LDFLAGS.dll.darwin ?= -dynamiclib
-ifndef TOOL_GCC_LDFLAGS.$(BUILD_TARGET)
+ifndef TOOL_GCC_LDFLAGS.$(KBUILD_TARGET)
 TOOL_GCC_LDFLAGS.dll ?= -shared
 else
-TOOL_GCC_LDFLAGS.dll ?= $(TOOL_GCC_LDFLAGS.$(BUILD_TARGET))
+TOOL_GCC_LDFLAGS.dll ?= $(TOOL_GCC_LDFLAGS.$(KBUILD_TARGET))
 endif
 
Index: /trunk/kBuild/tools/GCC3.kmk
===================================================================
--- /trunk/kBuild/tools/GCC3.kmk	(revision 1503)
+++ /trunk/kBuild/tools/GCC3.kmk	(revision 1504)
@@ -31,10 +31,10 @@
 TOOL_GCC3_CXX ?= g++$(HOSTSUFF_EXE)
 TOOL_GCC3_AS  ?= gcc$(HOSTSUFF_EXE)
-ifeq ($(BUILD_TARGET),solaris) ## @todo drop the MRI script!
+ifeq ($(KBUILD_TARGET),solaris) ## @todo drop the MRI script!
  TOOL_GCC3_AR ?= gar$(HOSTSUFF_EXE)
 else
  TOOL_GCC3_AR ?= ar$(HOSTSUFF_EXE)
 endif
-ifeq ($(BUILD_TARGET),os2)
+ifeq ($(KBUILD_TARGET),os2)
  TOOL_GCC3_AR_IMP ?= emximp$(HOSTSTUFF_EXE)
 else
@@ -43,12 +43,12 @@
 TOOL_GCC3_LD ?= gcc$(HOSTSUFF_EXE)
 TOOL_GCC3_LD_SYSMOD ?= ld$(HOSTSUFF_EXE)
-ifndef TOOL_GCC3_LDFLAGS.$(BUILD_TARGET)
+ifndef TOOL_GCC3_LDFLAGS.$(KBUILD_TARGET)
  TOOL_GCC3_LDFLAGS.dll ?= -shared
 else
- TOOL_GCC3_LDFLAGS.dll ?= $(TOOL_GCC3_LDFLAGS.$(BUILD_TARGET))
+ TOOL_GCC3_LDFLAGS.dll ?= $(TOOL_GCC3_LDFLAGS.$(KBUILD_TARGET))
 endif
 TOOL_GCC3_LDFLAGS.sysmod ?= -r
-TOOL_GCC3_LD_SONAME ?= -Wl,-soname=$(firstword $($(1)_SONAME.$(BUILD_TARGET).$(BUILD_TYPE)) $($(1)_SONAME.$(BUILD_TARGET)) $($(1)_SONAME.$(BUILD_TYPE)) $($(1)_SONAME) $(notdir $(2)))
-ifeq ($(BUILD_TARGET),os2)
+TOOL_GCC3_LD_SONAME ?= -Wl,-soname=$(firstword $($(1)_SONAME.$(KBUILD_TARGET).$(KBUILD_TYPE)) $($(1)_SONAME.$(KBUILD_TARGET)) $($(1)_SONAME.$(KBUILD_TYPE)) $($(1)_SONAME) $(notdir $(2)))
+ifeq ($(KBUILD_TARGET),os2)
  TOOL_GCC3_LD_MAP ?= -Zmap=$(1)
  TOOL_GCC3_LD_SYSMOD_MAP ?= -Zmap=$(1)
@@ -274,5 +274,5 @@
 define TOOL_GCC3_LINK_DLL_CMDS
 	$(QUIET)$(TOOL_GCC3_LD) $(TOOL_GCC3_LDFLAGS.dll) $(flags) -o $(out)\
-		$(if $(filter-out win32 os2, $(BUILD_TARGET)),$(call TOOL_GCC3_LD_SONAME,$(target),$(out)))\
+		$(if $(filter-out win32 os2, $(KBUILD_TARGET)),$(call TOOL_GCC3_LD_SONAME,$(target),$(out)))\
 		$(objs)\
 		$(filter %.def, $(othersrc))\
Index: /trunk/kBuild/tools/GCC32.kmk
===================================================================
--- /trunk/kBuild/tools/GCC32.kmk	(revision 1503)
+++ /trunk/kBuild/tools/GCC32.kmk	(revision 1504)
@@ -35,17 +35,17 @@
 TOOL_GCC32_LD  ?= gcc$(HOSTSUFF_EXE) -m32
 TOOL_GCC32_LD_SYSMOD ?= ld$(HOSTSUFF_EXE)
-ifndef TOOL_GCC32_LDFLAGS.$(BUILD_TARGET)
+ifndef TOOL_GCC32_LDFLAGS.$(KBUILD_TARGET)
 TOOL_GCC32_LDFLAGS.dll ?= -shared
 else
-TOOL_GCC32_LDFLAGS.dll ?= $(TOOL_GCC32_LDFLAGS.$(BUILD_TARGET))
+TOOL_GCC32_LDFLAGS.dll ?= $(TOOL_GCC32_LDFLAGS.$(KBUILD_TARGET))
 endif
 TOOL_GCC32_LDFLAGS.sysmod ?= -r -m elf_i386
-TOOL_GCC32_LD_SONAME ?= -Wl,-soname=$(firstword $($(1)_SONAME.$(BUILD_TARGET).$(BUILD_TYPE)) $($(1)_SONAME.$(BUILD_TARGET)) $($(1)_SONAME.$(BUILD_TYPE)) $($(1)_SONAME) $(notdir $(2)))
-ifeq ($(BUILD_TARGET),os2)
+TOOL_GCC32_LD_SONAME ?= -Wl,-soname=$(firstword $($(1)_SONAME.$(KBUILD_TARGET).$(KBUILD_TYPE)) $($(1)_SONAME.$(KBUILD_TARGET)) $($(1)_SONAME.$(KBUILD_TYPE)) $($(1)_SONAME) $(notdir $(2)))
+ifeq ($(KBUILD_TARGET),os2)
 TOOL_GCC32_LD_MAP ?= -Zmap=$(1)
 else
 TOOL_GCC32_LD_MAP ?= -Wl,-Map -Wl,$(1) -Wl,--cref
 endif
-ifeq ($(BUILD_TARGET),os2)
+ifeq ($(KBUILD_TARGET),os2)
 TOOL_GCC32_LD_SYSMOD_MAP ?= -Zmap=$(1)
 else
@@ -266,5 +266,5 @@
 define TOOL_GCC32_LINK_DLL_CMDS
 	$(QUIET)$(TOOL_GCC32_LD) $(TOOL_GCC32_LDFLAGS.dll) $(flags) -o $(out)\
-		$(if $(filter-out win os2, $(BUILD_TARGET)),$(call TOOL_GCC32_LD_SONAME,$(target),$(out)))\
+		$(if $(filter-out win os2, $(KBUILD_TARGET)),$(call TOOL_GCC32_LD_SONAME,$(target),$(out)))\
 		$(objs)\
 		$(foreach p,$(libpath), -L$(p))\
Index: /trunk/kBuild/tools/GCC3OMF.kmk
===================================================================
--- /trunk/kBuild/tools/GCC3OMF.kmk	(revision 1503)
+++ /trunk/kBuild/tools/GCC3OMF.kmk	(revision 1504)
@@ -35,8 +35,8 @@
 TOOL_GCC3OMF_LD ?= gcc$(HOSTSUFF_EXE)
 TOOL_GCC3OMF_LD_SYSMOD ?= gcc$(HOSTSUFF_EXE)
-ifndef TOOL_GCC3OMF_LDFLAGS.$(BUILD_TARGET)
+ifndef TOOL_GCC3OMF_LDFLAGS.$(KBUILD_TARGET)
 TOOL_GCC3OMF_LDFLAGS.dll ?= -shared -Zdll
 else
-TOOL_GCC3OMF_LDFLAGS.dll ?= $(TOOL_GCC3OMF_LDFLAGS.$(BUILD_TARGET))
+TOOL_GCC3OMF_LDFLAGS.dll ?= $(TOOL_GCC3OMF_LDFLAGS.$(KBUILD_TARGET))
 endif
 TOOL_GCC3OMF_LDFLAGS.sysmod ?= -nostdlib
Index: /trunk/kBuild/tools/GCC3PLAIN.kmk
===================================================================
--- /trunk/kBuild/tools/GCC3PLAIN.kmk	(revision 1503)
+++ /trunk/kBuild/tools/GCC3PLAIN.kmk	(revision 1504)
@@ -38,17 +38,17 @@
 TOOL_GCC3PLAIN_LDFLAGS.dll.os2 ?= -Zdll
 TOOL_GCC3PLAIN_LDFLAGS.dll.darwin ?= -dynamiclib
-ifndef TOOL_GCC3PLAIN_LDFLAGS.$(BUILD_TARGET)
+ifndef TOOL_GCC3PLAIN_LDFLAGS.$(KBUILD_TARGET)
  TOOL_GCC3PLAIN_LDFLAGS.dll ?= -shared
 else
- TOOL_GCC3PLAIN_LDFLAGS.dll ?= $(TOOL_GCC3PLAIN_LDFLAGS.$(BUILD_TARGET))
+ TOOL_GCC3PLAIN_LDFLAGS.dll ?= $(TOOL_GCC3PLAIN_LDFLAGS.$(KBUILD_TARGET))
 endif
 TOOL_GCC3PLAIN_LD_SONAME.darwin ?= $(NO_SUCH_VARIABLE)
 TOOL_GCC3PLAIN_LD_SONAME.os2 ?= $(NO_SUCH_VARIABLE)
-TOOL_GCC3PLAIN_LD_SONAME.solaris ?= -Wl,-h,$(firstword $($(1)_SONAME.$(BUILD_TARGET).$(BUILD_TYPE)) $($(1)_SONAME.$(BUILD_TARGET)) $($(1)_SONAME.$(BUILD_TYPE)) $($(1)_SONAME) $(notdir $(2)))
+TOOL_GCC3PLAIN_LD_SONAME.solaris ?= -Wl,-h,$(firstword $($(1)_SONAME.$(KBUILD_TARGET).$(KBUILD_TYPE)) $($(1)_SONAME.$(KBUILD_TARGET)) $($(1)_SONAME.$(KBUILD_TYPE)) $($(1)_SONAME) $(notdir $(2)))
 TOOL_GCC3PLAIN_LD_SONAME.win ?= $(NO_SUCH_VARIABLE)
-ifndef TOOL_GCC3PLAIN_LD_SONAME.$(BUILD_TARGET)
- TOOL_GCC3PLAIN_LD_SONAME ?= -Wl,-soname=$(firstword $($(1)_SONAME.$(BUILD_TARGET).$(BUILD_TYPE)) $($(1)_SONAME.$(BUILD_TARGET)) $($(1)_SONAME.$(BUILD_TYPE)) $($(1)_SONAME) $(notdir $(2)))
+ifndef TOOL_GCC3PLAIN_LD_SONAME.$(KBUILD_TARGET)
+ TOOL_GCC3PLAIN_LD_SONAME ?= -Wl,-soname=$(firstword $($(1)_SONAME.$(KBUILD_TARGET).$(KBUILD_TYPE)) $($(1)_SONAME.$(KBUILD_TARGET)) $($(1)_SONAME.$(KBUILD_TYPE)) $($(1)_SONAME) $(notdir $(2)))
 else
- TOOL_GCC3PLAIN_LD_SONAME ?= $(TOOL_GCC3PLAIN_LD_SONAME.$(BUILD_TARGET))
+ TOOL_GCC3PLAIN_LD_SONAME ?= $(TOOL_GCC3PLAIN_LD_SONAME.$(KBUILD_TARGET))
 endif
 ifdef SLKRUNS
@@ -269,5 +269,5 @@
 define TOOL_GCC3PLAIN_LINK_DLL_CMDS
 	$(QUIET)$(TOOL_GCC3PLAIN_LD) $(TOOL_GCC3PLAIN_LDFLAGS.dll) $(flags) -o $(out)\
-		$(if $(filter-out win32 os2, $(BUILD_TARGET)),$(call TOOL_GCC3PLAIN_LD_SONAME,$(target),$(out)))\
+		$(if $(filter-out win32 os2, $(KBUILD_TARGET)),$(call TOOL_GCC3PLAIN_LD_SONAME,$(target),$(out)))\
 		$(objs)\
 		$(filter %.def, $(othersrc))\
Index: /trunk/kBuild/tools/GCC4MACHO.kmk
===================================================================
--- /trunk/kBuild/tools/GCC4MACHO.kmk	(revision 1503)
+++ /trunk/kBuild/tools/GCC4MACHO.kmk	(revision 1504)
@@ -34,11 +34,11 @@
 TOOL_GCC4MACHO_LD  ?= gcc$(HOSTSUFF_EXE)
 TOOL_GCC4MACHO_LD_SYSMOD ?= gcc$(HOSTSUFF_EXE)
-ifndef TOOL_GCC4MACHO_LDFLAGS.$(BUILD_TARGET)
+ifndef TOOL_GCC4MACHO_LDFLAGS.$(KBUILD_TARGET)
 TOOL_GCC4MACHO_LDFLAGS.dll ?= -dynamiclib
 else
-TOOL_GCC4MACHO_LDFLAGS.dll ?= $(TOOL_GCC4MACHO_LDFLAGS.$(BUILD_TARGET))
+TOOL_GCC4MACHO_LDFLAGS.dll ?= $(TOOL_GCC4MACHO_LDFLAGS.$(KBUILD_TARGET))
 endif
 TOOL_GCC4MACHO_LDFLAGS.sysmod ?= -r
-#TOOL_GCC4MACHO_LD_SONAME = -Wl,-dylib_install_name $(firstword $($(1)_SONAME.$(BUILD_TARGET).$(BUILD_TYPE)) $($(1)_SONAME.$(BUILD_TARGET)) $($(1)_SONAME.$(BUILD_TYPE)) $($(1)_SONAME) $(notdir $(2)))
+#TOOL_GCC4MACHO_LD_SONAME = -Wl,-dylib_install_name $(firstword $($(1)_SONAME.$(KBUILD_TARGET).$(KBUILD_TYPE)) $($(1)_SONAME.$(KBUILD_TARGET)) $($(1)_SONAME.$(KBUILD_TYPE)) $($(1)_SONAME) $(notdir $(2)))
 
 ifdef SLKRUNS
Index: /trunk/kBuild/tools/GCC64.kmk
===================================================================
--- /trunk/kBuild/tools/GCC64.kmk	(revision 1503)
+++ /trunk/kBuild/tools/GCC64.kmk	(revision 1504)
@@ -35,17 +35,17 @@
 TOOL_GCC64_LD  ?= gcc$(HOSTSUFF_EXE) -m64
 TOOL_GCC64_LD_SYSMOD ?= ld$(HOSTSUFF_EXE)
-ifndef TOOL_GCC64_LDFLAGS.$(BUILD_TARGET)
+ifndef TOOL_GCC64_LDFLAGS.$(KBUILD_TARGET)
 TOOL_GCC64_LDFLAGS.dll ?= -shared
 else
-TOOL_GCC64_LDFLAGS.dll ?= $(TOOL_GCC64_LDFLAGS.$(BUILD_TARGET))
+TOOL_GCC64_LDFLAGS.dll ?= $(TOOL_GCC64_LDFLAGS.$(KBUILD_TARGET))
 endif
 TOOL_GCC64_LDFLAGS.sysmod ?= -r -m elf_x86_64
-TOOL_GCC64_LD_SONAME ?= -Wl,-soname=$(firstword $($(1)_SONAME.$(BUILD_TARGET).$(BUILD_TYPE)) $($(1)_SONAME.$(BUILD_TARGET)) $($(1)_SONAME.$(BUILD_TYPE)) $($(1)_SONAME) $(notdir $(2)))
-ifeq ($(BUILD_TARGET),os2)
+TOOL_GCC64_LD_SONAME ?= -Wl,-soname=$(firstword $($(1)_SONAME.$(KBUILD_TARGET).$(KBUILD_TYPE)) $($(1)_SONAME.$(KBUILD_TARGET)) $($(1)_SONAME.$(KBUILD_TYPE)) $($(1)_SONAME) $(notdir $(2)))
+ifeq ($(KBUILD_TARGET),os2)
 TOOL_GCC64_LD_MAP ?= -Zmap=$(1)
 else
 TOOL_GCC64_LD_MAP ?= -Wl,-Map -Wl,$(1) -Wl,--cref
 endif
-ifeq ($(BUILD_TARGET),os2)
+ifeq ($(KBUILD_TARGET),os2)
 TOOL_GCC64_LD_SYSMOD_MAP ?= -Zmap=$(1)
 else
@@ -266,5 +266,5 @@
 define TOOL_GCC64_LINK_DLL_CMDS
 	$(QUIET)$(TOOL_GCC64_LD) $(TOOL_GCC64_LDFLAGS.dll) $(flags) -o $(out)\
-		$(if $(filter-out win os2, $(BUILD_TARGET)),$(call TOOL_GCC64_LD_SONAME,$(target),$(out)))\
+		$(if $(filter-out win os2, $(KBUILD_TARGET)),$(call TOOL_GCC64_LD_SONAME,$(target),$(out)))\
 		$(objs)\
 		$(foreach p,$(libpath), -L$(p))\
Index: /trunk/kBuild/tools/GXX.kmk
===================================================================
--- /trunk/kBuild/tools/GXX.kmk	(revision 1503)
+++ /trunk/kBuild/tools/GXX.kmk	(revision 1504)
@@ -36,8 +36,8 @@
 TOOL_GXX_LDFLAGS.dll.os2 ?= -Zdll
 TOOL_GXX_LDFLAGS.dll.darwin ?= -dynamiclib
-ifndef TOOL_GXX_LDFLAGS.$(BUILD_TARGET)
+ifndef TOOL_GXX_LDFLAGS.$(KBUILD_TARGET)
 TOOL_GXX_LDFLAGS.dll ?= -shared
 else
-TOOL_GXX_LDFLAGS.dll ?= $(TOOL_GXX_LDFLAGS.$(BUILD_TARGET))
+TOOL_GXX_LDFLAGS.dll ?= $(TOOL_GXX_LDFLAGS.$(KBUILD_TARGET))
 endif
 
Index: /trunk/kBuild/tools/GXX3.kmk
===================================================================
--- /trunk/kBuild/tools/GXX3.kmk	(revision 1503)
+++ /trunk/kBuild/tools/GXX3.kmk	(revision 1504)
@@ -31,10 +31,10 @@
 TOOL_GXX3_CXX ?= g++$(HOSTSUFF_EXE)
 TOOL_GXX3_AS  ?= gcc$(HOSTSUFF_EXE)
-ifeq ($(BUILD_TARGET),solaris)
+ifeq ($(KBUILD_TARGET),solaris)
  TOOL_GXX3_AR ?= gar$(HOSTSUFF_EXE)
 else
  TOOL_GXX3_AR ?= ar$(HOSTSUFF_EXE)
 endif
-ifeq ($(BUILD_TARGET),os2)
+ifeq ($(KBUILD_TARGET),os2)
  TOOL_GXX3_AR_IMP ?= emximp$(HOSTSTUFF_EXE)
 else
@@ -43,12 +43,12 @@
 TOOL_GXX3_LD ?= g++$(HOSTSUFF_EXE)
 TOOL_GXX3_LD_SYSMOD ?= ld$(HOSTSUFF_EXE)
-ifndef TOOL_GXX3_LDFLAGS.$(BUILD_TARGET)
+ifndef TOOL_GXX3_LDFLAGS.$(KBUILD_TARGET)
  TOOL_GXX3_LDFLAGS.dll ?= -shared
 else
- TOOL_GXX3_LDFLAGS.dll ?= $(TOOL_GXX3_LDFLAGS.$(BUILD_TARGET))
+ TOOL_GXX3_LDFLAGS.dll ?= $(TOOL_GXX3_LDFLAGS.$(KBUILD_TARGET))
 endif
 TOOL_GXX3_LDFLAGS.sysmod ?= -r
-TOOL_GXX3_LD_SONAME ?= -Wl,-soname=$(firstword $($(1)_SONAME.$(BUILD_TARGET).$(BUILD_TYPE)) $($(1)_SONAME.$(BUILD_TARGET)) $($(1)_SONAME.$(BUILD_TYPE)) $($(1)_SONAME) $(notdir $(2)))
-ifeq ($(BUILD_TARGET),os2)
+TOOL_GXX3_LD_SONAME ?= -Wl,-soname=$(firstword $($(1)_SONAME.$(KBUILD_TARGET).$(KBUILD_TYPE)) $($(1)_SONAME.$(KBUILD_TARGET)) $($(1)_SONAME.$(KBUILD_TYPE)) $($(1)_SONAME) $(notdir $(2)))
+ifeq ($(KBUILD_TARGET),os2)
  TOOL_GXX3_LD_MAP ?= -Zmap=$(1)
  TOOL_GXX3_LD_SYSMOD_MAP ?= -Zmap=$(1)
@@ -274,5 +274,5 @@
 define TOOL_GXX3_LINK_DLL_CMDS
 	$(QUIET)$(TOOL_GXX3_LD) $(TOOL_GXX3_LDFLAGS.dll) $(flags) -o $(out)\
-		$(if $(filter-out win32 os2, $(BUILD_TARGET)),$(call TOOL_GXX3_LD_SONAME,$(target),$(out)))\
+		$(if $(filter-out win32 os2, $(KBUILD_TARGET)),$(call TOOL_GXX3_LD_SONAME,$(target),$(out)))\
 		$(objs)\
 		$(filter %.def, $(othersrc))\
Index: /trunk/kBuild/tools/GXX32.kmk
===================================================================
--- /trunk/kBuild/tools/GXX32.kmk	(revision 1503)
+++ /trunk/kBuild/tools/GXX32.kmk	(revision 1504)
@@ -35,17 +35,17 @@
 TOOL_GXX32_LD  ?= g++$(HOSTSUFF_EXE) -m32
 TOOL_GXX32_LD_SYSMOD ?= ld$(HOSTSUFF_EXE)
-ifndef TOOL_GXX32_LDFLAGS.$(BUILD_TARGET)
+ifndef TOOL_GXX32_LDFLAGS.$(KBUILD_TARGET)
 TOOL_GXX32_LDFLAGS.dll ?= -shared
 else
-TOOL_GXX32_LDFLAGS.dll ?= $(TOOL_GXX32_LDFLAGS.$(BUILD_TARGET))
+TOOL_GXX32_LDFLAGS.dll ?= $(TOOL_GXX32_LDFLAGS.$(KBUILD_TARGET))
 endif
 TOOL_GXX32_LDFLAGS.sysmod ?= -r -m elf_i386
-TOOL_GXX32_LD_SONAME ?= -Wl,-soname=$(firstword $($(1)_SONAME.$(BUILD_TARGET).$(BUILD_TYPE)) $($(1)_SONAME.$(BUILD_TARGET)) $($(1)_SONAME.$(BUILD_TYPE)) $($(1)_SONAME) $(notdir $(2)))
-ifeq ($(BUILD_TARGET),os2)
+TOOL_GXX32_LD_SONAME ?= -Wl,-soname=$(firstword $($(1)_SONAME.$(KBUILD_TARGET).$(KBUILD_TYPE)) $($(1)_SONAME.$(KBUILD_TARGET)) $($(1)_SONAME.$(KBUILD_TYPE)) $($(1)_SONAME) $(notdir $(2)))
+ifeq ($(KBUILD_TARGET),os2)
 TOOL_GXX32_LD_MAP ?= -Zmap=$(1)
 else
 TOOL_GXX32_LD_MAP ?= -Wl,-Map -Wl,$(1) -Wl,--cref
 endif
-ifeq ($(BUILD_TARGET),os2)
+ifeq ($(KBUILD_TARGET),os2)
 TOOL_GXX32_LD_SYSMOD_MAP ?= -Zmap=$(1)
 else
@@ -265,5 +265,5 @@
 define TOOL_GXX32_LINK_DLL_CMDS
 	$(QUIET)$(TOOL_GXX32_LD) $(TOOL_GXX32_LDFLAGS.dll) $(flags) -o $(out)\
-		$(if $(filter-out win os2, $(BUILD_TARGET)),$(call TOOL_GXX32_LD_SONAME,$(target),$(out)))\
+		$(if $(filter-out win os2, $(KBUILD_TARGET)),$(call TOOL_GXX32_LD_SONAME,$(target),$(out)))\
 		$(objs)\
 		$(foreach p,$(libpath), -L$(p))\
Index: /trunk/kBuild/tools/GXX3OMF.kmk
===================================================================
--- /trunk/kBuild/tools/GXX3OMF.kmk	(revision 1503)
+++ /trunk/kBuild/tools/GXX3OMF.kmk	(revision 1504)
@@ -35,8 +35,8 @@
 TOOL_GXX3OMF_LD ?= g++$(HOSTSUFF_EXE)
 TOOL_GXX3OMF_LD_SYSMOD ?= g++$(HOSTSUFF_EXE)
-ifndef TOOL_GXX3OMF_LDFLAGS.$(BUILD_TARGET)
+ifndef TOOL_GXX3OMF_LDFLAGS.$(KBUILD_TARGET)
 TOOL_GXX3OMF_LDFLAGS.dll ?= -shared -Zdll
 else
-TOOL_GXX3OMF_LDFLAGS.dll ?= $(TOOL_GXX3OMF_LDFLAGS.$(BUILD_TARGET))
+TOOL_GXX3OMF_LDFLAGS.dll ?= $(TOOL_GXX3OMF_LDFLAGS.$(KBUILD_TARGET))
 endif
 TOOL_GXX3OMF_LDFLAGS.sysmod ?= -nostdlib
Index: /trunk/kBuild/tools/GXX3PLAIN.kmk
===================================================================
--- /trunk/kBuild/tools/GXX3PLAIN.kmk	(revision 1503)
+++ /trunk/kBuild/tools/GXX3PLAIN.kmk	(revision 1504)
@@ -38,17 +38,17 @@
 TOOL_GXX3PLAIN_LDFLAGS.dll.os2 ?= -Zdll
 TOOL_GXX3PLAIN_LDFLAGS.dll.darwin ?= -dynamiclib
-ifndef TOOL_GXX3PLAIN_LDFLAGS.$(BUILD_TARGET)
+ifndef TOOL_GXX3PLAIN_LDFLAGS.$(KBUILD_TARGET)
  TOOL_GXX3PLAIN_LDFLAGS.dll ?= -shared
 else
- TOOL_GXX3PLAIN_LDFLAGS.dll ?= $(TOOL_GXX3PLAIN_LDFLAGS.$(BUILD_TARGET))
+ TOOL_GXX3PLAIN_LDFLAGS.dll ?= $(TOOL_GXX3PLAIN_LDFLAGS.$(KBUILD_TARGET))
 endif
 TOOL_GXX3PLAIN_LD_SONAME.darwin ?= $(NO_SUCH_VARIABLE)
 TOOL_GXX3PLAIN_LD_SONAME.os2 ?= $(NO_SUCH_VARIABLE)
-TOOL_GXX3PLAIN_LD_SONAME.solaris ?= -Wl,-h,$(firstword $($(1)_SONAME.$(BUILD_TARGET).$(BUILD_TYPE)) $($(1)_SONAME.$(BUILD_TARGET)) $($(1)_SONAME.$(BUILD_TYPE)) $($(1)_SONAME) $(notdir $(2)))
+TOOL_GXX3PLAIN_LD_SONAME.solaris ?= -Wl,-h,$(firstword $($(1)_SONAME.$(KBUILD_TARGET).$(KBUILD_TYPE)) $($(1)_SONAME.$(KBUILD_TARGET)) $($(1)_SONAME.$(KBUILD_TYPE)) $($(1)_SONAME) $(notdir $(2)))
 TOOL_GXX3PLAIN_LD_SONAME.win ?= $(NO_SUCH_VARIABLE)
-ifndef TOOL_GXX3PLAIN_LD_SONAME.$(BUILD_TARGET)
- TOOL_GXX3PLAIN_LD_SONAME ?= -Wl,-soname=$(firstword $($(1)_SONAME.$(BUILD_TARGET).$(BUILD_TYPE)) $($(1)_SONAME.$(BUILD_TARGET)) $($(1)_SONAME.$(BUILD_TYPE)) $($(1)_SONAME) $(notdir $(2)))
+ifndef TOOL_GXX3PLAIN_LD_SONAME.$(KBUILD_TARGET)
+ TOOL_GXX3PLAIN_LD_SONAME ?= -Wl,-soname=$(firstword $($(1)_SONAME.$(KBUILD_TARGET).$(KBUILD_TYPE)) $($(1)_SONAME.$(KBUILD_TARGET)) $($(1)_SONAME.$(KBUILD_TYPE)) $($(1)_SONAME) $(notdir $(2)))
 else
- TOOL_GXX3PLAIN_LD_SONAME ?= $(TOOL_GXX3PLAIN_LD_SONAME.$(BUILD_TARGET))
+ TOOL_GXX3PLAIN_LD_SONAME ?= $(TOOL_GXX3PLAIN_LD_SONAME.$(KBUILD_TARGET))
 endif
 ifdef SLKRUNS
@@ -269,5 +269,5 @@
 define TOOL_GXX3PLAIN_LINK_DLL_CMDS
 	$(QUIET)$(TOOL_GXX3PLAIN_LD) $(TOOL_GXX3PLAIN_LDFLAGS.dll) $(flags) -o $(out)\
-		$(if $(filter-out win32 os2, $(BUILD_TARGET)),$(call TOOL_GXX3PLAIN_LD_SONAME,$(target),$(out)))\
+		$(if $(filter-out win32 os2, $(KBUILD_TARGET)),$(call TOOL_GXX3PLAIN_LD_SONAME,$(target),$(out)))\
 		$(objs)\
 		$(filter %.def, $(othersrc))\
Index: /trunk/kBuild/tools/GXX4MACHO.kmk
===================================================================
--- /trunk/kBuild/tools/GXX4MACHO.kmk	(revision 1503)
+++ /trunk/kBuild/tools/GXX4MACHO.kmk	(revision 1504)
@@ -34,11 +34,11 @@
 TOOL_GXX4MACHO_LD  ?= g++$(HOSTSUFF_EXE)
 TOOL_GXX4MACHO_LD_SYSMOD ?= g++$(HOSTSUFF_EXE)
-ifndef TOOL_GXX4MACHO_LDFLAGS.$(BUILD_TARGET)
+ifndef TOOL_GXX4MACHO_LDFLAGS.$(KBUILD_TARGET)
 TOOL_GXX4MACHO_LDFLAGS.dll ?= -dynamiclib
 else
-TOOL_GXX4MACHO_LDFLAGS.dll ?= $(TOOL_GXX4MACHO_LDFLAGS.$(BUILD_TARGET))
+TOOL_GXX4MACHO_LDFLAGS.dll ?= $(TOOL_GXX4MACHO_LDFLAGS.$(KBUILD_TARGET))
 endif
 TOOL_GXX4MACHO_LDFLAGS.sysmod ?= -r
-#TOOL_GXX4MACHO_LD_SONAME = -Wl,-dylib_install_name $(firstword $($(1)_SONAME.$(BUILD_TARGET).$(BUILD_TYPE)) $($(1)_SONAME.$(BUILD_TARGET)) $($(1)_SONAME.$(BUILD_TYPE)) $($(1)_SONAME) $(notdir $(2)))
+#TOOL_GXX4MACHO_LD_SONAME = -Wl,-dylib_install_name $(firstword $($(1)_SONAME.$(KBUILD_TARGET).$(KBUILD_TYPE)) $($(1)_SONAME.$(KBUILD_TARGET)) $($(1)_SONAME.$(KBUILD_TYPE)) $($(1)_SONAME) $(notdir $(2)))
 
 ifdef SLKRUNS
Index: /trunk/kBuild/tools/GXX64.kmk
===================================================================
--- /trunk/kBuild/tools/GXX64.kmk	(revision 1503)
+++ /trunk/kBuild/tools/GXX64.kmk	(revision 1504)
@@ -35,17 +35,17 @@
 TOOL_GXX64_LD  ?= g++$(HOSTSUFF_EXE) -m64
 TOOL_GXX64_LD_SYSMOD ?= ld$(HOSTSUFF_EXE)
-ifndef TOOL_GXX64_LDFLAGS.$(BUILD_TARGET)
+ifndef TOOL_GXX64_LDFLAGS.$(KBUILD_TARGET)
 TOOL_GXX64_LDFLAGS.dll ?= -shared
 else
-TOOL_GXX64_LDFLAGS.dll ?= $(TOOL_GXX64_LDFLAGS.$(BUILD_TARGET))
+TOOL_GXX64_LDFLAGS.dll ?= $(TOOL_GXX64_LDFLAGS.$(KBUILD_TARGET))
 endif
 TOOL_GXX64_LDFLAGS.sysmod ?= -r -m elf_x86_64
-TOOL_GXX64_LD_SONAME ?= -Wl,-soname=$(firstword $($(1)_SONAME.$(BUILD_TARGET).$(BUILD_TYPE)) $($(1)_SONAME.$(BUILD_TARGET)) $($(1)_SONAME.$(BUILD_TYPE)) $($(1)_SONAME) $(notdir $(2)))
-ifeq ($(BUILD_TARGET),os2)
+TOOL_GXX64_LD_SONAME ?= -Wl,-soname=$(firstword $($(1)_SONAME.$(KBUILD_TARGET).$(KBUILD_TYPE)) $($(1)_SONAME.$(KBUILD_TARGET)) $($(1)_SONAME.$(KBUILD_TYPE)) $($(1)_SONAME) $(notdir $(2)))
+ifeq ($(KBUILD_TARGET),os2)
 TOOL_GXX64_LD_MAP ?= -Zmap=$(1)
 else
 TOOL_GXX64_LD_MAP ?= -Wl,-Map -Wl,$(1) -Wl,--cref
 endif
-ifeq ($(BUILD_TARGET),os2)
+ifeq ($(KBUILD_TARGET),os2)
 TOOL_GXX64_LD_SYSMOD_MAP ?= -Zmap=$(1)
 else
@@ -265,5 +265,5 @@
 define TOOL_GXX64_LINK_DLL_CMDS
 	$(QUIET)$(TOOL_GXX64_LD) $(TOOL_GXX64_LDFLAGS.dll) $(flags) -o $(out)\
-		$(if $(filter-out win os2, $(BUILD_TARGET)),$(call TOOL_GXX64_LD_SONAME,$(target),$(out)))\
+		$(if $(filter-out win os2, $(KBUILD_TARGET)),$(call TOOL_GXX64_LD_SONAME,$(target),$(out)))\
 		$(objs)\
 		$(foreach p,$(libpath), -L$(p))\
Index: /trunk/kBuild/tools/MINGW32.kmk
===================================================================
--- /trunk/kBuild/tools/MINGW32.kmk	(revision 1503)
+++ /trunk/kBuild/tools/MINGW32.kmk	(revision 1504)
@@ -52,5 +52,5 @@
   TOOL_MINGW32_PREFIX :=
  endif
- ifneq ($(BUILD_PLATFORM),win)
+ ifneq ($(KBUILD_HOST),win)
   # we're cross compiling either using an emulator (wine/odin) or a cross compiler.
   ifneq ($(PATH_TOOL_MINGW32),$(subst /win.x86,,$(subst /x86.win,,$(PATH_TOOL_MINGW32))))
Index: /trunk/kBuild/tools/TAR.kmk
===================================================================
--- /trunk/kBuild/tools/TAR.kmk	(revision 1503)
+++ /trunk/kBuild/tools/TAR.kmk	(revision 1504)
@@ -55,5 +55,5 @@
 TOOL_TAR_UNPACK_DEPEND =
 TOOL_TAR_UNPACK_DEPORD =
-ifeq ($(BUILD_PLATFORM),win) # hacking with buggy unxutils on windows. it doesn't like driver letters.
+ifeq ($(KBUILD_HOST),win) # hacking with buggy unxutils on windows. it doesn't like driver letters.
 define TOOL_TAR_UNPACK_CMDS
 	$(QUIET)$(TOOL_TAR_UNPACK) -x $(flags) -C $(subst G:,,$(inst)) -f $(archive)
Index: /trunk/kBuild/tools/VCC80.kmk
===================================================================
--- /trunk/kBuild/tools/VCC80.kmk	(revision 1503)
+++ /trunk/kBuild/tools/VCC80.kmk	(revision 1504)
@@ -2,5 +2,5 @@
 ## @file
 #
-# kBuild Tool Config - Visual C++ 8.0 (aka Visual .NET 2005, or MSC v14), targeting $(BUILD_TARGET).
+# kBuild Tool Config - Visual C++ 8.0 (aka Visual .NET 2005, or MSC v14), targeting $(KBUILD_TARGET).
 #
 # Copyright (c) 2004-2007 knut st. osmundsen <fbird-kBuild-spam@anduin.net>
@@ -25,5 +25,5 @@
 #
 
-TOOL_VCC80 := Visual C++ 8.0 (aka Visual .NET 2005, or MSC v14), targeting $(BUILD_TARGET).
+TOOL_VCC80 := Visual C++ 8.0 (aka Visual .NET 2005, or MSC v14), targeting $(KBUILD_TARGET).
 
 # Tool Specific Properties
@@ -48,5 +48,5 @@
 endif
 ifneq ($(PATH_TOOL_VCC80),)
- ifeq ($(BUILD_PLATFORM).$(BUILD_PLATFORM_ARCH),win.amd64)
+ ifeq ($(KBUILD_HOST).$(KBUILD_HOST_ARCH),win.amd64)
  PATH_TOOL_VCC80_BIN.amd64 ?= $(PATH_TOOL_VCC80)/bin/amd64
  else
@@ -54,8 +54,8 @@
  endif
  PATH_TOOL_VCC80_BIN.x86   ?= $(PATH_TOOL_VCC80)/bin
- PATH_TOOL_VCC80_BIN       ?= $(PATH_TOOL_VCC80_BIN.$(BUILD_TARGET))
+ PATH_TOOL_VCC80_BIN       ?= $(PATH_TOOL_VCC80_BIN.$(KBUILD_TARGET))
  PATH_TOOL_VCC80_LIB.amd64 ?= $(PATH_TOOL_VCC80)/lib/amd64
  PATH_TOOL_VCC80_LIB.x86   ?= $(PATH_TOOL_VCC80)/lib
- PATH_TOOL_VCC80_LIB       ?= $(PATH_TOOL_VCC80_LIB.$(BUILD_TARGET))
+ PATH_TOOL_VCC80_LIB       ?= $(PATH_TOOL_VCC80_LIB.$(KBUILD_TARGET))
  PATH_TOOL_VCC80_INC       ?= $(PATH_TOOL_VCC80)/include
  PATH_TOOL_VCC80_ATLMFC    ?= $(PATH_TOOL_VCC80X86)/atlmfc
@@ -63,5 +63,5 @@
  PATH_TOOL_VCC80_ATLMFC_LIB.amd64 ?= $(PATH_TOOL_VCC80_ATLMFC)/lib
  PATH_TOOL_VCC80_ATLMFC_LIB.x86   ?= $(PATH_TOOL_VCC80_ATLMFC)/lib/amd64
- PATH_TOOL_VCC80_ATLMFC_LIB       ?= $(PATH_TOOL_VCC80_ATLMFC_LIB.$(BUILD_TARGET))
+ PATH_TOOL_VCC80_ATLMFC_LIB       ?= $(PATH_TOOL_VCC80_ATLMFC_LIB.$(KBUILD_TARGET))
  TOOL_VCC80_CC  ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC80_BIN)/cl.exe
  TOOL_VCC80_CXX ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC80_BIN)/cl.exe
Index: /trunk/kBuild/tools/VCC80AMD64.kmk
===================================================================
--- /trunk/kBuild/tools/VCC80AMD64.kmk	(revision 1503)
+++ /trunk/kBuild/tools/VCC80AMD64.kmk	(revision 1504)
@@ -49,5 +49,5 @@
  PATH_TOOL_VCC80AMD64 := $(PATH_TOOL_VCC80AMD64)
 endif
-ifeq ($(BUILD_PLATFORM).$(BUILD_PLATFORM_ARCH),win.amd64)
+ifeq ($(KBUILD_HOST).$(KBUILD_HOST_ARCH),win.amd64)
 PATH_TOOL_VCC80AMD64_BIN ?= $(PATH_TOOL_VCC80AMD64)/bin/amd64
 else
Index: /trunk/kBuild/tools/XGCCAMD64LINUX.kmk
===================================================================
--- /trunk/kBuild/tools/XGCCAMD64LINUX.kmk	(revision 1503)
+++ /trunk/kBuild/tools/XGCCAMD64LINUX.kmk	(revision 1504)
@@ -29,5 +29,5 @@
 # Tool Specific Properties
 TOOL_XGCCAMD64LINUX_HOSTSUFF_EXE ?= $(HOSTSUFF_EXE)
-ifeq ($(BUILD_PLATFORM).$(BUILD_PLATFORM_ARCH),linux.amd64)
+ifeq ($(KBUILD_HOST).$(KBUILD_HOST_ARCH),linux.amd64)
  # not x-compile, use the default gcc.
  TOOL_XGCCAMD64LINUX_PREFIX := $(TOOL_XGCCAMD64LINUX_PREFIX)
@@ -39,5 +39,5 @@
    PATH_TOOL_XGCCAMD64LINUX := $(sort $(wildcard $(PATH_DEVTOOLS_BLD)/x86_64-unknown-linux-gnu/*))
    ifeq ($(PATH_TOOL_XGCCAMD64LINUX),)
-    ifeq ($(filter-out win.amd64,$(BUILD_PLATFORM).$(BUILD_PLATFORM_ARCH)),) # these can use the windows build.
+    ifeq ($(filter-out win.amd64,$(KBUILD_HOST).$(KBUILD_HOST_ARCH)),) # these can use the windows build.
      TOOL_XGCCAMD64LINUX_EXEC_PREFIX ?= $(EXEC_X86_WIN32)
      TOOL_XGCCAMD64LINUX_HOSTSUFF_EXE := .exe
@@ -68,5 +68,5 @@
 TOOL_XGCCAMD64LINUX_LD_SYSMOD ?= $(TOOL_XGCCAMD64LINUX_PREFIX)ld$(TOOL_XGCCAMD64LINUX_HOSTSUFF_EXE)
 
-TOOL_XGCCAMD64LINUX_LD_SONAME ?= -Wl,-soname=$(firstword $($(1)_SONAME.$(BUILD_TARGET).$(BUILD_TYPE)) $($(1)_SONAME.$(BUILD_TARGET)) $($(1)_SONAME.$(BUILD_TYPE)) $($(1)_SONAME) $(notdir $(2)))
+TOOL_XGCCAMD64LINUX_LD_SONAME ?= -Wl,-soname=$(firstword $($(1)_SONAME.$(KBUILD_TARGET).$(KBUILD_TYPE)) $($(1)_SONAME.$(KBUILD_TARGET)) $($(1)_SONAME.$(KBUILD_TYPE)) $($(1)_SONAME) $(notdir $(2)))
 TOOL_XGCCAMD64LINUX_LD_MAP ?= -Wl,-Map -Wl,$(1) -Wl,--cref
 TOOL_XGCCAMD64LINUX_LD_SYSMOD_MAP ?= -Map $(1) --cref
@@ -247,5 +247,5 @@
 define TOOL_XGCCAMD64LINUX_LINK_DLL_CMDS
 	$(QUIET)$(TOOL_XGCCAMD64LINUX_LD) $(TOOL_XGCCAMD64LINUX_LDFLAGS.dll) $(flags) -o $(out)\
-		$(if $(filter-out win32 os2, $(BUILD_TARGET)),$(call TOOL_XGCCAMD64LINUX_LD_SONAME,$(target),$(out)))\
+		$(if $(filter-out win32 os2, $(KBUILD_TARGET)),$(call TOOL_XGCCAMD64LINUX_LD_SONAME,$(target),$(out)))\
 		$(objs)\
 		$(foreach p,$(libpath), -L$(p))\
