#! /bin/sh
#
# top-level bootstrap build script
#
 
TOP=`pwd`
QUAKE=$TOP/quake/SUN386/quake
CONFIG=$TOP/m3build/templates/SUN386
BUILD="$QUAKE -D_bootstrap $CONFIG make.boot"
 
if [ ! -d m3cc ]; then
  echo "Unpack \(gunzip, tar -x\) a copy of m3cc.tar.gz first."
  exit 1
fi
 
echo ------------------------------------------
cat COPYRIGHT
echo ------------------------------------------
 
echo ---- building quake ----
(cd quake/SUN386; make -f ../src/makefile TARGET=SUN386)
 
echo ---- building m3build ----
(cd m3build/SUN386; $QUAKE -D_bootstrap -D_all -DBUILD_DIR=SUN386 -DPACKAGE=m3build -DPACKAGE_DIR=$TOP/m3build $CONFIG $TOP/m3build/src/m3makefile) || exit 1
 
echo ---- building m3core ----
(cd m3core/SUN386; $BUILD) || exit 1
 
echo ---- building libm3 ----
(cd libm3/SUN386; $BUILD) || exit 1
 
echo ---- building m3middle ----
(cd m3middle/SUN386; $BUILD) || exit 1
 
echo ---- building m3front ----
(cd m3front/SUN386; $BUILD) || exit 1
 
echo ---- building m3linker ----
(cd m3linker/SUN386; $BUILD) || exit 1
 
echo ---- building m3 ----
(cd m3/SUN386; $BUILD) || exit 1
 
echo ---- building m3cc ----
if [ ! -d m3cc/SUN386 ]; then
  mkdir m3cc/SUN386
fi
(cd m3cc/SUN386; $QUAKE $CONFIG ../src/m3makefile)
