mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-15 17:33:38 +00:00
util/mkinit.c:
Put the central list of the places that create .init files here.
compiler/compile_target_code.m:
scripts/c2init.in:
Point to util/mkinit.c as the repository of that central list.
Make some predicate names more descriptive.
util/mkinit_common.h:
Replace /* */ comments with // comments.
145 lines
4.4 KiB
Bash
Executable File
145 lines
4.4 KiB
Bash
Executable File
#! /bin/sh
|
|
#---------------------------------------------------------------------------#
|
|
# vim: ts=4 sw=4 et ft=sh
|
|
#---------------------------------------------------------------------------#
|
|
# @configure_input@
|
|
#---------------------------------------------------------------------------#
|
|
# Copyright (C) 1995-2008 The University of Melbourne.
|
|
# Copyright (C) 2025 The Mercury team.
|
|
# 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
|
|
# in the places listed at the top of util/mkinit.c.
|
|
# *************************************************************************
|
|
|
|
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 the following system library names, or if you add
|
|
# a new system library, 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
|
|
# scripts/Mercury.config.in
|
|
# scripts/Mercury.config.bootstrap.in
|
|
# tools/bootcheck,
|
|
# tools/binary
|
|
# tools/binary_step
|
|
# tools/linear
|
|
# tools/lmc.in
|
|
# tools/lml
|
|
|
|
RT_LIB_NAME=mer_rt
|
|
STD_LIB_NAME=mer_std
|
|
TRACE_LIB_NAME=mer_trace
|
|
EVENTSPEC_LIB_NAME=mer_eventspec
|
|
BROWSER_LIB_NAME=mer_browser
|
|
MDBCOMP_LIB_NAME=mer_mdbcomp
|
|
SSDB_LIB_NAME=mer_ssdb
|
|
|
|
MKINIT=${MERCURY_MKINIT=mkinit}
|
|
|
|
case "${debug}" in
|
|
true)
|
|
trace_opt="-t"
|
|
init_opt="-i"
|
|
;;
|
|
esac
|
|
|
|
case "${profile_deep}" in
|
|
true)
|
|
init_opt="-i"
|
|
;;
|
|
esac
|
|
|
|
if test "${experimental_complexity}" != ""
|
|
then
|
|
experimental_complexity_opt="-X ${experimental_complexity}"
|
|
else
|
|
experimental_complexity_opt=""
|
|
fi
|
|
|
|
if test "${mercury_stdlib_dir}" != ""
|
|
then
|
|
MERCURY_MOD_LIB_MODS="\
|
|
${mercury_stdlib_dir}/modules/${GRADE}/${RT_LIB_NAME}.init \
|
|
${mercury_stdlib_dir}/modules/${GRADE}/${STD_LIB_NAME}.init"
|
|
MERCURY_TRACE_LIB_MODS="\
|
|
${mercury_stdlib_dir}/modules/${GRADE}/${BROWSER_LIB_NAME}.init \
|
|
${mercury_stdlib_dir}/modules/${GRADE}/${MDBCOMP_LIB_NAME}.init"
|
|
MERCURY_SSDB_LIB_MODS="\
|
|
${mercury_stdlib_dir}/modules/${GRADE}/${SSDB_LIB_NAME}.init"
|
|
fi
|
|
MERCURY_TRACE_LIB_MODS="${MERCURY_TRACE_LIB_MODS} ${trace_init_files}"
|
|
MERCURY_SSDB_LIB_MODS="${MERCURY_SSDB_LIB_MODS} ${ssdb_init_files}"
|
|
|
|
MERCURY_ALL_LIB_MODS="${MERCURY_MOD_LIB_MODS}"
|
|
|
|
# XXX why does this test ${trace_opt} instead of ${trace}?
|
|
case "${trace_opt}" in
|
|
-t)
|
|
init_opt="-i"
|
|
MERCURY_ALL_LIB_MODS="${MERCURY_ALL_LIB_MODS}\
|
|
${MERCURY_TRACE_LIB_MODS}"
|
|
;;
|
|
esac
|
|
|
|
case "${ss_debug}" in
|
|
true)
|
|
ssdb=true
|
|
;;
|
|
esac
|
|
|
|
case "${ssdb}" in
|
|
true)
|
|
MERCURY_ALL_LIB_MODS="${MERCURY_ALL_LIB_MODS}\
|
|
${MERCURY_SSDB_LIB_MODS}"
|
|
;;
|
|
esac
|
|
|
|
# XXX: ${EXTRA_INIT_FILES} is not set or used anywhere by our code,
|
|
# and users can't set it since it is not documented anywhere,
|
|
# so its value should always be the empty string.
|
|
|
|
case "$#" in
|
|
0)
|
|
exec ${MKINIT} -c"${maxcalls}" ${init_opt} ${trace_opt} \
|
|
${library_opt} ${defentry_opt} ${extra_inits_opt} \
|
|
-g "${GRADE}" -o "${init_c_file}" ${experimental_complexity_opt} \
|
|
${extra_init_dirs} ${always_exec_init_opts} \
|
|
${EXTRA_INIT_FILES} ${MERCURY_ALL_LIB_MODS}
|
|
;;
|
|
*)
|
|
exec ${MKINIT} -c"${maxcalls}" ${init_opt} ${trace_opt} \
|
|
${library_opt} ${defentry_opt} ${extra_inits_opt} \
|
|
-g "${GRADE}" -o "${init_c_file}" ${experimental_complexity_opt} \
|
|
-r "${runtime_flags}" \
|
|
${extra_init_dirs} ${always_exec_init_opts} \
|
|
"$@" \
|
|
${EXTRA_INIT_FILES} ${MERCURY_ALL_LIB_MODS}
|
|
;;
|
|
esac
|