heptagon/heptc

43 lines
844 B
Text
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.
RUN_DIR="`pwd`"
2010-06-27 18:54:05 +02:00
2011-06-27 11:07:14 +02:00
SCRIPT_DIR="$( cd "$( dirname "$0" )" && pwd )"
2011-01-12 15:39:47 +01:00
COMPILER_DIR="$SCRIPT_DIR/compiler"
2011-01-12 15:39:47 +01:00
COMPILER=heptc.byte
2011-03-21 14:30:19 +01:00
COMPILER_DEBUG=heptc.d.byte
LIB_DIR="$SCRIPT_DIR/lib"
2011-01-12 15:39:47 +01:00
#the symlink
HEPTC="$COMPILER_DIR/$COMPILER"
HEPTC_DEBUG="$COMPILER_DIR/$COMPILER_DEBUG"
2011-01-12 15:39:47 +01:00
#compile the compiler
2011-05-30 10:23:03 +02:00
if [ ! -x "$HEPTC" ]
2010-06-27 18:54:05 +02:00
then
2011-05-30 10:23:03 +02:00
if [ -x "$HEPTC_DEBUG" ]
2011-03-21 14:30:19 +01:00
then
#use the debug
HEPTC=$HEPTC_DEBUG
else
2011-05-30 10:23:03 +02:00
cd "$COMPILER_DIR"
ocamlbuild -j 0 "$COMPILER"
2011-03-21 14:30:19 +01:00
cd -
fi
2010-06-27 18:54:05 +02:00
fi
2011-01-12 15:39:47 +01:00
#compile the stdlib
2011-05-30 10:23:03 +02:00
if [ ! -e "$LIB_DIR/pervasives.epci" ] || [ "$HEPTC" -nt "$LIB_DIR/pervasives.epci" ]
2010-06-27 18:54:05 +02:00
then
2011-05-30 10:23:03 +02:00
cd "$LIB_DIR"
2011-01-12 15:39:47 +01:00
echo "Recompile pervasives.epci"
2011-05-30 10:23:03 +02:00
"$HEPTC" -nopervasives pervasives.epi
2011-01-12 15:39:47 +01:00
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.
2011-05-30 10:23:03 +02:00
cd "$RUN_DIR"
"$HEPTC" -stdlib "$LIB_DIR" "$@"