heptagon/heptc

45 lines
797 B
Plaintext
Raw Normal View History

2010-06-27 18:54:05 +02:00
#!/bin/bash
#Small wrapper to deal with compilation of the compiler and the stdlib.
2010-08-29 23:50:50 +02:00
RUN_DIR=`pwd`
2011-01-12 15:39:47 +01:00
SCRIPT_DIR=$RUN_DIR/`dirname $0`
COMPILER_DIR=$SCRIPT_DIR/compiler
COMPILER=heptc.byte
2011-03-21 14:30:19 +01:00
COMPILER_DEBUG=heptc.d.byte
2011-01-12 15:39:47 +01:00
LIB_DIR=$SCRIPT_DIR/lib
#the symlink
HEPTC=$COMPILER_DIR/$COMPILER
2011-03-21 14:30:19 +01:00
HEPTC_DEBUG=$COMPILER_DIR/$COMPILER_DEBUG
2011-01-12 15:39:47 +01:00
#compile the compiler
if [ ! -x $HEPTC ]
2010-06-27 18:54:05 +02:00
then
2011-03-21 14:30:19 +01:00
if [ -x $HEPTC_DEBUG ]
then
#use the debug
HEPTC=$HEPTC_DEBUG
else
cd $COMPILER_DIR
ocamlbuild -j 0 $COMPILER
cd -
fi
2010-06-27 18:54:05 +02:00
fi
2011-01-12 15:39:47 +01:00
#compile the stdlib
if [ ! -e $LIB_DIR/pervasives.epci ] || [ $HEPTC -nt $LIB_DIR/pervasives.epci ]
2010-06-27 18:54:05 +02:00
then
2011-01-12 15:39:47 +01:00
cd $LIB_DIR
echo "Recompile pervasives.epci"
$HEPTC -nopervasives pervasives.epi
cd -
2010-06-27 18:54:05 +02:00
fi
2011-01-12 15:39:47 +01:00
#call the compiler with the passed arguments.
2010-08-29 23:50:50 +02:00
cd $RUN_DIR
2011-01-12 15:39:47 +01:00
$HEPTC -stdlib $LIB_DIR "$@"