[m-rev.] for review: simplify library/compiler Mmakefiles

Simon Taylor stayl at cs.mu.OZ.AU
Thu Apr 25 18:54:37 AEST 2002


Estimated hours taken: 8
Branches: main

Factor out the common Mmake code to set up the mmc, mgnuc
and ml flags when building the Mercury compiler and libraries.
Use options, not environment variables. This will make it simpler
to use `mmc --make' to compile the compiler.

Mmake.workspace:
	Similar to tools/lmc. Sets up Mmake variables to
	use the library files in a workspace rather than
	an installed library.

Mmake.common.in:
*/Mmakefile:
	Move common code into Mmake.workspace.

browser/Mmakefile:
library/Mmakefile:
	Avoid invoking the linker explicitly when creating
	libraries of Mercury code. That won't work well
	with `mmc --make'.

tools/bootcheck:
tests/Mmake.common:
	Use Mmake.workspace instead of setting up environment
	variables in bootcheck.

scripts/Mmake.vars.in:
	mmc compiles split C files to object code itself,
	so pass `--cflags "$(ALL_CFLAGS)"' to mmc when
	compiling with `--split-c-files'.

browser/interactive_query.m:
	Use `mmc --make' when compiling the query. This is needed
	to make tests/debugger/interactive_query.m work when linking
	against a workspace using options rather than environment
	variables.  This also fixes a bug -- mmc options were being
	passed to ml.

	Clean up after the query.

tests/debugger/Mmakefile:
tests/debugger/interactive.inp:
tests/debugger/interactive.inp.subdirs:
tests/debugger/interactive.inp.nosubdirs:
tests/debugger/interactive.exp:
tests/debugger/interactive.exp2:
	Generate the input file to this test so that MCFLAGS
	and MC_MAKE_FLAGS (from Mmake.workspace) are used when
	compiling queries.

	tests/debugger/Mmakefile now sets SHELL to /usr/local/bash
	to allow the use of $(...) style command substitution
	(`...` style command substitution can't be nested).

tests/warnings/Mmakefile:
tests/dppd/Mmakefile:
	Include tests/Mmake.common.

tools/*:
scripts/c2init.in:
scripts/ml.in:
	Update the lists of files containing the library names.


Index: Mmake.common.in
===================================================================
RCS file: /home/mercury1/repository/mercury/Mmake.common.in,v
retrieving revision 1.61
diff -u -u -r1.61 Mmake.common.in
--- Mmake.common.in	20 Mar 2002 12:35:03 -0000	1.61
+++ Mmake.common.in	24 Apr 2002 06:19:29 -0000
@@ -19,13 +19,16 @@
 
 include $(MERCURY_DIR)/VERSION
 
+WORKSPACE=$(MERCURY_DIR)
+include $(MERCURY_DIR)/Mmake.workspace
+
 #-----------------------------------------------------------------------------#
 
-# Specify the Mercury compiler to use for bootstrapping
-MC			= @BOOTSTRAP_MC@
+# Specify the Mercury compiler to use for bootstrapping.
+MC		= @BOOTSTRAP_MC@
 
-# Specify the compilation model to use for compiling the compiler
-GRADE			= @GRADE@
+# Specify the compilation model to use for compiling the compiler.
+GRADE		= @GRADE@
 
 # Specify EXT_FOR_EXE is `.exe' on MS-Windows and empty elsewhere.
 EXT_FOR_EXE	= @EXT_FOR_EXE@
@@ -36,7 +39,7 @@
 # or as `a' if it doesn't.
 EXT_FOR_SHARED_LIB	= @EXT_FOR_SHARED_LIB@
 
-# Specify USE_DLLs as `yes' if the OS supports Windows-style DLLs
+# Specify USE_DLLs as `yes' if the OS supports Windows-style DLLs.
 USE_DLLS		= @USE_DLLS@
 
 # Specify any special flags to pass to the C compiler when creating objects
@@ -113,15 +116,6 @@
 INSTALL_MERC_GC_LIB_DIR	= $(INSTALL_MERC_GRADELESS_LIB_DIR)
 FINAL_INSTALL_MERC_GC_LIB_DIR = $(FINAL_INSTALL_MERC_GRADELESS_LIB_DIR)
 
-SCRIPTS_DIR = $(MERCURY_DIR)/scripts
-RUNTIME_DIR = $(MERCURY_DIR)/runtime
-LIBRARY_DIR = $(MERCURY_DIR)/library
-TRACE_DIR = $(MERCURY_DIR)/trace
-BROWSER_DIR = $(MERCURY_DIR)/browser
-BOEHM_GC_DIR = $(MERCURY_DIR)/boehm_gc
-COMPILER_DIR = $(MERCURY_DIR)/compiler
-UTIL_DIR = $(MERCURY_DIR)/util
-
 # By default, GRADESTRING is defined as the result of invoking
 # `mmc --output-grade-string' with $(GRADE) and $(GRADEFLAGS).
 # But when installing the standard library, the compiler will not yet
@@ -133,22 +127,8 @@
 # compiler itself should be done by setting GRADE, not GRADEFLAGS.
 GRADESTRING		= $(GRADE)
 
-# The names of the various libraries.
-# The archives and shared object objects have a "lib" prefix and a ".a" or
-# ".so" (or ".dll") suffix around these names; the initialization files
-# have just a ".init" suffix. (The trace library does not have a .init file,
-# since it contains no Mercury code.)
-#
-# If you change these, you will also need to change scripts/ml.in,
-# scripts/c2init.in, tools/bootcheck, tools/binary, tools/binary_step
-# and tools/linear.
-RT_LIB_NAME = mer_rt
-STD_LIB_NAME = mer_std
-TRACE_LIB_NAME = mer_trace
-BROWSER_LIB_NAME = mer_browser
-
 # Options to pass to the Mercury compiler
