mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-05-01 09:14:08 +00:00
Estimated hours taken: 0.25 Branches: main Write the grade in the header comment in the generated `<module>_init.c' file. The `<module>_init.c' file contains grade dependent conditional compilation, so the `<module>_init.o' file must be rebuilt when the grade changes. util/mkinit.c: Add an option `-g' for the grade. Add the grade to the header comment. scripts/c2init.in: Pass the grade to mkinit. scripts/Mmakefile: scripts/canonical_grade.sh-subr: canonical_grade.sh-subr is now used by c2init.
80 lines
2.2 KiB
Bash
Executable File
80 lines
2.2 KiB
Bash
Executable File
#! /bin/sh
|
|
# @configure_input@
|
|
#---------------------------------------------------------------------------#
|
|
# Copyright (C) 1995-2001 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.common.in,
|
|
# 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
|
|
|
|
MERCURY_MOD_LIB_DIR=${MERCURY_MOD_LIB_DIR=@LIBDIR@/modules}
|
|
MERCURY_TRACE_LIB_DIR=${MERCURY_TRACE_LIB_DIR=@LIBDIR@/modules}
|
|
MKINIT=${MERCURY_MKINIT=mkinit}
|
|
|
|
case $require_tracing in
|
|
true)
|
|
trace_opt="-t" ;;
|
|
esac
|
|
|
|
case $stack_trace in
|
|
true)
|
|
init_opt="-i" ;;
|
|
esac
|
|
|
|
MERCURY_MOD_LIB_MODS=${MERCURY_MOD_LIB_MODS="\
|
|
$MERCURY_MOD_LIB_DIR/$RT_LIB_NAME.init \
|
|
$MERCURY_MOD_LIB_DIR/$STD_LIB_NAME.init"}
|
|
|
|
MERCURY_TRACE_LIB_MODS=${MERCURY_TRACE_LIB_MODS="\
|
|
$MERCURY_TRACE_LIB_DIR/$BROWSER_LIB_NAME.init"}
|
|
|
|
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 $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" \
|
|
$extra_init_dirs "$@" $EXTRA_INIT_FILES $MERCURY_ALL_LIB_MODS
|
|
;;
|
|
esac
|