-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
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
+ 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"
var fn = "{tc.compdir}/{name}._build.sh"
var f = new OFStream.open(fn)
+ var verbose = ""
+
+ if tc.verbose_level > 0 then
+ verbose = "-"
+ for i in [1..tc.verbose_level] do verbose = verbose + "v"
+ end
+
f.write("#!/bin/sh\n")
f.write("# This shell script is generated by NIT to compile the program {name}.\n")
f.write("CLIBDIR=\"{tc.clibdir}\"\n")
- f.write("{tc.bindir}/gccx -d {tc.compdir} -I $CLIBDIR {includes.join(" ")}")
+ f.write("{tc.bindir}/gccx {verbose} -d {tc.compdir} -I $CLIBDIR {includes.join(" ")}")
if tc.output_file != null then
f.write(" -o {tc.output_file}")
else if tc.ext_prefix.is_empty then
end
end
+ # Display an info
+ meth info(s: String, level: Int)
+ do
+ if level <= verbose_level then
+ print "{s}"
+ end
+ end
+
# Paths where to locate modules files
readable var _paths: Array[String] = new Array[String]
# Option --version
readable var _opt_version: OptionBool = new OptionBool("Show version and exit", "--version")
+ # Option --verbose
+ readable var _opt_verbose: OptionCount = new OptionCount("Verbose", "-v", "--verbose")
+
+ # Verbose level
+ readable var _verbose_level: Int = 0
+
init
do
super
- option_context.add_option(opt_warn, opt_path, opt_log, opt_only_parse, opt_only_metamodel, opt_help, opt_version)
+ option_context.add_option(opt_warn, opt_path, opt_log, opt_only_parse, opt_only_metamodel, opt_help, opt_version, opt_verbose)
end
# Parse and process the options given on the command line
# init options
option_context.parse(args)
+ # Set verbose level
+ _verbose_level = opt_verbose.value
+
# Setup the paths value
paths.append(opt_path.value)