-MCFLAGS	= --no-infer-all --halt-at-warn --no-warn-inferred-erroneous
+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
Index: Mmake.workspace
===================================================================
RCS file: Mmake.workspace
diff -N Mmake.workspace
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ Mmake.workspace	24 Apr 2002 15:11:56 -0000
@@ -0,0 +1,156 @@
+#-----------------------------------------------------------------------------#
+# Copyright (C) 2002 The University of Melbourne. 
+# This file may only be copied under the terms of the GNU General
+# Public Licence - see the file COPYING in the Mercury distribution.
+#-----------------------------------------------------------------------------#
+# Mmake.workspace - build a program or library using the current workspace,
+# not an installed library.
+#
+# The variable WORKSPACE must be set externally.
+# 
+# If the variable LINK_STATIC is set to `yes', the names of the `.a' files
+# for the Mercury libraries will be included in MLLIBS, otherwise
+# `-l' options will be included.
+#
+# Setting LINK_BOEHM_GC_ONLY to `yes' causes only the boehm_gc directory
+# to be included in MLFLAGS, MLLIBS and CFLAGS.
+
+# Setting LINK_RUNTIME_ONLY to `yes' causes only the boehm_gc and runtime
+# directories to be included in MLFLAGS, MLLIBS and CFLAGS.
+
+# Setting LINK_STDLIB_ONLY to `yes' causes only the boehm_gc, runtime
+# and library directories to be included in MLFLAGS, MLLIBS and CFLAGS.
+
+#-----------------------------------------------------------------------------#
+LINK_STATIC ?= no
+LINK_BOEHM_GC_ONLY ?= no
+LINK_RUNTIME_ONLY ?= no
+LINK_STDLIB_ONLY ?= no
+
+SCRIPTS_DIR = $(WORKSPACE)/scripts
+RUNTIME_DIR = $(WORKSPACE)/runtime
+LIBRARY_DIR = $(WORKSPACE)/library
+TRACE_DIR = $(WORKSPACE)/trace
+BROWSER_DIR = $(WORKSPACE)/browser
+BOEHM_GC_DIR = $(WORKSPACE)/boehm_gc
+COMPILER_DIR = $(WORKSPACE)/compiler
+UTIL_DIR = $(WORKSPACE)/util
+
+# The names of the various libraries.
+# The archives and shared object objects have a "lib" prefix and a ".a" or
+# ".so" (or ".dll") suffix around these names; the initialization files
+# have just a ".init" suffix. (The trace library does not have a .init file,
+# since it contains no Mercury code.)
+#
+# If you change these, you will also need to change scripts/ml.in,
+# scripts/c2init.in, tools/bootcheck, tools/binary, tools/binary_step
+# and tools/linear.
+RT_LIB_NAME = mer_rt
+STD_LIB_NAME = mer_std
+TRACE_LIB_NAME = mer_trace
+BROWSER_LIB_NAME = mer_browser
+
+MC =		$(SCRIPTS_DIR)/mmc
+MGNUC =		$(SCRIPTS_DIR)/mgnuc
+ML =		$(SCRIPTS_DIR)/ml
+C2INIT =	MERCURY_MKINIT=$(UTIL_DIR)/mkinit $(SCRIPTS_DIR)/c2init
+MTAGS =		$(SCRIPTS_DIR)/mtags
+MTAGSFLAGS +=	$(EXTRA_MTAGSFLAGS)
+
+VPATH =		$(LIBRARY_DIR)
+
+MCFLAGS += 	--no-mercury-stdlib-dir -I$(LIBRARY_DIR)
+MGNUCFLAGS +=	--no-mercury-stdlib-dir
+C2INITFLAGS += 	--trace-init-file $(BROWSER_DIR)/$(BROWSER_LIB_NAME).init
+C2INITARGS +=	$(LIBRARY_DIR)/$(STD_LIB_NAME).init \
+		$(RUNTIME_DIR)/$(RT_LIB_NAME).init
+MLFLAGS +=	--no-mercury-stdlib-dir
+
+#
+# MC_MAKE_FLAGS contains flags to be used by `mmc --make'.
+# This will also include flags to pass to ml.
+#
+MC_MAKE_FLAGS += --trace-init-file $(BROWSER_DIR)/$(BROWSER_LIB_NAME).init \
+		--init-file $(LIBRARY_DIR)/$(STD_LIB_NAME).init \
+		--init-file $(RUNTIME_DIR)/$(RT_LIB_NAME).init
+
+#
+# Work out the C include directories.
+#
+C_INCL_DIRS =	-I$(BOEHM_GC_DIR) -I$(BOEHM_GC_DIR)/include
+ifneq ($(LINK_BOEHM_GC_ONLY),yes)
+C_INCL_DIRS +=	-I$(RUNTIME_DIR)
+ifneq ($(LINK_RUNTIME_ONLY),yes)
+C_INCL_DIRS +=	-I$(LIBRARY_DIR)
+ifneq ($(LINK_STDLIB_ONLY),yes)
+C_INCL_DIRS +=	-I$(BROWSER_DIR) -I$(TRACE_DIR)
+endif
+endif
+endif
+CFLAGS +=	$(C_INCL_DIRS)
+MC_MAKE_FLAGS += $(patsubst -I%,--c-include-directory %,$(C_INCL_DIRS))
+
+#
+# Work out which libraries to link with.
+#
+STATIC_GC_LIBS =						\
+	`							\
+	    case $(GRADE) in					\
+		*.par*.gc*.prof*) echo $(BOEHM_GC_DIR)/libpar_gc_prof.$A ;; \
+		*.par*.gc*)	echo $(BOEHM_GC_DIR)/libpar_gc.$A ;; \
+		*.gc*.prof*)	echo $(BOEHM_GC_DIR)/libgc_prof.$A ;; \
+		*.gc*)		echo $(BOEHM_GC_DIR)/libgc.$A ;; \
+	    esac						\
+	`
+SHARED_GC_LIBS =						\
+	`							\
+	    case $(GRADE) in					\
+		*.par*.gc*.prof*) echo -lpar_gc_prof ;;		\
+		*.par*.gc*)	echo -libpar_gc ;;		\
+		*.gc*.prof*)	echo -lgc_prof ;;		\
+		*.gc*)		echo -lgc ;;			\
+	    esac						\
+	`
+
+ifeq ($(LINK_STATIC),yes)
+
+STATIC_LIBS := $(STATIC_GC_LIBS)
+ifneq ($(LINK_BOEHM_GC_ONLY),yes)
+STATIC_LIBS := $(RUNTIME_DIR)/lib$(RT_LIB_NAME).$A $(STATIC_LIBS)
+ifneq ($(LINK_RUNTIME_ONLY),yes)
+STATIC_LIBS := $(LIBRARY_DIR)/lib$(STD_LIB_NAME).$A $(STATIC_LIBS)
+ifneq ($(LINK_STDLIB_ONLY),yes)
+STATIC_LIBS := $(TRACE_DIR)/lib$(TRACE_LIB_NAME).$A \
+		$(BROWSER_DIR)/lib$(BROWSER_LIB_NAME).$A $(STATIC_LIBS)
+endif
+endif
+endif
+
+MLLIBS +=	$(STATIC_LIBS)
+MC_MAKE_FLAGS += $(patsubst %,--link-object %,$(STATIC_LIBS))
+
+else # LINK_STATIC != yes
+
+NON_STATIC_LIBS := $(SHARED_GC_LIBS)
+NON_STATIC_LIB_DIRS := -L$(BOEHM_GC_DIR) -R$(BOEHM_GC_DIR)
+ifneq ($(LINK_BOEHM_GC_ONLY),yes)
+NON_STATIC_LIBS := -l$(RT_LIB_NAME) $(NON_STATIC_LIBS)
+NON_STATIC_LIB_DIRS := -L$(RUNTIME_DIR) -R$(RUNTIME_DIR) $(NON_STATIC_LIB_DIRS)
+ifneq ($(LINK_RUNTIME_ONLY),yes)
+NON_STATIC_LIBS := -l$(STD_LIB_NAME) $(NON_STATIC_LIBS)
+NON_STATIC_LIB_DIRS := -L$(LIBRARY_DIR) -R$(LIBRARY_DIR) $(NON_STATIC_LIB_DIRS)
+ifneq ($(LINK_STDLIB_ONLY),yes)
+NON_STATIC_LIBS := -l$(TRACE_LIB_NAME) -l$(BROWSER_LIB_NAME) $(NON_STATIC_LIBS)
+NON_STATIC_LIB_DIRS := -L$(TRACE_DIR) -R$(TRACE_DIR) -L$(BROWSER_DIR) \
+			-R$(BROWSER_DIR) $(NON_STATIC_LIB_DIRS)
+endif
+endif
+endif
+
+MLFLAGS +=	$(NON_STATIC_LIB_DIRS)
+MLLIBS +=	$(NON_STATIC_LIBS)
+MC_MAKE_FLAGS += $(patsubst -R%,--link-flags -R%,$(NON_STATIC_LIB_DIRS)) \
+			$(NON_STATIC_LIBS)
+
+endif # LINK_STATIC != yes
+
Index: boehm_gc/Makefile
===================================================================
RCS file: /home/mercury1/repository/mercury/boehm_gc/Makefile,v
retrieving revision 1.50
diff -u -u -r1.50 Makefile
--- boehm_gc/Makefile	5 Sep 2001 16:52:46 -0000	1.50
+++ boehm_gc/Makefile	22 Apr 2002 05:41:54 -0000
@@ -19,6 +19,7 @@
 #-----------------------------------------------------------------------------#
 
 MERCURY_DIR=..
+LINK_BOEHM_GC_ONLY=yes
 include ../Mmake.common
 
 # Primary targets:
Index: boehm_gc/Mmakefile
===================================================================
RCS file: /home/mercury1/repository/mercury/boehm_gc/Mmakefile,v
retrieving revision 1.18
diff -u -u -r1.18 Mmakefile
--- boehm_gc/Mmakefile	17 Apr 2001 06:01:28 -0000	1.18
+++ boehm_gc/Mmakefile	22 Apr 2002 05:26:13 -0000
@@ -13,6 +13,7 @@
 MAIN_TARGET=lib$(GC_GRADE)
 
 MERCURY_DIR=..
+LINK_BOEHM_GC_ONLY=yes
 include $(MERCURY_DIR)/Mmake.common
 
 #-----------------------------------------------------------------------------#
Index: browser/Mmakefile
===================================================================
RCS file: /home/mercury1/repository/mercury/browser/Mmakefile,v
retrieving revision 1.18
diff -u -u -r1.18 Mmakefile
--- browser/Mmakefile	9 Mar 2002 07:17:09 -0000	1.18
+++ browser/Mmakefile	22 Apr 2002 06:15:04 -0000
@@ -16,46 +16,22 @@
 # compile the modules in this directory in debug grades as well.
 
 MERCURY_DIR=..
+LINK_STDLIB_ONLY=yes
 include $(MERCURY_DIR)/Mmake.common
 
 MAIN_TARGET=library
 
-VPATH=$(LIBRARY_DIR)
-
 #-----------------------------------------------------------------------------#
 
 # Specify which compilers to use to compile the library.
 # Don't change these without good reason - if you want to
 # do a temporary change, change ../Mmake.params.
 
-M_ENV	=	MERCURY_INT_DIR=$(LIBRARY_DIR) \
-		MERCURY_ALL_C_INCL_DIRS="\
-			-I$(TRACE_DIR) \
-			-I$(LIBRARY_DIR) \
-			-I$(RUNTIME_DIR) \
-			-I$(BOEHM_GC_DIR) \
-			-I$(BOEHM_GC_DIR)/include \
-		"
-
-MCD	=	$(M_ENV) $(MC) --generate-dependencies
-MCI	=	$(M_ENV) $(MC) --make-interface
-MCPI	=	$(M_ENV) $(MC) --make-private-interface
-MCSI	=	$(M_ENV) $(MC) --make-short-interface
-MCOI	=	$(M_ENV) $(MC) --make-opt-int
-MCTOI	=	$(M_ENV) $(MC) --make-trans-opt
-MCG	=	$(M_ENV) $(MC) --compile-to-c
-MCS	=	$(M_ENV) $(MC) --split-c-files -c --cflags "$(ALL_CFLAGS)"
-MGNUC	=	$(M_ENV) $(SCRIPTS_DIR)/mgnuc
-MGNUCFLAGS =	$(DLL_CFLAGS)
-LDFLAGS	=	-L$(LIBRARY_DIR) -L$(RUNTIME_DIR) -L$(BOEHM_GC_DIR)
-LDLIBS	=	-l$(STD_LIB_NAME) -l$(RT_LIB_NAME) \
-		` case "$(GRADE)" in 					\
-		    *.par*.gc*.prof*)	echo "-lpar_gc_prof" ;;		\
-		    *.par*.gc*)		echo "-lpar_gc" ;;		\
-		    *.gc*.prof*)	echo "-lgc_prof" ;;		\
-		    *.gc*)		echo "-lgc" ;;			\
-		  esac							\
-		`
+CFLAGS	+=	$(DLL_CFLAGS) -I$(TRACE_DIR)
+MLFLAGS +=	-R$(FINAL_INSTALL_MERC_LIB_DIR)	\
+		-R$(FINAL_INSTALL_MERC_GC_LIB_DIR)
+MLLIBS +=	$(SOCKET_LIBRARY) $(NSL_LIBRARY) $(DL_LIBRARY)	\
+		$(READLINE_LIBRARIES)
 
 # XXX Smart recompilation currently doesn't work when the module
 # name doesn't match the file name, so disable warnings about it
