mirror of
https://github.com/Mercury-Language/mercury.git
synced 2025-12-13 04:44:39 +00:00
Estimated hours taken: 10 Branches: main Split the existing browser library into two libraries, by making the program_representation module into its own library. This is useful because the compiler refers to program_representation.m, whose code thus needs to be linked into compiler executables even if the compiler isn't compiled with debugging enabled. By creating a new library for this module, we avoid any chance of the linker dragging in the rest of the modules in the browser library. (This is a problem with an upcoming diff.). The name of the new library is "mdbcomp", because the intention is that it contain code that is shared between the debugger and the compiler. This means mostly the definitions of data structures that the compiler generates for the debugger, and the predicates that operate on them. Mmake.common.in: Allow MDB_COMP_ as a prefix for symbol names in the browser directory. Mmake.workspace: Add a make variable holding for the name of the new library, and add the name to the relevant lists of libraries. Avoid duplicating the lists of filenames that need to be updated when adding new libraries or changing their names. Mmakefile: Use make variables to refer to library names. browser/mdbcomp.m: browser/mer_mdbcomp.m: Add these files as the top modules of the new library. browser/program_representation.m: Make program_representation.m a submodule of mdbcomp, not mdb. browser/program_representation.m: browser/browser_info.m: Move a predicate from program_representation.m to browser_info.m to avoid the mdbcomp library depend on the browser library, since this would negate the point of the exercise. browser/mdb.m: Delete program_representation.m from the list of submodules. browser/Mmakefile: Update this file to handle the new module. browser/Mercury.options: Mention the new module. browser/*.m: Update the lists of imported modules. Import only one browser module per line. compiler/notes/overall_design.html: Document the new library. compiler/compile_target_code.m: Add the mdbcomp library to the list of libraries we need to link with. compiler/prog_rep.m: trace/mercury_trace_internal.c: Import program_representation.m by its new name. scripts/c2init.in: Centralize knowledge about which files need to be updated when the list of libraries changes here. scripts/c2init.in: scripts/ml.in: tools/binary: tools/binary_step: tools/bootcheck: tools/linear: tools/lml: Update the list of libraries programs are linked with.
103 lines
2.9 KiB
Bash
Executable File
103 lines
2.9 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', which in turn includes
|
|
# the sh-subr files dealing with grades
|
|
@PARSE_ML_OPTIONS@
|
|
|
|
# include the file `canonical_grade.sh-subr'
|
|
@CANONICAL_GRADE@
|
|
|
|
# If you change one of these, or if you add a new one, you will also need
|
|
# to check the following files to see if corresponding changes are needed
|
|
# there as well:
|
|
#
|
|
# Mmake.workspace
|
|
# Mmakefile
|
|
# compiler/compile_target_code.m
|
|
# scripts/c2init.in
|
|
# scripts/ml.in
|
|
# tools/bootcheck,
|
|
# tools/binary
|
|
# tools/binary_step
|
|
# tools/linear
|
|
# tools/lmc
|
|
# tools/lml
|
|
|
|
RT_LIB_NAME=mer_rt
|
|
STD_LIB_NAME=mer_std
|
|
TRACE_LIB_NAME=mer_trace
|
|
BROWSER_LIB_NAME=mer_browser
|
|
MDBCOMP_LIB_NAME=mer_mdbcomp
|
|
ANALYSIS_LIB_NAME=mer_analysis
|
|
|
|
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_stdlib_dir/modules/$RT_LIB_NAME.init \
|
|
$mercury_stdlib_dir/modules/$STD_LIB_NAME.init"
|
|
MERCURY_TRACE_LIB_MODS="\
|
|
$mercury_stdlib_dir/modules/$BROWSER_LIB_NAME.init \
|
|
$mercury_stdlib_dir/modules/$MDBCOMP_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
|