Index: /trunk/kBuild/env.sh
===================================================================
--- /trunk/kBuild/env.sh	(revision 991)
+++ /trunk/kBuild/env.sh	(revision 992)
@@ -27,5 +27,7 @@
 #set -x
 
-# kBuild path.
+#
+# Determin the kBuild path from the script location.
+#
 if [ -z "$PATH_KBUILD" ]; then
     PATH_KBUILD=`dirname "$0"`
@@ -40,5 +42,7 @@
 echo "dbg: PATH_KBUILD=$PATH_KBUILD"
 
-# Type.
+#
+# Set default build type.
+#
 if [ -z "$BUILD_TYPE" ]; then
     BUILD_TYPE=release
@@ -47,25 +51,73 @@
 echo "dbg: BUILD_TYPE=$BUILD_TYPE"
 
-
-# Host platform.
-if [ -z "$BUILD_PLATFORM_CPU" ]; then
-    BUILD_PLATFORM_CPU=`uname -m`
-    case "$BUILD_PLATFORM_CPU" in
-        x86_64|AMD64|amd64)
-           BUILD_PLATFORM_CPU='k8'
-           ;;
-    esac
-fi
-export BUILD_PLATFORM_CPU
-echo "dbg: BUILD_PLATFORM_CPU=$BUILD_PLATFORM_CPU"
-
+#
+# Determin the host platform.
+#
+# The CPU isn't important, only the other two are.  But, since the cpu,
+# arch and platform (and build type) share a common key space, try make
+# sure any new additions are unique. (See header.kmk, KBUILD_OSES/ARCHES.)
+#
 if [ -z "$BUILD_PLATFORM_ARCH" ]; then
-    case "$BUILD_PLATFORM_CPU" in
-        i[3456789]86|i86pc)
+    # Try deduce it from the cpu if given.
+    if [ -s "$BUILD_PLATFORM_CPU" ]; then
+        case "$BUILD_PLATFORM_CPU" in
+            i[3456789]86)
+                BUILD_PLATFORM_ARCH='x86'
+                ;;
+            k8|k8l|k9|k10)
+                BUILD_PLATFORM_ARCH='amd64'
+                ;;
+        esac
+    fi
+fi
+if [ -z "$BUILD_PLATFORM_ARCH" ]; then
+    # Use uname (lots of guesses here, please help clean this up...)
+    BUILD_PLATFORM_ARCH=`uname -m`
+    case "$BUILD_PLATFORM_ARCH" in
+        x86_64|AMD64|amd64|k8|k8l|k9|k10)
+            BUILD_PLATFORM_ARCH='amd64'
+            ;;
+        x86|i86pc|ia32|i[3456789]86)
             BUILD_PLATFORM_ARCH='x86'
             ;;
-        k8|k8l|k9|k10)
-            BUILD_PLATFORM_ARCH='amd64'
-            ;;
+        sparc32|sparc)
+            BUILD_PLATFORM_ARCH='sparc32'
+            ;;
+        sparc64)
+            BUILD_PLATFORM_ARCH='sparc64'
+            ;;
+        s390)
+            ## @todo: 31-bit vs 64-bit on the mainframe?
+            BUILD_PLATFORM_ARCH='s390'
+            ;;
+        ppc32|ppc|powerpc)
+            BUILD_PLATFORM_ARCH='ppc32'
+            ;;
+        ppc64|powerpc64)
+            BUILD_PLATFORM_ARCH='ppc64'
+            ;;
+        mips32|mips)
+            BUILD_PLATFORM_ARCH='mips32'
+            ;;
+        mips64)
+            BUILD_PLATFORM_ARCH='mips64'
+            ;;
+        ia64)
+            BUILD_PLATFORM_ARCH='ia64'
+            ;;
+        #hppa32|hppa|parisc32|parisc)?
+        hppa32|parisc32)
+            BUILD_PLATFORM_ARCH='hppa32'
+            ;;
+        hppa64|parisc64)
+            BUILD_PLATFORM_ARCH='hppa64'
+            ;;
+        arm)
+            BUILD_PLATFORM_ARCH='arm'
+            ;;
+        alpha)
+            BUILD_PLATFORM_ARCH='alpha'
+            ;;
+
         *)  echo "$0: unknown cpu/arch - $BUILD_PLATFORM_CPU"
             sleep 1