@@ -68,6 +44,8 @@
 
 MTAGS	=	$(SCRIPTS_DIR)/mtags
 
+LN	=	ln
+
 #-----------------------------------------------------------------------------#
 
 # Stuff for Windows DLLS using gnu-win32
@@ -135,25 +113,13 @@
 library: lib$(BROWSER_LIB_NAME).$A lib$(BROWSER_LIB_NAME).$(EXT_FOR_SHARED_LIB)
 library: $(BROWSER_LIB_NAME).init
 
-lib$(BROWSER_LIB_NAME)$(DLL_DEF_LIB).$A : $(mdb.os)
+lib$(BROWSER_LIB_NAME)$(DLL_DEF_LIB).$A : libmdb.$A
 	rm -f lib$(BROWSER_LIB_NAME)$(DLL_DEF_LIB).$A
-	$(AR) $(ALL_ARFLAGS) \
-		$(AR_LIBFILE_OPT)lib$(BROWSER_LIB_NAME)$(DLL_DEF_LIB).$A \
-		$(mdb.os)
-	$(RANLIB) lib$(BROWSER_LIB_NAME)$(DLL_DEF_LIB).$A
-
-RPATH_1=$(SHLIB_RPATH_OPT)$(FINAL_INSTALL_MERC_LIB_DIR)
-RPATH_2=$(SHLIB_RPATH_SEP)$(FINAL_INSTALL_MERC_GC_LIB_DIR)
-
-lib$(BROWSER_LIB_NAME).so : $(mdb.pic_os)
-	$(LINK_SHARED_OBJ) $(ERROR_UNDEFINED)				\
-		-o lib$(BROWSER_LIB_NAME).so				\
-		$(mdb.pic_os)						\
-		$(RPATH_1)$(RPATH_2)					\
-		$(LDFLAGS) $(LDLIBS)					\
-		$(SOCKET_LIBRARY) $(NSL_LIBRARY) $(DL_LIBRARY)		\
-		$(READLINE_LIBRARIES)					\
-		$(SHARED_LIBS)
+	$(LN) libmdb.$A lib$(BROWSER_LIB_NAME)$(DLL_DEF_LIB).$A
+
+lib$(BROWSER_LIB_NAME).so : libmdb.so
+	rm -f lib$(BROWSER_LIB_NAME)$(DLL_DEF_LIB).so
+	$(LN) libmdb.so lib$(BROWSER_LIB_NAME)$(DLL_DEF_LIB).so
 
 $(BROWSER_LIB_NAME).init: $(deps_subdir)mdb.dep mdb.init
 	cp mdb.init $(BROWSER_LIB_NAME).init
Index: browser/interactive_query.m
===================================================================
RCS file: /home/mercury1/repository/mercury/browser/interactive_query.m,v
retrieving revision 1.13
diff -u -u -r1.13 interactive_query.m
--- browser/interactive_query.m	13 Mar 2002 12:25:31 -0000	1.13
+++ browser/interactive_query.m	24 Apr 2002 08:05:10 -0000
@@ -177,6 +177,7 @@
 		else
 			{ true }
 		),
+		cleanup_query(Options),
 		io__set_environment_var("MERCURY_OPTIONS", MERCURY_OPTIONS)
 	else
 		print("Unable to unset MERCURY_OPTIONS environment variable")
@@ -411,50 +412,37 @@
 	%		for inferring the type etc. of query/N
 	%	-O0 --no-c-optimize
 	%		to improve compilation speed
+	%	--no-verbose-make
+	%		don't show which files are being made
+	%	--output-compile-error-lines 10000
+	%		output all errors
 	%	--no-warn-det-decls-too-lax
 	%	--no-warn-simple-code
 	%		to avoid spurious warnings in the automatically
 	%		generated parts of the query predicate
+	%	--link-flags --allow-undefined
+	%		needed to allow the query to reference
+	%		symbols defined in the program
 	%
 	{ string__append_list([
 		"mmc --grade ", grade_option, " ",
-		"--infer-all ",
+		"--infer-all --no-verbose-make ",
 		"--pic-reg ", "-O0 --no-c-optimize ",
 		"--no-warn-simple-code --no-warn-det-decls-too-lax ",
-		"-c ", Options,
-		" query.m"], Command) },
-	invoke_system_command(Command, Succeeded0),
-	( { Succeeded0 = yes } ->
-		% Figure out the location of the object file,
-		% which will depend on whether --use-subdirs was specified.
-		% XXX This code doesn't properly handle the case when the
-		% option is later overridden, e.g. if the options are
-		% `--use-subdirs --no-use-subdirs'.  But that case
-		% is not very likely to occur in practice...
-		{ string__sub_string_search(Options, "--use-subdirs", _) ->
-			QueryObject = "Mercury/os/query.o"
-		;
-			QueryObject = "query.o"
-		},
-			
-		% We use the following options:
-		%	--make-shared-lib
-		%		needed so we can dynamically load in the
-		%		code
-		%	--allow-undefined
-		%		needed to allow the query to reference
-		%		symbols defined in the program
-		%	--trace
-		{ string__append_list([
-			"ml --grade ", grade_option,
-			" --trace",
-			" --allow-undefined",
-			" --make-shared-lib ", Options,
-			" -o libquery.so ", QueryObject], Command2) },
-		invoke_system_command(Command2, Succeeded)
-	;
-		{ Succeeded = no }
-	).
+		"--output-compile-error-lines 10000 ",
+		"--link-flags --allow-undefined ", Options,
+		" --make libquery.so"], Command) },
+	invoke_system_command(Command, Succeeded).
+
+:- pred cleanup_query(options, state, state).
+:- mode cleanup_query(in, di, uo) is det.
+
+cleanup_query(Options) -->
+	invoke_system_command(
+		string__append_list(["mmc --grade ", grade_option, " ",
+			Options, " --make query.realclean"]),
+		_),
+	io__remove_file("query.m", _).
 
 :- func grade_option = string.
 %
Index: compiler/Mmakefile
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/Mmakefile,v
retrieving revision 1.54
diff -u -u -r1.54 Mmakefile
--- compiler/Mmakefile	21 Mar 2002 10:48:36 -0000	1.54
+++ compiler/Mmakefile	22 Apr 2002 08:04:08 -0000
@@ -7,6 +7,7 @@
 # Mmake - this is Mmake file for building the Mercury compiler 
 
 MERCURY_DIR=..
+LINK_STATIC=yes
 include $(MERCURY_DIR)/Mmake.common
 
 MAIN_TARGET=mercury
@@ -30,52 +31,10 @@
 GCC_BACKEND_LIBS =
 endif
 
-# Specify which compilers to use to compile the compiler.
-# Don't change these without good reason - if you want to
-# do a temporary change, change ../Mmake.params
-
-M_ENV	=	MERCURY_INT_DIR=$(LIBRARY_DIR) \
-		MERCURY_ALL_C_INCL_DIRS="\
-			-I$(BROWSER_DIR) \
-			-I$(TRACE_DIR) \
-			-I$(LIBRARY_DIR) \
-			-I$(RUNTIME_DIR) \
-			-I$(BOEHM_GC_DIR) \
-			-I$(BOEHM_GC_DIR)/include \
-		"
-SMC	=	$(MC) --search-directory $(BROWSER_DIR)
-MCD	=	$(M_ENV) $(SMC) --generate-dependencies
-MCI	=	$(M_ENV) $(SMC) --make-interface
-MCPI	=	$(M_ENV) $(SMC) --make-private-interface
-MCSI	=	$(M_ENV) $(SMC) --make-short-interface
-MCOI	=	$(M_ENV) $(SMC) --make-optimization-interface
-MCTOI	=	$(M_ENV) $(SMC) --make-transitive-optimization-interface
-MCG	=	$(M_ENV) $(SMC) --compile-to-c
-MCE	=	$(M_ENV) $(SMC) --errorcheck-only
-MCS	=	$(M_ENV) $(SMC) --split-c-files -c --cflags "$(ALL_CFLAGS)"
-MGNUC	=	$(M_ENV) $(SCRIPTS_DIR)/mgnuc
-C2INIT =	MERCURY_MOD_LIB_MODS="$(LIBRARY_DIR)/$(STD_LIB_NAME).init $(RUNTIME_DIR)/$(RT_LIB_NAME).init" \
-		MERCURY_TRACE_LIB_MODS="$(BROWSER_DIR)/$(BROWSER_LIB_NAME).init" \
-		MERCURY_MKINIT=$(UTIL_DIR)/mkinit $(SCRIPTS_DIR)/c2init
-ML	=	MERCURY_C_LIB_DIR=. $(SCRIPTS_DIR)/ml
-MLFLAGS =	--shared --no-main --mercury-libs none
-MLLIBS  =	../main.$O \
-		$(TRACE_DIR)/lib$(TRACE_LIB_NAME).$A \
-		$(BROWSER_DIR)/lib$(BROWSER_LIB_NAME).$A \
-		$(LIBRARY_DIR)/lib$(STD_LIB_NAME).$A \
-		$(RUNTIME_DIR)/lib$(RT_LIB_NAME).$A ` \
-		    case $(GRADE) in \
-			*.par*.gc*.prof*) \
-				echo $(BOEHM_GC_DIR)/libpar_gc_prof.$A ;; \
-			*.par*.gc*)	echo $(BOEHM_GC_DIR)/libpar_gc.$A ;; \
-			*.gc*.prof*)	echo $(BOEHM_GC_DIR)/libgc_prof.$A ;; \
-			*.gc*)		echo $(BOEHM_GC_DIR)/libgc.$A ;; \
-		    esac \
-		` \
-		$(GCC_BACKEND_LIBS) \
-		$(MATH_LIB)
-MTAGS	=	$(SCRIPTS_DIR)/mtags
-MTAGSFLAGS =	$(EXTRA_MTAGSFLAGS)
+MCFLAGS +=	-I $(BROWSER_DIR)
+ALL_MLLIBS =	../main.$O $(MLLIBS) $(EXTRA_MLLIBS) \
+			$(GCC_BACKEND_LIBS) $(MATH_LIB)
+MLFLAGS +=	--no-main --shared
 
 #
 # Work-around for a fixed limit: on alpha-dec-osf3.2, if we compile with
@@ -187,7 +146,7 @@
 regenerate_preprocessed_files:
 	-[ -d ./$(dates_subdir) ] || mkdir -p ./$(dates_subdir)
 	touch $(PREPROCESSED_FILES)
-	$(MMAKE) $(PREPROCESSED_M_FILES)
+	MMAKE_DIR=$(SCRIPTS_DIR) $(MMAKE) $(PREPROCESSED_M_FILES)
 
 # The `.m' files for the preprocessed modules depend on the `.pp_date' files.
 $(PREPROCESSED_M_FILES): %.m: $(dates_subdir)%.pp_date
