[m-rev.] for review: remove junk from command lines

Zoltan Somogyi zs at cs.mu.OZ.AU
Fri May 6 18:38:17 AEST 2005


On 29-Apr-2005, Zoltan Somogyi <zs at cs.mu.OZ.AU> wrote:
> I can't really test the effect of this change on the nightly tests, which
> use a different setup from bootcheck. It is likely that they will need some
> minor tweaks, which I won't have time to do next week.

I found that some minor tweaks were necessary even for bootchecks in some
grades with some options. My testing hasn't been exhaustive, but it has
certainly been exhausting :-(, if only for my laptop. Here is the updated
log message and diff I am committing. Note that shorted mgnuc command lines
are coming next.

Zoltan.

Remove most of the junk from the command lines executed by make when building
the compiler and by bootcheck when building test cases. We do this by moving
the junk into files consulted via the --flags option.

After this change, it is actually possible to see in a glance not just which
files are being compiled but also with which options. The size of the output
(measured in bytes) from a bootcheck is now only about 40% of what is was
before.

configure.in:
	Remember the path to the bootstrap compiler and the flags it should be
	invoked with separately. Put the flags into the FLAGS files in various
	directories.

	Test whether the default install directory actually exists, so that
	the -L and -R linker options referring to this directory are passed
	to the C compiler only if it does.

Mmake.common.in:
	Comment out a bunch of additions of MCFLAGS, the ones whose contents
	are now in FLAGS files.

	Conform to the changes in configure.in.

	Add a template rule for the dependencies of the FLAGS files.

Mmake.workspace:
	Comment out a bunch of additions of MCFLAGS, the ones whose contents
	are now in FLAGS files. In some cases, add references to the FLAGS
	files.

Mmakefile:
	When rebuilding Mmake.common, rebuild only Mmake.common, not all files
	created by configure.

analysis/ANALYSIS_FLAGS.in:
browser/MDB_FLAGS.in:
compiler/COMP_FLAGS.in:
deep_profiler/PROF_FLAGS.in:
library/LIB_FLAGS.in:
mdbcomp/MDBCOMP_FLAGS.in:
profiler/DEEP_FLAGS.in:
slice/SLICE_FLAGS.in:
tests/TESTS_FLAGS.in:
	Add these files, which each contain the junk flags (the flags which are
	the same on every invocation and mostly just clutter up compiler
	command lines) that are needed on each compiler invocation in the
	relevant directory. Besides the results of configuration (word size
	etc), and the paths to other parts of the system, these files mostly
	control which warnings are enabled.

	Restrict the list of directories in -I options to what is sensible;
	for example, don't specify -I../analysis in the deep_profiler
	directory.

library/INTER_FLAGS:
	Add this file, which contains the flags enabled with intermodule
	optimization.

tests/WS_FLAGS.ws:
	Add this file. Unlike the .in files, which processed by config.status
	based on the results of autoconfiguration, this one is processed to
	specify the location of the workspace being tested.

analysis/Mmakefile:
browser/Mmakefile:
compiler/Mmakefile:
deep_profiler/Mmakefile:
library/Mmakefile:
mdbcomp/Mmakefile:
profiler/Mmakefile:
tests/Mmakefile:
	Include the relevant directory's FLAGS file on the command line, to
	replace all the additions to MCFLAGS in ../Mmake.common and in
	../Mmake.workspace, and in some cases, the directory-specific Mmakefile
	itself.

	Build the directory's FLAGS file before executing the depend target,
	since most compiler options beyond --generate-dependencies come from
	there.

	Delete the FLAGS files generated by config.status when doing "make
	clean".

tests/Mmakefile:
	Allow the environment to define DIFF_OPTS.

runtime/Mmakefile:
	Use an option to tell config.status what to rebuild, not some
	environment variables.

tests/invalid/Mercury.options:
	For two test cases, reset an option that is set in tests/WS_FLAGS,
	to match the options the affected tests were compiled with before.

tests/invalid/*.err2:
	Update these expected files to account for the use of error_util
	in error messages by previous changes to the compiler. These expected
	output files are used only with --use-subdirs.

tests/warnings/Mmakefile:
	For all test cases, reset an option that is set in tests/WS_FLAGS,
	to match the options the tests were compiled with before.

scripts/prepare_tmp_dir_grade_part
	Copy the flags files when creating the subdirectories of tmp_dir.

scripts/mgnuc.in:
	Provide a mechanism, a per-directory .mgnuc_opts file, for specifying
	the options that are required for every C file in a directory. The
	intention is to use this for -I../library etc, but this is not done
	yet; one thing at a time.

tools/bootcheck:
	Copy the FLAGS files when creating stage2 and stage3.

	Don't specify the compiler options that are now in FLAGS files.

	Fill in the location of the workspace in tests/WS_FlAGS before running
	the tests.

	Provide a mechanism (a file ~/.bootcheck_diff_opts) to allow the user
	to specify what options to invoke diff with.

	Move the setting of MMAKE_USE_SUBDIRS and MMAKE_USE_MMC_MAKE after
	we have built stage1, and always copy the profilers if --use-subdirs
	is set. The old ways of doing things caused problems if bootcheck
	was given --use-subdirs but stage1 doesn't use subdirs: the bootcheck
	modified the stage1 slice, profiler and deep_profiler directories.

cvs diff: Diffing .
Index: Mmake.common.in
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/Mmake.common.in,v
retrieving revision 1.81
diff -u -r1.81 Mmake.common.in
--- Mmake.common.in	28 Jan 2005 07:11:28 -0000	1.81
+++ Mmake.common.in	30 Apr 2005 04:26:02 -0000
@@ -29,7 +29,7 @@
 #-----------------------------------------------------------------------------#
 
 # Specify the Mercury compiler to use for bootstrapping.
-MC		= @BOOTSTRAP_MC@
+MC		= @BOOTSTRAP_MC_COMPILER@
 
 # Specify the compilation model to use for compiling the compiler.
 GRADE		= @GRADE@
@@ -121,6 +121,8 @@
 INSTALL_PREFIX		= @prefix@
 FINAL_INSTALL_PREFIX	= @prefix@
 
+INSTALLABLE_PREFIX	= @INSTALLABLE_PREFIX@
+
 #-----------------------------------------------------------------------------#
 
 INSTALL_MERC_GC_LIB_DIR	= $(INSTALL_MERC_GRADELESS_LIB_DIR)
@@ -138,7 +140,8 @@
 GRADESTRING = $(shell $(SCRIPTS_DIR)/canonical_grade $(ALL_GRADEFLAGS))
 
 # Options to pass to the Mercury compiler
-MCFLAGS	+= --no-infer-all --halt-at-warn --no-warn-inferred-erroneous
+# now included in FLAGS files
+# MCFLAGS	+= --no-infer-all --halt-at-warn --no-warn-inferred-erroneous
 
 # Do we want to deal with intermodule information when building the library?
 # By default yes, since this way we note immediately when intermodule
@@ -458,6 +461,13 @@
 	-rm -f $(OBJ_CHECKS)
 
 endif
-# ifdef CHECK_OBJS
+# the endif is for "ifdef CHECK_OBJS" a long way above
+
+#-----------------------------------------------------------------------------#
+
+%_FLAGS:	%_FLAGS.in ../config.status
+		@if test -f $*_FLAGS; then chmod u+w $*_FLAGS; fi
+		@../config.status --file $*_FLAGS
+		@chmod a-w $*_FLAGS
 
 #-----------------------------------------------------------------------------#
Index: Mmake.workspace
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/Mmake.workspace,v
retrieving revision 1.17
diff -u -r1.17 Mmake.workspace
--- Mmake.workspace	28 Jan 2005 07:11:29 -0000	1.17
+++ Mmake.workspace	12 Apr 2005 04:59:04 -0000
@@ -101,39 +101,42 @@
 VPATH =		$(LIBRARY_DIR)
 
 ifeq ($(origin MERCURY_CONFIG_FILE),undefined)
-MERCURY_CONFIG_FILE =	$(SCRIPTS_DIR)/Mercury.config.bootstrap
+MERCURY_CONFIG_FILE = $(SCRIPTS_DIR)/Mercury.config.bootstrap
+CONFIG_OVERRIDE =
+else
+CONFIG_OVERRIDE = --config-file $(MERCURY_CONFIG_FILE)
 endif
 
-MCFLAGS +=	--config-file $(MERCURY_CONFIG_FILE)
-
 ifeq ($(MMAKE_USE_MMC_MAKE),yes)
-MCFLAGS +=	--options-file $(WORKSPACE)/Mercury.options
+MCFLAGS      += --options-file $(WORKSPACE)/Mercury.options
 endif
 
-MCFLAGS += 	--no-mercury-stdlib-dir -I$(LIBRARY_DIR)
-MGNUCFLAGS +=	--no-mercury-stdlib-dir
-C2INITFLAGS += 	--trace-init-file $(BROWSER_DIR)/$(BROWSER_LIB_NAME).init \
+# now in FLAGS files
+# MCFLAGS    += --no-mercury-stdlib-dir -I$(LIBRARY_DIR)
+MGNUCFLAGS   += --no-mercury-stdlib-dir
+C2INITFLAGS  += --trace-init-file $(BROWSER_DIR)/$(BROWSER_LIB_NAME).init \
 		--trace-init-file $(MDBCOMP_DIR)/$(MDBCOMP_LIB_NAME).init
-C2INITARGS +=	$(LIBRARY_DIR)/$(STD_LIB_NAME).init \
+C2INITARGS   += $(LIBRARY_DIR)/$(STD_LIB_NAME).init \
 		$(RUNTIME_DIR)/$(RT_LIB_NAME).init
-MLFLAGS +=	--no-mercury-stdlib-dir
+MLFLAGS      += --no-mercury-stdlib-dir
 
 #
 # Work out the C include directories.
 #
-C_INCL_DIRS =	-I$(BOEHM_GC_DIR) -I$(BOEHM_GC_DIR)/include -I$(MPS_GC_DIR)
+C_INCL_DIRS   = -I$(BOEHM_GC_DIR) -I$(BOEHM_GC_DIR)/include -I$(MPS_GC_DIR)
 ifneq ($(LINK_BOEHM_GC_ONLY),yes)
-C_INCL_DIRS +=	-I$(RUNTIME_DIR)
+C_INCL_DIRS  += -I$(RUNTIME_DIR)
 ifneq ($(LINK_RUNTIME_ONLY),yes)
-C_INCL_DIRS +=	-I$(LIBRARY_DIR) -I$(LIBRARY_DIR)/$(mihs_subdir)
+C_INCL_DIRS  += -I$(LIBRARY_DIR) -I$(LIBRARY_DIR)/$(mihs_subdir)
 ifneq ($(LINK_STDLIB_ONLY),yes)
-C_INCL_DIRS +=	-I$(MDBCOMP_DIR) -I$(MDBCOMP_DIR)/$(mihs_subdir) \
+C_INCL_DIRS  += -I$(MDBCOMP_DIR) -I$(MDBCOMP_DIR)/$(mihs_subdir) \
 		-I$(BROWSER_DIR) -I$(BROWSER_DIR)/$(mihs_subdir) -I$(TRACE_DIR)
 endif
 endif
 endif
-CFLAGS +=	$(C_INCL_DIRS)
-MCFLAGS +=	$(C_INCL_DIRS:-I%=--c-include-directory %)
+CFLAGS       += $(C_INCL_DIRS)
+# now in FLAGS files
+# MCFLAGS    += $(C_INCL_DIRS:-I%=--c-include-directory %)
 
 #
 # Work out the .NET directories
@@ -214,13 +217,14 @@
 		-L$(LIBRARY_DIR) -L$(TRACE_DIR) -L$(MDBCOMP_DIR) \
 		-L$(BROWSER_DIR)
 
-MLFLAGS +=	$(LIB_DIR_OPTS)
-MCFLAGS +=	$(LIB_DIR_OPTS)
-MLLIBS +=	$(LINK_LIB_OPTS)
+MLFLAGS      += $(LIB_DIR_OPTS)
+# now in FLAGS files
+# MCFLAGS    += $(LIB_DIR_OPTS)
+MLLIBS       += $(LINK_LIB_OPTS)
 
 ifeq ($(SET_RPATH),yes)
 MLFLAGS += $(LIB_DIR_OPTS:-L%=-R%)
-MCFLAGS += $(LIB_DIR_OPTS:-L%=-R%)
+MCFLAGS += --flags RPATH
 endif
 
 endif # LINK_STATIC != yes
Index: Mmakefile
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/Mmakefile,v
retrieving revision 1.110
diff -u -r1.110 Mmakefile
--- Mmakefile	2 May 2005 01:38:50 -0000	1.110
+++ Mmakefile	2 May 2005 01:47:53 -0000
@@ -344,7 +344,7 @@
 	fi
 
 Mmake.common: Mmake.common.in config.status
-	./config.status
+	./config.status --file Mmake.common
 
 README: .README.in VERSION
 	sed 's/@VERSION@/$(VERSION)/g' .README.in > README
Index: configure.in
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/configure.in,v
retrieving revision 1.414
diff -u -r1.414 configure.in
--- configure.in	23 Mar 2005 03:51:08 -0000	1.414
+++ configure.in	29 Apr 2005 02:58:12 -0000
@@ -91,9 +91,18 @@
 AC_DEFINE_UNQUOTED(MR_VERSION, "$VERSION")
 if test "$prefix" = "NONE"; then
 	PREFIX="$ac_default_prefix"
+	if test -d $PREFIX
+	then
+		INSTALLABLE_PREFIX=yes
+	else
+		INSTALLABLE_PREFIX=no
+	fi
 else
 	PREFIX="$prefix"
+	# the directory may be created later
+	INSTALLABLE_PREFIX=yes
 fi
+AC_SUBST(INSTALLABLE_PREFIX)
 case "$PREFIX" in
     *\ *)
 	AC_MSG_ERROR(
@@ -3490,7 +3499,11 @@
 if test "$BOOTSTRAP_MC" = ""; then
 	BOOTSTRAP_MC=mmc
 fi
-BOOTSTRAP_MC="$BOOTSTRAP_MC $HAVE_BOXED_FLOATS --conf-low-tag-bits $LOW_TAG_BITS --bits-per-word $BITS_PER_WORD --bytes-per-word $BYTES_PER_WORD"
+BOOTSTRAP_MC_COMPILER="$BOOTSTRAP_MC"
+BOOTSTRAP_MC_ARGS="$HAVE_BOXED_FLOATS --conf-low-tag-bits $LOW_TAG_BITS --bits-per-word $BITS_PER_WORD --bytes-per-word $BYTES_PER_WORD"
+BOOTSTRAP_MC="$BOOTSTRAP_MC_COMPILER $BOOTSTRAP_MC_ARGS"
+AC_SUBST(BOOTSTRAP_MC_COMPILER)
+AC_SUBST(BOOTSTRAP_MC_ARGS)
 AC_SUBST(BOOTSTRAP_MC)
 #-----------------------------------------------------------------------------#
 
@@ -3999,6 +4012,15 @@
 bindist/bindist.INSTALL bindist/bindist.Makefile
 tools/lmc tools/dotime runtime/mercury_dotnet.cs java/runtime/Constants.java
 java/runtime/Native.java
+compiler/COMP_FLAGS
+library/LIB_FLAGS
+mdbcomp/MDBCOMP_FLAGS
+browser/MDB_FLAGS
+analysis/ANALYSIS_FLAGS
+slice/SLICE_FLAGS
+profiler/PROF_FLAGS
+deep_profiler/DEEP_FLAGS
+tests/TESTS_FLAGS
 ,
 [
 # Only do this when compiling the source, not when reconfiguring
cvs diff: Diffing analysis
Index: analysis/ANALYSIS_FLAGS.in
===================================================================
RCS file: analysis/ANALYSIS_FLAGS.in
diff -N analysis/ANALYSIS_FLAGS.in
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ analysis/ANALYSIS_FLAGS.in	11 Apr 2005 08:28:43 -0000
@@ -0,0 +1,20 @@
+ at BOOTSTRAP_MC_ARGS@
+--no-infer-all
+--halt-at-warn
+--no-warn-inferred-erroneous
+--no-mercury-stdlib-dir
+-I../library
+-I../browser
+-I../mdbcomp
+--c-include-directory ../boehm_gc
+--c-include-directory ../boehm_gc/include
+--c-include-directory ../runtime
+--c-include-directory ../library
+--c-include-directory ../library/Mercury/mihs
+--c-include-directory ../mdbcomp
+--c-include-directory ../mdbcomp/Mercury/mihs
+--c-include-directory ../browser
+--c-include-directory ../browser/Mercury/mihs
+--c-include-directory ../trace
+--c-include-directory ../analysis
+--config-file ../scripts/Mercury.config.bootstrap
Index: analysis/Mmakefile
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/analysis/Mmakefile,v
retrieving revision 1.4
diff -u -r1.4 Mmakefile
--- analysis/Mmakefile	28 Jan 2005 07:11:33 -0000	1.4
+++ analysis/Mmakefile	29 Apr 2005 03:02:06 -0000
@@ -23,12 +23,11 @@
 # Don't change these without good reason - if you want to
 # do a temporary change, change ../Mmake.params.
 
-MLFLAGS +=	-R$(FINAL_INSTALL_MERC_LIB_DIR)	\
-		-R$(FINAL_INSTALL_MERC_GC_LIB_DIR)
+MLFLAGS += -R$(FINAL_INSTALL_MERC_LIB_DIR) -R$(FINAL_INSTALL_MERC_GC_LIB_DIR)
 
-MTAGS	=	$(SCRIPTS_DIR)/mtags
+MTAGS	= $(SCRIPTS_DIR)/mtags
 
-LN	=	ln
+LN	= ln
 
 #-----------------------------------------------------------------------------#
 
@@ -47,6 +46,8 @@
 
 endif
 
+MCFLAGS	     += --flags ANALYSIS_FLAGS $(CONFIG_OVERRIDE)
+
 #-----------------------------------------------------------------------------#
 
 # targets
@@ -56,7 +57,7 @@
 
 DEPENDS = $(ANALYSIS_LIB_NAME).depend
 .PHONY: depend
-depend:	$(DEPENDS)
+depend:	ANALYSIS_FLAGS $(DEPENDS)
 
 .PHONY: check
 check:	$(ANALYSIS_LIB_NAME).check
@@ -110,6 +111,11 @@
 
 .PHONY: library
 library: lib$(ANALYSIS_LIB_NAME)
+
+#-----------------------------------------------------------------------------#
+
+realclean_local:
+	rm -f ANALYSIS_FLAGS ANALYSIS_FLAGS.date
 
 #-----------------------------------------------------------------------------#
 
cvs diff: Diffing bindist
cvs diff: Diffing boehm_gc
cvs diff: Diffing boehm_gc/Mac_files
cvs diff: Diffing boehm_gc/cord
cvs diff: Diffing boehm_gc/cord/private
cvs diff: Diffing boehm_gc/doc
cvs diff: Diffing boehm_gc/include
cvs diff: Diffing boehm_gc/include/private
cvs diff: Diffing boehm_gc/tests
cvs diff: Diffing browser
Index: browser/MDB_FLAGS.in
===================================================================
RCS file: browser/MDB_FLAGS.in
diff -N browser/MDB_FLAGS.in
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ browser/MDB_FLAGS.in	6 May 2005 01:43:59 -0000
@@ -0,0 +1,23 @@
+ at BOOTSTRAP_MC_ARGS@
+--no-infer-all
+--halt-at-warn
+--no-warn-inferred-erroneous
+--no-mercury-stdlib-dir
+--no-shlib-linker-use-install-name
+-I../library
+-I../mdbcomp
+-I../browser
+--c-include-directory ../boehm_gc
+--c-include-directory ../boehm_gc/include
+--c-include-directory ../runtime
+--c-include-directory ../library
+--c-include-directory ../library/Mercury/mihs
+--c-include-directory ../mdbcomp
+--c-include-directory ../mdbcomp/Mercury/mihs
+-L../boehm_gc
+-L../runtime
+-L../library
+-L../trace
+-L../mdbcomp
+-L../browser
+--config-file ../scripts/Mercury.config.bootstrap
Index: browser/Mmakefile
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/browser/Mmakefile,v
retrieving revision 1.45
diff -u -r1.45 Mmakefile
--- browser/Mmakefile	27 Mar 2005 14:02:19 -0000	1.45
+++ browser/Mmakefile	6 May 2005 01:55:02 -0000
@@ -53,15 +53,20 @@
 # Don't change these without good reason - if you want to do a temporary
 # change, change ../Mmake.params, or create Mmake.browser.params.
 
-CFLAGS	+=	$(DLL_CFLAGS) -I$(MDBCOMP_DIR) -I$(TRACE_DIR)
-MLFLAGS +=	-R$(FINAL_INSTALL_MERC_LIB_DIR)	\
+CFLAGS	     += $(DLL_CFLAGS) \
+		-I$(MDBCOMP_DIR) -I$(MDBCOMP_DIR)/$(mihs_subdir) \
+		-I$(TRACE_DIR)
+ifeq ($(INSTALLABLE_PREFIX),yes)
+MLFLAGS      += -R$(FINAL_INSTALL_MERC_LIB_DIR)	\
 		-R$(FINAL_INSTALL_MERC_GC_LIB_DIR)
-MCFLAGS +=	-I $(MDBCOMP_DIR) \
-		-R$(FINAL_INSTALL_MERC_LIB_DIR)	\
+MCFLAGS      += -R$(FINAL_INSTALL_MERC_LIB_DIR)	\
 		-R$(FINAL_INSTALL_MERC_GC_LIB_DIR)
-MLLIBS +=	$(SOCKET_LIBRARY) $(NSL_LIBRARY) $(DL_LIBRARY)	\
+endif
+MLLIBS 	     += $(SOCKET_LIBRARY) $(NSL_LIBRARY) $(DL_LIBRARY) \
 		$(READLINE_LIBRARIES)
 
+MCFLAGS      += --flags MDB_FLAGS $(CONFIG_OVERRIDE)
+
 #-----------------------------------------------------------------------------#
 
 # Set the install name for Darwin shared libraries.  We disable the
@@ -76,7 +81,6 @@
 # linker, so we disable the mmc option which causes the -install_name option
 # to be passed in the .dep files.
 
-MCFLAGS += --no-shlib-linker-use-install-name
 LD_LIBFLAGS-libmer_browser.dylib = -install_name \
 	$(FINAL_INSTALL_MERC_LIB_DIR)/libmer_browser.dylib
 
@@ -84,9 +88,9 @@
 
 JAVACFLAGS = -classpath $(LIBRARY_DIR)
 
-MTAGS	=	$(SCRIPTS_DIR)/mtags
+MTAGS	= $(SCRIPTS_DIR)/mtags
 
-LN	=	ln
+LN	= ln
 
 #-----------------------------------------------------------------------------#
 
@@ -130,7 +134,7 @@
 library: $(LIBS)
 
 .PHONY: depend
-depend:	$(DEPENDS)
+depend:	MDB_FLAGS $(DEPENDS)
 $(DEPENDS): Mercury.modules
 
 .NOTPARALLEL:
@@ -165,7 +169,7 @@
 # name doesn't match the file name, so smart recompilation
 # won't work without the Mercury.modules file.
 .PHONY: Mercury.modules
-Mercury.modules:
+Mercury.modules: MDB_FLAGS
 	$(MC) $(ALL_GRADEFLAGS) $(ALL_MCFLAGS) -f *.m
 
 .PHONY: check
@@ -254,7 +258,7 @@
 #-----------------------------------------------------------------------------#
 
 realclean_local:
-	rm -f Mercury.modules tags
+	rm -f Mercury.modules tags MDB_FLAGS MDB_FLAGS.date
 
 #-----------------------------------------------------------------------------#
 
cvs diff: Diffing bytecode
cvs diff: Diffing compiler
Index: compiler/COMP_FLAGS.in
===================================================================
RCS file: compiler/COMP_FLAGS.in
diff -N compiler/COMP_FLAGS.in
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ compiler/COMP_FLAGS.in	11 Apr 2005 08:28:51 -0000
@@ -0,0 +1,23 @@
+ at BOOTSTRAP_MC_ARGS@
+--no-infer-all
+--halt-at-warn
+--no-warn-inferred-erroneous
+--no-mercury-stdlib-dir
+-I../library
+-I../browser
+-I../mdbcomp
+-I../analysis
+--c-include-directory ../boehm_gc
+--c-include-directory ../boehm_gc/include
+--c-include-directory ../runtime
+--c-include-directory ../library
+--c-include-directory ../library/Mercury/mihs
+--c-include-directory ../mdbcomp
+--c-include-directory ../mdbcomp/Mercury/mihs
+--c-include-directory ../browser
+--c-include-directory ../browser/Mercury/mihs
+--c-include-directory ../trace
+--c-include-directory ../analysis
+--no-main
+--linkage shared
+--config-file ../scripts/Mercury.config.bootstrap
Index: compiler/Mmakefile
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/Mmakefile,v
retrieving revision 1.83
diff -u -r1.83 Mmakefile
--- compiler/Mmakefile	26 Apr 2005 07:49:21 -0000	1.83
+++ compiler/Mmakefile	30 Apr 2005 04:57:53 -0000
@@ -48,14 +48,12 @@
 $(GCC_MAIN_LIBS): force
 	cd $(GCC_SRC_DIR)/gcc && $(MAKE) mercury_gcc_backend_libs
 
-MCFLAGS +=	-I $(BROWSER_DIR) -I $(MDBCOMP_DIR) -I $(ANALYSIS_DIR) \
-			--c-include-directory $(ANALYSIS_DIR)
-CFLAGS +=	-I$(ANALYSIS_DIR) -I$(ANALYSIS_DIR)/$(mihs_subdir)
-MLOBJS :=	../main.$O ../analysis/lib$(ANALYSIS_LIB_NAME).$A $(MLOBJS)
-ALL_MLLIBS =	$(MLLIBS) $(EXTRA_MLLIBS) $(GCC_BACKEND_LIBS)
-MLFLAGS +=	--no-main --shared
-MCFLAGS +=	--no-main --linkage shared
-C2INITARGS +=	$(ANALYSIS_DIR)/$(ANALYSIS_LIB_NAME).init
+MCFLAGS	     += --flags COMP_FLAGS $(CONFIG_OVERRIDE)
+CFLAGS       += -I$(ANALYSIS_DIR) -I$(ANALYSIS_DIR)/$(mihs_subdir)
+MLOBJS       := ../main.$O ../analysis/lib$(ANALYSIS_LIB_NAME).$A $(MLOBJS)
+ALL_MLLIBS    = $(MLLIBS) $(EXTRA_MLLIBS) $(GCC_BACKEND_LIBS)
+MLFLAGS      += --no-main --shared
+C2INITARGS   += $(ANALYSIS_DIR)/$(ANALYSIS_LIB_NAME).init
 
 #
 # Work-around for a fixed limit: on alpha-dec-osf3.2, if we compile with
@@ -124,12 +122,12 @@
 #
 ifeq ($(ENABLE_GCC_BACK_END),yes)
 # Remove the #if line and everything between the #else and #endif lines.
-GCC_SED_EXPR =	-e "/^$${hash}if *ENABLE_GCC_BACK_END/s/.*//" \
+GCC_SED_EXPR  = -e "/^$${hash}if *ENABLE_GCC_BACK_END/s/.*//" \
 		-e "/^$${hash}else/,/^$${hash}endif/s/.*//"
 else
 # Remove everything between the #if line and the #else line,
 # and the #endif line.
-GCC_SED_EXPR =	-e "/^$${hash}if *ENABLE_GCC_BACK_END/,/^$${hash}else/s/.*//" \
+GCC_SED_EXPR  = -e "/^$${hash}if *ENABLE_GCC_BACK_END/,/^$${hash}else/s/.*//" \
 		-e "/^$${hash}endif/s/.*//"
 endif
 
@@ -161,13 +159,13 @@
 .PHONY: depend
 depend:		$(MC_PROG).depend
 
-$(MC_PROG).depend: regenerate_preprocessed_files Mercury.modules
+$(MC_PROG).depend: regenerate_preprocessed_files Mercury.modules COMP_FLAGS 
 
 # This directory contains source files for which the module
 # name doesn't match the file name, so smart recompilation
 # won't work without the Mercury.modules file.
 .PHONY: Mercury.modules
-Mercury.modules:
+Mercury.modules: COMP_FLAGS
 	$(MC) $(ALL_GRADEFLAGS) $(ALL_MCFLAGS) -f *.m
 
 .PHONY: all
@@ -223,7 +221,7 @@
 ifeq ("$(filter il% java%,$(GRADE))","")
 
 .PHONY: depend
-depend:		mlds_to_gcc.depend
+depend:		COMP_FLAGS mlds_to_gcc.depend
 
 mlds_to_gcc.depend: regenerate_preprocessed_files
 
@@ -314,7 +312,7 @@
 
 realclean_local:
 	rm -f tags $(MC_PROG).stats Mercury.modules \
-		mercury_compile$(EXT_FOR_EXE)
+		COMP_FLAGS COMP_FLAGS.date mercury_compile$(EXT_FOR_EXE)
 
 #-----------------------------------------------------------------------------#
 #-----------------------------------------------------------------------------#
cvs diff: Diffing compiler/notes
cvs diff: Diffing debian
cvs diff: Diffing deep_profiler
Index: deep_profiler/DEEP_FLAGS.in
===================================================================
RCS file: deep_profiler/DEEP_FLAGS.in
diff -N deep_profiler/DEEP_FLAGS.in
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ deep_profiler/DEEP_FLAGS.in	11 Apr 2005 08:28:54 -0000
@@ -0,0 +1,20 @@
+ at BOOTSTRAP_MC_ARGS@
+--no-infer-all
+--halt-at-warn
+--no-warn-inferred-erroneous
+--no-mercury-stdlib-dir
+-I../library
+-I../browser
+-I../mdbcomp
+--c-include-directory ../boehm_gc
+--c-include-directory ../boehm_gc/include
+--c-include-directory ../runtime
+--c-include-directory ../library
+--c-include-directory ../library/Mercury/mihs
+--c-include-directory ../mdbcomp
+--c-include-directory ../mdbcomp/Mercury/mihs
+--c-include-directory ../browser
+--c-include-directory ../browser/Mercury/mihs
+--c-include-directory ../trace
+--linkage shared
+--config-file ../scripts/Mercury.config.bootstrap
Index: deep_profiler/Mmakefile
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/deep_profiler/Mmakefile,v
retrieving revision 1.14
diff -u -r1.14 Mmakefile
--- deep_profiler/Mmakefile	25 Apr 2005 06:51:57 -0000	1.14
+++ deep_profiler/Mmakefile	30 Apr 2005 04:56:12 -0000
@@ -40,7 +40,7 @@
 #-----------------------------------------------------------------------------#
 
 MLFLAGS += --shared
-MCFLAGS += --linkage shared
+MCFLAGS      += --flags DEEP_FLAGS $(CONFIG_OVERRIDE)
 
 #-----------------------------------------------------------------------------#
 
@@ -50,6 +50,8 @@
 .PHONY: depend
 depend:	$(DEPEND)
 
+$(DEPEND): DEEP_FLAGS 
+
 .PHONY: all
 all:	$(ALL_DEEP_MODULES) $(TAGS_FILE_EXISTS)
 
@@ -122,7 +124,7 @@
 #-----------------------------------------------------------------------------#
 
 realclean_local:
-	rm -f tags
+	rm -f tags DEEP_FLAGS DEEP_FLAGS.date
 
 #-----------------------------------------------------------------------------#
 
cvs diff: Diffing deep_profiler/notes
cvs diff: Diffing doc
cvs diff: Diffing extras
cvs diff: Diffing extras/aditi
cvs diff: Diffing extras/cgi
cvs diff: Diffing extras/complex_numbers
cvs diff: Diffing extras/complex_numbers/samples
cvs diff: Diffing extras/complex_numbers/tests
cvs diff: Diffing extras/concurrency
cvs diff: Diffing extras/curs
cvs diff: Diffing extras/curs/samples
cvs diff: Diffing extras/curses
cvs diff: Diffing extras/curses/sample
cvs diff: Diffing extras/dynamic_linking
cvs diff: Diffing extras/error
cvs diff: Diffing extras/graphics
cvs diff: Diffing extras/graphics/easyx
cvs diff: Diffing extras/graphics/easyx/samples
cvs diff: Diffing extras/graphics/mercury_glut
cvs diff: Diffing extras/graphics/mercury_opengl
cvs diff: Diffing extras/graphics/mercury_tcltk
cvs diff: Diffing extras/graphics/samples
cvs diff: Diffing extras/graphics/samples/calc
cvs diff: Diffing extras/graphics/samples/gears
cvs diff: Diffing extras/graphics/samples/maze
cvs diff: Diffing extras/graphics/samples/pent
cvs diff: Diffing extras/lazy_evaluation
cvs diff: Diffing extras/lex
cvs diff: Diffing extras/lex/samples
cvs diff: Diffing extras/lex/tests
cvs diff: Diffing extras/logged_output
cvs diff: Diffing extras/moose
cvs diff: Diffing extras/moose/samples
cvs diff: Diffing extras/moose/tests
cvs diff: Diffing extras/morphine
cvs diff: Diffing extras/morphine/non-regression-tests
cvs diff: Diffing extras/morphine/scripts
cvs diff: Diffing extras/morphine/source
cvs diff: Diffing extras/odbc
cvs diff: Diffing extras/posix
cvs diff: Diffing extras/quickcheck
cvs diff: Diffing extras/quickcheck/tutes
cvs diff: Diffing extras/references
cvs diff: Diffing extras/references/samples
cvs diff: Diffing extras/references/tests
cvs diff: Diffing extras/stream
cvs diff: Diffing extras/trailed_update
cvs diff: Diffing extras/trailed_update/samples
cvs diff: Diffing extras/trailed_update/tests
cvs diff: Diffing extras/xml
cvs diff: Diffing extras/xml/samples
cvs diff: Diffing extras/xml_stylesheets
cvs diff: Diffing java
cvs diff: Diffing java/runtime
cvs diff: Diffing library
Index: library/INTER_FLAGS
===================================================================
RCS file: library/INTER_FLAGS
diff -N library/INTER_FLAGS
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ library/INTER_FLAGS	11 Apr 2005 03:22:57 -0000
@@ -0,0 +1,3 @@
+--transitive-intermodule-optimization
+--no-warn-smart-recompilation
+--enable-termination
Index: library/LIB_FLAGS.in
===================================================================
RCS file: library/LIB_FLAGS.in
diff -N library/LIB_FLAGS.in
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ library/LIB_FLAGS.in	11 Apr 2005 08:29:01 -0000
@@ -0,0 +1,19 @@
+ at BOOTSTRAP_MC_ARGS@
+--no-infer-all
+--halt-at-warn
+--no-warn-inferred-erroneous
+--no-mercury-stdlib-dir
+--strict-sequential 
+--generate-mmc-deps
+--no-shlib-linker-use-install-name
+--trace minimum
+--c-include-directory ../boehm_gc
+--c-include-directory ../boehm_gc/include
+--c-include-directory ../runtime
+-L../boehm_gc
+-L../runtime
+-L../library
+-L../trace
+-L../mdbcomp
+-L../browser
+--config-file ../scripts/Mercury.config.bootstrap
Index: library/Mmakefile
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/Mmakefile,v
retrieving revision 1.141
diff -u -r1.141 Mmakefile
--- library/Mmakefile	3 May 2005 03:54:05 -0000	1.141
+++ library/Mmakefile	3 May 2005 09:01:29 -0000
@@ -49,37 +49,31 @@
 
 # XXX Smart recompilation doesn't work with `--intermodule-optimization'.
 # We still want to generate version numbers in the interface files, so
-# just disable the warnings here.
-INTERMODULE_OPTS = --transitive-intermodule-optimization \
-			--no-warn-smart-recompilation
-ENABLE_TERM_OPTS = --enable-termination
-CHECK_TERM_OPTS =
+# just disable the warnings in INTER_FLAGS.
 # If you want to actually check termination for the library, then you need
-#	CHECK_TERM_OPTS = --check-termination
-# but that is not enabled by default because it probably just results in
-# spurious warnings.
+# to add --check-termination to INTER_FLAGS, but that is not enabled by default
+# because it probably just results in spurious warnings.
+INTER_FLAGS = --flags INTER_FLAGS
 
 else
 
-INTERMODULE_OPTS =
-ENABLE_TERM_OPTS =
-CHECK_TERM_OPTS =
+INTER_FLAGS =
 
 endif
 
 # We compile the files in the library directory with --trace minimum by
-# default, which has no effect in non-debugging grades and causes the
-# library to be shallow traced, not deep traced, in debugging grades.
-# This is probably what most users want, and it makes it much easier to
+# default (set in FLAGS), which has no effect in non-debugging grades and
+# causes the library to be shallow traced, not deep traced, in debugging
+# grades. This is probably what most users want, and it makes it much easier to
 # maintain the expected output of the debugging test cases in debugging grades.
 # However, this can be overridden by setting LIBRARY_TRACE_MINIMUM to no.
 #
 # Always generate dependencies for use by `mmc --make'.
 
 ifeq ($(LIBRARY_TRACE_MINIMUM),no)
-LIBRARY_TRACE_LEVEL =
+LIBRARY_TRACE_LEVEL = --trace default
 else
-LIBRARY_TRACE_LEVEL = --trace minimum
+LIBRARY_TRACE_LEVEL =
 endif
 
 # We need to compile the library with --strict-sequential for two reasons:
@@ -90,8 +84,8 @@
 # (2) The code for get_determinism in library/exception.m relies on it
 #     (in particular it relies on --no-reorder-disj).
 
-MCFLAGS += --strict-sequential $(LIBRARY_TRACE_LEVEL) --generate-mmc-deps \
-		$(INTERMODULE_OPTS) $(ENABLE_TERM_OPTS) $(CHECK_TERM_OPTS)
+MCFLAGS += --flags LIB_FLAGS $(CONFIG_OVERRIDE)
+MCFLAGS += $(LIBRARY_TRACE_LEVEL) $(INTER_FLAGS)
 
 # The IL and Java implementations of the standard library are not yet complete,
 # so we need to pass `--allow-stubs' to get them to compile.
@@ -103,15 +97,17 @@
 
 #-----------------------------------------------------------------------------#
 
-CFLAGS	+=	$(DLL_CFLAGS) -I$(TRACE_DIR) -I$(ROBDD_DIR)
-MLFLAGS	+=	-R$(FINAL_INSTALL_MERC_LIB_DIR) \
+CFLAGS	     += $(DLL_CFLAGS) -I$(TRACE_DIR) -I$(ROBDD_DIR)
+ifeq ($(INSTALLABLE_PREFIX),yes)
+MLFLAGS      += -R$(FINAL_INSTALL_MERC_LIB_DIR) \
 		-R$(FINAL_INSTALL_MERC_GC_LIB_DIR)
-MCFLAGS +=	-R$(FINAL_INSTALL_MERC_LIB_DIR) \
+MCFLAGS      += -R$(FINAL_INSTALL_MERC_LIB_DIR) \
 		-R$(FINAL_INSTALL_MERC_GC_LIB_DIR)
+endif
 
-MTAGS	=	$(SCRIPTS_DIR)/mtags
+MTAGS	= $(SCRIPTS_DIR)/mtags
 
-LN	=	ln
+LN	= ln
 
 #-----------------------------------------------------------------------------#
 
@@ -127,7 +123,6 @@
 # linker, so we disable the mmc option which causes the -install_name option
 # to be passed in the .dep files.
 
-MCFLAGS += --no-shlib-linker-use-install-name
 LD_LIBFLAGS-libmer_std.dylib = -install_name \
 	$(FINAL_INSTALL_MERC_LIB_DIR)/libmer_std.dylib
 
@@ -161,7 +156,7 @@
 #-----------------------------------------------------------------------------#
 
 .PHONY: depend
-depend:	$(STD_LIB_NAME).depend
+depend:	LIB_FLAGS $(STD_LIB_NAME).depend
 
 .PHONY: check
 check:	$(STD_LIB_NAME).check
@@ -442,7 +437,7 @@
 	rm -f mercury_dotnet.dll mercury_il.dll
 	rm -f liblibrary.$A liblibrary.so library.init
 	rm -f $($(STD_LIB_NAME).mods:%=%.h)
-	rm -f tags
+	rm -f tags LIB_FLAGS LIB_FLAGS.date
 	rm -f mercury runtime
 	rm -f mr_int.class mr_float.class mr_char.class
 	rm -f mr_int\$$*.class mr_float\$$*.class mr_char\$$*.class
cvs diff: Diffing mdbcomp
Index: mdbcomp/MDBCOMP_FLAGS.in
===================================================================
RCS file: mdbcomp/MDBCOMP_FLAGS.in
diff -N mdbcomp/MDBCOMP_FLAGS.in
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ mdbcomp/MDBCOMP_FLAGS.in	11 Apr 2005 08:29:05 -0000
@@ -0,0 +1,19 @@
+ at BOOTSTRAP_MC_ARGS@
+--no-infer-all
+--halt-at-warn
+--no-warn-inferred-erroneous
+--no-mercury-stdlib-dir
+--no-shlib-linker-use-install-name
+-I../library
+--c-include-directory ../boehm_gc
+--c-include-directory ../boehm_gc/include
+--c-include-directory ../runtime
+--c-include-directory ../library
+--c-include-directory ../library/Mercury/mihs
+-L../boehm_gc
+-L../runtime
+-L../library
+-L../trace
+-L../mdbcomp
+-L../browser
+--config-file ../scripts/Mercury.config.bootstrap
Index: mdbcomp/Mmakefile
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/mdbcomp/Mmakefile,v
retrieving revision 1.6
diff -u -r1.6 Mmakefile
--- mdbcomp/Mmakefile	27 Mar 2005 14:02:23 -0000	1.6
+++ mdbcomp/Mmakefile	30 Apr 2005 04:46:09 -0000
@@ -43,12 +43,15 @@
 # Don't change these without good reason - if you want to do a temporary
 # change, change ../Mmake.params, or create Mmake.mdbcomp.params.
 
-CFLAGS	+=	$(DLL_CFLAGS) -I$(TRACE_DIR)
-MLFLAGS +=	-R$(FINAL_INSTALL_MERC_LIB_DIR)	\
+CFLAGS	     += $(DLL_CFLAGS) -I$(TRACE_DIR)
+MCFLAGS      += --flags MDBCOMP_FLAGS $(CONFIG_OVERRIDE)
+ifeq ($(INSTALLABLE_PREFIX),yes)
+MLFLAGS      += -R$(FINAL_INSTALL_MERC_LIB_DIR)	\
 		-R$(FINAL_INSTALL_MERC_GC_LIB_DIR)
-MCFLAGS +=	-R$(FINAL_INSTALL_MERC_LIB_DIR)	\
+MCFLAGS      += -R$(FINAL_INSTALL_MERC_LIB_DIR)	\
 		-R$(FINAL_INSTALL_MERC_GC_LIB_DIR)
-MLLIBS +=	$(SOCKET_LIBRARY) $(NSL_LIBRARY) $(DL_LIBRARY)	\
+endif
+MLLIBS       += $(SOCKET_LIBRARY) $(NSL_LIBRARY) $(DL_LIBRARY) \
 		$(READLINE_LIBRARIES)
 
 #-----------------------------------------------------------------------------#
@@ -65,7 +68,6 @@
 # linker, so we disable the mmc option which causes the -install_name option
 # to be passed in the .dep files.
 
-MCFLAGS += --no-shlib-linker-use-install-name
 LD_LIBFLAGS-libmer_mdbcomp.dylib = -install_name \
 	$(FINAL_INSTALL_MERC_LIB_DIR)/libmer_mdbcomp.dylib
 
@@ -73,9 +75,9 @@
 
 JAVACFLAGS = -classpath $(LIBRARY_DIR)
 
-MTAGS	=	$(SCRIPTS_DIR)/mtags
+MTAGS	= $(SCRIPTS_DIR)/mtags
 
-LN	=	ln
+LN	= ln
 
 #-----------------------------------------------------------------------------#
 
@@ -119,7 +121,7 @@
 all-ints: $(MDBCOMP_LIB_NAME).int3s $(MDBCOMP_LIB_NAME).ints
 
 .PHONY: depend
-depend:	$(DEPENDS)
+depend:	MDBCOMP_FLAGS $(DEPENDS)
 $(DEPENDS): Mercury.modules
 
 # $(BROWSER_LIB_NAME).dep $(BROWSER_LIB_NAME).depend:
@@ -129,7 +131,7 @@
 # name doesn't match the file name, so smart recompilation
 # won't work without the Mercury.modules file.
 .PHONY: Mercury.modules
-Mercury.modules:
+Mercury.modules: MDBCOMP_FLAGS
 	$(MC) $(ALL_GRADEFLAGS) $(ALL_MCFLAGS) -f *.m
 
 .PHONY: check
@@ -218,7 +220,7 @@
 #-----------------------------------------------------------------------------#
 
 realclean_local:
-	rm -f Mercury.modules tags
+	rm -f Mercury.modules tags MDBCOMP_FLAGS MDBCOMP_FLAGS.date
 
 #-----------------------------------------------------------------------------#
 
cvs diff: Diffing profiler
Index: profiler/Mmakefile
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/profiler/Mmakefile,v
retrieving revision 1.26
diff -u -r1.26 Mmakefile
--- profiler/Mmakefile	14 Jan 2005 05:53:34 -0000	1.26
+++ profiler/Mmakefile	30 Apr 2005 04:56:43 -0000
@@ -20,13 +20,15 @@
 #-----------------------------------------------------------------------------#
 
 MLFLAGS += --shared
-MCFLAGS += --linkage shared
+MCFLAGS += --flags PROF_FLAGS $(CONFIG_OVERRIDE)
 
 #-----------------------------------------------------------------------------#
 
 .PHONY: depend
 depend:	mercury_profile.depend
 
+mercury_profile.depend: PROF_FLAGS
+
 .PHONY: all
 all:	mercury_profile $(TAGS_FILE_EXISTS)
 
@@ -79,7 +81,7 @@
 #-----------------------------------------------------------------------------#
 
 realclean_local:
-	rm -f tags
+	rm -f tags PROF_FLAGS PROF_FLAGS.date
 
 #-----------------------------------------------------------------------------#
 
Index: profiler/PROF_FLAGS.in
===================================================================
RCS file: profiler/PROF_FLAGS.in
diff -N profiler/PROF_FLAGS.in
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ profiler/PROF_FLAGS.in	11 Apr 2005 08:29:08 -0000
@@ -0,0 +1,20 @@
+ at BOOTSTRAP_MC_ARGS@
+--no-infer-all
+--halt-at-warn
+--no-warn-inferred-erroneous
+--no-mercury-stdlib-dir
+-I../library
+-I../browser
+-I../mdbcomp
+--c-include-directory ../boehm_gc
+--c-include-directory ../boehm_gc/include
+--c-include-directory ../runtime
+--c-include-directory ../library
+--c-include-directory ../library/Mercury/mihs
+--c-include-directory ../mdbcomp
+--c-include-directory ../mdbcomp/Mercury/mihs
+--c-include-directory ../browser
+--c-include-directory ../browser/Mercury/mihs
+--c-include-directory ../trace
+--linkage shared
+--config-file ../scripts/Mercury.config.bootstrap
cvs diff: Diffing robdd
cvs diff: Diffing runtime
Index: runtime/Mmakefile
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/runtime/Mmakefile,v
retrieving revision 1.120
diff -u -r1.120 Mmakefile
--- runtime/Mmakefile	26 Feb 2005 06:30:57 -0000	1.120
+++ runtime/Mmakefile	30 Apr 2005 06:25:19 -0000
@@ -134,7 +134,7 @@
 
 # MCPP_HDRS are header files in Microsoft's Managed extensions for C++
 
-MCPP_HDRS	=	mercury_mcpp.h		
+MCPP_HDRS	=	mercury_mcpp.h
 
 #		  keep this list in alphabetical order, please
 CFILES		= 	\
@@ -214,8 +214,8 @@
 
 # We intentionally compile with C level debugging enabled so that problems
 # in the runtime can be debugged without having to recompile it.  The cost
-# of doing this is negligible.  The runtime can be compiled without 
-# debugging enabled by removing the `--c-debug' flag below. 
+# of doing this is negligible.  The runtime can be compiled without
+# debugging enabled by removing the `--c-debug' flag below.
 MGNUCFLAGS	+= --c-debug --no-ansi
 
 #-----------------------------------------------------------------------------#
@@ -290,7 +290,7 @@
 .PHONY: all
 all:	runtime $(TAGS_FILE_EXISTS)
 
-ifeq ($(findstring java,$(GRADE)),java)        
+ifeq ($(findstring java,$(GRADE)),java)
 #
 # For grade java, there's nothing to do
 
@@ -299,7 +299,7 @@
 	@echo "No Mercury runtime needed for grade=java"
 
 else
-ifeq ($(findstring il,$(GRADE)),il)        
+ifeq ($(findstring il,$(GRADE)),il)
 
 # Managed C++ files compiled in this directory should not be put in an
 # assembly of their own.  We put the runtime and library dlls into a single
@@ -312,7 +312,7 @@
 
 clean_local:
 	rm -f $(DOTNET_DLLS)
-	
+
 runtime: $(DOTNET_DLLS)
 
 mercury_dotnet.dll: mercury_il.dll $(MCPP_HDRS)
@@ -323,7 +323,7 @@
 #	sed '/REMOVE FOR ROTOR/s@^@//@' mercury_il.il > mercury_il.rotor.il
 #	$(MS_ILASM) $(ALL_MS_ILASMFLAGS) /dll /quiet /OUT=mercury_il.dll \
 #			mercury_il.rotor.il
- 
+
 else
 
 .PHONY: runtime
@@ -348,7 +348,8 @@
 lib$(RT_LIB_NAME).dylib: $(PIC_OBJS)
 	$(LINK_SHARED_OBJ) $(ERROR_UNDEFINED) 				\
 		-o lib$(RT_LIB_NAME).dylib $(PIC_OBJS)			\
-		-install_name $(FINAL_INSTALL_MERC_LIB_DIR)/lib$(RT_LIB_NAME).dylib \
+		-install_name 						\
+			$(FINAL_INSTALL_MERC_LIB_DIR)/lib$(RT_LIB_NAME).dylib \
 		$(LDFLAGS) $(LDLIBS) $(THREADLIBS)			\
 		$(SHARED_LIBS)
 
@@ -359,7 +360,7 @@
 	cat `vpath_find $(CFILES)` | grep '^INIT ' > $(RT_LIB_NAME).init
 
 mercury_conf.h.date: $(MERCURY_DIR)/config.status mercury_conf.h.in
-	CONFIG_FILES= CONFIG_HEADERS=mercury_conf.h $(MERCURY_DIR)/config.status
+	$(MERCURY_DIR)/config.status --header=mercury_conf.h
 	echo datestamp > mercury_conf.h.date
 
 mercury_conf.h: mercury_conf.h.date
@@ -393,33 +394,33 @@
 	-[ -d $(INSTALL_RECONF_DIR)/runtime ] || \
 		mkdir -p $(INSTALL_RECONF_DIR)/runtime
 
-ifeq ($(findstring java,$(GRADE)),java)        
+ifeq ($(findstring java,$(GRADE)),java)
 
 # For grade java, there's nothing to do.
 # (The java version of the Mercury runtime is in mercury/java/runtime,
 # not mercury/runtime, and its build and installation is handled by
 # mercury/library/Mmakefile.)
 
-.PHONY: install_headers 
+.PHONY: install_headers
 install_headers:
 
-.PHONY: install_init 
+.PHONY: install_init
 install_init:
 
-.PHONY: install_lib 
+.PHONY: install_lib
 install_lib:
 
 else
-ifeq ($(findstring il,$(GRADE)),il)        
+ifeq ($(findstring il,$(GRADE)),il)
 
-.PHONY: install_headers 
+.PHONY: install_headers
 install_headers: $(MCPP_HDRS) install_dirs
 	cp `vpath_find $(MCPP_HDRS)` $(INSTALL_INC_DIR)
 
 .PHONY: install_init
-install_init: 
+install_init:
 
-.PHONY: install_lib 
+.PHONY: install_lib
 install_lib: $(DOTNET_DLLS) install_headers install_dirs
 	cp `vpath_find $(DOTNET_DLLS)` $(INSTALL_MERC_LIB_DIR)
 
@@ -427,7 +428,7 @@
 
 else
 
-# mercury_conf.h needs to be in a separate directory so it can be 
+# mercury_conf.h needs to be in a separate directory so it can be
 # overridden by a different configuration.
 .PHONY: install_headers
 install_headers: $(HDRS) $(BODY_HDRS) $(MACHHDRS) \
cvs diff: Diffing runtime/GETOPT
cvs diff: Diffing runtime/machdeps
cvs diff: Diffing samples
cvs diff: Diffing samples/c_interface
cvs diff: Diffing samples/c_interface/c_calls_mercury
cvs diff: Diffing samples/c_interface/cplusplus_calls_mercury
cvs diff: Diffing samples/c_interface/mercury_calls_c
cvs diff: Diffing samples/c_interface/mercury_calls_cplusplus
cvs diff: Diffing samples/c_interface/mercury_calls_fortran
cvs diff: Diffing samples/c_interface/simpler_c_calls_mercury
cvs diff: Diffing samples/c_interface/simpler_cplusplus_calls_mercury
cvs diff: Diffing samples/diff
cvs diff: Diffing samples/muz
cvs diff: Diffing samples/rot13
cvs diff: Diffing samples/solutions
cvs diff: Diffing samples/tests
cvs diff: Diffing samples/tests/c_interface
cvs diff: Diffing samples/tests/c_interface/c_calls_mercury
cvs diff: Diffing samples/tests/c_interface/cplusplus_calls_mercury
cvs diff: Diffing samples/tests/c_interface/mercury_calls_c
cvs diff: Diffing samples/tests/c_interface/mercury_calls_cplusplus
cvs diff: Diffing samples/tests/c_interface/mercury_calls_fortran
cvs diff: Diffing samples/tests/c_interface/simpler_c_calls_mercury
cvs diff: Diffing samples/tests/c_interface/simpler_cplusplus_calls_mercury
cvs diff: Diffing samples/tests/diff
cvs diff: Diffing samples/tests/muz
cvs diff: Diffing samples/tests/rot13
cvs diff: Diffing samples/tests/solutions
cvs diff: Diffing samples/tests/toplevel
cvs diff: Diffing scripts
Index: scripts/mgnuc.in
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/scripts/mgnuc.in,v
retrieving revision 1.105
diff -u -r1.105 mgnuc.in
--- scripts/mgnuc.in	20 Jul 2004 04:41:31 -0000	1.105
+++ scripts/mgnuc.in	2 May 2005 09:16:56 -0000
@@ -333,11 +333,11 @@
 use_msvcrt=@USE_MSVCRT@
 if test $use_msvcrt = "yes"; then
 	case $thread_safe in
-    # /MD states that we will use the MSVC runtime,
-    # the boehm_gc collector assumes that the collector
-    # has been built as a DLL if we are using the MSVC runtime
-    # so we need to define GC_NOT_DLL when the collector isn't
-    # built as a DLL.
+		# /MD states that we will use the MSVC runtime,
+		# the boehm_gc collector assumes that the collector
+		# has been built as a DLL if we are using the MSVC runtime
+		# so we need to define GC_NOT_DLL when the collector isn't
+		# built as a DLL.
 		true)	MSVCRT_OPTS="/MD" ;;
 		false)	MSVCRT_OPTS="/DGC_NOT_DLL /MD" ;;
 	esac
