Files
mercury/scripts/mmc.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

119 lines
4.4 KiB
Bash

#! /bin/sh
# @configure_input@
#---------------------------------------------------------------------------#
# Copyright (C) 1994-1998, 2000-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.
#---------------------------------------------------------------------------#
#
# MMC - Melbourne Mercury Compiler.
#
# Use `mmc -h' for help.
#
# Environment variables: MERCURY_STDLIB_DIR, MERCURY_CONFIG_DIR,
# MERCURY_INT_DIR, MERCURY_ALL_MC_C_INCL_DIRS, MERCURY_COMPILER,
# MERCURY_C_COMPILER, MERCURY_DEFAULT_GRADE, MERCURY_DEFAULT_OPT_LEVEL.
MC=${MERCURY_COMPILER="@LIBDIR@/bin/@FULLARCH@/mercury_compile"}
case "$MERCURY_INT_DIR" in
"")
INT_DIR_OPT=
CONFIG_DIR=${MERCURY_STDLIB_DIR-@LIBDIR@}
CONFIG_DIR=${MERCURY_CONFIG_DIR=$CONFIG_DIR}
STDLIB_DIR=${MERCURY_STDLIB_DIR=@LIBDIR@}
STDLIB_DIR_OPT="--mercury-standard-library-directory \"${STDLIB_DIR}\""
if [ "$STDLIB_DIR" != "$CONFIG_DIR" ]; then
CONFIG_DIR_OPT="--mercury-configuration-directory \"${CONFIG_DIR}\""
else
CONFIG_DIR_OPT=
fi
;;
*)
INT_DIR_OPT="-I $MERCURY_INT_DIR"
STDLIB_DIR_OPT=--no-mercury-standard-library-directory
CONFIG_DIR_OPT=
;;
esac
MATH_LIB=${MERCURY_MATH_LIB="@MATH_LIB@"}
SHARED_LIBS="@SHARED_LIBS_SH@"
DEFAULT_MERCURY_LINKAGE=${MERCURY_LINKAGE=@DEFAULT_LINKAGE@}
export DEFAULT_MERCURY_LINKAGE
# The default options settings are passed in the DEFAULT_MCFLAGS enviroment
# variable, rather than on the command line, so that they can be overridden
# by the value of MCFLAGS in the Mercury.options file.
#
# The default optimization level should be after
# all the options that describe the machine configuration.
#
# XXX Add --linker-trace-flags "@LDFLAGS_FOR_TRACE@" and
# --shlib-linker-trace-flags "@LD_LIBFLAGS_FOR_TRACE@"
# once those options are accepted everywhere.
DEFAULT_MCFLAGS=${DEFAULT_MCFLAGS-"\
$MERCURY_ALL_MC_C_INCL_DIRS \
--cc \"${MERCURY_C_COMPILER=@CC@}\" \
--grade \"${MERCURY_DEFAULT_GRADE=@DEFAULT_GRADE@}\" \
--cflags-for-ansi \"@CFLAGS_FOR_ANSI@\" \
--cflags-for-optimization \"@CFLAGS_FOR_OPT@\" \
--cflags-for-warnings \"@CFLAGS_FOR_WARNINGS@\" \
--cflags-for-threads \"@CFLAGS_FOR_THREADS@\" \
--cflags-for-debug \"@CFLAGS_FOR_DEBUG@\" \
--cflags-for-regs \"@CFLAGS_FOR_REGS@\" \
--cflags-for-gotos \"@CFLAGS_FOR_GOTOS@\" \
--cflags-for-pic \"@CFLAGS_FOR_PIC@\" \
--c-flag-to-name-object-file \"@OBJFILE_OPT@\" \
--object-file-extension \".@OBJ_SUFFIX@\" \
--pic-object-file-extension \".@EXT_FOR_PIC_OBJECTS@\" \
--link-with-pic-object-file-extension \".@EXT_FOR_LINK_WITH_PIC_OBJECTS@\" \
--executable-file-extension \"@EXT_FOR_EXE@\" \
--shared-library-extension \".@EXT_FOR_SHARED_LIB@\" \
--library-extension \".@LIB_SUFFIX@\"
--create-archive-command \"@AR@\" \
--create-archive-command-output-flag \"@AR_LIBFILE_OPT@\" \
--create-archive-command-flags \"@ARFLAGS@\" \
--ranlib-command \"@RANLIB@\" \
--link-executable-command \"@LINK_EXE@\" \
--link-shared-lib-command \"@LINK_SHARED_OBJ@\" \
--trace-libs \"@TRACE_LIBS_SYSTEM@\" \
--thread-libs \"@THREAD_LIBS@\" \
--shared-libs \"$SHARED_LIBS\" \
--math-lib \"$MATH_LIB\" \
--readline-libs \"@READLINE_LIBRARIES@\" \
--linker-thread-flags \"@LDFLAGS_FOR_THREADS@\" \
--shlib-linker-thread-flags \"@LD_LIBFLAGS_FOR_THREADS@\" \
--linker-static-flags \"@LD_STATIC_FLAGS@\" \
--linker-strip-flag \"@LD_STRIP_FLAG@\" \
--linker-debug-flags \"@LDFLAGS_FOR_DEBUG@\" \
--shlib-linker-debug-flags \"@LD_LIBFLAGS_FOR_DEBUG@\" \
--linker-rpath-flag \"@EXE_RPATH_OPT@\" \
--linker-rpath-separator \"@EXE_RPATH_SEP@\" \
--shlib-linker-rpath-flag \"@SHLIB_RPATH_OPT@\" \
--shlib-linker-rpath-separator \"@SHLIB_RPATH_SEP@\" \
--linker-allow-undefined-flag \"@ALLOW_UNDEFINED@\" \
--linker-error-undefined-flag \"@ERROR_UNDEFINED@\" \
--fullarch \"@FULLARCH@\" \
--install-prefix \"@prefix@\" \
@LIBGRADE_OPTS@ \
--num-real-r-regs \"@NUM_REAL_R_REGS@\" \
--num-real-r-temps \"@NUM_REAL_R_TEMPS@\" \
--conf-low-tag-bits \"@LOW_TAG_BITS@\" \
--bits-per-word \"@BITS_PER_WORD@\" \
--bytes-per-word \"@BYTES_PER_WORD@\" \
--dotnet-library-version \"@MS_DOTNET_LIBRARY_VERSION@\" \
@HAVE_DELAY_SLOT@ \
@HAVE_BOXED_FLOATS@ \
@MCFLAGS_FOR_CC@ \
${MERCURY_DEFAULT_OPT_LEVEL=-O2} \
$STDLIB_DIR_OPT \
$CONFIG_DIR_OPT \
"}
export DEFAULT_MCFLAGS
case $# in
0) exec $MC $INT_DIR_OPT ;;
*) exec $MC "$@" $INT_DIR_OPT ;;
esac