mirror of
https://github.com/Mercury-Language/mercury.git
synced 2025-12-16 14:25:56 +00:00
scripts/c2init.in: scripts/mmake.in: scripts/msc.in: Small changes to the help messages to make them come out better when converted to man pages. scripts/mgnuc.in: Add a `--help' option.
77 lines
2.2 KiB
Bash
Executable File
77 lines
2.2 KiB
Bash
Executable File
#! /bin/sh
|
|
# @configure_input@
|
|
#---------------------------------------------------------------------------#
|
|
# Copyright (C) 1995 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: the manpage is produced automatically from this help
|
|
# message, so if you change the help message, don't forget to check
|
|
# that the manpage still looks OK.
|
|
Help="\
|
|
Name: c2init - Create Mercury initialization file.
|
|
Usage: c2init [options] modules ...
|
|
Options:
|
|
-l, --library
|
|
Don't generate a \`main()' function.
|
|
Instead, generate a function
|
|
mercury_main(int argc, char **argv, char *stack_bottom);
|
|
(declared in \"init.h\") that can be called from C code.
|
|
-c <n>, --max-calls <n>
|
|
Break up the initialization into groups of at most <n> function
|
|
calls. (Default value of <n> is 40.)
|
|
-w <label>, --entry-point <label>
|
|
Set entry point to <label>.
|
|
(Default value is \`mercury__io__run_0_0'.)
|
|
Environment variables:
|
|
MERCURY_MOD_LIB_DIR, MERCURY_MOD_LIB_MODS, MERCURY_MKINIT.
|
|
"
|
|
|
|
MERCURY_MOD_LIB_DIR=${MERCURY_MOD_LIB_DIR=@LIBDIR@/modules}
|
|
MERCURY_MOD_LIB_MODS=${MERCURY_MOD_LIB_MODS=$MERCURY_MOD_LIB_DIR/*}
|
|
MKINIT=${MERCURY_MKINIT=mkinit}
|
|
|
|
# maximum number of calls to put in a single function
|
|
maxcalls=40
|
|
defentry=mercury__io__run_0_0
|
|
library_opt=""
|
|
while true; do
|
|
case "$1" in
|
|
-c|--max-calls)
|
|
maxcalls="$2"; shift; shift;;
|
|
-w|--entry-point)
|
|
defentry="$2"; shift; shift;;
|
|
-l|--library)
|
|
library_opt="-l"; shift;;
|
|
-l-|--no-library)
|
|
library_opt=""; shift;;
|
|
-h|--help|"-?")
|
|
echo "$Help"
|
|
exit 0;;
|
|
--)
|
|
shift; break;;
|
|
-*)
|
|
echo "`basename $0`: invalid option \`$1'" 1>&2;
|
|
echo "Try \`$0 --help' for help." 1>&2;
|
|
exit 1;;
|
|
*)
|
|
break;;
|
|
esac
|
|
done
|
|
|
|
case $# in
|
|
0) exec $MKINIT -w"$defentry" -c"$maxcalls" $library_opt \
|
|
$MERCURY_MOD_LIB_MODS
|
|
;;
|
|
*) exec $MKINIT -w"$defentry" -c"$maxcalls" $library_opt \
|
|
"$@" $MERCURY_MOD_LIB_MODS
|
|
;;
|
|
esac
|