#! /bin/sh
#
# die quickly if anything goes astray...
set -e

echo '*******************************************************************'
echo '* I hope that you read the relevant documentation and tweaked the *'
echo '* appropriate configuration files _BEFORE_ you started running    *'
echo '* this!                                                           *'
echo '*******************************************************************'

echo ''
echo "*** We don't project-ify or setup-ify this distribution..."
echo ''
PROJECT=none
SETUP=std

# figure out the absolute pathname of the "top" directory
# (the one which has "mkworld", "nofib", "grasp-utils", etc., as subdirs)
hardtop=`pwd`
hardtop=`echo $hardtop | sed 's|^/tmp_mnt||' | sed 's|^/export||' | sed 's|^/grasp_tmp|/local/grasp_tmp|'`
echo ''
echo "*** I decided the top of your build tree is: $hardtop"

#	make all the Makefiles first

for i in mkworld grasp-utils literate ; do
    ( set -e;									\
      cd $i ;									\
      echo '' ;									\
      echo "*** configuring $i ..." ;						\
      make -f Makefile.BOOT BOOT_DEFINES="-P none -S std -DTopDirPwd=$hardtop";	\
      echo '' ;									\
      echo "*** making Makefiles in $i ..." ;					\
      make Makefiles 								\
    )
done

#	now make the dependencies and Real Stuff

for i in mkworld literate grasp-utils ; do
    ( set -e;									\
      cd $i ;									\
      echo '' ;									\
      echo "*** making make dependencies in $i ..." ;				\
      make depend ;								\
      echo '' ;									\
      echo "*** making all in $i ..." ;						\
      make all									\
    )
done

echo ''
echo '*******************************************************************'
echo "* You should be ready to install, test, etc., this system..."
echo "* (Please consult the documentation.)"
echo '*******************************************************************'
exit 0