mirror of
https://github.com/Mercury-Language/mercury.git
synced 2025-12-18 23:35:25 +00:00
Combine the options for ml and c2init. Once mmake has been
Estimated hours taken: 1 Branches: main Combine the options for ml and c2init. Once mmake has been altered to pass MLFLAGS to c2init users will be able to mostly ignore the existence of c2init. This change requires an installed compiler which uses `--init-c-file' rather than `-o' to name c2init's output file. This is difficult to test for in configure.in. Bootstrap CVS tag: bootstrap_20011203_init_c_file_c2init_option scripts/parse_ml_options.sh-subr.in: Parse the combined options for ml and c2init. The `-o' and `--output' options for c2init have been removed (`-o' conflicts with a linker option), use `--init-c-file' instead. configure.in: Add parse_ml_options.sh-subr.in to the list of files to substitute. scripts/ml.in: scripts/c2init.in: Include parse_ml_options.sh-subr. scripts/Mmakefile: ml and c2init depend on parse_ml_options.sh-subr.
This commit is contained in:
@@ -12,6 +12,17 @@
|
||||
# Type `c2init --help' for usage message.
|
||||
#
|
||||
|
||||
Usage="\
|
||||
Name: c2init - Create Mercury initialization file.
|
||||
Usage: c2init [options] *.c *.init ..."
|
||||
|
||||
FULLARCH=@FULLARCH@
|
||||
DEFAULT_GRADE=${MERCURY_DEFAULT_GRADE=@DEFAULT_GRADE@}
|
||||
|
||||
# include the file `parse_ml_options.sh-subr'
|
||||
@PARSE_ML_OPTIONS@
|
||||
|
||||
|
||||
# If you change these, you will also need to change Mmake.common.in,
|
||||
# scripts/ml.in, tools/bootcheck, tools/binary, tools/binary_step and
|
||||
# tools/linear.
|
||||
@@ -24,133 +35,6 @@ MERCURY_MOD_LIB_DIR=${MERCURY_MOD_LIB_DIR=@LIBDIR@/modules}
|
||||
MERCURY_TRACE_LIB_DIR=${MERCURY_TRACE_LIB_DIR=@LIBDIR@/modules}
|
||||
MKINIT=${MERCURY_MKINIT=mkinit}
|
||||
|
||||
# maximum number of calls to put in a single function
|
||||
maxcalls=40
|
||||
defentry_opt=""
|
||||
init_opt=""
|
||||
trace_opt=""
|
||||
library_opt=""
|
||||
extra_inits_opt=""
|
||||
aditi_opt=""
|
||||
extra_init_dirs=""
|
||||
output_file="-"
|
||||
|
||||
# include the file `init_grade_options.sh-subr'
|
||||
@INIT_GRADE_OPTIONS@
|
||||
|
||||
# IMPORTANT: the manpage is produced automatically from this help
|
||||
# message, so if you change the help message, don't forget to check
|
||||
# that the manpage still looks OK.
|
||||
Help="\
|
||||
Name: c2init - Create Mercury initialization file.
|
||||
Usage: c2init [options] *.c *.init ...
|
||||
Options:
|
||||
-a, --aditi
|
||||
Generate a function to upload Aditi-RL data to a database.
|
||||
-c <n>, --max-calls <n>
|
||||
Break up the initialization into groups of at most <n> function
|
||||
calls. (Default value of <n> is 40.)
|
||||
-i, --include-initialization-code
|
||||
Always include code that calls the initialization functions
|
||||
of the various modules. With this option, the debugger can use
|
||||
information from any modules that were compiled with execution
|
||||
tracing to print (partial) stack traces, and to print the
|
||||
values of variables in ancestors of the current call, even
|
||||
in grades in which this not normally possible.
|
||||
-t, --trace
|
||||
Enable execution tracing in the generated executable.
|
||||
Implies -i.
|
||||
--no-main, --library
|
||||
Don't generate a \`main()' function.
|
||||
Instead, generate a function
|
||||
mercury_main(int argc, char **argv);
|
||||
(declared in \"init.h\") that can be called from C code.
|
||||
(A more fine-grained interface is also available;
|
||||
see \"init.h\" for details.)
|
||||
-I <directory>, --init-file-directory <directory>
|
||||
Include <directory> in the list of directories searched to
|
||||
locate \`.init' files.
|
||||
--init-c-file <filename>, -o <filename>, --output <filename>
|
||||
Output the generated C initialization program to the
|
||||
specified file, rather than sending it to the standard
|
||||
output.
|
||||
-w <label>, --entry-point <label>
|
||||
Set entry point to <label>.
|
||||
(Default value corresponds to main/2.)
|
||||
-x, --extra-inits
|
||||
Search \`.c' files for extra initialization functions.
|
||||
(This may be necessary if the C files contain
|
||||
hand-coded C code with \`INIT' comments, rather than
|
||||
containing only C code that was automatically generated
|
||||
by the Mercury compiler.)
|
||||
|
||||
$grade_usage
|
||||
|
||||
Environment variables:
|
||||
MERCURY_MOD_LIB_DIR, MERCURY_MOD_LIB_MODS,
|
||||
MERCURY_TRACE_LIB_DIR, MERCURY_TRACE_LIB_MODS, MERCURY_MKINIT.
|
||||
"
|
||||
|
||||
while true; do
|
||||
case "$1" in
|
||||
-a|--aditi)
|
||||
aditi_opt="-a";;
|
||||
-a-|--no-aditi)
|
||||
aditi_opt="";;
|
||||
-c|--max-calls)
|
||||
maxcalls="$2"; shift;;
|
||||
|
||||
-i|--include-initialization-code)
|
||||
init_opt="-i";;
|
||||
|
||||
-t|--trace)
|
||||
trace_opt="-t";;
|
||||
|
||||
--no-main|--library)
|
||||
library_opt="-l";;
|
||||
|
||||
--main|--no-library)
|
||||
library_opt="";;
|
||||
|
||||
-I|--init-file-directory)
|
||||
extra_init_dirs="$extra_init_dirs -I $2"; shift;;
|
||||
|
||||
--init-c-file|-o|--output)
|
||||
output_file="$2"; shift;;
|
||||
|
||||
-w|--entry-point)
|
||||
defentry_opt="-w$2"; shift;;
|
||||
|
||||
-x|--extra-inits)
|
||||
extra_inits_opt="-x";;
|
||||
|
||||
-x-|--no-extra-inits)
|
||||
extra_inits_opt="";;
|
||||
|
||||
-h|--help|"-?")
|
||||
echo "$Help"
|
||||
exit 0;;
|
||||
|
||||
# include the file `parse_grade_options.sh-subr'
|
||||
@PARSE_GRADE_OPTIONS@
|
||||
|
||||
--)
|
||||
break;;
|
||||
|
||||
-*)
|
||||
echo "`basename $0`: invalid option \`$1'" 1>&2;
|
||||
echo "Try \`$0 --help' for help." 1>&2;
|
||||
exit 1;;
|
||||
|
||||
*)
|
||||
break;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
# include the file `final_grade_options.sh-subr'
|
||||
@FINAL_GRADE_OPTIONS@
|
||||
|
||||
case $require_tracing in
|
||||
true)
|
||||
trace_opt="-t" ;;
|
||||
@@ -182,12 +66,12 @@ esac
|
||||
case $# in
|
||||
0) exec $MKINIT $aditi_opt -c"$maxcalls" $init_opt $trace_opt \
|
||||
$library_opt $defentry_opt $extra_inits_opt \
|
||||
-o "$output_file" \
|
||||
-o "$init_c_file" \
|
||||
$extra_init_dirs $EXTRA_INIT_FILES $MERCURY_ALL_LIB_MODS
|
||||
;;
|
||||
*) exec $MKINIT $aditi_opt -c"$maxcalls" $init_opt $trace_opt \
|
||||
$library_opt $defentry_opt $extra_inits_opt \
|
||||
-o "$output_file" \
|
||||
-o "$init_c_file" \
|
||||
$extra_init_dirs "$@" $EXTRA_INIT_FILES $MERCURY_ALL_LIB_MODS
|
||||
;;
|
||||
esac
|
||||
|
||||
Reference in New Issue
Block a user