Index: deep_profiler/Mmakefile
===================================================================
RCS file: /home/mercury1/repository/mercury/deep_profiler/Mmakefile,v
retrieving revision 1.3
diff -u -u -r1.3 Mmakefile
--- deep_profiler/Mmakefile	6 Jun 2001 10:50:47 -0000	1.3
+++ deep_profiler/Mmakefile	22 Apr 2002 05:39:11 -0000
@@ -9,6 +9,7 @@
 -include Mmake.deep.params
 
 MERCURY_DIR=..
+LINK_STATIC=yes
 include $(MERCURY_DIR)/Mmake.common
 
 ifeq ("$(ENABLE_DEEP_PROFILER)","yes")
@@ -21,51 +22,9 @@
 	INSTALL=nothing
 endif
 
-VPATH=$(LIBRARY_DIR)
-
 #-----------------------------------------------------------------------------#
 
-# Specify which compilers to use to compile the profiler.
-# Don't change these without good reason - if you want to
-# do a temporary change, change ../Mmake.params
-
-M_ENV	=	MERCURY_INT_DIR=$(LIBRARY_DIR)  \
-		MERCURY_ALL_C_INCL_DIRS="\
-			-I$(TRACE_DIR) \
-			-I$(LIBRARY_DIR) \
-			-I$(RUNTIME_DIR) \
-			-I$(BOEHM_GC_DIR) \
-			-I$(BOEHM_GC_DIR)/include \
-		"
-MCD	=	$(M_ENV) $(MC) --generate-dependencies
-MCI	=	$(M_ENV) $(MC) --make-interface
-MCPI	=	$(M_ENV) $(MC) --make-private-interface
-MCSI	=	$(M_ENV) $(MC) --make-short-interface
-MCOI	=	$(M_ENV) $(MC) --make-optimization-interface
-MCTOI	=	$(M_ENV) $(MC) --make-transitive-optimization-interface
-MCG	=	$(M_ENV) $(MC) --compile-to-c
-MCS	=	$(M_ENV) $(MC) --split-c-files -c --cflags "$(ALL_CFLAGS)"
-MGNUC	=	$(M_ENV) $(SCRIPTS_DIR)/mgnuc
-C2INIT  =	MERCURY_MOD_LIB_MODS="$(LIBRARY_DIR)/$(STD_LIB_NAME).init $(RUNTIME_DIR)/$(RT_LIB_NAME).init" \
-		MERCURY_TRACE_LIB_MODS="$(BROWSER_DIR)/$(BROWSER_LIB_NAME).init" \
-                MERCURY_MKINIT=$(UTIL_DIR)/mkinit $(SCRIPTS_DIR)/c2init
-ML	=	MERCURY_C_LIB_DIR=. $(SCRIPTS_DIR)/ml
-MLFLAGS =	--shared --mercury-libs none
-MLLIBS  =	$(TRACE_DIR)/lib$(TRACE_LIB_NAME).$A \
-		$(BROWSER_DIR)/lib$(BROWSER_LIB_NAME).$A \
-		$(LIBRARY_DIR)/lib$(STD_LIB_NAME).$A \
-		$(RUNTIME_DIR)/lib$(RT_LIB_NAME).$A ` \
-		    case $(GRADE) in \
-			*.par*.gc*.prof*) \
-				echo $(BOEHM_GC_DIR)/libpar_gc_prof.$A ;; \
-			*.par*.gc*)	echo $(BOEHM_GC_DIR)/libpar_gc.$A ;; \
-			*.gc*.prof*)	echo $(BOEHM_GC_DIR)/libgc_prof.$A ;; \
-			*.gc*)		echo $(BOEHM_GC_DIR)/libgc.$A ;; \
-		    esac \
-		` $(MATH_LIB)
-MSL	=	MERCURY_SP_LIB_DIR=$(LIBRARY_DIR) $(SCRIPTS_DIR)/msl
-MNLFLAGS =	-u 6000
-MTAGS	=	$(SCRIPTS_DIR)/mtags
+MLFLAGS += --shared
 
 #-----------------------------------------------------------------------------#
 
Index: library/Mmakefile
===================================================================
RCS file: /home/mercury1/repository/mercury/library/Mmakefile,v
retrieving revision 1.88
diff -u -u -r1.88 Mmakefile
--- library/Mmakefile	5 Apr 2002 15:22:53 -0000	1.88
+++ library/Mmakefile	22 Apr 2002 05:46:12 -0000
@@ -13,8 +13,9 @@
 EXTRA_LDFLAGS =
 EXTRA_LDLIBS =
 #-----------------------------------------------------------------------------#
-
+ 
 MERCURY_DIR=..
+LINK_RUNTIME_ONLY=yes
 include $(MERCURY_DIR)/Mmake.common
 
 MAIN_TARGET=mercury
@@ -23,36 +24,6 @@
 
 #-----------------------------------------------------------------------------#
 
-# We need to compile the library with --strict-sequential for two reasons:
-# (1) Otherwise Mercury code that is compiled with --strict-sequential
-#     might do the wrong thing, because the standard library wasn't compiled
-#     with --strict-sequential.  (We could make it a separate grade, but
-#     that's not worth it.)
-# (2) The code for get_determinism in library/exception.m relies on it
-#     (in particular it relies on --no-reorder-disj).
-MCFLAGS += --strict-sequential
-
-# Generate dependencies for use by `mmc --make'.
-MCFLAGS += --generate-mmc-deps
-
-# Modules which use user-guided type specialization need to be
-# compiled with these flags to make sure all calls
-# to the builtin comparison routines are inlined.
-TYPE_SPEC_FLAGS = --inline-vars-threshold 10000
-MCFLAGS-list += $(TYPE_SPEC_FLAGS)
-MCFLAGS-map += $(TYPE_SPEC_FLAGS)
-MCFLAGS-tree234 += $(TYPE_SPEC_FLAGS)
-MCFLAGS-set += $(TYPE_SPEC_FLAGS)
-MCFLAGS-set_ordlist += $(TYPE_SPEC_FLAGS)
-
-#-----------------------------------------------------------------------------#
-
-# Bug workarounds.
-
-MCFLAGS-std_util += --no-halt-at-warn
-
-#-----------------------------------------------------------------------------#
-
 # Specify which options to use to compile the library.
 # Don't change these without good reason - if you want to
 # do a temporary change, change ../Mmake.params.
@@ -79,44 +50,47 @@
 
 endif
 
