mirror of
https://github.com/Mercury-Language/mercury.git
synced 2025-12-18 07:15:19 +00:00
Estimated hours taken: 0.5
scripts/{c2init,mnc,mnl,msc,msl}.in:
Fix a portability problem: ULTRIX's /bin/sh does not understand
`shift 2', so I've replaced all occurrences of this with
`shift; shift'. (Thanks to Jeff Schultz for the bug report.)
73 lines
1.5 KiB
Bash
73 lines
1.5 KiB
Bash
#! /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.
|
|
#---------------------------------------------------------------------------#
|
|
|
|
# mnl - Mercury NU-Prolog Linker.
|
|
#
|
|
# Links NU-Prolog object files together with the Mercury library
|
|
# to produce an executable binary.
|
|
#
|
|
# Usage: mnl [-v|--verbose] [-d|--debug] [<nc link options>] files...
|
|
#
|
|
# Environment variables: MERCURY_LIB_DIR, MERCURY_LIB_OBJS
|
|
|
|
NULIBDIR=${MERCURY_NU_LIB_DIR=@LIBDIR@/nuprolog/@FULLARCH@}
|
|
LIBRARY_OBJS=${MERCURY_NU_LIB_OBJS=" `cd $NULIBDIR; echo *.no` "}
|
|
debug_objs="portray.no debug.no error.no"
|
|
|
|
options=
|
|
verbose=false
|
|
debug=false
|
|
|
|
while true; do
|
|
case "$1" in
|
|
-v|--verbose)
|
|
verbose=true
|
|
shift
|
|
;;
|
|
-d|--debug)
|
|
debug=true
|
|
shift
|
|
;;
|
|
-e|-u|-o|-F)
|
|
options="$options $1 $2"
|
|
shift; shift
|
|
;;
|
|
-*) options="$options $1"
|
|
shift
|
|
;;
|
|
*) break 2
|
|
;;
|
|
esac
|
|
done
|
|
|
|
objlist=
|
|
for obj in $LIBRARY_OBJS; do
|
|
if echo "" "$@" "$debug_objs " | grep " $obj " > /dev/null; then
|
|
true
|
|
else
|
|
objlist="$objlist $NULIBDIR/$obj"
|
|
fi
|
|
done
|
|
if $debug; then
|
|
for obj in $debug_objs; do
|
|
if echo "" "$@" "" | grep " $obj " > /dev/null; then
|
|
true
|
|
else
|
|
objlist="$objlist $NULIBDIR/$obj"
|
|
fi
|
|
done
|
|
fi
|
|
|
|
if $verbose; then
|
|
echo nc $options $objlist "$@"
|
|
fi
|
|
case $# in
|
|
0) exec nc $options $objlist ;;
|
|
*) exec nc $options $objlist "$@" ;;
|
|
esac
|