Files
mercury/bcheck
1995-04-30 11:58:22 +00:00

138 lines
2.6 KiB
Bash
Executable File

#!/bin/sh
set -x
usage="bcheck [-jN] [-o filename]"
jfactor=""
outfile=""
while getopts j:o: flag
do
case $flag in
j) jfactor="-j$OPTARG" ;;
o) outfile=$OPTARG ;;
\\?) echo $usage;
exit 1 ;;
esac
done
shift `expr "$OPTIND" - 1`
if [ $# -ne 0 ]
then
echo $usage
exit 1
fi
if mmake $jfactor all
then
echo "building of stage 1 successful"
else
echo "building of stage 1 not successful"
exit 1
fi
root=`/bin/pwd`
# .pp files are not necessary
[ -d stage2 ] || mkdir stage2
/bin/rm -fr stage2/*
mkdir stage2/compiler
mkdir stage2/library
cp compiler/*.m stage2/compiler
cp compiler/Mmake* stage2/compiler
cp library/*.m stage2/library
cp library/Mmake* stage2/library
ln -s $root/boehm_gc stage2/boehm_gc
ln -s $root/doc stage2/doc
ln -s $root/runtime stage2/runtime
ln -s $root/scripts stage2/scripts
cp Mmake* stage2
MERCURY_COMPILER=$root/compiler/mercury_compile
export MERCURY_COMPILER
MERCURY_INT_DIR=$root/stage2/library
export MERCURY_INT_DIR
if (cd stage2 ; mmake depend)
then
echo "building of stage 2 dependencies successful"
else
echo "building of stage 2 dependencies not successful"
exit 1
fi
if (cd stage2 ; mmake $jfactor library)
then
echo "building of stage 2 library successful"
else
echo "building of stage 2 library not successful"
exit 1
fi
if (cd stage2 ; mmake $jfactor all)
then
echo "building of stage 2 successful"
else
echo "building of stage 2 not successful"
exit 1
fi
# .pp files are not necessary
[ -d stage3 ] || mkdir stage3
/bin/rm -fr stage3/*
mkdir stage3/compiler
mkdir stage3/library
cp compiler/*.m stage3/compiler
cp compiler/Mmake* stage3/compiler
cp library/*.m stage3/library
cp library/Mmake* stage3/library
ln -s $root/boehm_gc stage3/boehm_gc
ln -s $root/doc stage3/doc
ln -s $root/runtime stage3/runtime
ln -s $root/scripts stage3/scripts
cp Mmake* stage3
MERCURY_COMPILER=$root/stage2/compiler/mercury_compile
export MERCURY_COMPILER
MERCURY_INT_DIR=$root/stage3/library
export MERCURY_INT_DIR
if (cd stage3 ; mmake depend)
then
echo "building of stage 3 dependencies successful"
else
echo "building of stage 3 dependencies not successful"
exit 1
fi
if (cd stage3 ; mmake $jfactor library)
then
echo "building of stage 3 library successful"
else
echo "building of stage 3 library not successful"
exit 1
fi
if (cd stage3 ; mmake $jfactor all)
then
echo "building of stage 3 successful"
else
echo "building of stage 3 not successful"
exit 1
fi
if [ -n "$outfile" ]
then
diff stage2/library stage3/library > "$outfile"
diff stage2/compiler stage3/compiler >> "$outfile"
else
diff stage2/library stage3/library
diff stage2/compiler stage3/compiler
fi
exit 0