-M_ENV	=	MERCURY_INT_DIR=. \
-		MERCURY_ALL_C_INCL_DIRS="\
-			-I$(TRACE_DIR) \
-			-I$(RUNTIME_DIR) \
-			-I$(BOEHM_GC_DIR) \
-			-I$(BOEHM_GC_DIR)/include \
-		"
-MCD	=	$(M_ENV) $(MC) --generate-dependencies $(INTERMODULE_OPTS)
-MCI	=	$(M_ENV) $(MC) --make-interface $(INTERMODULE_OPTS) \
-			$(ENABLE_TERM_OPTS)
-MCPI	=	$(M_ENV) $(MC) --make-private-interface $(INTERMODULE_OPTS) \
-			$(ENABLE_TERM_OPTS)
-MCSI	=	$(M_ENV) $(MC) --make-short-interface $(INTERMODULE_OPTS) \
-			$(ENABLE_TERM_OPTS)
-MCOI	=	$(M_ENV) $(MC) --make-opt-int $(INTERMODULE_OPTS) \
-			$(ENABLE_TERM_OPTS)
-MCTOI	=	$(M_ENV) $(MC) --make-trans-opt $(INTERMODULE_OPTS) \
-			$(ENABLE_TERM_OPTS)
-MCG	=	$(M_ENV) $(MC) --compile-to-c --trace minimum \
-			$(INTERMODULE_OPTS) $(CHECK_TERM_OPTS)
-MCS	=	$(M_ENV) $(MC) --split-c-files -c --cflags "$(ALL_CFLAGS)" \
-			$(INTERMODULE_OPTS) $(CHECK_TERM_OPTS)
-MGNUC	=	$(M_ENV) $(SCRIPTS_DIR)/mgnuc
-MGNUCFLAGS =	$(DLL_CFLAGS)
-LDFLAGS	=	-L$(BOEHM_GC_DIR) -L$(RUNTIME_DIR)
-ALL_LDFLAGS =	$(LDFLAGS) $(EXTRA_LDFLAGS)
-LDLIBS	=	-l$(RT_LIB_NAME) \
-		` case "$(GRADE)" in 					\
-		    *.par*.gc*.prof*)	echo "-lpar_gc_prof" ;;		\
-		    *.par*.gc*)		echo "-lpar_gc" ;;		\
-		    *.gc*.prof*)	echo "-lgc_prof" ;;		\
-		    *.gc*)		echo "-lgc" ;;			\
-		  esac							\
-		`
-ALL_LDLIBS =	$(LDLIBS) $(EXTRA_LDLIBS)
+# We need to compile the library with --strict-sequential for two reasons:
+# (1) Otherwise Mercury code that is compiled with --strict-sequential
+#     might do the wrong thing, because the standard library wasn't compiled
+#     with --strict-sequential.  (We could make it a separate grade, but
+#     that's not worth it.)
+# (2) The code for get_determinism in library/exception.m relies on it
+#     (in particular it relies on --no-reorder-disj).
+#
+# 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
+# maintain the expected output of the debugging test cases in debugging grades.
+#
+# Always generate dependencies for use by `mmc --make'.
+MCFLAGS += --strict-sequential --trace minimum --generate-mmc-deps \
+		$(INTERMODULE_OPTS) $(ENABLE_TERM_OPTS) $(CHECK_TERM_OPTS)
+
+# Modules which use user-guided type specialization need to be
+# compiled with these flags to make sure all calls
+# to the builtin comparison routines are inlined.
+TYPE_SPEC_FLAGS = --inline-vars-threshold 10000
+MCFLAGS-list += $(TYPE_SPEC_FLAGS)
+MCFLAGS-map += $(TYPE_SPEC_FLAGS)
+MCFLAGS-tree234 += $(TYPE_SPEC_FLAGS)
+MCFLAGS-set += $(TYPE_SPEC_FLAGS)
+MCFLAGS-set_ordlist += $(TYPE_SPEC_FLAGS)
+
+# Bug workarounds.
+MCFLAGS-std_util += --no-halt-at-warn
+
+#-----------------------------------------------------------------------------#
+
+CFLAGS	+=	$(DLL_CFLAGS) -I$(TRACE_DIR)
+MLFLAGS	+=	-R$(FINAL_INSTALL_MERC_LIB_DIR) \
+		-R$(FINAL_INSTALL_MERC_GC_LIB_DIR)
 
 MTAGS	=	$(SCRIPTS_DIR)/mtags
 
+LN	=	ln
+
 #-----------------------------------------------------------------------------#
 
 # Stuff for Windows DLLS using gnu-win32
@@ -266,22 +240,13 @@
 lib_std: lib$(STD_LIB_NAME).$A lib$(STD_LIB_NAME).$(EXT_FOR_SHARED_LIB)
 lib_std: $(STD_LIB_NAME).init
 
-lib$(STD_LIB_NAME)$(DLL_DEF_LIB).$A : $(library.os)
+lib$(STD_LIB_NAME)$(DLL_DEF_LIB).$A : liblibrary.$A
 	rm -f lib$(STD_LIB_NAME)$(DLL_DEF_LIB).$A
-	$(AR) $(ALL_ARFLAGS) \
-		$(AR_LIBFILE_OPT)lib$(STD_LIB_NAME)$(DLL_DEF_LIB).$A \
-		$(library.os)
-	$(RANLIB) lib$(STD_LIB_NAME)$(DLL_DEF_LIB).$A
-
-RPATH_1=$(SHLIB_RPATH_OPT)$(FINAL_INSTALL_MERC_LIB_DIR)
-RPATH_2=$(SHLIB_RPATH_SEP)$(FINAL_INSTALL_MERC_GC_LIB_DIR)
-
-lib$(STD_LIB_NAME).so : $(library.pic_os)
-	$(LINK_SHARED_OBJ) $(ERROR_UNDEFINED) 				\
-		-o lib$(STD_LIB_NAME).so $(library.pic_os)		\
-		$(RPATH_1)$(RPATH_2)					\
-		$(ALL_LDFLAGS) $(ALL_LDLIBS)				\
-		$(SHARED_LIBS)
+	$(LN) liblibrary.$A lib$(STD_LIB_NAME)$(DLL_DEF_LIB).$A
+
+lib$(STD_LIB_NAME).so : liblibrary.so
+	rm -f lib$(STD_LIB_NAME).so
+	$(LN) liblibrary.so lib$(STD_LIB_NAME).so
 
 endif
 
Index: profiler/Mmakefile
===================================================================
RCS file: /home/mercury1/repository/mercury/profiler/Mmakefile,v
retrieving revision 1.19
diff -u -u -r1.19 Mmakefile
--- profiler/Mmakefile	17 Jan 2001 02:30:57 -0000	1.19
+++ profiler/Mmakefile	22 Apr 2002 05:38:57 -0000
@@ -7,55 +7,14 @@
 # Mmake - this is Mmake file for building the Mercury profiler
 
 MERCURY_DIR=..
+LINK_STATIC=yes
 include $(MERCURY_DIR)/Mmake.common
 
 MAIN_TARGET=mercury_profile
 
-VPATH=$(LIBRARY_DIR)
-
 #-----------------------------------------------------------------------------#
 
-# Specify which compilers to use to compile the profiler.
-# Don't change these without good reason - if you want to
-# do a temporary change, change ../Mmake.params
-
-M_ENV	=	MERCURY_INT_DIR=$(LIBRARY_DIR)  \
-		MERCURY_ALL_C_INCL_DIRS="\
-			-I$(TRACE_DIR) \
-			-I$(LIBRARY_DIR) \
-			-I$(RUNTIME_DIR) \
-			-I$(BOEHM_GC_DIR) \
-			-I$(BOEHM_GC_DIR)/include \
-		"
-MCD	=	$(M_ENV) $(MC) --generate-dependencies
-MCI	=	$(M_ENV) $(MC) --make-interface
-MCPI	=	$(M_ENV) $(MC) --make-private-interface
-MCSI	=	$(M_ENV) $(MC) --make-short-interface
-MCOI	=	$(M_ENV) $(MC) --make-optimization-interface
-MCTOI	=	$(M_ENV) $(MC) --make-transitive-optimization-interface
-MCG	=	$(M_ENV) $(MC) --compile-to-c
-MCS	=	$(M_ENV) $(MC) --split-c-files -c --cflags "$(ALL_CFLAGS)"
-MGNUC	=	$(M_ENV) $(SCRIPTS_DIR)/mgnuc
-C2INIT  =	MERCURY_MOD_LIB_MODS="$(LIBRARY_DIR)/$(STD_LIB_NAME).init $(RUNTIME_DIR)/$(RT_LIB_NAME).init" \
-		MERCURY_TRACE_LIB_MODS="$(BROWSER_DIR)/$(BROWSER_LIB_NAME).init" \
-                MERCURY_MKINIT=$(UTIL_DIR)/mkinit $(SCRIPTS_DIR)/c2init
-ML	=	MERCURY_C_LIB_DIR=. $(SCRIPTS_DIR)/ml
-MLFLAGS =	--shared --mercury-libs none
-MLLIBS  =	$(TRACE_DIR)/lib$(TRACE_LIB_NAME).$A \
-		$(BROWSER_DIR)/lib$(BROWSER_LIB_NAME).$A \
-		$(LIBRARY_DIR)/lib$(STD_LIB_NAME).$A \
-		$(RUNTIME_DIR)/lib$(RT_LIB_NAME).$A ` \
-		    case $(GRADE) in \
-			*.par*.gc*.prof*) \
-				echo $(BOEHM_GC_DIR)/libpar_gc_prof.$A ;; \
-			*.par*.gc*)	echo $(BOEHM_GC_DIR)/libpar_gc.$A ;; \
-			*.gc*.prof*)	echo $(BOEHM_GC_DIR)/libgc_prof.$A ;; \
-			*.gc*)		echo $(BOEHM_GC_DIR)/libgc.$A ;; \
-		    esac \
-		` $(MATH_LIB)
-MSL	=	MERCURY_SP_LIB_DIR=$(LIBRARY_DIR) $(SCRIPTS_DIR)/msl
-MNLFLAGS =	-u 6000
-MTAGS	=	$(SCRIPTS_DIR)/mtags
+MLFLAGS += --shared
 
 #-----------------------------------------------------------------------------#
 
Index: runtime/Mmakefile
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/Mmakefile,v
retrieving revision 1.87
diff -u -u -r1.87 Mmakefile
--- runtime/Mmakefile	20 Mar 2002 12:37:53 -0000	1.87
+++ runtime/Mmakefile	22 Apr 2002 07:26:52 -0000
@@ -9,21 +9,14 @@
 MAIN_TARGET=runtime
 
 MERCURY_DIR=..
