mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-23 05:13:48 +00:00
Estimated hours taken: 1 Ensure that mmake does not attempt to remake the `.c' file if it is up-to-date. (This change should hopefully fix a problem with the source distribution not being able to bootstrap itself.) Also a couple of minor tidy-ups. scripts/mmake.in: Export new variable MMAKE_MAKE_CMD, for use by Mmake.rules. scripts/Mmake.rules: In the rule for `.m' -> `.o', use a recursive invocatino of make (via the MMAKE_MAKE_CMD variable) to build the `.c' file, rather than unconditionally invoking `$(MCG)'. scripts/.cvsignore: Add Mmake.vars, since it is now automatically-generated. scripts/ml.in: Some stylistic changes: make sure that autoconf @var@ variables occur only in assignments to shell variables at the start of the script, not scattered throughout the body of the script.
131 lines
3.1 KiB
Bash
131 lines
3.1 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.
|
|
#---------------------------------------------------------------------------#
|
|
#
|
|
# mmake - Mercury Make.
|
|
#
|
|
# Type mmake -h for help.
|
|
#
|
|
#-----------------------------------------------------------------------------#
|
|
|
|
MMAKE_MAKE=${MMAKE_MAKE=@GNU_MAKE@}
|
|
MMAKE_DIR=${MMAKE_DIR=@LIBDIR@/mmake}
|
|
MMAKE_VARS=${MMAKE_VARS=$MMAKE_DIR/Mmake.vars}
|
|
MMAKE_RULES=${MMAKE_RULES=$MMAKE_DIR/Mmake.rules}
|
|
MERCURY_INT_DIR=${MERCURY_INT_DIR=@LIBDIR@/ints}
|
|
MERCURY_DEFAULT_GRADE=${MERCURY_DEFAULT_GRADE=@DEFAULT_GRADE@}
|
|
|
|
MMAKE=$0
|
|
verbose=false
|
|
save_makefile=false
|
|
|
|
while [ $# -gt 0 ]; do
|
|
case $1 in
|
|
-h|--help)
|
|
#-----------------------------------------------------------------------------#
|
|
cat << 'EOF'
|
|
Usage: mmake [<mmake options>] [-- <make options>] <target>...
|
|
Options:
|
|
-s, --save-makefile:
|
|
Save the generated makefile to `Mmake.makefile'.
|
|
-v, --verbose:
|
|
Print verbose progress messages.
|
|
-h, --help:
|
|
Print this usage message.
|
|
Targets:
|
|
<module>.depend:
|
|
Make the file `<module>.dep'. This step is required
|
|
in preparation for the targets below.
|
|
<module>:
|
|
Compile and link a Mercury program with main module
|
|
`<module>.m' to produce an executable.
|
|
<module>.nu:
|
|
Compile and link a Mercury program with NU-Prolog
|
|
rather than with the Mercury compiler.
|
|
<module>.sicstus:
|
|
Compile and link a Mercury program with SICStus Prolog
|
|
rather than with the Mercury compiler.
|
|
<module>.nu.debug:
|
|
<module>.sicstus.debug:
|
|
Debugging versions of the above.
|
|
clean:
|
|
Remove intermediate files.
|
|
realclean:
|
|
Remove all automatically-generated files: intermediate files,
|
|
dependency files, and executables.
|
|
EOF
|
|
#-----------------------------------------------------------------------------#
|
|
exit
|
|
;;
|
|
-s|--save-makefile)
|
|
save_makefile=true
|
|
MMAKE="$MMAKE $1"
|
|
shift
|
|
;;
|
|
-v|--verbose)
|
|
verbose=true
|
|
MMAKE="$MMAKE $1"
|
|
shift
|
|
;;
|
|
--)
|
|
MMAKE="$MMAKE $1"
|
|
shift
|
|
break
|
|
;;
|
|
*)
|
|
break
|
|
;;
|
|
esac
|
|
done
|
|
|
|
if [ -f Mmake ]; then
|
|
mmake="Mmake"
|
|
else
|
|
mmake=""
|
|
fi
|
|
if [ "`echo *.dep`" = "*.dep" ]; then
|
|
deps=""
|
|
else
|
|
deps="*.dep"
|
|
fi
|
|
if [ "`echo *.d`" = "*.d" ]; then
|
|
ds=""
|
|
else
|
|
ds="*.d"
|
|
fi
|
|
|
|
if $save_makefile; then
|
|
tmp=Mmake.makefile
|
|
else
|
|
tmp=/tmp/mmake.$$
|
|
trap 'status=$?; rm -f $tmp; exit $status' 0 1 2 3 13 15
|
|
fi
|
|
|
|
MMAKE_MAKE_CMD="${MMAKE_MAKE} -f $tmp -r"
|
|
|
|
if $verbose; then
|
|
echo MMAKE=$MMAKE
|
|
echo export MMAKE
|
|
echo MMAKE_MAKE_CMD=$MMAKE_MAKE_CMD
|
|
echo export MMAKE_MAKE_CMD
|
|
echo MERCURY_INT_DIR=$MERCURY_INT_DIR
|
|
echo export MERCURY_INT_DIR
|
|
echo MERCURY_DEFAULT_GRADE=$MERCURY_DEFAULT_GRADE
|
|
echo export MERCURY_DEFAULT_GRADE
|
|
echo cat ${MMAKE_VARS} $deps $ds $mmake ${MMAKE_RULES} ">" $tmp
|
|
echo ${MMAKE_MAKE} -f $tmp -r "$@"
|
|
fi
|
|
export MMAKE
|
|
export MMAKE_MAKE_CMD
|
|
export MERCURY_INT_DIR
|
|
export MERCURY_DEFAULT_GRADE
|
|
cat ${MMAKE_VARS} $deps $ds $mmake ${MMAKE_RULES} > $tmp
|
|
case $# in
|
|
0) ${MMAKE_MAKE} -f $tmp -r ;;
|
|
*) ${MMAKE_MAKE} -f $tmp -r "$@" ;;
|
|
esac
|