]> mj.ucw.cz Git - eval.git/commitdiff
New compile script.
authorMartin Mares <mj@ucw.cz>
Fri, 6 Apr 2001 09:17:43 +0000 (09:17 +0000)
committerMartin Mares <mj@ucw.cz>
Fri, 6 Apr 2001 09:17:43 +0000 (09:17 +0000)
TODO
config
public/compile

diff --git a/TODO b/TODO
index b4f45fbac1c91155ef9d291b435451c40945128a..b748cf713dae92fbb711b314046a26ff8a3f1586 100644 (file)
--- a/TODO
+++ b/TODO
@@ -1,3 +1,2 @@
-check pascal
 -static ?
-check rhide compiler configuration
+multiple check inputs?
diff --git a/config b/config
index 0f0bcf27dc4caacc7e7f0ef0aeb0e6256f503545..daf2f7450757fba72351c2c89e525cef2bbe8f0b 100644 (file)
--- a/config
+++ b/config
@@ -7,24 +7,28 @@ EVAL_USER=mo-eval
 EVAL_GROUP=mo-eval
 TEST_USERS="mo-test1 mo-test2"
 
-# Currently used test user
-TEST_USER=mo-test1
+# Test user for sandboxing
+TEST_USER=${TEST_USER:mo-test1}
 
 ### all of the following variables can be overriden in per-task config file
 
 # Known source file extensions
 EXTENSIONS="c C cpp p pas"
 
+# Extra compiler flags (null, but can be overriden)
+EXTRA_CFLAGS=
+
 # For each source extension, we must give compiler command
-COMP_c='/usr/bin/gcc -O2 -g -o $EXE $SRC'
-COMP_C='/usr/bin/g++ -O2 -g -o $EXE $SRC'
+COMP_c='/usr/bin/gcc -O2 -g -o $EXE $EXTRA_CFLAGS $SRC'
+COMP_C='/usr/bin/g++ -O2 -g -o $EXE $EXTRA_CFLAGS $SRC'
 COMP_cpp="$COMP_C"
-COMP_p='/usr/bin/fpc -Ci -Cr -g -O2 -So -Sg -o$EXE $SRC'
+COMP_p='/usr/bin/fpc -Ci -Cr -g -O2 -So -Sg -o$EXE $EXTRA_CFLAGS $SRC'
 COMP_pas="$COMP_p"
 
 # Sandbox options used when compiling
 COMP_SANDBOX_OPTS='-m65536 -t60 -w -e'
 
 # Sandbox options used when testing
-TEST_SANDBOX_OPTS='-a2 -f -m$MEM_LIMIT -t$TIME_LIMIT -w'
+TEST_SANDBOX_OPTS='-a2 -f -m$MEM_LIMIT -t$TIME_LIMIT'
+# -w for wall clock measuring
 # For stdio tasks append '-i$PROBLEM.in -o$PROBLEM.out'
index b640c89bbe2082af3644086c9e4fe498f4a2fa46..0a180d3f2d81b19cc8652c82cf2ced8750058681 100644 (file)
@@ -6,14 +6,29 @@ set -e
 . $MO_PUBLIC/bin/lib
 . $MO_PUBLIC/config
 
-[ -n "$1" ] || die "Usage: compile <problem>"
-PROBLEM=$1
-public-setup
-. $PDIR/config
-locate-source
-if compile ; then
-       mv $TDIR/$PROBLEM .
+[ -n "$1" ] || die "Usage: compile (<problem> | <file> [<options>])"
+if [ "${1%%.*}" == "$1" ] ; then
+       # Compiling problem
+       PROBLEM=$1
+       public-setup
+       . $PDIR/config
+       locate-source
+       if compile ; then
+               mv $TDIR/$PROBLEM .
+       else
+               echo >&2
+               sed <log >&2 '1,/^Compiler output:/d;/^Compiler output files:/,$d;/^Exited /d'
+       fi
 else
-       echo >&2
-       sed <log >&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