]> mj.ucw.cz Git - moe.git/blob - mop/public/compile
Moved `public' to MO-P stuff, too. I will decide later where to put it.
[moe.git] / mop / public / compile
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 . $MO_ROOT/bin/lib
7 . $MO_ROOT/config
8
9 [ -n "$1" ] || die "Usage: compile (<problem> | <file> [<options>])"
10 if [ "${1%%.*}" == "$1" ] ; then
11         # Compiling problem
12         PROBLEM=$1
13         public-setup
14         . $PDIR/config
15         locate-source
16         if compile ; then
17                 mv $TDIR/$PROBLEM .
18         else
19                 echo >&2
20                 sed <check-log >&2 '1,/^Compiler output:/d;/^Compiler output files:/,$d;/^Exited /d'
21         fi
22 else
23         SRC=$1
24         [ -f $SRC ] || die "$SRC doesn't exist"
25         EXE=${1%%.*}
26         SRCEXT=${1/*./}
27         shift
28         EXTRA_CFLAGS="$@"
29         CCMD=COMP_$SRCEXT
30         [ -n "${!CCMD}" ] || die "Don't know how to compile $SRC"
31         CCMD="`eval echo ${!CCMD}`"
32         echo "$CCMD"
33         $CCMD
34 fi