]> mj.ucw.cz Git - moe.git/blob - mop/public/compile.sh
Doc: Note that Isolate has moved
[moe.git] / mop / public / compile.sh
1 # The Evaluator -- Public Compilation Script
2 # (c) 2001 Martin Mares <mj@ucw.cz>
3
4 set -e
5 [ -n "$MO_ROOT" -a -d "$MO_ROOT" ] || { echo >&2 "MO_ROOT not set, giving up." ; exit 1 ; }
6 pushd $MO_ROOT >/dev/null
7 . lib/libeval.sh
8 . cf/eval
9 . cf/mop
10 popd >/dev/null
11
12 [ -n "$1" ] || die "Usage: compile (<problem> | <file> [<options>])"
13 if [ "${1%%.*}" == "$1" ] ; then
14         # Compiling problem
15         PROBLEM=$1
16         public-setup
17         . $PDIR/config
18         locate-source
19         if compile ; then
20                 mv $TDIR/$PROBLEM .
21         else
22                 echo >&2
23                 sed <check-log >&2 '1,/^Compiler output:/d;/^Compiler output files:/,$d;/^Exited /d'
24         fi
25 else
26         SRC=$1
27         [ -f $SRC ] || die "$SRC doesn't exist"
28         EXE=${1%%.*}
29         SRCEXT=${1/*./}
30         shift
31         EXTRA_CFLAGS="$@"
32         CCMD=EXT_${SRCEXT}_COMP
33         [ -n "${!CCMD}" ] || die "Don't know how to compile $SRC"
34         CCMD="`eval echo ${!CCMD}`"
35         echo "$CCMD"
36         $CCMD
37 fi