case ${1} in

386)
        cpu="i386"
        objdir="/usr/obj/386"
        kernconf="DINOSAUR DUM386"
        ;;

486)
        cpu="i486"
        objdir="/usr/obj/486"
        kernconf="TP365XD" #"RUNT FIDO PB486"
        ;;

586)
        cpu="i586"
        objdir="/usr/obj/586"
        kernconf="NEO THINKPAD" # SMURF STUCCO
        ;;
k62)
        cpu="k6-2"
        objdir="/usr/obj/k62"
        kernconf="NEUTRON" # BUFF
        ;;
tbird)
        cpu="athlon-tbird"
        objdir="/usr/obj/tbird"
        kernconf="STEALTH"
        ;;
p2)
        cpu="p2"
        objdir="/usr/obj/p2"
        kernconf="FLOP"
        ;;
*)
        echo "No arch supplied."
        exit 1
        ;;

esac

if [ -d ${objdir} ] ; then
	echo "Removing previous build directory..."
	rm -r ${objdir}
fi

echo "Creating build directory..."
mkdir ${objdir}

cd /usr/src

MAKEOBJDIRPREFIX=${objdir} ; export MAKEOBJDIRPREFIX

make KERNCONF="${kernconf}" CPUTYPE="${cpu}" cleandir
make KERNCONF="${kernconf}" CPUTYPE="${cpu}" cleandir
make KERNCONF="${kernconf}" CPUTYPE="${cpu}" clean
make KERNCONF="${kernconf}" CPUTYPE="${cpu}" -j4 buildworld
make KERNCONF="${kernconf}" CPUTYPE="${cpu}" -j4 buildkernel

