From: Jean Privat Date: Fri, 28 Jan 2011 20:40:48 +0000 (-0500) Subject: Merge branch 'beef-up-gccx' into wip X-Git-Tag: v0.4~16 X-Git-Url: http://nitlanguage.org?hp=6d65fbac14f2d8d1c13217ab5a79aba3b9117ea3 Merge branch 'beef-up-gccx' into wip --- diff --git a/bin/gccx b/bin/gccx index 7d8e285..6bcd9cf 100755 --- a/bin/gccx +++ b/bin/gccx @@ -25,14 +25,17 @@ out="a.out" # Default output binary filename dir="" # Default tmp dir nolibgc="true" # Disable boehm libgc? CKSUM="cksum" # Tool that perfors checksum. cksum seems to be very portable +recompile="false" usage() { e=`basename "$0"` cat<&1 >/dev/null; then + cache=ccache +fi + stop=false verbose=false vverbose=false while [ $stop = false ]; do case $1 in + -R) recompile=true; shift;; -O) OPTS="$OPTS -O2" ext="_savo"; shift;; -i) CC="/opt/intel/cc/10.1.015/bin/icc -O2" ext="_savi"; shift;; + -ll) CC="clang --ansi --pedantic -O3"; ext="_savll"; shift;; -I) OPTS="$OPTS -I $2"; shift; shift;; -o) out="$2"; shift; shift;; -d) dir="$2/"; shift; shift;; @@ -86,6 +96,10 @@ if [ $nolibgc != true ] && test_libgc; then OPTS="$OPTS -DWITH_LIBGC -lgc" fi +if [ $cache = "ccache" ]; then + CC="ccache $CC" +fi + for i in "$@"; do j=`basename "$i" .c` transformed=`echo "$i" | sed " @@ -102,12 +116,19 @@ for i in "$@"; do "` found="false" + if [ $cache != true ]; then + o="$dir$j.o" + if [ $vverbose = true ] ; then + echo "* $CC $OPTS -c $i -o $o" >&2 + fi + $CC $OPTS -c $i -o $o || exit 1 + else # We remove starting # to be path independent (after preprocess, there are the only # remainings) cksum=`gcc -E $OPTS $i 2> /dev/null | grep -v "^#" | $CKSUM` for e in $ext; do o="$dir$j.$e.o" cksumfile="$dir$j.$e.cksum" - if [ -f "$cksumfile" -a -f "$o" ]; then + if [ -f "$cksumfile" -a -f "$o" -a "x$recompile" != "xtrue" ]; then cksumtry=`cat $cksumfile` if [ "x$cksum" = "x$cksumtry" ]; then if [ $vverbose = true ] ; then @@ -132,6 +153,7 @@ for i in "$@"; do exit 1 fi fi +fi objs="$objs $o" done diff --git a/src/compiling/compiling_base.nit b/src/compiling/compiling_base.nit index e1c5040..c922f05 100644 --- a/src/compiling/compiling_base.nit +++ b/src/compiling/compiling_base.nit @@ -86,9 +86,11 @@ class CProgram var verbose = "" var tc = program.tc - if tc.verbose_level > 0 then - verbose = "-" - for i in [1..tc.verbose_level] do verbose = verbose + "v" + if tc.verbose_level == 1 then + verbose = "-v" + else if tc.verbose_level >= 2 then + # We catch tc.verbose_level >= 2, since 3+ is not valid with gccx + verbose = "-vv" end f.write("#!/bin/sh\n")