+LINK_BOEHM_GC_ONLY=yes
 include $(MERCURY_DIR)/Mmake.common
 -include Mmake.runtime.params
 
 #-----------------------------------------------------------------------------#
 
-CFLAGS	= -g $(DLL_CFLAGS) -DMERCURY_BOOTSTRAP_H -DMERCURY_CONF_BOOTSTRAP_H
-
-MGNUC		= MERCURY_ALL_C_INCL_DIRS=" \
-			-I$(RUNTIME_DIR) \
-			-I$(BOEHM_GC_DIR) \
-			-I$(BOEHM_GC_DIR)/include \
-			" \
-		  $(SCRIPTS_DIR)/mgnuc 
-MGNUCFLAGS	= --no-ansi
-MOD2C		= $(SCRIPTS_DIR)/mod2c
+CFLAGS	+= -g $(DLL_CFLAGS) -DMERCURY_BOOTSTRAP_H -DMERCURY_CONF_BOOTSTRAP_H
+MGNUCFLAGS	+= --no-ansi
 
 #-----------------------------------------------------------------------------#
 
@@ -190,14 +183,8 @@
 PIC_OBJS	= $(CFILES:.c=.$(EXT_FOR_PIC_OBJECTS))
 
 LDFLAGS		= -L$(BOEHM_GC_DIR)
-LDLIBS		= \
-		` case "$(GRADE)" in 					\
-		    *.par*.gc*.prof*)	echo "-lpar_gc_prof" ;;		\
-		    *.par*.gc*)		echo "-lpar_gc" ;;		\
-		    *.gc*.prof*)	echo "-lgc_prof" ;;		\
-		    *.gc*)		echo "-lgc" ;;			\
-		  esac							\
-		`
+LDLIBS		= $(SHARED_GC_LIBS)
+
 THREADLIBS	= \
 		` case "$(GRADE)" in					\
 		    *.par*) echo "-lpthread" ;;				\
Index: scripts/Mmake.vars.in
===================================================================
RCS file: /home/mercury1/repository/mercury/scripts/Mmake.vars.in,v
retrieving revision 1.66
diff -u -u -r1.66 Mmake.vars.in
--- scripts/Mmake.vars.in	19 Apr 2002 14:59:34 -0000	1.66
+++ scripts/Mmake.vars.in	21 Apr 2002 15:00:50 -0000
@@ -105,7 +105,7 @@
 ALL_MCGFLAGS	= $(MCGFLAGS) $(EXTRA_MCGFLAGS) $(TARGET_MCFLAGS) \
 		  $(LIB_MCFLAGS)
 ALL_MCSFLAGS	= $(MCSFLAGS) $(EXTRA_MCSFLAGS) $(TARGET_MCFLAGS) \
-		  $(LIB_MCFLAGS)
+		  $(LIB_MCFLAGS) --cflags "$(ALL_CFLAGS)"
 
 MCIFLAGS	= $(MCFLAGS)
 MCPIFLAGS	= $(MCFLAGS)
Index: scripts/c2init.in
===================================================================
RCS file: /home/mercury1/repository/mercury/scripts/c2init.in,v
retrieving revision 1.36
diff -u -u -r1.36 c2init.in
--- scripts/c2init.in	19 Apr 2002 14:59:34 -0000	1.36
+++ scripts/c2init.in	22 Apr 2002 07:17:43 -0000
@@ -25,7 +25,7 @@
 # include the file `canonical_grade.sh-subr'
 @CANONICAL_GRADE@
 
-# If you change these, you will also need to change Mmake.common.in,
+# If you change these, you will also need to change Mmake.workspace
 # scripts/ml.in, tools/bootcheck, tools/binary, tools/binary_step and
 # tools/linear.
 RT_LIB_NAME=mer_rt
Index: scripts/ml.in
===================================================================
RCS file: /home/mercury1/repository/mercury/scripts/ml.in,v
retrieving revision 1.95
diff -u -u -r1.95 ml.in
--- scripts/ml.in	19 Apr 2002 14:59:35 -0000	1.95
+++ scripts/ml.in	22 Apr 2002 07:18:01 -0000
@@ -80,7 +80,7 @@
 # Likewise for -lreadline -l{termcap,curses,ncurses}
 READLINE_LIBRARIES="@READLINE_LIBRARIES@"
 
-# If you change these, you will also need to change Mmake.common.in,
+# If you change these, you will also need to change Mmake.workspace,
 # scripts/c2init.in, tools/bootcheck, tools/binary, tools/binary_step
 # and tools/linear.
 RT_LIB_NAME=mer_rt
Index: tests/Mmake.common
===================================================================
RCS file: /home/mercury1/repository/tests/Mmake.common,v
retrieving revision 1.23
diff -u -u -r1.23 Mmake.common
--- tests/Mmake.common	14 Apr 2002 08:54:30 -0000	1.23
+++ tests/Mmake.common	24 Apr 2002 06:08:26 -0000
@@ -1,5 +1,14 @@
 #-----------------------------------------------------------------------------#
 
+# Set up to test a particular workspace.
+ifdef WORKSPACE
+
+# Make sure we don't get the installed versions of the libraries.
+LINK_STATIC = yes
+include $(WORKSPACE)/Mmake.workspace
+
+endif
+
 #
 # Note: Mmake lets you override MCFLAGS for a particular file by setting
 # MCFLAGS-foo.  Similarly, you can override GRADEFLAGS for a particular
Index: tests/debugger/Mmakefile
===================================================================
RCS file: /home/mercury1/repository/tests/debugger/Mmakefile,v
retrieving revision 1.72
diff -u -u -r1.72 Mmakefile
--- tests/debugger/Mmakefile	3 Apr 2002 07:08:22 -0000	1.72
+++ tests/debugger/Mmakefile	24 Apr 2002 07:29:54 -0000
@@ -63,8 +63,8 @@
 # The optimization level also affects stack frame sizes.
 MCFLAGS-nondet_stack = -O2 --no-reclaim-heap-on-failure
 
-MCFLAGS = --trace deep
-MLFLAGS = --trace
+MCFLAGS += --trace deep
+MLFLAGS += --trace
 
 # We need to use shared libraries for interactive queries to work.
 # The following is necessary for shared libraries to work on Linux.
@@ -72,10 +72,11 @@
 MLFLAGS-interactive = --shared
 
 # Since the `interactive' test case requires the use of shared libraries,
-# this means it won't work properly if MERCURY_LIBS is set to point
-# to static libraries (as is done by tools/bootcheck and tools/lmc).
-# So we only enable it if MERCURY_LIBS is not set.
-ifeq "$(origin MERCURY_LIBS)" "undefined"
+# this means it won't work properly if the static libraries are linked
+# (as is done by tools/bootcheck and tools/lmc).
+# So we only enable it if LINK_STATIC is not set.
+LINK_STATIC ?= no
+ifeq ($(LINK_STATIC),no)
 	RETRY_PROGS := $(RETRY_PROGS) interactive
 endif
 
@@ -299,13 +300,24 @@
 # to have been built.
 
 ifeq ($(MMAKE_USE_SUBDIRS),yes)
-INTERACTIVE_INP = interactive.inp.subdirs
+USE_SUBDIRS_OPT = --use-subdirs
 else
-INTERACTIVE_INP = interactive.inp.nosubdirs
+USE_SUBDIRS_OPT =
 endif
 
-interactive.out.orig: interactive $(INTERACTIVE_INP) $(interactive.ints)
-	$(MDB) ./interactive < $(INTERACTIVE_INP) > interactive.out.orig 2>&1
+# We need $(...) style command substitution for the rule below.
+# (MC_MAKE_FLAGS can contain `...` style command substitution,
+# which can't be nested).
+SHELL=/usr/local/bin/bash
+
+interactive.out.orig: interactive interactive.inp $(interactive.ints)
+	echo "echo on" > interactive.inp.tmp
+	echo mmc_options $(USE_SUBDIRS_OPT) \
+			$$(eval echo $(MC_MAKE_FLAGS) $(ALL_MCFLAGS)) \
+			--trace minimum >> interactive.inp.tmp
+	cat interactive.inp >> interactive.inp.tmp
+	$(MDB) ./interactive < interactive.inp.tmp > interactive.out.orig 2>&1
+	rm -f interactive.inp.tmp
 
 # We pipe the output through sed to avoid differences for `--use-subdirs',
 # and to remove some spurious warnings that `gcc' and `ld' issue.
@@ -315,7 +327,7 @@
 interactive.out: interactive.out.orig
 	cat interactive.out.orig | \
 		sed \
-		    -e '/mdb> mmc_options --use-subdirs/d' \
+		    -e '/mdb> mmc_options/d' \
 		    -e '/In file included from \/home\/mercury\/public\/.a\/lib\/mercury\/inc\/mercury_trace_base.h:[0-9]*,$$/N' \
 		    -e 's/In file included from \/home\/mercury\/public\/.a\/lib\/mercury\/inc\/mercury_trace_base.h:[0-9]*,.//' \
 		    -e '/                 from \/home\/mercury\/public\/.a\/lib\/mercury\/inc\/mercury_wrapper.h:[0-9]*,$$/N' \
