mirror of
https://github.com/Mercury-Language/mercury.git
synced 2025-12-12 04:14:06 +00:00
Estimated hours taken: 8 Branches: main Factor out the common Mmake code to set up the mmc, mgnuc and ml flags when building the Mercury compiler and libraries. Use options, not environment variables. This will make it simpler to use `mmc --make' to compile the compiler. Mmake.workspace: Similar to tools/lmc. Sets up Mmake variables to use the library files in a workspace rather than an installed library. configure.in: Check for the `--no-mercury-stdlib-dir' mmc option. Bootstrap CVS tag: bootstrap_20020429_stdlib_dir Mmake.common.in: */Mmakefile: Move common code into Mmake.workspace. browser/Mmakefile: library/Mmakefile: Avoid invoking the linker explicitly when creating libraries of Mercury code. That won't work well with `mmc --make'. tools/bootcheck: tests/Mmake.common: Use Mmake.workspace instead of setting up environment variables in bootcheck. scripts/Mmake.vars.in: mmc compiles split C files to object code itself, so pass `--cflags "$(ALL_CFLAGS)"' to mmc when compiling with `--split-c-files'. browser/interactive_query.m: Use `mmc --make' when compiling the query. This is needed to make tests/debugger/interactive_query.m work when linking against a workspace using options rather than environment variables. This also fixes a bug -- mmc options were being passed to ml. Clean up after the query. tests/debugger/Mmakefile: tests/debugger/interactive.inp: tests/debugger/interactive.inp.subdirs: tests/debugger/interactive.inp.nosubdirs: tests/debugger/interactive.exp: tests/debugger/interactive.exp2: Generate the input file to this test so that MCFLAGS and MC_MAKE_FLAGS (from Mmake.workspace) are used when compiling queries. tests/debugger/Mmakefile now sets SHELL to /usr/local/bash to allow the use of $(...) style command substitution (`...` style command substitution can't be nested). tests/warnings/Mmakefile: tests/dppd/Mmakefile: Include tests/Mmake.common. tools/*: scripts/c2init.in: scripts/ml.in: Update the lists of files containing the library names.
83 lines
2.2 KiB
Bash
Executable File
83 lines
2.2 KiB
Bash
Executable File
#! /bin/sh
|
|
# @configure_input@
|
|
#---------------------------------------------------------------------------#
|
|
# Copyright (C) 1995-2002 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.
|
|
#
|
|
|
|
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
|
|
# 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
|