#! /bin/sh

#dir where include-files are stored
DIRX="`pwd | cut -c1-5`"
if test $DIRX = "/afs/"; then
    #echo "COMPILE ON AFS"
    IDIR="runtime/"
    GLUTLIB="-gcc -L/afs/andrew/course/15/411/lib"
    GCLIB="/afs/andrew/course/15/411/lib"
    GCINCLUDE="-gcc -I/afs/andrew/course/15/411/include"
else
    IDIR="runtime/"
    GLUTLIB=""
    GCLIB="/usr/local/lib"
    GCINCLUDE="-gcc -I/usr/progs/gc/gc6.1/include/"
fi

#The Compiler (executable)
COMPILER=../../ocaml/code/compile

#Includes for the main support of the language
INCLUDE="-gcc "$IDIR"l3rt.c -gcc -rdynamic"

#Customized imports for some of the test programs
CUSTOME="-gcc "$IDIR"l3ffi.c -gcc "$IDIR"l3io.c"

#Includes for the graphics support (glut)
GRAPHICS="-gcc "$IDIR"l3graphics.c "$GLUTLIB" -gcc -lglut -gcc -lGLU"

#Includes for the Garbage Collector 
GC=$GCINCLUDE" -gcc -Wl,-rpath,"$GCLIB" -gcc -L"$GCLIB" -gcc -lgc -gcc -ldl" 

$COMPILER $1 $GC $INCLUDE $CUSTOME $GRAPHICS $2 $3 $4 $5 $6 $7 $8