Index: tests/debugger/interactive.exp
===================================================================
RCS file: /home/mercury1/repository/tests/debugger/interactive.exp,v
retrieving revision 1.4
diff -u -u -r1.4 interactive.exp
--- tests/debugger/interactive.exp	27 Feb 2002 09:38:35 -0000	1.4
+++ tests/debugger/interactive.exp	24 Apr 2002 08:07:18 -0000
@@ -167,6 +167,7 @@
 <stdin>:001:   argument has type `int',
 <stdin>:001:   constant `"foo"' has type `string'.
 For more information, try recompiling with `-E'.
+** Error making `query.c'.
 qperm([1,2,"foo"], List).
 Compilation error(s) occurred.
 ?- <stdin>:026: Inferred :- pred query((list:list(int))).
@@ -181,6 +182,7 @@
 <stdin>:026:   mode error: variable `HeadVar__2' has instantiatedness `free',
 <stdin>:026:   expected instantiatedness was `ground'.
 For more information, try recompiling with `-E'.
+** Error making `query.c'.
 qperm(List, [1]).
 Compilation error(s) occurred.
 ?- quit.
Index: tests/debugger/interactive.exp2
===================================================================
RCS file: /home/mercury1/repository/tests/debugger/interactive.exp2,v
retrieving revision 1.2
diff -u -u -r1.2 interactive.exp2
--- tests/debugger/interactive.exp2	27 Feb 2002 09:38:36 -0000	1.2
+++ tests/debugger/interactive.exp2	24 Apr 2002 08:07:06 -0000
@@ -169,6 +169,7 @@
 <stdin>:001:   argument has type `int',
 <stdin>:001:   constant `"foo"' has type `string'.
 For more information, try recompiling with `-E'.
+** Error making `query.c'.
 qperm([1,2,"foo"], List).
 Compilation error(s) occurred.
 ?- <stdin>:026: Inferred :- pred query((list:list(int))).
@@ -183,6 +184,7 @@
 <stdin>:026:   mode error: variable `HeadVar__2' has instantiatedness `free',
 <stdin>:026:   expected instantiatedness was `ground'.
 For more information, try recompiling with `-E'.
