From: Martin Mares Date: Wed, 19 Mar 2008 12:52:27 +0000 (+0100) Subject: Introduced extension aliases. X-Git-Tag: python-dummy-working~220 X-Git-Url: http://mj.ucw.cz/gitweb/?a=commitdiff_plain;h=b2cd4a0eedc0a59821d144b2edde40a95ea7f522;p=eval.git Introduced extension aliases. When several filename extensions corresponded to the same programming language, the compiler and runtime settings had to be duplicated. It is now possible to define one extension as an alias for another, so that it is used only for locating the source. The copy of the program in $TDIR already has the new extension and it is processed according to it. --- diff --git a/bin/lib b/bin/lib index 16afaeb..8d94413 100644 --- a/bin/lib +++ b/bin/lib @@ -173,7 +173,14 @@ function locate-source function compile { pstart "Compiling... " + + a="ALIAS_EXT_$SRCEXT" + if [ -n "${!a}" ] ; then + SRCEXT="${!a}" + echo "Normalized file extension: $SRCEXT" + fi override-vars "EXT_$SRCEXT" + # Beware, the original SRCN can be a strange user-supplied name SRC=$PROBLEM.$SRCEXT cp "$SDIR/$SRCN" $TDIR/$SRC @@ -181,6 +188,7 @@ function compile echo "Extras: $COMP_EXTRAS" for a in $COMP_EXTRAS ; do cp $PDIR/$a $TDIR/ ; done fi + box-clean for a in $SRC $COMP_EXTRAS ; do cp $TDIR/$a $BOXDIR/ ; done EXE=$PROBLEM diff --git a/config b/config index 052e999..8e88612 100644 --- a/config +++ b/config @@ -38,6 +38,11 @@ REMOTE_SUBMIT_GROUP=mo-submit # Known source file extensions EXTENSIONS="c cc C cpp p pas" +# Some of the extensions can be aliases for other extensions +ALIAS_EXT_cc=cpp +ALIAS_EXT_C=cpp +ALIAS_EXT_p=pas + ## Variables which control compilation and execution ## (see below for values for individual languages) @@ -61,16 +66,12 @@ EXT_c_COMP='/usr/bin/gcc -std=gnu99 -O2 -g -o $EXE $EXTRA_CFLAGS $SRC -lm' EXTRA_CFLAGS= # C++ -EXT_C_COMP='/usr/bin/g++ -O2 -g -o $EXE $EXTRA_CXXFLAGS $SRC -lm' -EXT_cpp_COMP="$EXT_C_COMP" -EXT_cc_COMP="$EXT_C_COMP" +EXT_cpp_COMP='/usr/bin/g++ -O2 -g -o $EXE $EXTRA_CXXFLAGS $SRC -lm' EXTRA_CXXFLAGS= # Pascal -EXT_p_COMP='/usr/bin/fpc -Ci -Cr -Ct -g -O2 -Sg -o$EXE $EXTRA_PFLAGS $SRC' -EXT_pas_COMP="$EXT_p_COMP" +EXT_pas_COMP='/usr/bin/fpc -Ci -Cr -Ct -g -O2 -Sg -o$EXE $EXTRA_PFLAGS $SRC' EXTRA_PFLAGS= -EXT_p_EXIT_CODE_HOOK=fpc-exit-code EXT_pas_EXIT_CODE_HOOK=fpc-exit-code ### Per-task configuration variables (default values, override in per-task config)