mirror of
https://github.com/Mercury-Language/mercury.git
synced 2025-12-18 23:35:25 +00:00
mnl.sh: Remove the dependency on @LIBOBJS@, since @LIBOBJS@ comes from the library directory and it's a bit hard to compute in the scripts directory.
57 lines
980 B
Bash
57 lines
980 B
Bash
#!/bin/sh
|
|
|
|
# mnl - Mercury NU-Prolog Linker.
|
|
#
|
|
# Links NU-Prolog object files together with the Mercury library
|
|
# to produce an executable binary.
|
|
#
|
|
# Usage: mnl [-v|--verbose] [<nc link options>] files...
|
|
#
|
|
# Environment variables: MERCURY_LIB_DIR, MERCURY_LIB_OBJS
|
|
|
|
NULIBDIR=${MERCURY_LIB_DIR:-@LIBDIR@/nuprolog/@FULLARCH@}
|
|
LIBRARY_OBJS=${MERCURY_LIB_OBJS:-`cd $NULIBDIR; echo *.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 2
|
|
;;
|
|
-*) options="$options $1"
|
|
shift
|
|
;;
|
|
*) break 2
|
|
;;
|
|
esac
|
|
done
|
|
if $debug; then
|
|
LIBRARY_OBJS="$LIBRARY_OBJS debug.no portray.no"
|
|
fi
|
|
|
|
objlist=
|
|
for obj in $LIBRARY_OBJS; do
|
|
if echo "" "$@" "" | grep " $obj " > /dev/null; then
|
|
true
|
|
else
|
|
objlist="$objlist $NULIBDIR/$obj"
|
|
fi
|
|
done
|
|
|
|
if $verbose; then
|
|
echo nc $options $objlist "$@"
|
|
fi
|
|
exec nc $options $objlist "$@"
|