Files
mercury/scripts/c2init.in
Simon Taylor 4b49b1f019 Implement the ml and c2init scripts in the compiler to
Estimated hours taken: 25
Branches: main

Implement the ml and c2init scripts in the compiler to
reduce dependencies on Cygwin.

compiler/compile_target_code.m:
	Implement the functionality of ml and c2init, rather than
	calling those scripts.

	Handle all compiler dependencies using options, rather than
	testing for particular compilers here.

compiler/options.m:
NEWS:
doc/user_guide.texi:
	Add options which implement functionality which is part
	of ml, c2init or mgnuc when using Mmake:
	--warn-target-code, --output-link-command,
	--output-shared-lib-link-command, --ansi-c,
	--no-strip, --no-demangle, --no-main,
	--allow-undefined, --use-readline, --runtime-flags,
	--extra-inits.

	Add options to describe the C compiler and linker, for
	use by configure/mmc.

	The `--ml-flags' (`--link-flags') option has been removed.

compiler/options_file.m:
	Remove the MLFLAGS variable.

compiler/handle_options.m:
	`--target-debug' implies `--no-strip'.

	Add the path to the GC libraries to the library search paths.

compiler/mercury_compile.m:
	Handle --output-link-command and --output-shared-lib-link-command.

compiler/passes_aux.m:
	Add a variant of invoke_shell_command which takes a second
	command to process the first command's output. This is used
	by compile_target_code.m to invoke the demangler.

configure.in:
scripts/mmc.in:
	Handle extra default options.

scripts/c2init.in:
scripts/ml.in:
	Document that the code here is duplicated in
	compiler/compile_target_code.m.

Mmake.workspace:
browser/Mmakefile:
compiler/Mercury.options:
compiler/Mmakefile:
library/Mmakefile:
	Pass `-R' options pointing to the installation directories
	to mmc, as we already do for ml.
2003-02-05 14:41:20 +00:00

87 lines
2.6 KiB
Bash
Executable File

#! /bin/sh
# @configure_input@
#---------------------------------------------------------------------------#
# Copyright (C) 1995-2003 The University of Melbourne.
# This file may only be copied under the terms of the GNU General
# Public License - see the file COPYING in the Mercury distribution.
#---------------------------------------------------------------------------#
# C2INIT - Convert *.c to *_init.c
#
# This script outputs an appropriate init.c, given the .c files.
# Type `c2init --help' for usage message.
#
# *************************************************************************
# *** IMPORTANT NOTE: any changes to this file may also require similar ***
# *** changes to compiler/compile_target_code.m ***
# *************************************************************************
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@
# include the file `canonical_grade.sh-subr'
@CANONICAL_GRADE@
# If you change these, you will also need to change Mmake.workspace,
# compiler/compile_target_code.m, scripts/ml.in, tools/bootcheck,
# tools/binary, tools/binary_step and tools/linear.
RT_LIB_NAME=mer_rt
STD_LIB_NAME=mer_std
TRACE_LIB_NAME=mer_trace
BROWSER_LIB_NAME=mer_browser
MKINIT=${MERCURY_MKINIT=mkinit}
case $require_tracing in
true)
trace_opt="-t" ;;
esac
case $stack_trace in
true)
init_opt="-i" ;;
esac
if [ "$mercury_stdlib_dir" != "" ]
then
MERCURY_MOD_LIB_MODS=${MERCURY_MOD_LIB_MODS="\
$mercury_stdlib_dir/modules/$RT_LIB_NAME.init \
$mercury_stdlib_dir/modules/$STD_LIB_NAME.init"}
MERCURY_TRACE_LIB_MODS=${MERCURY_TRACE_LIB_MODS="\
$mercury_stdlib_dir/modules/$BROWSER_LIB_NAME.init"}
fi
MERCURY_TRACE_LIB_MODS="$MERCURY_TRACE_LIB_MODS $trace_init_files"
case "$trace_opt" in
-t)
init_opt="-i"
MERCURY_ALL_LIB_MODS="$MERCURY_MOD_LIB_MODS\
$MERCURY_TRACE_LIB_MODS"
;;
*)
MERCURY_ALL_LIB_MODS="$MERCURY_MOD_LIB_MODS"
;;
esac
case $# in
0) exec $MKINIT $aditi_opt -c"$maxcalls" $init_opt $trace_opt \
$library_opt $defentry_opt $extra_inits_opt \
-g "$GRADE" -o "$init_c_file" \
$extra_init_dirs $EXTRA_INIT_FILES $TRACE_INIT_FILES \
$MERCURY_ALL_LIB_MODS
;;
*) exec $MKINIT $aditi_opt -c"$maxcalls" $init_opt $trace_opt \
$library_opt $defentry_opt $extra_inits_opt \
-g "$GRADE" -o "$init_c_file" -r "$runtime_flags" \
$extra_init_dirs "$@" $EXTRA_INIT_FILES $TRACE_INIT_FILES \
$MERCURY_ALL_LIB_MODS
;;
esac