@@ -78,4 +130,9 @@
 echo "dbg: BUILD_PLATFORM_ARCH=$BUILD_PLATFORM_ARCH"
 
+if [ -s "$BUILD_PLATFORM_CPU" ]; then
+    BUILD_PLATFORM_CPU="blend"
+fi
+export BUILD_PLATFORM_CPU
+echo "dbg: BUILD_PLATFORM_CPU=$BUILD_PLATFORM_CPU"
 
 if [ -z "$BUILD_PLATFORM" ]; then
@@ -125,7 +182,10 @@
 
 
-# Target platform.
+#
+# The target platform.
+# Defaults to the host when not specified.
+#
 if [ -z "$BUILD_TARGET_CPU" ]; then
-    BUILD_TARGET_CPU=$BUILD_PLATFORM_CPU
+    BUILD_TARGET_CPU="$BUILD_PLATFORM_CPU"
 fi
 export BUILD_TARGET_CPU
@@ -133,17 +193,5 @@
 
 if [ -z "$BUILD_TARGET_ARCH" ]; then
-    case "$BUILD_TARGET_CPU" in
-        i[3456789]86|i86pc)
-            BUILD_TARGET_ARCH='x86'
-            ;;
-        k8|k8l|k9|k10)
-            BUILD_TARGET_ARCH='amd64'
-            ;;
-        *)  echo "$0: unknown cpu/arch - $BUILD_TARGET_CPU"
-            sleep 1
-            exit 1
-            ;;
-    esac
-
+    BUILD_TARGET_ARCH="$BUILD_PLATFORM_ARCH"
 fi
 export BUILD_TARGET_ARCH
@@ -151,5 +199,5 @@
 
 if [ -z "$BUILD_TARGET" ]; then
-    BUILD_TARGET=$BUILD_PLATFORM
+    BUILD_TARGET="$BUILD_PLATFORM"
 fi
 export BUILD_TARGET
@@ -161,5 +209,5 @@
 _PATH_SEP=":"
 case "$BUILD_PLATFORM" in
-    os2|win|win32|win64|nt|winnt|win2k|winxp)
+    os2|win|nt)
         _SUFF_EXE=".exe"
         _PATH_SEP=";"
@@ -167,8 +215,11 @@
 esac
 
-# Make shell
+# Make shell. OS/2 and DOS only?
 export MAKESHELL="$PATH_KBUILD/bin/$BUILD_PLATFORM.$BUILD_PLATFORM_ARCH/kmk_ash${_SUFF_EXE}";
 
-# The PATH.
+#
+# Add the bin/x.y/ directory to the PATH.
+# NOTE! Once bootstrapped this is the only thing that is actually necessary.
+#
 PATH="$PATH_KBUILD/bin/$BUILD_PLATFORM.$BUILD_PLATFORM_ARCH/${_PATH_SEP}$PATH"
 export PATH
Index: /trunk/kBuild/header.kmk
===================================================================
--- /trunk/kBuild/header.kmk	(revision 991)
+++ /trunk/kBuild/header.kmk	(revision 992)
@@ -138,5 +138,5 @@
 #
 KBUILD_OSES   := darwin freebsd l4 linux netbsd nt openbsd os2 solaris win
-KBUILD_ARCHES := x86 amd64 sparc32 sparc64 mips32 mips64 ppc32 ppc64
+KBUILD_ARCHES := x86 amd64 sparc32 sparc64 s390 ppc32 ppc64 mips32 mips64 ia64 hppa32 hppa64 arm alpha
 
 
