X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;ds=sidebyside;f=public%2Fcompile;h=b10ae9daefd62cc819f8ca846a5b2edcac3c54a5;hb=85cf1d4306413c3780d66b96054921ad3be45d76;hp=b640c89bbe2082af3644086c9e4fe498f4a2fa46;hpb=c119e07ea8001ba944e6d9c33e4e73f98fe750ee;p=moe.git diff --git a/public/compile b/public/compile old mode 100644 new mode 100755 index b640c89..b10ae9d --- a/public/compile +++ b/public/compile @@ -2,18 +2,33 @@ # (c) 2001 Martin Mares set -e -[ -n "$MO_PUBLIC" -a -d "$MO_PUBLIC" ] || { echo >&2 "MO_PUBLIC not set, giving up." ; exit 1 ; } -. $MO_PUBLIC/bin/lib -. $MO_PUBLIC/config +[ -n "$MO_ROOT" -a -d "$MO_ROOT" ] || { echo >&2 "MO_ROOT not set, giving up." ; exit 1 ; } +. $MO_ROOT/bin/lib +. $MO_ROOT/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