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`
|
2010-06-29 19:09:05 +02:00
|
|
|
|
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
|
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" "$@"
|