+** Error making `query.c'.
 qperm(List, [1]).
 Compilation error(s) occurred.
 ?- quit.
Index: tests/debugger/interactive.inp
===================================================================
RCS file: tests/debugger/interactive.inp
diff -N tests/debugger/interactive.inp
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ tests/debugger/interactive.inp	23 Apr 2002 07:45:47 -0000
@@ -0,0 +1,74 @@
+print *
+
+print *
+
+print *
+
+print *
+
+print *
+
+print *
+
+print *
+
+print *
+level 1
+print *
+up 1
+vars
+print *
+
+print HeadVar__1
+print HeadVar__2
+print HeadVar__3
+
+print *
+
+print *
+
+print *
+
+print *
+
+print *
+
+goto -a 20
+stack
+stack -d
+print *
+#
+# Test interactive queries.
+#
+query interactive list
+append(X, Y, ['a', 'b', 'c']).
+qperm([1,2,3], List).
+qperm([1,2,3], List), List = [2 | _].
+qperm([1,2,3], List), List = [4 | _].
+qperm([1,2,"foo"], List).
+qperm(List, [1]).
+quit.
+cc_query interactive list
+append(X, Y, ['a', 'b', 'c']).
+qperm([1,2,3], List).
+qperm([1,2,3], List), List = [2 | _].
+qperm([1,2,3], List), List = [4 | _].
+quit.
+io_query interactive list
+main.
+if { append(X, Y, ['a', 'b', 'c']) } then print("X = "), print(X), print(", Y = "), print(Y), nl else print("No solution\n").
+if { qperm([1,2,3], List) } then print(List), nl else [].
+if { qperm([1,2,3], List), List = [2 | _] } then print(List), nl else { true }.
+if { qperm([1,2,3], List), List = [4 | _] } then print(List), nl else print("No solution, as expected."), io__nl.
+quit.
+retry
+print *
+finish -a
+register --quiet
+break print_list
+break qdelete
+continue -a
+step -aS 5
+disable 1
+continue -n
+continue -n -S
Index: tests/debugger/interactive.inp.nosubdirs
===================================================================
RCS file: tests/debugger/interactive.inp.nosubdirs
diff -N tests/debugger/interactive.inp.nosubdirs
--- tests/debugger/interactive.inp.nosubdirs	27 Feb 2002 09:38:36 -0000	1.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,75 +0,0 @@
-echo on
-print *
-
-print *
-
-print *
-
-print *
-
-print *
-
-print *
-
-print *
-
-print *
-level 1
-print *
-up 1
-vars
-print *
-
-print HeadVar__1
-print HeadVar__2
-print HeadVar__3
-
-print *
-
-print *
-
-print *
-
-print *
-
-print *
-
-goto -a 20
-stack
-stack -d
-print *
-#
-# Test interactive queries.
-#
-query interactive list
-append(X, Y, ['a', 'b', 'c']).
-qperm([1,2,3], List).
-qperm([1,2,3], List), List = [2 | _].
-qperm([1,2,3], List), List = [4 | _].
-qperm([1,2,"foo"], List).
-qperm(List, [1]).
-quit.
-cc_query interactive list
-append(X, Y, ['a', 'b', 'c']).
-qperm([1,2,3], List).
-qperm([1,2,3], List), List = [2 | _].
-qperm([1,2,3], List), List = [4 | _].
-quit.
-io_query interactive list
-main.
-if { append(X, Y, ['a', 'b', 'c']) } then print("X = "), print(X), print(", Y = "), print(Y), nl else print("No solution\n").
-if { qperm([1,2,3], List) } then print(List), nl else [].
-if { qperm([1,2,3], List), List = [2 | _] } then print(List), nl else { true }.
-if { qperm([1,2,3], List), List = [4 | _] } then print(List), nl else print("No solution, as expected."), io__nl.
-quit.
-retry
-print *
-finish -a
-register --quiet
-break print_list
-break qdelete
-continue -a
-step -aS 5
-disable 1
-continue -n
-continue -n -S
Index: tests/debugger/interactive.inp.subdirs
===================================================================
RCS file: tests/debugger/interactive.inp.subdirs
diff -N tests/debugger/interactive.inp.subdirs
--- tests/debugger/interactive.inp.subdirs	27 Feb 2002 09:38:36 -0000	1.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,76 +0,0 @@
-echo on
-print *
-
-print *
-
-print *
-
-print *
-
-print *
-
-print *
-
-print *
-
-print *
-level 1
-print *
-up 1
-vars
-print *
-
-print HeadVar__1
-print HeadVar__2
-print HeadVar__3
-
-print *
-
-print *
-
-print *
-
-print *
-
-print *
-
-goto -a 20
-stack
-stack -d
-print *
-#
-# Test interactive queries.
-#
-mmc_options --use-subdirs
-query interactive list
-append(X, Y, ['a', 'b', 'c']).
-qperm([1,2,3], List).
-qperm([1,2,3], List), List = [2 | _].
-qperm([1,2,3], List), List = [4 | _].
-qperm([1,2,"foo"], List).
-qperm(List, [1]).
-quit.
-cc_query interactive list
-append(X, Y, ['a', 'b', 'c']).
-qperm([1,2,3], List).
-qperm([1,2,3], List), List = [2 | _].
-qperm([1,2,3], List), List = [4 | _].
-quit.
-io_query interactive list
-main.
-if { append(X, Y, ['a', 'b', 'c']) } then print("X = "), print(X), print(", Y = "), print(Y), nl else print("No solution\n").
-if { qperm([1,2,3], List) } then print(List), nl else [].
-if { qperm([1,2,3], List), List = [2 | _] } then print(List), nl else { true }.
-if { qperm([1,2,3], List), List = [4 | _] } then print(List), nl else print("No solution, as expected."), io__nl.
-quit.
-retry
-print *
-finish -a
-register --quiet
-break print_list
-break qdelete
-continue -a
-step -aS 5
-disable 1
-continue -n
-continue -n -S
Index: tests/debugger/declarative/Mmakefile
===================================================================
RCS file: /home/mercury1/repository/tests/debugger/declarative/Mmakefile,v
retrieving revision 1.33
diff -u -u -r1.33 Mmakefile
--- tests/debugger/declarative/Mmakefile	23 Apr 2002 08:52:41 -0000	1.33
+++ tests/debugger/declarative/Mmakefile	24 Apr 2002 08:37:27 -0000
@@ -51,8 +51,8 @@
 	ite_2			\
 	solutions
 
-MCFLAGS = --trace decl
-MLFLAGS = --trace
+MCFLAGS += --trace decl
+MLFLAGS += --trace
 
 MCFLAGS-deep_sub=--trace deep
 MCFLAGS-dependency=--trace rep
Index: tests/dppd/Mmakefile
===================================================================
RCS file: /home/mercury1/repository/tests/dppd/Mmakefile,v
retrieving revision 1.1
diff -u -u -r1.1 Mmakefile
--- tests/dppd/Mmakefile	20 Feb 1999 11:34:13 -0000	1.1
+++ tests/dppd/Mmakefile	22 Apr 2002 14:12:47 -0000
@@ -1,3 +1,5 @@
+include ../Mmake.common
+
 MCFLAGS=#--pd --no-inlining -d 35 -D petdr #-d 99
 #GRADE=asm_fast.gc.prof
 MLFLAGS=--static
Index: tests/warnings/Mmakefile
===================================================================
RCS file: /home/mercury1/repository/tests/warnings/Mmakefile,v
retrieving revision 1.18
diff -u -u -r1.18 Mmakefile
--- tests/warnings/Mmakefile	5 Mar 2001 03:31:30 -0000	1.18
+++ tests/warnings/Mmakefile	22 Apr 2002 14:02:37 -0000
@@ -1,5 +1,6 @@
 #-----------------------------------------------------------------------------#
 
+include ../Mmake.common
 -include ../Mmake.params
 
 main_target: check
Index: tools/binary
===================================================================
RCS file: /home/mercury1/repository/mercury/tools/binary,v
retrieving revision 1.22
diff -u -u -r1.22 binary
--- tools/binary	12 Dec 2001 08:02:09 -0000	1.22
+++ tools/binary	22 Apr 2002 07:18:35 -0000
@@ -61,7 +61,7 @@
 "
 
 # If you change this, you will also need to change scripts/ml.in,
-# scripts/c2init.in, Mmake.common.in, tools/bootcheck, tools/binary_step
+# scripts/c2init.in, Mmake.workspace, tools/bootcheck, tools/binary_step
 # and tools/linear.
 STD_LIB_NAME=mer_std
 
Index: tools/binary_step
===================================================================
RCS file: /home/mercury1/repository/mercury/tools/binary_step,v
retrieving revision 1.16
diff -u -u -r1.16 binary_step
--- tools/binary_step	12 Dec 2001 08:02:09 -0000	1.16
+++ tools/binary_step	22 Apr 2002 07:19:21 -0000
@@ -41,7 +41,7 @@
 "
 
 # If you change this, you will also need to change scripts/ml.in,
-# scripts/c2init.in, Mmake.common.in, tools/bootcheck, tools/binary
+# scripts/c2init.in, Mmake.workspace, tools/bootcheck, tools/binary
 # and tools/linear.
 STD_LIB_NAME=mer_std
 
Index: tools/bootcheck
===================================================================
RCS file: /home/mercury1/repository/mercury/tools/bootcheck,v
retrieving revision 1.126
diff -u -u -r1.126 bootcheck
--- tools/bootcheck	18 Mar 2002 09:16:28 -0000	1.126
+++ tools/bootcheck	24 Apr 2002 06:07:23 -0000
@@ -105,6 +105,7 @@
 		Use this option on systems which don't support symbolic links.
 "
 
+unset WORKSPACE
 testdirs=""
 extras=false
 jfactor=""
@@ -143,7 +144,7 @@
 fi
 
 # If you change these, you will also need to change scripts/ml.in,
-# scripts/c2init.in, Mmake.common.in, tools/binary, tools/binary_step
+# scripts/c2init.in, Mmake.workspace, tools/binary, tools/binary_step
 # and tools/linear.
 RT_LIB_NAME=mer_rt
 STD_LIB_NAME=mer_std
@@ -395,8 +396,6 @@
 
 	MERCURY_COMPILER=$root/compiler/mercury_compile
 	export MERCURY_COMPILER
-	MERCURY_INT_DIR=$root/stage2/library
-	export MERCURY_INT_DIR
 
 	[ -d stage2 ] || mkdir stage2
 	if $keep_stage_2
@@ -632,8 +631,6 @@
 
 	MERCURY_COMPILER=$root/stage2/compiler/mercury_compile
 	export MERCURY_COMPILER
-	MERCURY_INT_DIR=$root/stage3/library
-	export MERCURY_INT_DIR
 
 	[ -d stage3 ] || mkdir stage3
 	if $keep_stage_3
@@ -877,47 +874,11 @@
 		stage2_insert=""
 	fi
 
-	MERCURY_INT_DIR=$root/${stage2_insert}library
-	export MERCURY_INT_DIR
-
-	if test "$test_grade" = ""; then
-		gc_grade=`scripts/ml --print-gc-grade`
-	else
-		gc_grade=`scripts/ml --grade $test_grade --print-gc-grade`
-	fi
-	MERCURY_LIBS="
-		`$CYGPATH $root/${stage2_insert}trace/lib$TRACE_LIB_NAME.$A`
-		`$CYGPATH $root/${stage2_insert}browser/lib$BROWSER_LIB_NAME.$A`
-		`$CYGPATH $root/${stage2_insert}library/lib$STD_LIB_NAME.$A`
-		`$CYGPATH $root/${stage2_insert}runtime/lib$RT_LIB_NAME.$A`
-		`$CYGPATH $root/${stage2_insert}boehm_gc/lib$gc_grade.$A`
-		-lm"
-	export MERCURY_LIBS
-
-	MERCURY_ALL_C_INCL_DIRS="-I$root/${stage2_insert}trace
-		-I$root/${stage2_insert}library
-		-I$root/${stage2_insert}runtime
-		-I$root/${stage2_insert}boehm_gc
-		-I$root/${stage2_insert}boehm_gc/include"
-	export MERCURY_ALL_C_INCL_DIRS
-	MERCURY_ALL_MC_C_INCL_DIRS="
-		--c-include-directory $root/${stage2_insert}trace
-		--c-include-directory $root/${stage2_insert}library
-		--c-include-directory $root/${stage2_insert}runtime
-		--c-include-directory $root/${stage2_insert}boehm_gc
-		--c-include-directory $root/${stage2_insert}boehm_gc/include"
-	export MERCURY_ALL_MC_C_INCL_DIRS
+	WORKSPACE="$root/${stage2_insert}"
+	export WORKSPACE	
 
 	MMAKE_DIR="$root/${stage2_insert}scripts"
 	export MMAKE_DIR
-
-	MERCURY_MOD_LIB_MODS="
-		$root/${stage2_insert}library/$STD_LIB_NAME.init
-		$root/${stage2_insert}runtime/$RT_LIB_NAME.init"
-	export MERCURY_MOD_LIB_MODS
-	MERCURY_TRACE_LIB_MODS="
-		$root/${stage2_insert}browser/$BROWSER_LIB_NAME.init"
-	export MERCURY_TRACE_LIB_MODS
 
 		# for mkinit, mmc, mgnuc, ml etc
 	PATH=$root/${stage2_insert}util:$root/${stage2_insert}scripts:$PATH
Index: tools/linear
===================================================================
RCS file: /home/mercury1/repository/mercury/tools/linear,v
retrieving revision 1.6
diff -u -u -r1.6 linear
--- tools/linear	12 Dec 2001 08:02:09 -0000	1.6
+++ tools/linear	22 Apr 2002 07:19:32 -0000
@@ -44,7 +44,7 @@
 "
 
 # If you change this, you will also need to change scripts/ml.in,
-# scripts/c2init.in, Mmake.common.in, tools/bootcheck, tools/binary
+# scripts/c2init.in, Mmake.workspace, tools/bootcheck, tools/binary
 # and tools/binary_step.
 STD_LIB_NAME=mer_std
 
Index: trace/Mmakefile
===================================================================
RCS file: /home/mercury1/repository/mercury/trace/Mmakefile,v
retrieving revision 1.28
diff -u -u -r1.28 Mmakefile
--- trace/Mmakefile	20 Mar 2002 12:37:56 -0000	1.28
+++ trace/Mmakefile	22 Apr 2002 08:59:56 -0000
@@ -10,21 +10,15 @@
 MAIN_TARGET=trace
 
 MERCURY_DIR=..
+LINK_STDLIB_ONLY=yes
 include $(MERCURY_DIR)/Mmake.common
 -include Mmake.trace.params
 
 #-----------------------------------------------------------------------------#
 
-M_ENV		= MERCURY_ALL_C_INCL_DIRS="\
-			-I$(BROWSER_DIR) \
-			-I$(LIBRARY_DIR) \
-			-I$(RUNTIME_DIR) \
-			-I$(BOEHM_GC_DIR) \
-			-I$(BOEHM_GC_DIR)/include \
-		  "
-CFLAGS	= -g $(DLL_CFLAGS) -DMERCURY_BOOTSTRAP_H -DMERCURY_CONF_BOOTSTRAP_H
-MGNUC		= $(M_ENV) $(SCRIPTS_DIR)/mgnuc
-MGNUCFLAGS	= --no-ansi
+CFLAGS		+= -I$(BROWSER_DIR) -g $(DLL_CFLAGS) \
+			-DMERCURY_BOOTSTRAP_H -DMERCURY_CONF_BOOTSTRAP_H
+MGNUCFLAGS	+= --no-ansi
 
 #-----------------------------------------------------------------------------#
 
@@ -87,16 +81,8 @@
 
 LDFLAGS		= -L$(BROWSER_DIR) -L$(LIBRARY_DIR) \
 			-L$(RUNTIME_DIR) -L$(BOEHM_GC_DIR)
-LDLIBS		= -l$(BROWSER_LIB_NAME) -l$(STD_LIB_NAME) -l$(RT_LIB_NAME) \
-		` case "$(GRADE)" in 					\
-		    *.par*.gc*.prof*)	echo "-lpar_gc_prof" ;;		\
-		    *.par*.gc*)		echo "-lpar_gc" ;;		\
-		    *.gc*.prof*)	echo "-lgc_prof" ;;		\
-		    *.gc*)		echo "-lgc" ;;			\
-		  esac							\
-		` 							\
-		$(SOCKET_LIBRARY) $(NSL_LIBRARY) $(DL_LIBRARY)		\
-		$(READLINE_LIBRARIES)
+LDLIBS		= -l$(BROWSER_LIB_NAME) $(MLLIBS) $(SOCKET_LIBRARY) \
+			$(NSL_LIBRARY) $(DL_LIBRARY) $(READLINE_LIBRARIES)
 THREADLIBS	= \
 		` case "$(GRADE)" in					\
 		    *.par*) echo "-lpthread" ;;				\
--------------------------------------------------------------------------
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