OPTS="-g" # option for compiler call
objs="" # List of .o files
-CC="gcc --ansi --pedantic -Wall -Wextra -Wformat-security -Wcast-align -Wno-uninitialized -Wno-unused-variable -Wno-unused-label -Wno-unused-parameter" # Default compiler call
+CC="gcc --ansi --pedantic -Wall -Wextra -Wformat-security -Wcast-align -Wno-uninitialized -Wno-unused-variable -Wno-unused-label -Wno-unused-parameter -Wno-missing-field-initializers" # Default compiler call
ext="_savo _sav" # Default flavor to reuse
out="a.out" # Default output binary filename
dir="" # Default tmp dir
-nolibgc="false" # Try to use libgc ?
+nolibgc="true" # Disable boehm libgc?
CKSUM="cksum" # Tool that perfors checksum. cksum seems to be very portable
usage()
-o name Call name the executable
-d Create temporary files in a specific directory
-nolibgc Do not include libgc
+-v Verbose (show compilation steps)
+-vv Verbose+ (show gcc calls)
-h This help
END
}
}
stop=false
+verbose=false
+vverbose=false
while [ $stop = false ]; do
case $1 in
-O) OPTS="$OPTS -O2" ext="_savo"; shift;;
-d) dir="$2/"; shift; shift;;
--nolibgc) nolibgc=true; shift;;
-x) OPTS="$OPTS $2"; shift; shift;;
+ -vv) vverbose=true; verbose=true; shift;;
+ -v) verbose=true; shift;;
-h|"") usage; exit;;
*) stop=true
esac
for i in "$@"; do
j=`basename "$i" .c`
+ transformed=`echo "$i" | sed "
+ /\.nit_compile\/.*_sep\.c/s/\.nit_compile\/\(.*\)\._sep\.c/Module \1/
+ /\.nit_compile\/.*_glob\.c/s/\.nit_compile\/\(.*\)\._glob\.c/Module \1/
+ /\.nit_compile[1-9]\/.*_sep\.c/s/\.nit_compile[1-9]\/\(.*\)\._sep\.c/Module \1/
+ /\.nit_compile[1-9]\/.*_glob\.c/s/\.nit_compile[1-9]\/\(.*\)\._glob\.c/Module \1/
+ /\/nit_main\.c/s/.*\/nit_main\.c/Main/
+ /\.nit_compile\/.*\._tables\.c/s/.*/Tables/
+ /\.nit_compile[1-9]\/.*\._tables\.c/s/.*/Tables/
+ /\/\/.*_nit\.c/s/.*\/\/\(.*\)_nit.c/Native \1/
+ s/.*\/gc.c/Garbage Collector/
+ s/.*\/gc_static_objects_list.c/Garbage Collector object list/
+ "`
+
found="false"
# 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`
if [ -f "$cksumfile" -a -f "$o" ]; then
cksumtry=`cat $cksumfile`
if [ "x$cksum" = "x$cksumtry" ]; then
+ if [ $vverbose = true ] ; then
+ echo "* $transformed up-to-date"
+ fi
found=true
break
fi
fi
done
if [ $found = false ]; then
- echo "* $CC $OPTS -c $i -o $o" >&2
+ if [ $verbose = true ] ; then
+ if [ $vverbose = true ] ; then
+ echo "* $CC $OPTS -c $i -o $o" >&2
+ else
+ echo "* $transformed"
+ fi
+ fi
if $CC $OPTS -c $i -o $o; then
echo "$cksum" > "$cksumfile"
else
objs="$objs $o"
done
-echo "* $CC $OPTS -lm $objs -o $out" >&2
+if [ $vverbose = true ] ; then
+ echo "* $CC $OPTS -lm $objs -o $out" >&2
+fi
$CC $OPTS -lm $objs -o "$out"