X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;ds=inline;f=public%2Fcompile;h=0a180d3f2d81b19cc8652c82cf2ced8750058681;hb=27eeef5382c1b3693c6ab64391cac17de9dc0016;hp=b640c89bbe2082af3644086c9e4fe498f4a2fa46;hpb=c119e07ea8001ba944e6d9c33e4e73f98fe750ee;p=eval.git diff --git a/public/compile b/public/compile index b640c89..0a180d3 100644 --- a/public/compile +++ b/public/compile @@ -6,14 +6,29 @@ set -e . $MO_PUBLIC/bin/lib . $MO_PUBLIC/config -[ -n "$1" ] || die "Usage: compile " -PROBLEM=$1 -public-setup -. $PDIR/config -locate-source -if compile ; then - mv $TDIR/$PROBLEM . +[ -n "$1" ] || die "Usage: compile ( | [])" +if [ "${1%%.*}" == "$1" ] ; then + # Compiling problem + PROBLEM=$1 + public-setup + . $PDIR/config + locate-source + if compile ; then + mv $TDIR/$PROBLEM . + else + echo >&2 + sed &2 '1,/^Compiler output:/d;/^Compiler output files:/,$d;/^Exited /d' + fi else - echo >&2 - sed &2 '1,/^Compiler output:/d;/^Compiler output files:/,$d;/^Exited /d' + SRC=$1 + [ -f $SRC ] || die "$SRC doesn't exist" + EXE=${1%%.*} + SRCEXT=${1/*./} + shift + EXTRA_CFLAGS="$@" + CCMD=COMP_$SRCEXT + [ -n "${!CCMD}" ] || die "Don't know how to compile $SRC" + CCMD="`eval echo ${!CCMD}`" + echo "$CCMD" + $CCMD fi