mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-16 18:03:36 +00:00
Estimated hours taken: 6 configure.in: Rename BRANCH_DELAY_SLOT to HAVE_DELAY_SLOT. bootcheck: Add a new option, -r. If given, this makes a copy of the runtime directory instead of linking to it in stage[23]. This allows the stage[23] versions to use a different grade than stage1. Another change is that we now remake only the library and compiler dependencies, but not the profiler dependencies. binary: A shell script to find code generation and optimization bugs by performing binary search. It depends on the existence of two directories, stage2.ok and stage2.bad, containing correct and buggy versions of stage2, and tries different mixes of .c code from each until it locates the offending part of the offending .c file. Note that this script has so far been tested only in pieces. binary_step: Check whether a particular mix of .c files from the ok and bad directories is able to build a stage3 compiler. It doesn't check for differences from stage2, since stage2 is a patchwork. divide: Divide a .c file into its parts. assemble: Assemble a .c file, with the specified parts coming from the .c file in stage2.bad and the others from stage2.ok. NOTE: these scripts require some other auxiliary scripts. I will put these into /usr/local/contrib when it is created on cyclone. In the meantime, they are in ~zs/bin/script.
134 lines
2.6 KiB
Bash
Executable File
134 lines
2.6 KiB
Bash
Executable File
#!/bin/sh
|
|
|
|
usage="\
|
|
Usage: $0 [options]
|
|
Options:
|
|
-h, --help
|
|
Display this usage message.
|
|
-j <num-jobs>, --jobs <num-jobs>
|
|
Run using <num-jobs> different parallel processes.
|
|
-m <mmake-args>, --mmake-args <mmake-args>
|
|
Pass <mmake-args> as options to \`mmake'.
|
|
"
|
|
|
|
jfactor=""
|
|
mmake_opts=""
|
|
|
|
while [ $# -gt 0 ]; do
|
|
case "$1" in
|
|
|
|
-h|--help)
|
|
echo "$usage"
|
|
exit 0 ;;
|
|
|
|
-j|--jobs)
|
|
jfactor="-j$2"; shift ;;
|
|
-j*)
|
|
jfactor="-j` expr $1 : '-j\(.*\)' `" ;;
|
|
--jobs*)
|
|
jfactor="--jobs` expr $1 : '--jobs\(.*\)' `" ;;
|
|
|
|
-m|--mmake)
|
|
mmake_opts="$mmake_opts $2"; shift ;;
|
|
|
|
--)
|
|
shift; break ;;
|
|
-*)
|
|
echo "$0: unknown option \`$1'" 1>&2
|
|
echo "$usage" 1>&2
|
|
exit 1 ;;
|
|
*)
|
|
break ;;
|
|
esac
|
|
shift
|
|
done
|
|
|
|
root=`/bin/pwd`
|
|
|
|
MERCURY_COMPILER=$root/stage1/mercury_compile
|
|
export MERCURY_COMPILER
|
|
MERCURY_INT_DIR=$root/stage2/library
|
|
export MERCURY_INT_DIR
|
|
|
|
MMAKE_VPATH=.
|
|
export MMAKE_VPATH
|
|
MMAKE_DIR=../scripts
|
|
export MMAKE_DIR
|
|
|
|
# Ensure that mmake will not disturb the .o and .c files placed there by binary
|
|
|
|
touch stage2/library/*.c
|
|
touch stage2/compiler/*.c
|
|
|
|
sleep 2
|
|
|
|
touch stage2/library/*.o
|
|
touch stage2/compiler/*.o
|
|
|
|
# Rebuild the stage2 library and compiler from the components already there.
|
|
|
|
/bin/rm -f stage2/library/libmercury.a stage2/library/libmercury.so
|
|
/bin/rm -f stage2/compiler/mercury_compile
|
|
|
|
# the `RM_C=:' ensures that the `.c' files do not get deleted
|
|
|
|
if (cd stage2/library ; mmake $mmake_opts $jfactor RM_C=: libmercury)
|
|
then
|
|
echo "building of stage 2 library successful"
|
|
else
|
|
echo "building of stage 2 library not successful"
|
|
exit 1
|
|
fi
|
|
|
|
if (cd stage2/compiler ; mmake $mmake_opts $jfactor RM_C=: mercury_compile)
|
|
then
|
|
echo "building of stage 2 compiler successful"
|
|
else
|
|
echo "building of stage 2 compiler not successful"
|
|
exit 1
|
|
fi
|
|
|
|
unset MMAKE_VPATH
|
|
unset MMAKE_DIR
|
|
|
|
MERCURY_COMPILER=$root/stage2/compiler/mercury_compile
|
|
export MERCURY_COMPILER
|
|
MERCURY_INT_DIR=$root/stage3/library
|
|
export MERCURY_INT_DIR
|
|
|
|
# Rebuild the stage3 library and compiler from scratch
|
|
|
|
/bin/rm -f stage3/library/*.c
|
|
/bin/rm -f stage3/compiler/*.c
|
|
|
|
if (cd stage3 ; mmake $mmake_opts depend_library depend_compiler)
|
|
then
|
|
echo "building of stage 3 dependencies successful"
|
|
else
|
|
echo "building of stage 3 dependencies not successful"
|
|
exit 1
|
|
fi
|
|
|
|
MMAKE_VPATH=.
|
|
export MMAKE_VPATH
|
|
MMAKE_DIR=../scripts
|
|
export MMAKE_DIR
|
|
|
|
if (cd stage3/library ; mmake -S $mmake_opts $jfactor cs)
|
|
then
|
|
echo "building of stage 3 library successful"
|
|
else
|
|
echo "building of stage 3 library not successful"
|
|
exit 1
|
|
fi
|
|
|
|
if (cd stage3/compiler ; mmake -S $mmake_opts $jfactor cs)
|
|
then
|
|
echo "building of stage 3 compiler successful"
|
|
else
|
|
echo "building of stage 3 compiler not successful"
|
|
exit 1
|
|
fi
|
|
|
|
exit 0
|