@@ -589,16 +589,24 @@
 	exec $AS $AS_OPTS "$@" ;;
 esac
 
+if test -r .mgnuc_opts
+then
+	INVISIBLE_OPTS=`cat .mgnuc_opts`
+else
+	INVISIBLE_OPTS=""
+fi
 
 ALL_CC_OPTS="$MERC_ALL_C_INCL_DIRS $ANSI_OPTS $CHECK_OPTS $OPT_OPTS \
-		$HLC_OPTS $HLD_OPTS $GCC_OPTS $MSVCRT_OPTS $GC_OPTS $DEFINE_OPTS \
-		$STACK_TRACE_OPTS $TRACE_OPTS $DECL_DEBUG_OPTS \
-		$LLDEBUG_OPTS $C_DEBUG_OPTS \
-		$PROF_TIME_OPTS $PROF_CALLS_OPTS $PROF_MEMORY_OPTS \
-		$PROF_DEEP_OPTS $INLINE_ALLOC_OPTS $TRAIL_OPTS \
-		$RECORD_TERM_SIZE_OPTS \
-		$RESERVE_TAG_OPTS $MINIMAL_MODEL_OPTS \
-		$SPLIT_OPTS $THREAD_OPTS $PICREG_OPTS $ARCH_OPTS $ARG_OPTS"
+	$HLC_OPTS $HLD_OPTS $GCC_OPTS $MSVCRT_OPTS \
+	$GC_OPTS $DEFINE_OPTS \
+	$STACK_TRACE_OPTS $TRACE_OPTS $DECL_DEBUG_OPTS \
+	$LLDEBUG_OPTS $C_DEBUG_OPTS \
+	$PROF_TIME_OPTS $PROF_CALLS_OPTS $PROF_MEMORY_OPTS \
+	$PROF_DEEP_OPTS $INLINE_ALLOC_OPTS $TRAIL_OPTS \
+	$RECORD_TERM_SIZE_OPTS \
+	$RESERVE_TAG_OPTS $MINIMAL_MODEL_OPTS \
+	$SPLIT_OPTS $THREAD_OPTS $PICREG_OPTS $ARCH_OPTS $ARG_OPTS \
+	$INVISIBLE_OPTS"
 
 case $verbose in true)
 	echo $CC $ALL_CC_OPTS "$@" $OVERRIDE_OPTS $ALL_LOCAL_C_INCL_DIRS;;
