Index: tools/build
===================================================================
--- tools/build	(revision 7fc2bec150eb1d5e021a646592e99e93dfb4fe7c)
+++ tools/build	(revision 7fc2bec150eb1d5e021a646592e99e93dfb4fe7c)
@@ -0,0 +1,63 @@
+#! /bin/sh
+
+function syntax {
+	echo "Syntax:"
+	echo " build.<arch> [-compiler <compiler>] [-cpu <cpu>] [-machine <machine>]"
+	echo
+	echo "<arch>     ... amd64, ia32, ia64, mips32, ppc32, sparc64"
+	echo "<compiler> ... native, *cross"
+	echo "<cpu>      ... for ia32: athlon-xp, athlon-mp, pentium3, *pentium4, prescott"
+	echo "<machine>  ... for mips32: *msim, msim4kc, simics, lgxemul, bgxemul, indy"
+	echo
+}
+
+ARCH="`basename "$0" | awk -F. '{ if (NF > 1) print \$NF }'`"
+if [ -z "$ARCH" ]; then
+	syntax
+	exit 1
+fi
+
+ARGS=""
+while [ "$#" -gt 0 ]; do
+	case "$1" in
+		-compiler)
+			if [ -z "$2" ]; then
+				syntax
+				exit 1
+			fi
+			ARGS="$ARGS COMPILER=$2"
+			shift
+			;;
+		-cpu)
+			if [ -z "$2" ]; then
+				syntax
+				exit 1
+			fi
+			ARGS="$ARGS CPU=$2"
+			shift
+			;;
+		-machine)
+			if [ -z "$2" ]; then
+				syntax
+				exit 1
+			fi
+			ARGS="$ARGS MACHINE=$2"
+			shift
+			;;
+		*)
+			syntax
+			exit 1
+			;;
+	esac
+	shift
+done
+
+TAG="`svnversion . 2> /dev/null`"
+TIMESTAMP="`date "+%Y-%m-%d %H:%M:%S" 2> /dev/null`"
+if [ -z "$TAG" ] || [ "$TAG" == "exported" ]; then
+	TAG="Built on $TIMESTAMP for $ARCH"
+else
+	TAG="Revision $TAG (built on $TIMESTAMP for $ARCH)"
+fi
+
+make all "ARCH=$ARCH" "TAG=$TAG" $ARGS
Index: tools/clean
===================================================================
--- tools/clean	(revision 7fc2bec150eb1d5e021a646592e99e93dfb4fe7c)
+++ tools/clean	(revision 7fc2bec150eb1d5e021a646592e99e93dfb4fe7c)
@@ -0,0 +1,10 @@
+#! /bin/sh
+
+ARCH="`basename "$0" | awk -F. '{ if (NF > 1) print \$NF }'`"
+if [ -z "$ARCH" ]; then
+	for ARCH in arch/* ; do
+		make clean "ARCH=`basename "$ARCH"`"
+	done
+else
+	make clean "ARCH=$ARCH"
+fi