Index: scripts/prepare_tmp_dir_grade_part
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/scripts/prepare_tmp_dir_grade_part,v
retrieving revision 1.1
diff -u -r1.1 prepare_tmp_dir_grade_part
--- scripts/prepare_tmp_dir_grade_part	28 Jan 2005 07:11:59 -0000	1.1
+++ scripts/prepare_tmp_dir_grade_part	20 Apr 2005 14:16:21 -0000
@@ -37,15 +37,18 @@
 mkdir tmp_dir/library
 cp library/Mmake* tmp_dir/library
 cp library/Mercury.* tmp_dir/library
+cp library/*FLAGS* tmp_dir/library
 cp library/print_extra_inits tmp_dir/library
 cp library/library_strong_name.sn tmp_dir/library
 cp library/*.m tmp_dir/library
 mkdir tmp_dir/mdbcomp
 cp mdbcomp/Mmake* tmp_dir/mdbcomp
 cp mdbcomp/Mercury.* tmp_dir/mdbcomp
+cp mdbcomp/*FLAGS* tmp_dir/mdbcomp
 cp mdbcomp/*.m tmp_dir/mdbcomp
 mkdir tmp_dir/browser
 cp browser/Mmake* tmp_dir/browser
 cp browser/Mercury.* tmp_dir/browser
+cp browser/*FLAGS* tmp_dir/browser
 cp browser/*.m tmp_dir/browser
 exit 0
cvs diff: Diffing slice
Index: slice/Mmakefile
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/slice/Mmakefile,v
retrieving revision 1.1
diff -u -r1.1 Mmakefile
--- slice/Mmakefile	29 Apr 2005 01:03:21 -0000	1.1
+++ slice/Mmakefile	30 Apr 2005 04:51:28 -0000
@@ -25,18 +25,18 @@
 
 VPATH = $(MDBCOMP_DIR) $(LIBRARY_DIR)
 
-MCFLAGS += -I $(MDBCOMP_DIR)
-
 #-----------------------------------------------------------------------------#
 
 MLFLAGS += --shared
-MCFLAGS += --linkage shared
+MCFLAGS += --flags SLICE_FLAGS $(CONFIG_OVERRIDE)
 
 #-----------------------------------------------------------------------------#
 
 .PHONY: depend
 depend:	$(DEPENDS)
 
+$(DEPENDS): SLICE_FLAGS
+
 .PHONY: all
 all:	$(MERCURY_MAIN_MODULES) $(TAGS_FILE_EXISTS)
 
@@ -97,7 +97,7 @@
 #-----------------------------------------------------------------------------#
 
 realclean_local:
-	rm -f tags
+	rm -f tags SLICE_FLAGS SLICE_FLAGS.date
 
 #-----------------------------------------------------------------------------#
 
Index: slice/SLICE_FLAGS.in
===================================================================
RCS file: slice/SLICE_FLAGS.in
diff -N slice/SLICE_FLAGS.in
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ slice/SLICE_FLAGS.in	29 Apr 2005 02:55:59 -0000
@@ -0,0 +1,20 @@
+ at BOOTSTRAP_MC_ARGS@
+--no-infer-all
+--halt-at-warn
+--no-warn-inferred-erroneous
+--no-mercury-stdlib-dir
+-I../library
+-I../browser
+-I../mdbcomp
+--c-include-directory ../boehm_gc
+--c-include-directory ../boehm_gc/include
+--c-include-directory ../runtime
+--c-include-directory ../library
+--c-include-directory ../library/Mercury/mihs
+--c-include-directory ../mdbcomp
+--c-include-directory ../mdbcomp/Mercury/mihs
+--c-include-directory ../browser
+--c-include-directory ../browser/Mercury/mihs
+--c-include-directory ../trace
+--linkage shared
+--config-file ../scripts/Mercury.config.bootstrap
cvs diff: Diffing tests
Index: tests/Mmake.common
===================================================================
RCS file: /home/mercury/mercury1/repository/tests/Mmake.common,v
retrieving revision 1.44
diff -u -r1.44 Mmake.common
--- tests/Mmake.common	24 Mar 2005 01:58:08 -0000	1.44
+++ tests/Mmake.common	12 Apr 2005 02:39:59 -0000
@@ -34,7 +34,9 @@
 # file by setting both GRADEFLAGS-foo.
 #
 
+ifndef DIFF_OPTS
 DIFF_OPTS=-c
+endif
 
 # Override this with `RUN_RECOMPILATION_TESTS=no'
 # if your compiler cannot run smart recompilation.
@@ -69,6 +71,11 @@
 endif
 
 -include $(TESTS_DIR)/Mmake.params
+
+MCFLAGS += --flags $(TESTS_DIR)/TESTS_FLAGS
+ifdef WORKSPACE_FLAGS
+MCFLAGS += --flags $(TESTS_DIR)/WS_FLAGS
+endif
 
 # Avoid trying to make this file with `mmc --make' if it doesn't exist.
 $(TESTS_DIR)/Mmake.params: ;
Index: tests/TESTS_FLAGS.in
===================================================================
RCS file: tests/TESTS_FLAGS.in
diff -N tests/TESTS_FLAGS.in
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ tests/TESTS_FLAGS.in	11 Apr 2005 13:46:58 -0000
@@ -0,0 +1 @@
+ at BOOTSTRAP_MC_ARGS@
Index: tests/WS_FLAGS.ws
===================================================================
RCS file: tests/WS_FLAGS.ws
diff -N tests/WS_FLAGS.ws
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ tests/WS_FLAGS.ws	29 Apr 2005 04:38:41 -0000
@@ -0,0 +1,16 @@
+--no-mercury-stdlib-dir
+-I at WORKSPACE@/library
+-I at WORKSPACE@/browser
+-I at WORKSPACE@/mdbcomp
+--c-include-directory @WORKSPACE@/boehm_gc
+--c-include-directory @WORKSPACE@/boehm_gc/include
+--c-include-directory @WORKSPACE@/runtime
+--c-include-directory @WORKSPACE@/library
+--c-include-directory @WORKSPACE@/library/Mercury/mihs
+--c-include-directory @WORKSPACE@/mdbcomp
+--c-include-directory @WORKSPACE@/mdbcomp/Mercury/mihs
+--c-include-directory @WORKSPACE@/browser
+--c-include-directory @WORKSPACE@/browser/Mercury/mihs
+--c-include-directory @WORKSPACE@/trace
+--linkage shared
+--config-file @WORKSPACE@/scripts/Mercury.config.bootstrap
cvs diff: Diffing tests/benchmarks
cvs diff: Diffing tests/debugger
cvs diff: Diffing tests/debugger/declarative
cvs diff: Diffing tests/dppd
cvs diff: Diffing tests/general
cvs diff: Diffing tests/general/accumulator
cvs diff: Diffing tests/general/string_format
cvs diff: Diffing tests/general/structure_reuse
cvs diff: Diffing tests/grade_subdirs
cvs diff: Diffing tests/hard_coded
cvs diff: Diffing tests/hard_coded/exceptions
cvs diff: Diffing tests/hard_coded/purity
cvs diff: Diffing tests/hard_coded/sub-modules
cvs diff: Diffing tests/hard_coded/typeclasses
cvs diff: Diffing tests/invalid
Index: tests/invalid/Mercury.options
===================================================================
RCS file: /home/mercury/mercury1/repository/tests/invalid/Mercury.options,v
retrieving revision 1.10
diff -u -r1.10 Mercury.options
--- tests/invalid/Mercury.options	20 Apr 2005 12:57:43 -0000	1.10
+++ tests/invalid/Mercury.options	26 Apr 2005 10:22:57 -0000
@@ -49,6 +49,7 @@
 				--no-automatic-intermodule-optimization
 MCFLAGS-impure_method_impl =	--no-intermodule-optimization \
 				--no-automatic-intermodule-optimization
+MCFLAGS-loopcheck =		--warn-inferred-erroneous
 MCFLAGS-method_impl =		--no-intermodule-optimization \
 				--no-automatic-intermodule-optimization
 MCFLAGS-missing_det_decls =	--no-infer-det
@@ -64,9 +65,10 @@
 MCFLAGS-nonexistent_import =    --no-verbose-make --make nonexistent_import
 MCFLAGS-overloading = 		--no-intermodule-optimization \
 				--no-automatic-intermodule-optimization
+MCFLAGS-pragma_c_code_no_det =	--warn-inferred-erroneous
+MCFLAGS-record_syntax_errors =	--verbose-error-messages
 MCFLAGS-sub_c = 	--verbose-error-messages --no-intermodule-optimization \
 				--no-automatic-intermodule-optimization
-MCFLAGS-record_syntax_errors =	--verbose-error-messages
 MCFLAGS-test_nested =		--no-intermodule-optimization \
 				--no-automatic-intermodule-optimization
 MCFLAGS-transitive_import = --no-intermodule-optimization \
Index: tests/invalid/imported_mode.err_exp2
===================================================================
RCS file: /home/mercury/mercury1/repository/tests/invalid/imported_mode.err_exp2,v
retrieving revision 1.2
diff -u -r1.2 imported_mode.err_exp2
--- tests/invalid/imported_mode.err_exp2	17 Jan 2003 05:57:08 -0000	1.2
+++ tests/invalid/imported_mode.err_exp2	3 May 2005 07:43:56 -0000
@@ -1,4 +1,5 @@
-Mercury/ints/exported_mode.int:003: Error: mode declaration for predicate `exported_mode.p/2'
+Mercury/ints/exported_mode.int:003: Error: mode declaration for predicate
+Mercury/ints/exported_mode.int:003:   `exported_mode.p/2'
 Mercury/ints/exported_mode.int:003:   without preceding `pred' declaration.
 Mercury/ints/exported_mode.int:003: Inferred :- pred p(T1, T2).
 For more information, try recompiling with `-E'.
Index: tests/invalid/missing_interface_import.err_exp2
===================================================================
RCS file: /home/mercury/mercury1/repository/tests/invalid/missing_interface_import.err_exp2,v
retrieving revision 1.5
diff -u -r1.5 missing_interface_import.err_exp2
--- tests/invalid/missing_interface_import.err_exp2	4 Dec 2003 12:06:20 -0000	1.5
+++ tests/invalid/missing_interface_import.err_exp2	3 May 2005 07:44:55 -0000
@@ -1,11 +1,17 @@
-missing_interface_import.m:007: In definition of type `missing_interface_import.bar'/0:
-missing_interface_import.m:007:   error: undefined type `map'/2
-missing_interface_import.m:007:   (the module `map' has not been imported in the interface).
-missing_interface_import.m:009: In definition of predicate `missing_interface_import.p'/1:
-missing_interface_import.m:009:   error: undefined type `std_util.univ'/0
-missing_interface_import.m:009:   (the module `std_util' has not been imported in the interface).
-missing_interface_import.m:010: In definition of predicate `missing_interface_import.q'/1:
-missing_interface_import.m:010:   error: undefined type `list'/1
-missing_interface_import.m:010:   (the module `list' has not been imported in the interface).
+missing_interface_import.m:007: In definition of type
+missing_interface_import.m:007:   `missing_interface_import.bar'/0:
+missing_interface_import.m:007:   error: undefined type `map'/2.
+missing_interface_import.m:007:   (The module `map' has not been imported in
+missing_interface_import.m:007:   the interface.)
+missing_interface_import.m:009: In definition of predicate
+missing_interface_import.m:009:   `missing_interface_import.p'/1:
+missing_interface_import.m:009:   error: undefined type `std_util.univ'/0.
+missing_interface_import.m:009:   (The module `std_util' has not been imported
+missing_interface_import.m:009:   in the interface.)
+missing_interface_import.m:010: In definition of predicate
+missing_interface_import.m:010:   `missing_interface_import.q'/1:
+missing_interface_import.m:010:   error: undefined type `list'/1.
+missing_interface_import.m:010:   (The module `list' has not been imported in
+missing_interface_import.m:010:   the interface.)
 `Mercury/ints/missing_interface_import.int' not written.
 For more information, try recompiling with `-E'.
cvs diff: Diffing tests/invalid/purity
cvs diff: Diffing tests/misc_tests
cvs diff: Diffing tests/mmc_make
cvs diff: Diffing tests/mmc_make/lib
cvs diff: Diffing tests/recompilation
cvs diff: Diffing tests/tabling
cvs diff: Diffing tests/term
cvs diff: Diffing tests/valid
cvs diff: Diffing tests/warnings
Index: tests/warnings/Mmakefile
===================================================================
RCS file: /home/mercury/mercury1/repository/tests/warnings/Mmakefile,v
retrieving revision 1.37
diff -u -r1.37 Mmakefile
--- tests/warnings/Mmakefile	24 Mar 2005 05:34:41 -0000	1.37
+++ tests/warnings/Mmakefile	13 Apr 2005 04:15:31 -0000
@@ -48,6 +48,8 @@
 # `.err' files, not stderr.
 MCFLAGS += --output-compile-error-lines 0
 
+MCFLAGS += --infer-all
+
 $(COMPILE_PROGS:%=%.runtest): %.runtest: %.res_compile ;
 
 $(ERRORCHECK_PROGS:%=%.runtest): %.runtest: %.res_error ;
cvs diff: Diffing tools
Index: tools/bootcheck
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/tools/bootcheck,v
retrieving revision 1.170
diff -u -r1.170 bootcheck
--- tools/bootcheck	2 May 2005 08:53:31 -0000	1.170
+++ tools/bootcheck	2 May 2005 09:15:42 -0000
@@ -9,144 +9,144 @@
 usage="\
 Usage: $0 [options]
 Options:
-	-d <dirname>, --test-dir <dirname>
-		Run the tests in directory <dirname>. Multiple such options
-		may be given, in which case the tests in all the named
-		directories will be run. In the absence of any such options,
-		all tests in all directories will be run (unless testing
-		as a whole is disabled).
+    -d <dirname>, --test-dir <dirname>
+        Run the tests in directory <dirname>. Multiple such options
+        may be given, in which case the tests in all the named
+        directories will be run. In the absence of any such options,
+        all tests in all directories will be run (unless testing
+        as a whole is disabled).
     -s <testname>, --specified-test <testname>
-	    Run only the tests whose names are specified as arguments of this
-		option, which may be given more than once. The test names must include
-		the directory name component.
-	-f, --failing-tests
-		Run only the tests which failed on the last run, as recorded in the
-		FAILED_TESTS files in the various test directories. Meaningful only
-		in the absence of -s options.
-	--error-file
-		Run only the tests which failed on the last run, as recorded in the
-		tests/runtests.errs file. Meaningful only in the absence of -s and -f
-		options.
-	-e, --extras
-		Test the programs in the extras directory.
-	-h, --help
-		Display this usage message.
-	-j <num-jobs>, --jobs <num-jobs>
-		Run using <num-jobs> different parallel processes.
-	-k, --keep-objs
-		Keep the stage 2 object files even if stage 2 is successful.
-	-m <mmake-args>, --mmake-opts <mmake-args>
-		Pass <mmake-args> as options to \`mmake'.
-	-M <make-args>, --make-opts <make-args>
-		Pass <make-args> as options to \`make'.
-	-o <filename>, --output-file <filename>
-		Output results to <filename>.
-	--target <target>
-		Specify the target to use in creating stages 2 and 3.
-	-G <grade>, --grade <grade>
-		Specify the grade to use in creating stages 2 and 3.
-		The tests will also be executed in this grade, unless
-		the --test-grade option says otherwise. Implies -r -g.
-	--gradedir <grade>
-		Same as '--grade <grade>', except that it also causes
-		the grade name to be included in the names of the stage 2
-		and stage 3 directories.  This can be useful if you have
-		lots of disk space and want to run bootchecks in several
-		grades at once.  Note however that the name of the tests
-		directory doesn't include the grade, so you might also
-		need to use --no-test-suite (see below) for this to work.
-	--test-grade <grade>
-		Specify the grade to use in executing the tests.
-		If this is the same as the grade of stages 2 and 3, then
-		we use the stage 2 runtime, library etc for the tests.
-		Otherwise, we use the stage 1 runtime, library etc,
-		and trust that these are compatible with the given grade.
-		Implies -r -g.
-	-g, --copy-boehm-gc
-		Copy the boehm_gc directory instead of linking it.
-		This is necessary if one wants to bootcheck a grade
-		that is not compatible with the standard one.
-	-r, --copy-runtime
-		Copy the runtime directory instead of linking it.
-		This is necessary if one wants to bootcheck a grade
-		that is not compatible with the standard one.
-	-p, --copy-profilers
-		Copy the profiler directories instead of linking them.
-		This is sometimes necessary for bootstrapping changes.
-	-b-, --no-bootcheck
-		Do not run the bootstrap check; execute the test suite and/or
-		the extras only. This option requires a previous bootstrap
-		check to have left a working stage 2 directory.
-	--no-check-namespace
-		Don't build the check_namespace targets in the runtime,
-		trace, browser, mdbcomp and library directories.
-	-t-, --no-test-suite
-		By default, bootcheck will also run the test quite.
-		This option prevents that.
-	--skip-stage-2
-		Take the existing stage 2 directory as given; do not run mmake
-		in it.
-	-2, --keep-stage-2
-		Don't rebuild the stage 2 directory from scratch after
-		building stage 1. Instead use the existing stage 2 directory
-		as the starting point for mmake.
-	-3, --keep-stage-3
-		Don't rebuild the stage 3 directory from scratch after
-		building stage 1. Instead use the existing stage 3 directory
-		as the starting point for mmake.
-	--test-split-library
-		Build the split version of the stage 2 library.
-	--test-params
-		When executing the test suite, use the stage 2 Mmake.params
-		file.
-	--stop-after-stage-2
-		Stop after building stage 2, even if it is successful.
-	--use-subdirs
-		Assume intermediate files are built in subdirectories.
-		(Same as the \`--use-subdirs' option to mmake and mmc.)
-	--use-mmc-make
-		Use \`mmc --make' to build the files.
-		(Same as the \`--use-mmc-make' option to mmake.)
-	--compile-times
-		Report information about compilation times in the stage 2
-		library and compiler directories.
-	--no-write-out-profile-data
-		When doing bootcheck in a deep profiling grade, disable the
-		writing out of profile data files. This makes the bootcheck
-		faster, but avoiding writing out the profiling data also avoids
-		the checks on its integrity.
-	--type-stats TYPE_STATS_FILE_NAME
-		Collect statistics about the builtin operations (unify, index
-		and compare) performed on various types. The argument of this
-		option should give the absolute pathname of the file in which
-		the runtime has been configured to accumulate statistics. The
-		statistics derived from the creation of the stage 3 compiler
-		will be put TYPE_STATS_FILE_NAME.stage3.$$, while the
-		statistics derived from the execution of the test suite will
-		be put into TYPE_STATS_FILE_NAME.tests.$$. Both filenames will
-		be reported in the output of bootcheck, to allow the statistics
-		files to be matched with the bootcheck that created them.
-	--trace-count
-		Collect counts of the number of times each label is executed
-		in modules compiled with debugging.
-	-W, --windows
-		Translate paths into the Microsoft Windows format and use the
-		extension \`.lib' for libraries. This option also implies
-		--no-sym-links.
-	--no-sym-links
-		Use this option on systems which don't support symbolic links.
-	--disable-debug-libs
-		Make the trace and browser libraries empty. This can be useful
-		when trying to track down the reason why they are being linked
-		into the compiler in the first place.
-	--keep-deep-data
-		Keep the Deep.data files resulting from the bootcheck. The
-		usual behavior is to delete them in the interest of conserving
-		disk space.
-	--progress
-		Create a timestamp file when finishing the execution of each test case,
-		to allow the user to monitor the bootcheck's progress. The timestamp
-		files will have names of the form .date.<testname>.
+        Run only the tests whose names are specified as arguments of this
+        option, which may be given more than once. The test names must include
+        the directory name component.
+    -f, --failing-tests
+        Run only the tests which failed on the last run, as recorded in the
+        FAILED_TESTS files in the various test directories. Meaningful only
+        in the absence of -s options.
+    --error-file
+        Run only the tests which failed on the last run, as recorded in the
+        tests/runtests.errs file. Meaningful only in the absence of -s and -f
+        options.
+    -e, --extras
+        Test the programs in the extras directory.
+    -h, --help
+        Display this usage message.
+    -j <num-jobs>, --jobs <num-jobs>
+        Run using <num-jobs> different parallel processes.
+    -k, --keep-objs
+        Keep the stage 2 object files even if stage 2 is successful.
+    -m <mmake-args>, --mmake-opts <mmake-args>
+        Pass <mmake-args> as options to \`mmake'.
+    -M <make-args>, --make-opts <make-args>
+        Pass <make-args> as options to \`make'.
+    -o <filename>, --output-file <filename>
+        Output results to <filename>.
+    --target <target>
+        Specify the target to use in creating stages 2 and 3.
+    -G <grade>, --grade <grade>
+        Specify the grade to use in creating stages 2 and 3.
+        The tests will also be executed in this grade, unless
+        the --test-grade option says otherwise. Implies -r -g.
+    --gradedir <grade>
+        Same as '--grade <grade>', except that it also causes
+        the grade name to be included in the names of the stage 2
+        and stage 3 directories.  This can be useful if you have
+        lots of disk space and want to run bootchecks in several
+        grades at once.  Note however that the name of the tests
+        directory doesn't include the grade, so you might also
+        need to use --no-test-suite (see below) for this to work.
+    --test-grade <grade>
+        Specify the grade to use in executing the tests.
+        If this is the same as the grade of stages 2 and 3, then
+        we use the stage 2 runtime, library etc for the tests.
+        Otherwise, we use the stage 1 runtime, library etc,
+        and trust that these are compatible with the given grade.
+        Implies -r -g.
+    -g, --copy-boehm-gc
+        Copy the boehm_gc directory instead of linking it.
+        This is necessary if one wants to bootcheck a grade
+        that is not compatible with the standard one.
+    -r, --copy-runtime
+        Copy the runtime directory instead of linking it.
+        This is necessary if one wants to bootcheck a grade
+        that is not compatible with the standard one.
+    -p, --copy-profilers
+        Copy the profiler directories instead of linking them.
+        This is sometimes necessary for bootstrapping changes.
+    -b-, --no-bootcheck
+        Do not run the bootstrap check; execute the test suite and/or
+        the extras only. This option requires a previous bootstrap
+        check to have left a working stage 2 directory.
+    --no-check-namespace
+        Don't build the check_namespace targets in the runtime,
+        trace, browser, mdbcomp and library directories.
+    -t-, --no-test-suite
+        By default, bootcheck will also run the test quite.
+        This option prevents that.
+    --skip-stage-2
+        Take the existing stage 2 directory as given; do not run mmake
+        in it.
+    -2, --keep-stage-2
+        Don't rebuild the stage 2 directory from scratch after
+        building stage 1. Instead use the existing stage 2 directory
+        as the starting point for mmake.
+    -3, --keep-stage-3
+        Don't rebuild the stage 3 directory from scratch after
+        building stage 1. Instead use the existing stage 3 directory
+        as the starting point for mmake.
+    --test-split-library
+        Build the split version of the stage 2 library.
+    --test-params
+        When executing the test suite, use the stage 2 Mmake.params
+        file.
+    --stop-after-stage-2
+        Stop after building stage 2, even if it is successful.
+    --use-subdirs
+        Assume intermediate files are built in subdirectories.
+        (Same as the \`--use-subdirs' option to mmake and mmc.)
+    --use-mmc-make
+        Use \`mmc --make' to build the files.
+        (Same as the \`--use-mmc-make' option to mmake.)
+    --compile-times
+        Report information about compilation times in the stage 2
+        library and compiler directories.
+    --no-write-out-profile-data
+        When doing bootcheck in a deep profiling grade, disable the
+        writing out of profile data files. This makes the bootcheck
+        faster, but avoiding writing out the profiling data also avoids
+        the checks on its integrity.
+    --type-stats TYPE_STATS_FILE_NAME
+        Collect statistics about the builtin operations (unify, index
+        and compare) performed on various types. The argument of this
+        option should give the absolute pathname of the file in which
+        the runtime has been configured to accumulate statistics. The
+        statistics derived from the creation of the stage 3 compiler
+        will be put TYPE_STATS_FILE_NAME.stage3.$$, while the
+        statistics derived from the execution of the test suite will
+        be put into TYPE_STATS_FILE_NAME.tests.$$. Both filenames will
+        be reported in the output of bootcheck, to allow the statistics
+        files to be matched with the bootcheck that created them.
+    --trace-count
+        Collect counts of the number of times each label is executed
+        in modules compiled with debugging.
+    -W, --windows
+        Translate paths into the Microsoft Windows format and use the
+        extension \`.lib' for libraries. This option also implies
+        --no-sym-links.
+    --no-sym-links
+        Use this option on systems which don't support symbolic links.
+    --disable-debug-libs
+        Make the trace and browser libraries empty. This can be useful
+        when trying to track down the reason why they are being linked
+        into the compiler in the first place.
+    --keep-deep-data
+        Keep the Deep.data files resulting from the bootcheck. The
+        usual behavior is to delete them in the interest of conserving
+        disk space.
+    --progress
+        Create a timestamp file when finishing the execution of each test case,
+        to allow the user to monitor the bootcheck's progress. The timestamp
+        files will have names of the form .date.<testname>.
 "
 
 unset WORKSPACE
@@ -163,13 +163,13 @@
 runtests=true
 do_bootcheck=true
 if test -f /bin/cygwin1.dll; then
-	# Don't run check_namespace on Cygwin, unless explicitly asked,
-	# because the `-nostdinc' option doesn't work with gcc 2.95 on Cygwin.
-	# (This has been fixed in later versions of gcc, e.g. 3.2, so
-	# we should reenable this at some point...)
-	check_namespace=false
+    # Don't run check_namespace on Cygwin, unless explicitly asked,
+    # because the `-nostdinc' option doesn't work with gcc 2.95 on Cygwin.
+    # (This has been fixed in later versions of gcc, e.g. 3.2, so
+    # we should reenable this at some point...)
+    check_namespace=false
 else
-	check_namespace=true
+    check_namespace=true
 fi
 grade=
 use_gradedir=false
@@ -186,11 +186,11 @@
 stop_after_stage_2=false
 windows=false
 use_cp=false
-A=a		# the extension for libraries
+A=a     # the extension for libraries
 if test -d compiler/Mercury; then
-	use_subdirs=${MMAKE_USE_SUBDIRS=yes}
+    use_subdirs=${MMAKE_USE_SUBDIRS=yes}
 else
-	use_subdirs=${MMAKE_USE_SUBDIRS=no}
+    use_subdirs=${MMAKE_USE_SUBDIRS=no}
 fi
 use_mmc_make=no
 compile_times=false
@@ -203,17 +203,17 @@
 
 if test -f .KEEP_OBJS
 then
-	keep_objs=true
+    keep_objs=true
 fi
 
 if test -f .BOOT_GRADE
 then
-	grade=`cat .BOOT_GRADE`
+    grade=`cat .BOOT_GRADE`
 fi
 
 if test -f .NO_WRITE_DEEP
 then
-	write_out_profile_data=false
+    write_out_profile_data=false
 fi
 
 # If you change these, you will also need to change the files indicated
@@ -226,169 +226,169 @@
 ANALYSIS_LIB_NAME=mer_analysis
 
 while test $# -gt 0; do
-	case "$1" in
+    case "$1" in
 
-	-b-|--no-bootcheck)
-		do_bootcheck=false ;;
+    -b-|--no-bootcheck)
+        do_bootcheck=false ;;
 
-	-d|--test-dir)
-		testdirs="$testdirs $2"; shift ;;
-	-d*)
-		testdirs="$testdirs ` expr $1 : '-d\(.*\)' `"; ;;
-
-	-e|--extras)
-		extras=true ;;
-
-	-s|--specified-tests)
-		specified_tests_only="$specified_tests_only $2"; shift ;;
-
-	-f|--failing-tests)
-		failing_tests_only=true ;;
-
-	--error-file)
-		error_file_only=true ;;
-
-	-h|--help)
-		echo "$usage"
-		exit 0 ;;
-
-	-j|--jobs)
-		jfactor="-j$2"; shift ;;
-	-j*)
-		jfactor="-j` expr $1 : '-j\(.*\)' `" ;;
-	--jobs*)
-		jfactor="--jobs` expr $1 : '--jobs\(.*\)' `" ;;
-
-	-k|--keep-objs)
-		keep_objs=true ;;
-
-	-m|--mmake|--mmake-opts)
-		mmake_opts="$mmake_opts $2"; shift ;;
-	-M|--make-opts)
-		make_opts="$make_opts $2"; shift ;;
-
-	-o|--output-file)
-		outfile="$2"; shift ;;
-	-o*)
-		outfile="` expr $1 : '-o\(.*\)' `"; ;;
-
-	--target)
-		case "$2" in
-		c|asm)	target="$2"; shift ;;
-		*)	echo "unknown target \`$2'" 1>&2; exit 1 ;;
-		esac
-		;;
+    -d|--test-dir)
+        testdirs="$testdirs $2"; shift ;;
+    -d*)
+        testdirs="$testdirs ` expr $1 : '-d\(.*\)' `"; ;;
+
+    -e|--extras)
+        extras=true ;;
+
+    -s|--specified-tests)
+        specified_tests_only="$specified_tests_only $2"; shift ;;
+
+    -f|--failing-tests)
+        failing_tests_only=true ;;
+
+    --error-file)
+        error_file_only=true ;;
+
+    -h|--help)
+        echo "$usage"
+        exit 0 ;;
+
+    -j|--jobs)
+        jfactor="-j$2"; shift ;;
+    -j*)
+        jfactor="-j` expr $1 : '-j\(.*\)' `" ;;
+    --jobs*)
+        jfactor="--jobs` expr $1 : '--jobs\(.*\)' `" ;;
+
+    -k|--keep-objs)
+        keep_objs=true ;;
+
+    -m|--mmake|--mmake-opts)
+        mmake_opts="$mmake_opts $2"; shift ;;
+    -M|--make-opts)
+        make_opts="$make_opts $2"; shift ;;
+
+    -o|--output-file)
+        outfile="$2"; shift ;;
+    -o*)
+        outfile="` expr $1 : '-o\(.*\)' `"; ;;
+
+    --target)
+        case "$2" in
+        c|asm)  target="$2"; shift ;;
+        *)  echo "unknown target \`$2'" 1>&2; exit 1 ;;
+        esac
+        ;;
 
-	-G|--grade)
-		grade="$2"; shift ;;
-	-G*)
-		grade="` expr $1 : '-G\(.*\)' `"; ;;
+    -G|--grade)
+        grade="$2"; shift ;;
+    -G*)
+        grade="` expr $1 : '-G\(.*\)' `"; ;;
 
-	--gradedir)
-		use_gradedir=true; grade="$2"; shift ;;
+    --gradedir)
+        use_gradedir=true; grade="$2"; shift ;;
 
-	--test-grade)
-		test_grade="$2"; shift ;;
+    --test-grade)
+        test_grade="$2"; shift ;;
 
-	--test-split-library)
-		test_split_library=true ;;
+    --test-split-library)
+        test_split_library=true ;;
 
-	-r|--copy-runtime)
-		copy_runtime=true ;;
+    -r|--copy-runtime)
+        copy_runtime=true ;;
 
-	-g|--copy-boehm-gc)
-		copy_boehm_gc=true ;;
+    -g|--copy-boehm-gc)
+        copy_boehm_gc=true ;;
 
-	-p|--copy-profilers)
-		copy_profilers=true ;;
+    -p|--copy-profilers)
+        copy_profilers=true ;;
 
-	--check-namespace)
-		check_namespace=true ;;
-	--no-check-namespace)
-		check_namespace=false ;;
+    --check-namespace)
+        check_namespace=true ;;
+    --no-check-namespace)
+        check_namespace=false ;;
 
-	-t-|--no-test-suite)
-		runtests=false ;;
+    -t-|--no-test-suite)
+        runtests=false ;;
 
-	--skip-stage-2)
-		keep_stage_2=true
-		mmake_stage_2=false ;;
+    --skip-stage-2)
+        keep_stage_2=true
+        mmake_stage_2=false ;;
 
-	-2|--keep-stage-2)
-		keep_stage_2=true ;;
+    -2|--keep-stage-2)
+        keep_stage_2=true ;;
 
-	-3|--keep-stage-3)
-		keep_stage_3=true ;;
+    -3|--keep-stage-3)
+        keep_stage_3=true ;;
 
-	--test-params)
-		test_params=true ;;
+    --test-params)
+        test_params=true ;;
 
-	--stop-after-stage-2)
-		stop_after_stage_2=true ;;
+    --stop-after-stage-2)
+        stop_after_stage_2=true ;;
 
-	--use-subdirs)
-		use_subdirs=yes ;;
-	--no-use-subdirs)
-		use_subdirs=no ;;
+    --use-subdirs)
+        use_subdirs=yes ;;
+    --no-use-subdirs)
+        use_subdirs=no ;;
 
-	--use-mmc-make)
-		use_mmc_make=yes ;;
-	--no-use-mmc-make)
-		use_mmc_make=no ;;
+    --use-mmc-make)
+        use_mmc_make=yes ;;
+    --no-use-mmc-make)
+        use_mmc_make=no ;;
 
-	--compile-times)
-		compile_times=true ;;
-	--no-compile-times)
-		compile_times=false ;;
+    --compile-times)
+        compile_times=true ;;
+    --no-compile-times)
+        compile_times=false ;;
 
-	--no-write-out-profile-data)
-		write_out_profile_data=false ;;
+    --no-write-out-profile-data)
+        write_out_profile_data=false ;;
 
-	--type-stats)
-		type_stats="$2"; shift ;;
+    --type-stats)
+        type_stats="$2"; shift ;;
 
-	--trace-count|--trace-counts)
-		trace_count=true ;;
+    --trace-count|--trace-counts)
+        trace_count=true ;;
 
-	-W|--windows)
-		windows=true; use_cp=true; A=lib ;;
+    -W|--windows)
+        windows=true; use_cp=true; A=lib ;;
 
-	--use-cp)
-		use_cp=true ;;
+    --use-cp)
+        use_cp=true ;;
 
-	--no-sym-links)
-		use_cp=true ;;
+    --no-sym-links)
+        use_cp=true ;;
 
-	--disable-debug-libs)
-		disable_debug_libs=true ;;
+    --disable-debug-libs)
+        disable_debug_libs=true ;;
 
-	--keep-deep-data)
-		delete_deep_data=false ;;
+    --keep-deep-data)
+        delete_deep_data=false ;;
 
-	--progress)
-		progress=true ;;
+    --progress)
+        progress=true ;;
 
-	--)
-		shift; break ;;
-	-*)
-		echo "$0: unknown option \`$1'" 1>&2
-		echo "$usage" 1>&2
-		exit 1 ;;
-	*)
-		break ;;
-	esac
-	shift
+    --)
+        shift; break ;;
+    -*)
+        echo "$0: unknown option \`$1'" 1>&2
+        echo "$usage" 1>&2
+        exit 1 ;;
+    *)
+        break ;;
+    esac
+    shift
 done
 
 if test $# -ne 0; then
-	echo "$0: unexpected argument(s) \`$*'" 1>&2
-	echo "$usage" 1>&2
-	exit 1
+    echo "$0: unexpected argument(s) \`$*'" 1>&2
+    echo "$usage" 1>&2
+    exit 1
 fi
 
 if test "$grade" != "" -a "$test_grade" = ""
 then
-	test_grade="$grade"
+    test_grade="$grade"
 fi
 
 case $use_subdirs in
@@ -419,59 +419,59 @@
 esac
 
 case $target in
-	c)
-		target_ext=c
-		target_subdir=$cs_subdir
-		target_opt=
-		;;
-	asm)
-		target_ext=s
-		target_subdir=$ss_subdir
-		target_opt="--target asm"
-		# If the stage 1 directory was built without --target asm,
-		# but the stage 2 will be built with `--target asm',
-		# then we need to copy the profiler directories.
-		# So to be safe, we just enable this by default.
-		copy_profilers=true
-		;;
+    c)
+        target_ext=c
+        target_subdir=$cs_subdir
+        target_opt=
+        ;;
+    asm)
+        target_ext=s
+        target_subdir=$ss_subdir
+        target_opt="--target asm"
+        # If the stage 1 directory was built without --target asm,
+        # but the stage 2 will be built with `--target asm',
+        # then we need to copy the profiler directories.
+        # So to be safe, we just enable this by default.
+        copy_profilers=true
+        ;;
 esac
 case $grade in
-	il|ilc)
-		target_ext=il
-		target_subdir=$ils_subdir
-		target_opt=
-		# See comment above
-		copy_profilers=true
-		# The IL back-end generates native Windows executables,
-		# which do not understand symlinks.  So we need to use cp.
-		use_cp=true
-		;;
+    il|ilc)
+        target_ext=il
+        target_subdir=$ils_subdir
+        target_opt=
+        # See comment above
+        copy_profilers=true
+        # The IL back-end generates native Windows executables,
+        # which do not understand symlinks.  So we need to use cp.
+        use_cp=true
+        ;;
 esac
 
 if test "$grade" != "" -o "$test_grade" != ""
 then
-	copy_runtime=true
-	copy_boehm_gc=true
+    copy_runtime=true
+    copy_boehm_gc=true
 fi
 
 #-----------------------------------------------------------------------------#
 
 if $use_cp
 then
-	LN="cp -pr"
-	LN_S="cp -pr"
+    LN="cp -pr"
+    LN_S="cp -pr"
 else
-	LN="ln"
-	LN_S="ln -s"
+    LN="ln"
+    LN_S="ln -s"
 fi
 
 #-----------------------------------------------------------------------------#
 
 if $windows
 then
-	CYGPATH='cygpath -m'
+    CYGPATH='cygpath -m'
 else
-	CYGPATH='echo'
+    CYGPATH='echo'
 fi
 
 #-----------------------------------------------------------------------------#
@@ -482,8 +482,8 @@
 # one too many times - zs.
 if echo $MERCURY_OPTIONS | grep '\-Di' > /dev/null
 then
-	MERCURY_OPTIONS=`echo $MERCURY_OPTIONS | sed -e 's/-Di//'`
-	export MERCURY_OPTIONS
+    MERCURY_OPTIONS=`echo $MERCURY_OPTIONS | sed -e 's/-Di//'`
+    export MERCURY_OPTIONS
 fi
 
 echo "starting at `date`"
@@ -504,996 +504,1026 @@
 # in any case.
 if test "$RMSTAGECMD" = ""
 then
-	RMSTAGECMD="/bin/rm -fr"
+    RMSTAGECMD="/bin/rm -fr"
 fi
 
 #-----------------------------------------------------------------------------#
 
 if test "$use_gradedir" = "true"; then
-	stage2dir=stage2.$grade
-	stage3dir=stage3.$grade
+    stage2dir=stage2.$grade
+    stage3dir=stage3.$grade
 else
-	stage2dir=stage2
-	stage3dir=stage3
+    stage2dir=stage2
+    stage3dir=stage3
 fi
 
 if $progress
 then
-	BOOTCHECK_TEST_PROGRESS=yes
-	export BOOTCHECK_TEST_PROGRESS
+    BOOTCHECK_TEST_PROGRESS=yes
+    export BOOTCHECK_TEST_PROGRESS
 fi
 
 ORIG_MERCURY_OPTIONS="$MERCURY_OPTIONS"
 
 if $write_out_profile_data
 then
-	true
+    true
 else
-	# Turn off the writing out of deep profiling files, since
-	# Deep.data will be overwritten many times in each directory,
-	# and thus the time spent writing them out is wasted. If deep
-	# profiling debugging is enabled, this also avoids the writing
-	# of *huge* amounts of stuff on stderr.
-	MERCURY_OPTIONS="$MERCURY_OPTIONS -s"
-	export MERCURY_OPTIONS
+    # Turn off the writing out of deep profiling files, since
+    # Deep.data will be overwritten many times in each directory,
+    # and thus the time spent writing them out is wasted. If deep
+    # profiling debugging is enabled, this also avoids the writing
+    # of *huge* amounts of stuff on stderr.
+    MERCURY_OPTIONS="$MERCURY_OPTIONS -s"
+    export MERCURY_OPTIONS
 fi
 
 if $trace_count
 then
-	MERCURY_OPTIONS="$MERCURY_OPTIONS --trace-count"
-	export MERCURY_OPTIONS
+    MERCURY_OPTIONS="$MERCURY_OPTIONS --trace-count"
+    export MERCURY_OPTIONS
 else
-	true
+    true
 fi
 
 NEW_MERCURY_OPTIONS="$MERCURY_OPTIONS"
 
 if $do_bootcheck
 then
-	MERCURY_OPTIONS="$ORIG_MERCURY_OPTIONS"
-	export MERCURY_OPTIONS
+    MERCURY_OPTIONS="$ORIG_MERCURY_OPTIONS"
+    export MERCURY_OPTIONS
 
-	if mmake $mmake_opts MMAKEFLAGS=$jfactor all
-	then
-		echo "building of stage 1 successful"
-	else
-		cd $root
-		mmake $mmake_opts depend
-		if mmake $mmake_opts MMAKEFLAGS=$jfactor all
-		then
-			echo "building of stage 1 successful"
-		else
-			echo "building of stage 1 not successful"
-			exit 1
-		fi
-	fi
-
-	# Don't set MMAKE_USE_SUBDIRS and MMAKE_USE_MMC_MAKE until after
-	# we have finished making stage1, because $use_subdirs and $use_mmc_make
-	# come from options that are intended to affect only stages 2 and 3.
-
-	MMAKE_USE_SUBDIRS=$use_subdirs
-	export MMAKE_USE_SUBDIRS
-
-	MMAKE_USE_MMC_MAKE=$use_mmc_make
-	export MMAKE_USE_MMC_MAKE
-
-	MERCURY_OPTIONS="$NEW_MERCURY_OPTIONS"
-	export MERCURY_OPTIONS
-
-	MERCURY_COMPILER=$root/compiler/mercury_compile
-	export MERCURY_COMPILER
-
-	MERCURY_CONFIG_FILE=$root/scripts/Mercury.config
-	export MERCURY_CONFIG_FILE
-
-	test -d $stage2dir || mkdir $stage2dir
-	if $keep_stage_2
-	then
-		echo keeping existing stage2
-	else
-		# We try to do the removal of the stage 2 directory in parallel
-		# since recursive rm's across NFS can be quite slow ...
-		$RMSTAGECMD $root/$stage2dir/compiler < /dev/null &
-		$RMSTAGECMD $root/$stage2dir/library < /dev/null &
-		wait
-		$RMSTAGECMD $root/$stage2dir/* < /dev/null
-		/bin/rm -fr $root/$stage2dir/* < /dev/null
-		/bin/rm -fr $root/$stage2dir/.[a-zA-Z]* < /dev/null
-	fi
-
-	if $mmake_stage_2
-	then
-		set +x
-		echo linking stage 2... 1>&2
-		cd $stage2dir
-		$LN_S $root/main.c .
-		mkdir compiler
-		cd compiler
-		# Break up the links into several chunks.
-		# This is needed to cope with small limits
-		# on the size of argument vectors.
-
-		$LN_S $root/compiler/[a-h]*.m .
-		$LN_S $root/compiler/[i-o]*.m .
-		$LN_S $root/compiler/[p-s]*.m .
-		$LN_S $root/compiler/[t-z]*.m .
-		$LN_S $root/compiler/*.pp .
-		$LN_S $root/compiler/notes .
-
-		cp $root/compiler/Mmake* $root/compiler/Mercury.options .
-		cd $root/$stage2dir
-		mkdir library
-		cd library
-		$LN_S $root/library/[a-l]*.m .
-		$LN_S $root/library/[m-z]*.m .
-		# See comment below for why we use $LN rather than $LN_S here
-		$LN $root/library/library_strong_name.sn .
-		$LN_S $root/library/print_extra_inits .
-		cp $root/library/Mmake* $root/library/Mercury.options .
-		$LN_S $root/library/$STD_LIB_NAME.init .
-		$LN_S $root/library/RESERVED_MACRO_NAMES .
-		cd $root/$stage2dir
-		mkdir mdbcomp
-		cd mdbcomp
-		$LN_S $root/mdbcomp/*.m .
-		cp $root/mdbcomp/Mmake* $root/mdbcomp/Mercury.options .
-		$LN_S $root/mdbcomp/$MDCOMP_LIB_NAME.init .
-		$LN_S $root/mdbcomp/RESERVED_MACRO_NAMES .
-		cd $root/$stage2dir
-		mkdir browser
-		cd browser
-		$LN_S $root/browser/*.m .
-		cp $root/browser/Mmake* $root/browser/Mercury.options .
-		$LN_S $root/browser/$BROWSER_LIB_NAME.init .
-		$LN_S $root/browser/RESERVED_MACRO_NAMES .
-		cd $root/$stage2dir
-		mkdir analysis
-		cd analysis
-		$LN_S $root/analysis/*.m .
-		cp $root/analysis/Mmake* $root/analysis/Mercury.options .
-		$LN_S $root/analysis/$ANALYSIS_LIB_NAME.init .
-
-		cd $root/$stage2dir
-		if $copy_runtime
-		then
-			# Remove symbolic link to the stage 1 runtime
-			# if it's present, which it can be with the -2 option.
-			rm -f runtime
-			mkdir runtime
-			cd runtime
-			$LN_S $root/runtime/*.h .
-			$LN_S $root/runtime/*.c .
-			# We need to use $LN rather than $LN_S for the files
-			# that get processed with Microsoft's tools, since
-			# Microsoft's tools don't understand Cygwin symbolic
-			# links (hard links are OK, Cygwin's ln just makes
-			# copies).
-			$LN $root/runtime/*.cpp .
-			rm -f mercury_mcpp.h mercury_conf*.h
-			$LN $root/runtime/mercury_mcpp.h .
-			$LN $root/runtime/mercury_conf*.h .
-			$LN $root/runtime/mercury_il.il .
-			$LN_S $root/runtime/*.in .
-			cp $root/runtime/Mmake* .
-			$LN_S $root/runtime/machdeps .
-			$LN_S $root/runtime/RESERVED_MACRO_NAMES .
-			cd $root/$stage2dir
-			rm -f trace
-			mkdir trace
-			cd trace
-			$LN_S $root/trace/*.h .
-			$LN_S $root/trace/*.c .
-			cp $root/trace/Mmake* .
-			$LN_S $root/trace/RESERVED_MACRO_NAMES .
-			cd $root/$stage2dir
-			rm -f robdd
-			mkdir robdd
-			cd robdd
-			$LN_S $root/robdd/*.h .
-			$LN_S $root/robdd/*.c .
-			cp $root/robdd/Mmake* .
-			cp $root/robdd/Make* .
-			cd $root/$stage2dir
-		else
-			$LN_S $root/runtime .
-			$LN_S $root/trace .
-			$LN_S $root/robdd .
-		fi
-		if $copy_boehm_gc
-		then
-			# Remove symbolic link to the stage 1 gc
-			# if it's present, which it can be with the -2 option.
-			rm -f boehm_gc
-			mkdir boehm_gc
-			cd boehm_gc
-			$LN_S $root/boehm_gc/*.h .
-			$LN_S $root/boehm_gc/*.c .
-			$LN_S $root/boehm_gc/*.s .
-			$LN_S $root/boehm_gc/*.S .
-			$LN_S $root/boehm_gc/include .
-			cp $root/boehm_gc/Mmake* .
-			$LN_S $root/boehm_gc/Makefile .
-			cp $root/boehm_gc/NT_MAKEFILE .
-			cp $root/boehm_gc/gc_cpp.cc .
-			$LN_S $root/boehm_gc/machdeps .
-			cd $root/$stage2dir
-		else
-			$LN_S $root/boehm_gc .
-		fi
-		$LN_S $root/java .
-		$LN_S $root/mps_gc .
-		$LN_S $root/bindist .
-		$LN_S $root/doc .
-		$LN_S $root/scripts .
-		$LN_S $root/tools .
-		$LN_S $root/util .
-		if $copy_profilers
-		then
-			mkdir slice
-			cd slice
-			$LN_S $root/slice/*.m .
-			cp $root/slice/Mmake* $root/slice/Mercury.options .
-			cd $root/$stage2dir
-			mkdir profiler
-			cd profiler
-			$LN_S $root/profiler/*.m .
-			cp $root/profiler/Mmake* $root/profiler/Mercury.options .
-			cd $root/$stage2dir
-			mkdir deep_profiler
-			cd deep_profiler
-			$LN_S $root/deep_profiler/*.m .
-			cp $root/deep_profiler/Mmake* .
-			cp $root/deep_profiler/Mercury.options .
-			cd $root/$stage2dir
-		else
-			$LN_S $root/slice .
-			$LN_S $root/profiler .
-			$LN_S $root/deep_profiler .
-		fi
-		$LN_S $root/conf* .
-		$LN_S $root/aclocal.m4 .
-		$LN_S $root/VERSION .
-		$LN_S $root/install-sh .
-		$LN_S $root/.*.in .
-		rm -f config*.log
-		cp $root/Mmake* $root/Mercury.options .
-		if test -f $root/Mmake.stage.params
-		then
-			/bin/rm -f Mmake.params
-			cp $root/Mmake.stage.params Mmake.params
-		fi
-		if test -f $root/Mmake.stage.mdbcomp.params
-		then
-			/bin/rm -f mdbcomp/Mmake.mdbcomp.params
-			cp $root/Mmake.stage.mdbcomp.params mdbcomp/Mmake.mdbcomp.params
-		fi
-		if test -f $root/Mmake.stage.browser.params
-		then
-			/bin/rm -f browser/Mmake.browser.params
-			cp $root/Mmake.stage.browser.params browser/Mmake.browser.params
-		fi
-		if test -f $root/Mmake.stage.deep.params
-		then
-			/bin/rm -f deep_profiler/Mmake.deep.params
-			cp $root/Mmake.stage.deep.params deep_profiler/Mmake.deep.params
-		fi
-		if test -f $root/Mmake.stage.library.params
-		then
-			/bin/rm -f library/Mmake.library.params
-			cp $root/Mmake.stage.library.params library/Mmake.library.params
-		fi
-		if test -f $root/Mmake.stage.runtime.params
-		then
-			/bin/rm -f runtime/Mmake.runtime.params
-			cp $root/Mmake.stage.runtime.params runtime/Mmake.runtime.params
-		fi
-		if test -f $root/Mmake.stage.trace.params
-		then
-			/bin/rm -f trace/Mmake.trace.params
-			cp $root/Mmake.stage.trace.params trace/Mmake.trace.params
-		fi
-		if test -f $root/Mercury.stage.options
-		then
-			/bin/rm -f Mercury.options
-			cp $root/Mercury.stage.options Mercury.options
-		fi
-		if test "$grade" != ""
-		then
-			echo "GRADE = $grade" >> Mmake.params
-		fi
-		echo 'GCC_SRC_DIR := ../$(GCC_SRC_DIR)' >> Mmake.params
-		cd $root
-
-		set -x
-
-		MMAKE_VPATH=.
-		export MMAKE_VPATH
-		MMAKE_DIR=$root/scripts
-		export MMAKE_DIR
-
-		# Use the new mmake to build stage 2
-		MMAKE=$MMAKE_DIR/mmake
-		mmake_opts="$mmake_opts $target_opt"
-
-		if (cd $stage2dir && $MMAKE $mmake_opts $jfactor runtime)
-		then
-			echo "building of stage 2 runtime successful"
-		else
-			echo "building of stage 2 runtime not successful"
-			exit 1
-		fi
-
-		if (cd $stage2dir && \
-			$MMAKE $mmake_opts dep_library dep_mdbcomp \
-			dep_browser dep_analysis dep_compiler dep_slice \
-			dep_profiler dep_deep_profiler)
-		then
-			echo "building of stage 2 dependencies successful"
-		else
-			echo "building of stage 2 dependencies not successful"
-			exit 1
-		fi
-
-		if (cd $stage2dir/library && \
-			$MMAKE $mmake_opts $jfactor mercury)
-		then
-			echo "building of stage 2 library successful"
-		else
-			echo "building of stage 2 library not successful"
-			exit 1
-		fi
-
-		if $test_split_library
-		then
-			if (cd $stage2dir/library && \
-			    $MMAKE $mmake_opts $jfactor $STD_LIB_NAME.split.a)
-			then
-				echo "building of stage 2 split library successful"
-			else
-				echo "building of stage 2 split library not successful"
-				exit 1
-			fi
-
-			mv $stage2dir/library/$STD_LIB_NAME.split.a \
-				$stage2dir/library/$STD_LIB_NAME.a
-		fi
-
-		if (cd $stage2dir/mdbcomp && \
-			$MMAKE $mmake_opts $jfactor library)
-		then
-			echo "building of stage 2 mdbcomp successful"
-		else
-			echo "building of stage 2 mdbcomp not successful"
-			exit 1
-		fi
-
-		if (cd $stage2dir/browser && \
-			$MMAKE $mmake_opts $jfactor library)
-		then
-			echo "building of stage 2 browser successful"
-		else
-			echo "building of stage 2 browser not successful"
-			exit 1
-		fi
-
-		if (cd $stage2dir && $MMAKE $mmake_opts $jfactor trace)
-		then
-			echo "building of stage 2 trace successful"
-		else
-			echo "building of stage 2 trace not successful"
-			exit 1
-		fi
-
-		if $disable_debug_libs
-		then
-			/bin/rm $stage2dir/browser/lib$BROWSER_LIB_NAME.a
-			ar cr $stage2dir/browser/lib$BROWSER_LIB_NAME.a
-			/bin/rm $stage2dir/trace/lib$TRACE_LIB_NAME.a
-			ar cr $stage2dir/trace/lib$TRACE_LIB_NAME.a
-		fi
-
-		if (cd $stage2dir && $MMAKE $mmake_opts $jfactor analysis)
-		then
-			echo "building of stage 2 analysis successful"
-		else
-			echo "building of stage 2 analysis not successful"
-			exit 1
-		fi
-
-		if (cd $stage2dir/compiler && \
-			$MMAKE $mmake_opts $jfactor mercury_compile)
-		then
-			echo "building of stage 2 compiler successful"
-		else
-			echo "building of stage 2 compiler not successful"
-			exit 1
-		fi
-
-		if (cd $stage2dir && $MMAKE $mmake_opts MMAKEFLAGS=$jfactor all)
-		then
-			echo "building of stage 2 successful"
-		else
-			echo "building of stage 2 not successful"
-			exit 1
-		fi
-
-		if $compile_times
-		then
-			ls -lt $stage2dir/library/*.c
-			ls -lt $stage2dir/library/*.o
-			ls -lt $stage2dir/library/*.{a,so}
-			ls -lt $stage2dir/compiler/*.c
-			ls -lt $stage2dir/compiler/*.o
-			ls -lt $stage2dir/compiler/mercury_compile
-		fi
-	fi
-
-	# Build the check_namespace target in the relevant directories.
-	# We want to do so before we delete any of the stage 2 object files.
-
-	check_namespace_status=0
-	if $check_namespace
-	then
-		cd $root/$stage2dir/runtime
-		mmake $mmake_opts check_namespace || {
-			echo '** mmake check_namespace failed in runtime!'
-			check_namespace_status=1
-		}
-		cd $root/$stage2dir/trace
-		mmake $mmake_opts check_namespace || {
-			echo '** mmake check_namespace failed in trace!'
-			check_namespace_status=1
-		}
-		cd $root/$stage2dir/library
-		mmake $mmake_opts check_namespace || {
-			echo '** mmake check_namespace failed in library!'
-			check_namespace_status=1
-		}
-		cd $root/$stage2dir/mdbcomp
-		mmake $mmake_opts check_namespace || {
-			echo '** mmake check_namespace failed in mdbcomp!'
-			check_namespace_status=1
-		}
-		cd $root/$stage2dir/browser
-		mmake $mmake_opts check_namespace || {
-			echo '** mmake check_namespace failed in browser!'
-			check_namespace_status=1
-		}
-		cd $root
-	fi
-
-	if $stop_after_stage_2
-	then
-		echo "stopping after building stage 2"
-		exit 0
-	fi
-
-	# We can now remove the object files from most stage 2 directories,
-	# but we will keep the compiler objects for a while longer.
-	if $keep_objs
-	then
-		true
-	else
-		libdirs="library mdbcomp browser"
-		if $copy_profilers
-		then
-			profdirs="slice profiler deep_profiler"
-		else
-			profdirs=
-		fi
-		if $copy_runtime
-		then
-			rundirs="runtime trace"
-		else
-			rundirs=
-		fi
-
-		objdirs="$libdirs $profdirs $rundirs"
-		for rmdir in $objdirs
-		do
-			cd $root/$stage2dir/$rmdir
-			/bin/rm -f *.o *.pic_o
-		done
-
-		for cleandir in runtime trace library mdbcomp browser
-		do
-			cd $root/$stage2dir/$cleandir
-			mmake clean_check
-		done
-
-		cd $root
-	fi
-
-	MERCURY_COMPILER=$root/$stage2dir/compiler/mercury_compile
-	export MERCURY_COMPILER
-
-	test -d $stage3dir || mkdir $stage3dir
-	if $keep_stage_3
-	then
-		echo keeping existing stage3
-	else
-		# We try to do the removal of the stage 3 directory in parallel
-		# since recursive rm's across NFS can be quite slow ...
-		$RMSTAGECMD $root/$stage3dir/compiler < /dev/null &
-		$RMSTAGECMD $root/$stage3dir/library < /dev/null &
-		wait
-		$RMSTAGECMD $root/$stage3dir/* < /dev/null
-		/bin/rm -fr $root/$stage3dir/* < /dev/null
-		/bin/rm -fr $root/$stage3dir/.[a-zA-Z]* < /dev/null
-	fi
-
-	echo linking stage 3... 1>&2
-	set +x
-	cd $stage3dir
-	$LN_S $root/main.c .
-	mkdir compiler
-	cd compiler
-	# Break up the links into several chunks.
-	# This is needed to cope with small limits
-	# on the size of argument vectors.
-	$LN_S $root/compiler/[a-h]*.m .
-	$LN_S $root/compiler/[i-o]*.m .
-	$LN_S $root/compiler/[p-s]*.m .
-	$LN_S $root/compiler/[t-z]*.m .
-	$LN_S $root/compiler/*.pp .
-	$LN_S $root/compiler/notes .
-
-	cp $root/compiler/Mmake* $root/compiler/Mercury.options .
-	cd $root/$stage3dir
-	mkdir library
-	cd library
-	$LN_S $root/library/[a-l]*.m .
-	$LN_S $root/library/[m-z]*.m .
-	$LN_S $root/library/print_extra_inits .
-	$LN_S $root/library/library_strong_name.sn .
-	cp $root/library/Mmake* $root/library/Mercury.options .
-	$LN_S $root/library/$STD_LIB_NAME.init .
-	cd $root/$stage3dir
-	mkdir mdbcomp
-	cd mdbcomp
-	$LN_S $root/mdbcomp/*.m .
-	cp $root/mdbcomp/Mmake* $root/mdbcomp/Mercury.options .
-	$LN_S $root/mdbcomp/$MDBCOMP_LIB_NAME.init .
-	cd $root/$stage3dir
-	mkdir browser
-	cd browser
-	$LN_S $root/browser/*.m .
-	cp $root/browser/Mmake* $root/browser/Mercury.options .
-	$LN_S $root/browser/$BROWSER_LIB_NAME.init .
-	cd $root/$stage3dir
-	mkdir analysis
-	cd analysis
-	$LN_S $root/analysis/*.m .
-	cp $root/analysis/Mmake* $root/analysis/Mercury.options .
-	$LN_S $root/analysis/$ANALYSIS_LIB_NAME.init .
-	cd $root/$stage3dir
-	$LN_S $root/$stage2dir/boehm_gc .
-	$LN_S $root/$stage2dir/java .
-	$LN_S $root/$stage2dir/mps_gc .
-	$LN_S $root/bindist .
-	$LN_S $root/doc .
-	$LN_S $root/$stage2dir/runtime .
-	$LN_S $root/$stage2dir/trace .
-	$LN_S $root/$stage2dir/robdd .
-	$LN_S $root/scripts .
-	$LN_S $root/tools .
-	$LN_S $root/util .
-	$LN_S $root/$stage2dir/slice .
-	$LN_S $root/$stage2dir/profiler .
-	$LN_S $root/$stage2dir/deep_profiler .
-	$LN_S $root/conf* .
-	$LN_S $root/aclocal.m4 .
-	$LN_S $root/VERSION .
-	$LN_S $root/install-sh .
-	$LN_S $root/.*.in .
-	rm -f config*.log
-	cp $root/$stage2dir/Mmake* $root/$stage2dir/Mercury.options .
-	cd $root
-	set -x
-
-	MMAKE_VPATH=.
-	export MMAKE_VPATH
-	MMAKE_DIR=$root/scripts
-	export MMAKE_DIR
-
-	# Use the new mmake to build stage 3
-	MMAKE=$MMAKE_DIR/mmake
-
-	if test "$type_stats" != ""
-	then
-		# Start collecting statistics from stage 3 with a clean slate,
-		# while making sure that the existing stats are not lost.
-		# Note: we do not have to go to any great lengths to restore
-		# the old stats if bootcheck fails, since the save files
-		# can easily be recovered outside bootcheck.
-
-		cat "$type_stats" >> "$type_stats".save.$$
-		cp /dev/null "$type_stats"
-	fi
-
-	if (cd $stage3dir && $MMAKE $mmake_opts dep_library dep_mdbcomp \
-		dep_browser_all dep_analysis dep_compiler)
-	then
-		echo "building of stage 3 dependencies successful"
-	else
-		echo "building of stage 3 dependencies not successful"
-		exit 1
-	fi
-
-	if (cd $stage3dir/library &&
-		$MMAKE $mmake_opts $jfactor all-ints &&
-		$MMAKE $mmake_opts $jfactor ${target_ext}s)
-	then
-		echo "building of stage 3 library successful"
-	else
-		echo "building of stage 3 library initially not successful"
-		df .
-		# try again, in case the failure cause was transient
-		if (cd $stage3dir/library &&
-			$MMAKE $mmake_opts $jfactor all-ints &&
-			$MMAKE $mmake_opts $jfactor ${target_ext}s)
-		then
-			echo "building of stage 3 library successful"
-		else
-			echo "building of stage 3 library not successful"
-			exit 1
-		fi
-	fi
-
-	# We delay deleting the stage 2 compiler objects until now,
-	# so that if (a) an error manifests itself during the creation
-	# of the stage 3 library, and (b) this error can be fixed by
-	# changing the runtime, a bootcheck -2, which requires a relink,
-	# will not have to expensively recreate the stage 2 compiler objects.
-
-	if $keep_objs
-	then
-		true
-	else
-		find $root/$stage2dir/compiler -name "*.o" -print |
-		xargs /bin/rm -f
-	fi
-
-	if (cd $stage3dir/mdbcomp &&
-		$MMAKE $mmake_opts $jfactor all-ints &&
-		$MMAKE $mmake_opts $jfactor ${target_ext}s)
-	then
-		echo "building of stage 3 mdbcomp successful"
-	else
-		echo "building of stage 3 mdbcomp initially not successful"
-		df .
-		# try again, in case the failure cause was transient
-		if (cd $stage3dir/mdbcomp && \
-			$MMAKE $mmake_opts $jfactor ${target_ext}s)
-		then
-			echo "building of stage 3 mdbcomp successful"
-		else
-			echo "building of stage 3 mdbcomp not successful"
-			exit 1
-		fi
-	fi
-
-	if (cd $stage3dir/browser &&
-		$MMAKE $mmake_opts $jfactor all-ints &&
-		$MMAKE $mmake_opts $jfactor ${target_ext}s)
-	then
-		echo "building of stage 3 browser successful"
-	else
-		echo "building of stage 3 browser initially not successful"
-		df .
-		# try again, in case the failure cause was transient
-		if (cd $stage3dir/browser && \
-			$MMAKE $mmake_opts $jfactor ${target_ext}s)
-		then
-			echo "building of stage 3 browser successful"
-		else
-			echo "building of stage 3 browser not successful"
-			exit 1
-		fi
-	fi
-
-	if (cd $stage3dir/analysis &&
-		$MMAKE $mmake_opts $jfactor all-ints &&
-		$MMAKE $mmake_opts $jfactor ${target_ext}s)
-	then
-		echo "building of stage 3 analysis successful"
-	else
-		echo "building of stage 3 analysis initially not successful"
-		df .
-		# try again, in case the failure cause was transient
-		if (cd $stage3dir/analysis &&
-			$MMAKE $mmake_opts $jfactor all-ints &&
-			$MMAKE $mmake_opts $jfactor ${target_ext}s)
-		then
-			echo "building of stage 3 analysis successful"
-		else
-			echo "building of stage 3 analysis not successful"
-			exit 1
-		fi
-	fi
-
-	if (cd $stage3dir/compiler && \
-		$MMAKE $mmake_opts $jfactor ${target_ext}s)
-	then
-		echo "building of stage 3 compiler successful"
-	else
-		echo "building of stage 3 compiler initially not successful"
-		df .
-		# try again, in case the failure cause was transient
-		if (cd $stage3dir/compiler && \
-			$MMAKE $mmake_opts $jfactor ${target_ext}s)
-		then
-			echo "building of stage 3 compiler successful"
-		else
-			echo "building of stage 3 compiler not successful"
-			exit 1
-		fi
-	fi
-
-	if test "$type_stats" != ""
-	then
-		echo "Saving stage 3 stats in $type_stats.stage3.$$"
-		mv "$type_stats" "$type_stats".stage3.$$
-		cp /dev/null "$type_stats"
-	fi
-
-	diff_status=0
-
-	exec 3>&1		# save stdout in fd 3
-	if test -n "$outfile"
-	then
-		exec > "$outfile"	# redirect stdout to $outfile
-	fi
-
-	for dir in library mdbcomp browser analysis compiler; do
-		# `mmake cs' in the compiler directory doesn't build
-		# `top_level_init.c', so we only compare the `.c'
-		# files present in the stage 3 directory.
-		for file in $stage3dir/$dir/${target_subdir}*.${target_ext}; do
-		    diff -u $stage2dir/$dir/${cs_subdir}`basename $file` $file \
-			|| diff_status=1
-		done
-	done
-
-	exec >&3		# restore stdout from fd 3
-	if test $diff_status -ne 0
-	then
-		echo "** error - stage 2 and stage 3 differ!"
-	else
-		echo "stage 2 and stage 3 compare ok"
-		if test -d $stage3dir/library/ComplexityArgs
-		then
-			mv $stage3dir/library/ComplexityArgs \
-				$root/stage3_library_ComplexityArgs
-		fi
-		if test -d $stage3dir/library/ComplexityData
-		then
-			mv $stage3dir/library/ComplexityData \
-				$root/stage3_library_ComplexityData
-		fi
-		if test -d $stage3dir/compiler/ComplexityArgs
-		then
-			mv $stage3dir/compiler/ComplexityArgs \
-				$root/stage3_compiler_ComplexityArgs
-		fi
-		if test -d $stage3dir/compiler/ComplexityData
-		then
-			mv $stage3dir/compiler/ComplexityData \
-				$root/stage3_compiler_ComplexityData
-		fi
-
-		echo "removing stage 3..."
-		# We try to do the removal of the stage 3 directory in parallel
-		# since recursive rm's across NFS can be quite slow ...
-		$RMSTAGECMD $root/$stage3dir/compiler < /dev/null &
-		$RMSTAGECMD $root/$stage3dir/library < /dev/null &
-		wait
-		$RMSTAGECMD $root/$stage3dir/* < /dev/null
-		/bin/rm -fr $root/$stage3dir/* < /dev/null
-		/bin/rm -fr $root/$stage3dir/.[a-zA-Z]* < /dev/null
-
-		if $keep_objs
-		then
-			true
-		else
-		case "$grade" in
-			*debug*)
-				# These files take up a lot of disk
-				# space, so we compress them. This
-				# reduces the probability that running
-				# the tests will run out of disk space,
-				# while still allowing the original
-				# files to be reconstructed
-				# relatively quickly.
-				gzip $root/$stage2dir/library/*.c
-				gzip $root/$stage2dir/mdbcomp/*.c
-				gzip $root/$stage2dir/browser/*.c
-				gzip $root/$stage2dir/compiler/*.c
-				;;
-		esac
-		fi
-	fi
+    if mmake $mmake_opts MMAKEFLAGS=$jfactor all
+    then
+        echo "building of stage 1 successful"
+    else
+        cd $root
+        mmake $mmake_opts depend
+        if mmake $mmake_opts MMAKEFLAGS=$jfactor all
+        then
+            echo "building of stage 1 successful"
+        else
+            echo "building of stage 1 not successful"
+            exit 1
+        fi
+    fi
+
+    # Don't set MMAKE_USE_SUBDIRS and MMAKE_USE_MMC_MAKE until after
+    # we have finished making stage1, because $use_subdirs and $use_mmc_make
+    # come from options that are intended to affect only stages 2 and 3.
+
+    MMAKE_USE_SUBDIRS=$use_subdirs
+    export MMAKE_USE_SUBDIRS
+
+    MMAKE_USE_MMC_MAKE=$use_mmc_make
+    export MMAKE_USE_MMC_MAKE
+
+    MERCURY_OPTIONS="$NEW_MERCURY_OPTIONS"
+    export MERCURY_OPTIONS
+
+    MERCURY_COMPILER=$root/compiler/mercury_compile
+    export MERCURY_COMPILER
+
+    # now in FLAGS files
+    # MERCURY_CONFIG_FILE=$root/scripts/Mercury.config
+    # export MERCURY_CONFIG_FILE
+
+    test -d $stage2dir || mkdir $stage2dir
+    if $keep_stage_2
+    then
+        echo keeping existing stage2
+    else
+        # We try to do the removal of the stage 2 directory in parallel
+        # since recursive rm's across NFS can be quite slow ...
+        $RMSTAGECMD $root/$stage2dir/compiler < /dev/null &
+        $RMSTAGECMD $root/$stage2dir/library < /dev/null &
+        wait
+        $RMSTAGECMD $root/$stage2dir/* < /dev/null
+        /bin/rm -fr $root/$stage2dir/* < /dev/null
+        /bin/rm -fr $root/$stage2dir/.[a-zA-Z]* < /dev/null
+    fi
+
+    if $mmake_stage_2
+    then
+        set +x
+        echo linking stage 2... 1>&2
+        cd $stage2dir
+        $LN_S $root/main.c .
+        mkdir compiler
+        cd compiler
+        # Break up the links into several chunks.
+        # This is needed to cope with small limits
+        # on the size of argument vectors.
+
+        $LN_S $root/compiler/[a-h]*.m .
+        $LN_S $root/compiler/[i-o]*.m .
+        $LN_S $root/compiler/[p-s]*.m .
+        $LN_S $root/compiler/[t-z]*.m .
+        $LN_S $root/compiler/*.pp .
+        $LN_S $root/compiler/notes .
+
+        cp $root/compiler/Mmake* $root/compiler/Mercury.options .
+        cp $root/compiler/*_FLAGS.in .
+        cd $root/$stage2dir
+        mkdir library
+        cd library
+        $LN_S $root/library/[a-l]*.m .
+        $LN_S $root/library/[m-z]*.m .
+        # See comment below for why we use $LN rather than $LN_S here
+        $LN $root/library/library_strong_name.sn .
+        $LN_S $root/library/print_extra_inits .
+        cp $root/library/Mmake* $root/library/Mercury.options .
+        cp $root/library/*_FLAGS.in .
+        cp $root/library/INTER_FLAGS .
+        $LN_S $root/library/$STD_LIB_NAME.init .
+        $LN_S $root/library/RESERVED_MACRO_NAMES .
+        cd $root/$stage2dir
+        mkdir mdbcomp
+        cd mdbcomp
+        $LN_S $root/mdbcomp/*.m .
+        cp $root/mdbcomp/Mmake* $root/mdbcomp/Mercury.options .
+        cp $root/mdbcomp/*_FLAGS.in .
+        $LN_S $root/mdbcomp/$MDCOMP_LIB_NAME.init .
+        $LN_S $root/mdbcomp/RESERVED_MACRO_NAMES .
+        cd $root/$stage2dir
+        mkdir browser
+        cd browser
+        $LN_S $root/browser/*.m .
+        cp $root/browser/Mmake* $root/browser/Mercury.options .
+        cp $root/browser/*_FLAGS.in .
+        $LN_S $root/browser/$BROWSER_LIB_NAME.init .
+        $LN_S $root/browser/RESERVED_MACRO_NAMES .
+        cd $root/$stage2dir
+        mkdir analysis
+        cd analysis
+        $LN_S $root/analysis/*.m .
+        cp $root/analysis/Mmake* $root/analysis/Mercury.options .
+        cp $root/analysis/*_FLAGS.in .
+        $LN_S $root/analysis/$ANALYSIS_LIB_NAME.init .
+
+        cd $root/$stage2dir
+        if $copy_runtime
+        then
+            # Remove symbolic link to the stage 1 runtime
+            # if it's present, which it can be with the -2 option.
+            rm -f runtime
+            mkdir runtime
+            cd runtime
+            $LN_S $root/runtime/*.h .
+            $LN_S $root/runtime/*.c .
+            # We need to use $LN rather than $LN_S for the files
+            # that get processed with Microsoft's tools, since
+            # Microsoft's tools don't understand Cygwin symbolic
+            # links (hard links are OK, Cygwin's ln just makes
+            # copies).
+            $LN $root/runtime/*.cpp .
+            rm -f mercury_mcpp.h mercury_conf*.h
+            $LN $root/runtime/mercury_mcpp.h .
+            $LN $root/runtime/mercury_conf*.h .
+            $LN $root/runtime/mercury_il.il .
+            $LN_S $root/runtime/*.in .
+            cp $root/runtime/Mmake* .
+            $LN_S $root/runtime/machdeps .
+            $LN_S $root/runtime/RESERVED_MACRO_NAMES .
+            cd $root/$stage2dir
+            rm -f trace
+            mkdir trace
+            cd trace
+            $LN_S $root/trace/*.h .
+            $LN_S $root/trace/*.c .
+            cp $root/trace/Mmake* .
+            $LN_S $root/trace/RESERVED_MACRO_NAMES .
+            cd $root/$stage2dir
+            rm -f robdd
+            mkdir robdd
+            cd robdd
+            $LN_S $root/robdd/*.h .
+            $LN_S $root/robdd/*.c .
+            cp $root/robdd/Mmake* .
+            cp $root/robdd/Make* .
+            cd $root/$stage2dir
+        else
+            $LN_S $root/runtime .
+            $LN_S $root/trace .
+            $LN_S $root/robdd .
+        fi
+        if $copy_boehm_gc
+        then
+            # Remove symbolic link to the stage 1 gc
+            # if it's present, which it can be with the -2 option.
+            rm -f boehm_gc
+            mkdir boehm_gc
+            cd boehm_gc
+            $LN_S $root/boehm_gc/*.h .
+            $LN_S $root/boehm_gc/*.c .
+            $LN_S $root/boehm_gc/*.s .
+            $LN_S $root/boehm_gc/*.S .
+            $LN_S $root/boehm_gc/include .
+            cp $root/boehm_gc/Mmake* .
+            $LN_S $root/boehm_gc/Makefile .
+            cp $root/boehm_gc/NT_MAKEFILE .
+            cp $root/boehm_gc/gc_cpp.cc .
+            $LN_S $root/boehm_gc/machdeps .
+            cd $root/$stage2dir
+        else
+            $LN_S $root/boehm_gc .
+        fi
+        $LN_S $root/java .
+        $LN_S $root/mps_gc .
+        $LN_S $root/bindist .
+        $LN_S $root/doc .
+        $LN_S $root/scripts .
+        $LN_S $root/tools .
+        $LN_S $root/util .
+        if $copy_profilers
+        then
+            mkdir slice
+            cd slice
+            $LN_S $root/slice/*.m .
+            cp $root/slice/Mmake* $root/slice/Mercury.options .
+            cp $root/slice/*_FLAGS.in .
+            cd $root/$stage2dir
+            mkdir profiler
+            cd profiler
+            $LN_S $root/profiler/*.m .
+            cp $root/profiler/Mmake* $root/profiler/Mercury.options .
+            cp $root/profiler/*_FLAGS.in .
+            cd $root/$stage2dir
+            mkdir deep_profiler
+            cd deep_profiler
+            $LN_S $root/deep_profiler/*.m .
+            cp $root/deep_profiler/Mmake* .
+            cp $root/deep_profiler/Mercury.options .
+            cp $root/deep_profiler/*_FLAGS.in .
+            cd $root/$stage2dir
+        else
+            $LN_S $root/slice .
+            $LN_S $root/profiler .
+            $LN_S $root/deep_profiler .
+        fi
+        $LN_S $root/conf* .
+        $LN_S $root/aclocal.m4 .
+        $LN_S $root/VERSION .
+        $LN_S $root/install-sh .
+        $LN_S $root/.*.in .
+        rm -f config*.log
+        cp $root/Mmake* $root/Mercury.options .
+        if test -f $root/Mmake.stage.params
+        then
+            /bin/rm -f Mmake.params
+            cp $root/Mmake.stage.params Mmake.params
+        fi
+        if test -f $root/Mmake.stage.mdbcomp.params
+        then
+            /bin/rm -f mdbcomp/Mmake.mdbcomp.params
+            cp $root/Mmake.stage.mdbcomp.params mdbcomp/Mmake.mdbcomp.params
+        fi
+        if test -f $root/Mmake.stage.browser.params
+        then
+            /bin/rm -f browser/Mmake.browser.params
+            cp $root/Mmake.stage.browser.params browser/Mmake.browser.params
+        fi
+        if test -f $root/Mmake.stage.deep.params
+        then
+            /bin/rm -f deep_profiler/Mmake.deep.params
+            cp $root/Mmake.stage.deep.params deep_profiler/Mmake.deep.params
+        fi
+        if test -f $root/Mmake.stage.library.params
+        then
+            /bin/rm -f library/Mmake.library.params
+            cp $root/Mmake.stage.library.params library/Mmake.library.params
+        fi
+        if test -f $root/Mmake.stage.runtime.params
+        then
+            /bin/rm -f runtime/Mmake.runtime.params
+            cp $root/Mmake.stage.runtime.params runtime/Mmake.runtime.params
+        fi
+        if test -f $root/Mmake.stage.trace.params
+        then
+            /bin/rm -f trace/Mmake.trace.params
+            cp $root/Mmake.stage.trace.params trace/Mmake.trace.params
+        fi
+        if test -f $root/Mercury.stage.options
+        then
+            /bin/rm -f Mercury.options
+            cp $root/Mercury.stage.options Mercury.options
+        fi
+        if test "$grade" != ""
+        then
+            echo "GRADE = $grade" >> Mmake.params
+        fi
+        echo 'GCC_SRC_DIR := ../$(GCC_SRC_DIR)' >> Mmake.params
+        cd $root
+
+        set -x
+
+        MMAKE_VPATH=.
+        export MMAKE_VPATH
+        MMAKE_DIR=$root/scripts
+        export MMAKE_DIR
+
+        # Use the new mmake to build stage 2
+        MMAKE=$MMAKE_DIR/mmake
+        mmake_opts="$mmake_opts $target_opt"
+
+        if (cd $stage2dir && $MMAKE $mmake_opts $jfactor runtime)
+        then
+            echo "building of stage 2 runtime successful"
+        else
+            echo "building of stage 2 runtime not successful"
+            exit 1
+        fi
+
+        if (cd $stage2dir && \
+            $MMAKE $mmake_opts dep_library dep_mdbcomp \
+            dep_browser dep_analysis dep_compiler dep_slice \
+            dep_profiler dep_deep_profiler)
+        then
+            echo "building of stage 2 dependencies successful"
+        else
+            echo "building of stage 2 dependencies not successful"
+            exit 1
+        fi
+
+        if (cd $stage2dir/library && \
+            $MMAKE $mmake_opts $jfactor mercury)
+        then
+            echo "building of stage 2 library successful"
+        else
+            echo "building of stage 2 library not successful"
+            exit 1
+        fi
+
+        if $test_split_library
+        then
+            if (cd $stage2dir/library && \
+                $MMAKE $mmake_opts $jfactor $STD_LIB_NAME.split.a)
+            then
+                echo "building of stage 2 split library successful"
+            else
+                echo "building of stage 2 split library not successful"
+                exit 1
+            fi
+
+            mv $stage2dir/library/$STD_LIB_NAME.split.a \
+                $stage2dir/library/$STD_LIB_NAME.a
+        fi
+
+        if (cd $stage2dir/mdbcomp && \
+            $MMAKE $mmake_opts $jfactor library)
+        then
+            echo "building of stage 2 mdbcomp successful"
+        else
+            echo "building of stage 2 mdbcomp not successful"
+            exit 1
+        fi
+
+        if (cd $stage2dir/browser && \
+            $MMAKE $mmake_opts $jfactor library)
+        then
+            echo "building of stage 2 browser successful"
+        else
+            echo "building of stage 2 browser not successful"
+            exit 1
+        fi
+
+        if (cd $stage2dir && $MMAKE $mmake_opts $jfactor trace)
+        then
+            echo "building of stage 2 trace successful"
+        else
+            echo "building of stage 2 trace not successful"
+            exit 1
+        fi
+
+        if $disable_debug_libs
+        then
+            /bin/rm $stage2dir/browser/lib$BROWSER_LIB_NAME.a
+            ar cr $stage2dir/browser/lib$BROWSER_LIB_NAME.a
+            /bin/rm $stage2dir/trace/lib$TRACE_LIB_NAME.a
+            ar cr $stage2dir/trace/lib$TRACE_LIB_NAME.a
+        fi
+
+        if (cd $stage2dir && $MMAKE $mmake_opts $jfactor analysis)
+        then
+            echo "building of stage 2 analysis successful"
+        else
+            echo "building of stage 2 analysis not successful"
+            exit 1
+        fi
+
+        if (cd $stage2dir/compiler && \
+            $MMAKE $mmake_opts $jfactor mercury_compile)
+        then
+            echo "building of stage 2 compiler successful"
+        else
+            echo "building of stage 2 compiler not successful"
+            exit 1
+        fi
+
+        if (cd $stage2dir && $MMAKE $mmake_opts MMAKEFLAGS=$jfactor all)
+        then
+            echo "building of stage 2 successful"
+        else
+            echo "building of stage 2 not successful"
+            exit 1
+        fi
+
+        if $compile_times
+        then
+            ls -lt $stage2dir/library/*.c
+            ls -lt $stage2dir/library/*.o
+            ls -lt $stage2dir/library/*.{a,so}
+            ls -lt $stage2dir/compiler/*.c
+            ls -lt $stage2dir/compiler/*.o
+            ls -lt $stage2dir/compiler/mercury_compile
+        fi
+    fi
+
+    # Build the check_namespace target in the relevant directories.
+    # We want to do so before we delete any of the stage 2 object files.
+
+    check_namespace_status=0
+    if $check_namespace
+    then
+        cd $root/$stage2dir/runtime
+        mmake $mmake_opts check_namespace || {
+            echo '** mmake check_namespace failed in runtime!'
+            check_namespace_status=1
+        }
+        cd $root/$stage2dir/trace
+        mmake $mmake_opts check_namespace || {
+            echo '** mmake check_namespace failed in trace!'
+            check_namespace_status=1
+        }
+        cd $root/$stage2dir/library
+        mmake $mmake_opts check_namespace || {
+            echo '** mmake check_namespace failed in library!'
+            check_namespace_status=1
+        }
+        cd $root/$stage2dir/mdbcomp
+        mmake $mmake_opts check_namespace || {
+            echo '** mmake check_namespace failed in mdbcomp!'
+            check_namespace_status=1
+        }
+        cd $root/$stage2dir/browser
+        mmake $mmake_opts check_namespace || {
+            echo '** mmake check_namespace failed in browser!'
+            check_namespace_status=1
+        }
+        cd $root
+    fi
+
+    if $stop_after_stage_2
+    then
+        echo "stopping after building stage 2"
+        exit 0
+    fi
+
+    # We can now remove the object files from most stage 2 directories,
+    # but we will keep the compiler objects for a while longer.
+    if $keep_objs
+    then
+        true
+    else
+        libdirs="library mdbcomp browser"
+        if $copy_profilers
+        then
+            profdirs="slice profiler deep_profiler"
+        else
+            profdirs=
+        fi
+        if $copy_runtime
+        then
+            rundirs="runtime trace"
+        else
+            rundirs=
+        fi
+
+        objdirs="$libdirs $profdirs $rundirs"
+        for rmdir in $objdirs
+        do
+            cd $root/$stage2dir/$rmdir
+            /bin/rm -f *.o *.pic_o
+        done
+
+        for cleandir in runtime trace library mdbcomp browser
+        do
+            cd $root/$stage2dir/$cleandir
+            mmake clean_check
+        done
+
+        cd $root
+    fi
+
+    MERCURY_COMPILER=$root/$stage2dir/compiler/mercury_compile
+    export MERCURY_COMPILER
+
+    test -d $stage3dir || mkdir $stage3dir
+    if $keep_stage_3
+    then
+        echo keeping existing stage3
+    else
+        # We try to do the removal of the stage 3 directory in parallel
+        # since recursive rm's across NFS can be quite slow ...
+        $RMSTAGECMD $root/$stage3dir/compiler < /dev/null &
+        $RMSTAGECMD $root/$stage3dir/library < /dev/null &
+        wait
+        $RMSTAGECMD $root/$stage3dir/* < /dev/null
+        /bin/rm -fr $root/$stage3dir/* < /dev/null
+        /bin/rm -fr $root/$stage3dir/.[a-zA-Z]* < /dev/null
+    fi
+
+    echo linking stage 3... 1>&2
+    set +x
+    cd $stage3dir
+    $LN_S $root/main.c .
+    mkdir compiler
+    cd compiler
+    # Break up the links into several chunks.
+    # This is needed to cope with small limits
+    # on the size of argument vectors.
+    $LN_S $root/compiler/[a-h]*.m .
+    $LN_S $root/compiler/[i-o]*.m .
+    $LN_S $root/compiler/[p-s]*.m .
+    $LN_S $root/compiler/[t-z]*.m .
+    $LN_S $root/compiler/*.pp .
+    $LN_S $root/compiler/notes .
+
+    cp $root/compiler/Mmake* $root/compiler/Mercury.options .
+    cp $root/compiler/*_FLAGS.in .
+    cd $root/$stage3dir
+    mkdir library
+    cd library
+    $LN_S $root/library/[a-l]*.m .
+    $LN_S $root/library/[m-z]*.m .
+    $LN_S $root/library/print_extra_inits .
+    $LN_S $root/library/library_strong_name.sn .
+    cp $root/library/Mmake* $root/library/Mercury.options .
+    cp $root/library/*_FLAGS.in .
+    cp $root/library/INTER_FLAGS .
+    $LN_S $root/library/$STD_LIB_NAME.init .
+    cd $root/$stage3dir
+    mkdir mdbcomp
+    cd mdbcomp
+    $LN_S $root/mdbcomp/*.m .
+    cp $root/mdbcomp/Mmake* $root/mdbcomp/Mercury.options .
+    cp $root/mdbcomp/*_FLAGS.in .
+    $LN_S $root/mdbcomp/$MDBCOMP_LIB_NAME.init .
+    cd $root/$stage3dir
+    mkdir browser
+    cd browser
+    $LN_S $root/browser/*.m .
+    cp $root/browser/Mmake* $root/browser/Mercury.options .
+    cp $root/browser/*_FLAGS.in .
+    $LN_S $root/browser/$BROWSER_LIB_NAME.init .
+    cd $root/$stage3dir
+    mkdir analysis
+    cd analysis
+    $LN_S $root/analysis/*.m .
+    cp $root/analysis/Mmake* $root/analysis/Mercury.options .
+    cp $root/analysis/*_FLAGS.in .
+    $LN_S $root/analysis/$ANALYSIS_LIB_NAME.init .
+    cd $root/$stage3dir
+    $LN_S $root/$stage2dir/boehm_gc .
+    $LN_S $root/$stage2dir/java .
+    $LN_S $root/$stage2dir/mps_gc .
+    $LN_S $root/bindist .
+    $LN_S $root/doc .
+    $LN_S $root/$stage2dir/runtime .
+    $LN_S $root/$stage2dir/trace .
+    $LN_S $root/$stage2dir/robdd .
+    $LN_S $root/scripts .
+    $LN_S $root/tools .
+    $LN_S $root/util .
+    $LN_S $root/$stage2dir/slice .
+    $LN_S $root/$stage2dir/profiler .
+    $LN_S $root/$stage2dir/deep_profiler .
+    $LN_S $root/conf* .
+    $LN_S $root/aclocal.m4 .
+    $LN_S $root/VERSION .
+    $LN_S $root/install-sh .
+    $LN_S $root/.*.in .
+    rm -f config*.log
+    cp $root/$stage2dir/Mmake* $root/$stage2dir/Mercury.options .
+    cd $root
+    set -x
+
+    MMAKE_VPATH=.
+    export MMAKE_VPATH
+    MMAKE_DIR=$root/scripts
+    export MMAKE_DIR
+
+    # Use the new mmake to build stage 3
+    MMAKE=$MMAKE_DIR/mmake
+
+    if test "$type_stats" != ""
+    then
+        # Start collecting statistics from stage 3 with a clean slate,
+        # while making sure that the existing stats are not lost.
+        # Note: we do not have to go to any great lengths to restore
+        # the old stats if bootcheck fails, since the save files
+        # can easily be recovered outside bootcheck.
+
+        cat "$type_stats" >> "$type_stats".save.$$
+        cp /dev/null "$type_stats"
+    fi
+
+    if (cd $stage3dir && $MMAKE $mmake_opts dep_library dep_mdbcomp \
+        dep_browser_all dep_analysis dep_compiler)
+    then
+        echo "building of stage 3 dependencies successful"
+    else
+        echo "building of stage 3 dependencies not successful"
+        exit 1
+    fi
+
+    if (cd $stage3dir/library &&
+        $MMAKE $mmake_opts $jfactor all-ints &&
+        $MMAKE $mmake_opts $jfactor ${target_ext}s)
+    then
+        echo "building of stage 3 library successful"
+    else
+        echo "building of stage 3 library initially not successful"
+        df .
+        # try again, in case the failure cause was transient
+        if (cd $stage3dir/library &&
+            $MMAKE $mmake_opts $jfactor all-ints &&
+            $MMAKE $mmake_opts $jfactor ${target_ext}s)
+        then
+            echo "building of stage 3 library successful"
+        else
+            echo "building of stage 3 library not successful"
+            exit 1
+        fi
+    fi
+
+    # We delay deleting the stage 2 compiler objects until now,
+    # so that if (a) an error manifests itself during the creation
+    # of the stage 3 library, and (b) this error can be fixed by
+    # changing the runtime, a bootcheck -2, which requires a relink,
+    # will not have to expensively recreate the stage 2 compiler objects.
+
+    if $keep_objs
+    then
+        true
+    else
+        find $root/$stage2dir/compiler -name "*.o" -print |
+        xargs /bin/rm -f
+    fi
+
+    if (cd $stage3dir/mdbcomp &&
+        $MMAKE $mmake_opts $jfactor all-ints &&
+        $MMAKE $mmake_opts $jfactor ${target_ext}s)
+    then
+        echo "building of stage 3 mdbcomp successful"
+    else
+        echo "building of stage 3 mdbcomp initially not successful"
+        df .
+        # try again, in case the failure cause was transient
+        if (cd $stage3dir/mdbcomp && \
+            $MMAKE $mmake_opts $jfactor ${target_ext}s)
+        then
+            echo "building of stage 3 mdbcomp successful"
+        else
+            echo "building of stage 3 mdbcomp not successful"
+            exit 1
+        fi
+    fi
+
+    if (cd $stage3dir/browser &&
+        $MMAKE $mmake_opts $jfactor all-ints &&
+        $MMAKE $mmake_opts $jfactor ${target_ext}s)
+    then
+        echo "building of stage 3 browser successful"
+    else
+        echo "building of stage 3 browser initially not successful"
+        df .
+        # try again, in case the failure cause was transient
+        if (cd $stage3dir/browser && \
+            $MMAKE $mmake_opts $jfactor ${target_ext}s)
+        then
+            echo "building of stage 3 browser successful"
+        else
+            echo "building of stage 3 browser not successful"
+            exit 1
+        fi
+    fi
+
+    if (cd $stage3dir/analysis &&
+        $MMAKE $mmake_opts $jfactor all-ints &&
+        $MMAKE $mmake_opts $jfactor ${target_ext}s)
+    then
+        echo "building of stage 3 analysis successful"
+    else
+        echo "building of stage 3 analysis initially not successful"
+        df .
+        # try again, in case the failure cause was transient
+        if (cd $stage3dir/analysis &&
+            $MMAKE $mmake_opts $jfactor all-ints &&
+            $MMAKE $mmake_opts $jfactor ${target_ext}s)
+        then
+            echo "building of stage 3 analysis successful"
+        else
+            echo "building of stage 3 analysis not successful"
+            exit 1
+        fi
+    fi
+
+    if (cd $stage3dir/compiler && \
+        $MMAKE $mmake_opts $jfactor ${target_ext}s)
+    then
+        echo "building of stage 3 compiler successful"
+    else
+        echo "building of stage 3 compiler initially not successful"
+        df .
+        # try again, in case the failure cause was transient
+        if (cd $stage3dir/compiler && \
+            $MMAKE $mmake_opts $jfactor ${target_ext}s)
+        then
+            echo "building of stage 3 compiler successful"
+        else
+            echo "building of stage 3 compiler not successful"
+            exit 1
+        fi
+    fi
+
+    if test "$type_stats" != ""
+    then
+        echo "Saving stage 3 stats in $type_stats.stage3.$$"
+        mv "$type_stats" "$type_stats".stage3.$$
+        cp /dev/null "$type_stats"
+    fi
+
+    diff_status=0
+
+    exec 3>&1       # save stdout in fd 3
+    if test -n "$outfile"
+    then
+        exec > "$outfile"   # redirect stdout to $outfile
+    fi
+
+    for dir in library mdbcomp browser analysis compiler; do
+        # `mmake cs' in the compiler directory doesn't build
+        # `top_level_init.c', so we only compare the `.c'
+        # files present in the stage 3 directory.
+        for file in $stage3dir/$dir/${target_subdir}*.${target_ext}; do
+            diff -u $stage2dir/$dir/${cs_subdir}`basename $file` $file \
+            || diff_status=1
+        done
+    done
+
+    exec >&3        # restore stdout from fd 3
+    if test $diff_status -ne 0
+    then
+        echo "** error - stage 2 and stage 3 differ!"
+    else
+        echo "stage 2 and stage 3 compare ok"
+        if test -d $stage3dir/library/ComplexityArgs
+        then
+            mv $stage3dir/library/ComplexityArgs \
+                $root/stage3_library_ComplexityArgs
+        fi
+        if test -d $stage3dir/library/ComplexityData
+        then
+            mv $stage3dir/library/ComplexityData \
+                $root/stage3_library_ComplexityData
+        fi
+        if test -d $stage3dir/compiler/ComplexityArgs
+        then
+            mv $stage3dir/compiler/ComplexityArgs \
+                $root/stage3_compiler_ComplexityArgs
+        fi
+        if test -d $stage3dir/compiler/ComplexityData
+        then
+            mv $stage3dir/compiler/ComplexityData \
+                $root/stage3_compiler_ComplexityData
+        fi
+
+        echo "removing stage 3..."
+        # We try to do the removal of the stage 3 directory in parallel
+        # since recursive rm's across NFS can be quite slow ...
+        $RMSTAGECMD $root/$stage3dir/compiler < /dev/null &
+        $RMSTAGECMD $root/$stage3dir/library < /dev/null &
+        wait
+        $RMSTAGECMD $root/$stage3dir/* < /dev/null
+        /bin/rm -fr $root/$stage3dir/* < /dev/null
+        /bin/rm -fr $root/$stage3dir/.[a-zA-Z]* < /dev/null
+
+        if $keep_objs
+        then
+            true
+        else
+        case "$grade" in
+            *debug*)
+                # These files take up a lot of disk
+                # space, so we compress them. This
+                # reduces the probability that running
+                # the tests will run out of disk space,
+                # while still allowing the original
+                # files to be reconstructed
+                # relatively quickly.
+                gzip $root/$stage2dir/library/*.c
+                gzip $root/$stage2dir/mdbcomp/*.c
+                gzip $root/$stage2dir/browser/*.c
+                gzip $root/$stage2dir/compiler/*.c
+                ;;
+        esac
+        fi
+    fi
 
-	echo "finishing stage 3 at `date`"
+    echo "finishing stage 3 at `date`"
 else
-	diff_status=0
-	check_namespace_status=0
-	echo "building of stages 1 and 2 skipped"
-
-	# Don't set MMAKE_USE_SUBDIRS and MMAKE_USE_MMC_MAKE until after
-	# we have finished making stage1, because $use_subdirs and $use_mmc_make
-	# come from options that are intended to affect only stages 2 and 3.
+    diff_status=0
+    check_namespace_status=0
+    echo "building of stages 1 and 2 skipped"
+
+    # Don't set MMAKE_USE_SUBDIRS and MMAKE_USE_MMC_MAKE until after
+    # we have finished making stage1, because $use_subdirs and $use_mmc_make
+    # come from options that are intended to affect only stages 2 and 3.
 
-	MMAKE_USE_SUBDIRS=$use_subdirs
-	export MMAKE_USE_SUBDIRS
+    MMAKE_USE_SUBDIRS=$use_subdirs
+    export MMAKE_USE_SUBDIRS
 
-	MMAKE_USE_MMC_MAKE=$use_mmc_make
-	export MMAKE_USE_MMC_MAKE
+    MMAKE_USE_MMC_MAKE=$use_mmc_make
+    export MMAKE_USE_MMC_MAKE
 fi
 
 #-----------------------------------------------------------------------------#
 
 if test "$runtests" = "true" -o "$extras" = "true"
 then
-	# Use everything from stage 2, unless the options say that the tests
-	# should be done in grade different from the grade of stage 2,
-	# in which case use everything from stage 1, trusting the user
-	# that the grade of the tests and the grade of stage 1 are compatible.
-
-	MERCURY_COMPILER=$root/$stage2dir/compiler/mercury_compile
-	export MERCURY_COMPILER
-
-	MERCURY_CONFIG_FILE=$root/scripts/Mercury.config
-	export MERCURY_CONFIG_FILE
-
-	if test "$test_grade" = "$grade"
-	then
-		stage2_insert="/$stage2dir"
-	else
-		stage2_insert=""
-	fi
-
-	WORKSPACE="$root${stage2_insert}"
-	export WORKSPACE
-
-	MMAKE_DIR="$root${stage2_insert}/scripts"
-	export MMAKE_DIR
-
-	# Set PATH for mkinit, mmc, mgnuc, ml etc
-	PATH=$root${stage2_insert}/util:$root${stage2_insert}/scripts:$PATH
-	export PATH
+    # Use everything from stage 2, unless the options say that the tests
+    # should be done in grade different from the grade of stage 2,
+    # in which case use everything from stage 1, trusting the user
+    # that the grade of the tests and the grade of stage 1 are compatible.
+
+    MERCURY_COMPILER=$root/$stage2dir/compiler/mercury_compile
+    export MERCURY_COMPILER
+
+    # now in FLAGS files
+    # MERCURY_CONFIG_FILE=$root/scripts/Mercury.config
+    # export MERCURY_CONFIG_FILE
+
+    if test "$test_grade" = "$grade"
+    then
+        stage2_insert="/$stage2dir"
+    else
+        stage2_insert=""
+    fi
+
+    WORKSPACE="$root${stage2_insert}"
+    export WORKSPACE
+
+    MMAKE_DIR="$root${stage2_insert}/scripts"
+    export MMAKE_DIR
+
+    # Set PATH for mkinit, mmc, mgnuc, ml etc
+    PATH=$root${stage2_insert}/util:$root${stage2_insert}/scripts:$PATH
+    export PATH
 fi
 
 #-----------------------------------------------------------------------------#
 
 # Run the tests in the tests/* directories
 
+if test -s $HOME/.bootcheck_diff_opts
+then
+    DIFF_OPTS=`cat $HOME/.bootcheck_diff_opts`
+    export DIFF_OPTS
+fi
+
 test_status=0
 if $runtests
 then
-	# We need to give tests/debugger access to the mdbrc and mdb_doc
-	# files in the doc and scripts directories, without hardcoding their
-	# pathnames. We must also compensate for scripts/mdbrc having hardcoded
-	# within it the *installed* pathname of mdb_doc and not its current
-	# pathname.
-	cat $root/doc/mdb_doc > $root/scripts/test_mdbrc
-	sed -e '/^source/d' $root/scripts/mdbrc >> $root/scripts/test_mdbrc
-	MERCURY_DEBUGGER_INIT=$root/scripts/test_mdbrc
-	export MERCURY_DEBUGGER_INIT
-
-	MERCURY_SUPPRESS_STACK_TRACE=yes
-	export MERCURY_SUPPRESS_STACK_TRACE
-
-	if test "$test_grade" != ""
-	then
-		test_grade_opt="GRADE=$test_grade"
-	else
-		test_grade_opt=""
-	fi
-
-	test_status=0
-	if test -d tests
-	then
-		tests_prefix=""
-	elif test -d ../tests
-	then
-		tests_prefix="../"
-	else
-		echo "cannot find test directory"
-		test_status=1
-	fi
-
-	if test "$test_status" = 0
-	then
-		if $test_params
-		then
-			cp $root/$stage2dir/Mmake.params ${tests_prefix}tests
-		else
-			/bin/rm ${tests_prefix}tests/Mmake.params > /dev/null 2>&1
-		fi
-
-		cp $root/doc/mdb_command_test.inp ${tests_prefix}tests/debugger
-
-		case $error_file_only in
-			true)
-				if test ! -f ${tests_prefix}tests/runtests.errs
-				then
-					echo "bootcheck: \`--failing-tests' specified but" 1>&2
-					echo \
-					"\`${tests_prefix}tests/runtests.errs' does not exist." \
-						1>&2
-					exit 1
-				fi
-
-				mv ${tests_prefix}tests/runtests.errs \
-					${tests_prefix}tests/runtests.$$
-				test_log_opt="ERROR_FILE=$root/${tests_prefix}tests/runtests.$$"
-				;;
-			false)
-				test_log_opt=""
-				;;
-		esac
-
-		case $failing_tests_only in
-			true)
-				test_log_opt="FAILING_TESTS_ONLY"
-				;;
-		esac
-
-		cd $root/${tests_prefix}tests
-		/bin/rm -fr PASSED_TC_DIR PASSED_TC_FILES > /dev/null 2>&1
-		/bin/rm -fr FAILED_TC_DIR FAILED_TC_FILES > /dev/null 2>&1
-		> FAILED_TESTS_SUMMARY
-
-		if test "$specified_tests_only" != ""
-		then
-			test_status=0
-			for specified_test in $specified_tests_only
-			do
-				specified_test_dir=`dirname $specified_test`
-				specified_test_base=`basename $specified_test`
-				if test -d "$root/${tests_prefix}/tests/$specified_test_dir"
-				then
-					cd $root/${tests_prefix}tests/$specified_test_dir
-					mmake $target_opt $jfactor $test_grade_opt \
-						SPECIFIED_TESTS="$specified_test_base" runtests
-					if test "$?" -ne "0"
-					then
-						test_status=$?
-					fi
-				else
-					test_status=1
-				fi
-			done
-		else
-			if test "$testdirs" = ""
-			then
-				mmake $target_opt $jfactor $test_grade_opt \
-					$test_log_opt runtests
-			else
-				for testdir in $testdirs
-				do
-					cd $root/${tests_prefix}tests/$testdir
-					mmake $target_opt $jfactor $test_grade_opt \
-						$test_log_opt runtests
-				done
-			fi
-			test_status=$?
-		fi
-
-		case $failing_tests_only in
-			true)	rm -f ${tests_prefix}tests/runtests.$$ ;;
-		esac
-
-		if test "$type_stats" != ""
-		then
-			echo "Saving test suite stats in $type_stats.test.$$"
-			mv "$type_stats" "$type_stats".test.$$
-		fi
+    # We need to give tests/debugger access to the mdbrc and mdb_doc
+    # files in the doc and scripts directories, without hardcoding their
+    # pathnames. We must also compensate for scripts/mdbrc having hardcoded
+    # within it the *installed* pathname of mdb_doc and not its current
+    # pathname.
+    cat $root/doc/mdb_doc > $root/scripts/test_mdbrc
+    sed -e '/^source/d' $root/scripts/mdbrc >> $root/scripts/test_mdbrc
+    MERCURY_DEBUGGER_INIT=$root/scripts/test_mdbrc
+    export MERCURY_DEBUGGER_INIT
+
+    MERCURY_SUPPRESS_STACK_TRACE=yes
+    export MERCURY_SUPPRESS_STACK_TRACE
+
+    if test "$test_grade" != ""
+    then
+        test_grade_opt="GRADE=$test_grade"
+    else
+        test_grade_opt=""
+    fi
+
+    test_status=0
+    if test -d tests
+    then
+        tests_prefix=""
+    elif test -d ../tests
+    then
+        tests_prefix="../"
+    else
+        echo "cannot find test directory"
+        test_status=1
+    fi
+
+    if test "$test_status" = 0
+    then
+        if $test_params
+        then
+            cp $root/$stage2dir/Mmake.params ${tests_prefix}tests
+        else
+            /bin/rm ${tests_prefix}tests/Mmake.params > /dev/null 2>&1
+        fi
+
+        cp $root/doc/mdb_command_test.inp ${tests_prefix}tests/debugger
+
+        sed -e "s:@WORKSPACE@:$WORKSPACE:" \
+            < ${tests_prefix}tests/WS_FLAGS.ws \
+            > ${tests_prefix}tests/WS_FLAGS
+
+        WORKSPACE_FLAGS=yes
+        export WORKSPACE_FLAGS
+
+        case $error_file_only in
+            true)
+                if test ! -f ${tests_prefix}tests/runtests.errs
+                then
+                    echo "bootcheck: \`--failing-tests' specified but" 1>&2
+                    echo \
+                    "\`${tests_prefix}tests/runtests.errs' does not exist." \
+                        1>&2
+                    exit 1
+                fi
+
+                mv ${tests_prefix}tests/runtests.errs \
+                    ${tests_prefix}tests/runtests.$$
+                test_log_opt="ERROR_FILE=$root/${tests_prefix}tests/runtests.$$"
+                ;;
+            false)
+                test_log_opt=""
+                ;;
+        esac
+
+        case $failing_tests_only in
+            true)
+                test_log_opt="FAILING_TESTS_ONLY"
+                ;;
+        esac
+
+        cd $root/${tests_prefix}tests
+        /bin/rm -fr PASSED_TC_DIR PASSED_TC_FILES > /dev/null 2>&1
+        /bin/rm -fr FAILED_TC_DIR FAILED_TC_FILES > /dev/null 2>&1
+        > FAILED_TESTS_SUMMARY
+
+        if test "$specified_tests_only" != ""
+        then
+            test_status=0
+            for specified_test in $specified_tests_only
+            do
+                specified_test_dir=`dirname $specified_test`
+                specified_test_base=`basename $specified_test`
+                if test -d "$root/${tests_prefix}/tests/$specified_test_dir"
+                then
+                    cd $root/${tests_prefix}tests/$specified_test_dir
+                    mmake $target_opt $jfactor $test_grade_opt \
+                        SPECIFIED_TESTS="$specified_test_base" runtests
+                    if test "$?" -ne "0"
+                    then
+                        test_status=$?
+                    fi
+                else
+                    test_status=1
+                fi
+            done
+        else
+            if test "$testdirs" = ""
+            then
+                mmake $target_opt $jfactor $test_grade_opt \
+                    $test_log_opt runtests
+            else
+                for testdir in $testdirs
+                do
+                    cd $root/${tests_prefix}tests/$testdir
+                    mmake $target_opt $jfactor $test_grade_opt \
+                        $test_log_opt runtests
+                done
+            fi
+            test_status=$?
+        fi
+
+        case $failing_tests_only in
+            true)   rm -f ${tests_prefix}tests/runtests.$$ ;;
+        esac
+
+        if test "$type_stats" != ""
+        then
+            echo "Saving test suite stats in $type_stats.test.$$"
+            mv "$type_stats" "$type_stats".test.$$
+        fi
 
-		cd $root
-	fi
+        cd $root
+    fi
 fi
 
 #-----------------------------------------------------------------------------#
@@ -1503,95 +1533,95 @@
 extras_status=0
 if $extras
 then
-	cd $root/extras
-	if test -f Mmake.params
-	then
-		mv Mmake.params Mmake.params.$$
-	fi
-
-	if test -f $root/Mmake.stage.params
-	then
-		cp $root/Mmake.stage.params Mmake.params
-	elif test -f $root/Mmake.params
-	then
-		cp $root/Mmake.params Mmake.params
-	else
-		cp /dev/null Mmake.params
-	fi
-
-	if test "$test_grade" != ""
-	then
-		echo "GRADE = $test_grade" >> Mmake.params
-	elif test "$grade" != ""
-	then
-		echo "GRADE = $grade" >> Mmake.params
-	fi
-
-	for testdir in *
-	do
-		if test -f $testdir/Mmakefile -a ! -f $testdir/NOBOOTTEST
-		then
-			(cd $testdir;
-			mmake realclean $jfactor;
-			mmake depend    $jfactor &&
-			mmake           $jfactor &&
-			mmake check     $jfactor &&
-			mmake realclean $jfactor ) ||
-			extras_status=1
-		fi
-	done
-
-	if test -f Mmake.params.$$
-	then
-		mv Mmake.params.$$ Mmake.params
-	else
-		/bin/rm Mmake.params
-	fi
+    cd $root/extras
+    if test -f Mmake.params
+    then
+        mv Mmake.params Mmake.params.$$
+    fi
+
+    if test -f $root/Mmake.stage.params
+    then
+        cp $root/Mmake.stage.params Mmake.params
+    elif test -f $root/Mmake.params
+    then
+        cp $root/Mmake.params Mmake.params
+    else
+        cp /dev/null Mmake.params
+    fi
+
+    if test "$test_grade" != ""
+    then
+        echo "GRADE = $test_grade" >> Mmake.params
+    elif test "$grade" != ""
+    then
+        echo "GRADE = $grade" >> Mmake.params
+    fi
+
+    for testdir in *
+    do
+        if test -f $testdir/Mmakefile -a ! -f $testdir/NOBOOTTEST
+        then
+            (cd $testdir;
+            mmake realclean $jfactor;
+            mmake depend    $jfactor &&
+            mmake           $jfactor &&
+            mmake check     $jfactor &&
+            mmake realclean $jfactor ) ||
+            extras_status=1
+        fi
+    done
+
+    if test -f Mmake.params.$$
+    then
+        mv Mmake.params.$$ Mmake.params
+    else
+        /bin/rm Mmake.params
+    fi
 
-	cd $root
+    cd $root
 fi
 
 if $delete_deep_data
 then
-	(cd $root; find stage2 tests -name Deep.data -print | xargs /bin/rm -f)
+    (cd $root; find stage2 tests -name Deep.data -print | xargs /bin/rm -f)
 fi
 
 #-----------------------------------------------------------------------------#
 
 if test "$type_stats" != ""
 then
-	mv "$type_stats".save.$$ "$type_stats"
+    mv "$type_stats".save.$$ "$type_stats"
 fi
 
 exitstatus=0
 
 if test "$diff_status" != 0
 then
-	echo "error exit: stages 2 and 3 differ"
-	exitstatus=1
+    echo "error exit: stages 2 and 3 differ"
+    exitstatus=1
 fi
 
 if test "$test_status" != 0
 then
-	echo "error exit: some tests failed"
-	exitstatus=1
+    echo "error exit: some tests failed"
+    exitstatus=1
 fi
 
 if test "$extras_status" != 0
 then
-	echo "error exit: some tests failed in extras"
-	exitstatus=1
+    echo "error exit: some tests failed in extras"
+    exitstatus=1
 fi
 
 if test "$check_namespace_status" != 0
 then
-	echo "error exit: some namespace isn't clean"
-	exitstatus=1
+    echo "error exit: some namespace isn't clean"
+    exitstatus=1
 fi
 
 if test -s $root/${tests_prefix}tests/FAILED_TESTS_SUMMARY
 then
-	cat $root/${tests_prefix}tests/FAILED_TESTS_SUMMARY
+    cat $root/${tests_prefix}tests/FAILED_TESTS_SUMMARY
 fi
 
 echo "finishing at `date`"
cvs diff: Diffing trace
cvs diff: Diffing util
cvs diff: Diffing vim
cvs diff: Diffing vim/after
cvs diff: Diffing vim/ftplugin
cvs diff: Diffing vim/syntax
--------------------------------------------------------------------------
mercury-reviews mailing list
post:  mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the reviews mailing list