[m-rev.] diff: using `mmc --make' with mmake [2]

Simon Taylor stayl at cs.mu.OZ.AU
Sun May 5 01:17:39 AEST 2002



Estimated hours taken: 5
Branches: main

More changes to make `mmc --make' work with mmake.

scripts/Mmake.vars.in:
	Pass MCFLAGS, CFLAGS, MLFLAGS, etc. to mmc in an options file
	on standard input.

	Don't add options for EXTRA_LIBRARIES to CFLAGS and MLFLAGS
	when compiling with `mmc --make'. mmc handles those options
	itself.

compiler/options.m:
compiler/options_file.m:
doc/user_guide.texi:
	`--options-file -' now makes the compiler read an options
	file from standard input.

	Make `--options-file' behave as a standard accumulating option
	rather than attempting to copy the behaviour of make's `-f' option.

	s/--link_object/--link-object/

Mmake.workspace:
	Put the `.a' files for the libraries in MLOBJS, not MLLIBS.
	`mmc --make' will now relink when they change.

compiler/modules.m:
	Link MLOBS into `module.split'.

tests/debugger/Mmakefile:
	Create a Mercury.options file for use in compiling
	the queries in interactive.m test.

Index: Mmake.workspace
===================================================================
RCS file: /home/mercury1/repository/mercury/Mmake.workspace,v
retrieving revision 1.3
diff -u -u -r1.3 Mmake.workspace
--- Mmake.workspace	2 May 2002 07:54:54 -0000	1.3
+++ Mmake.workspace	4 May 2002 05:25:01 -0000
@@ -75,14 +75,6 @@
 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
@@ -96,12 +88,16 @@
 endif
 endif
 CFLAGS +=	$(C_INCL_DIRS)
-MC_MAKE_FLAGS += $(patsubst -I%,--c-include-directory %,$(C_INCL_DIRS))
+MCFLAGS +=	$(C_INCL_DIRS:-I%=--c-include-directory %)
 
 #
 # Work out which libraries to link with.
+# The $(shell) here is needed to allow the variable values in
+# ECHO_MERCURY_OPTIONS in Mmake.vars to be single-quoted when
+# passed to echo in order to preserve double-quotes (e.g. for
+# file names containing spaces).
 #
-STATIC_GC_LIBS =						\
+STATIC_GC_LIBS_0 = 						\
 	`							\
 	    case $(GRADE) in					\
 		*.par*.gc*.prof*) echo $(BOEHM_GC_DIR)/libpar_gc_prof.$A ;; \
@@ -110,8 +106,10 @@
 		*.gc*)		echo $(BOEHM_GC_DIR)/libgc.$A ;; \
 	    esac						\
 	`
-SHARED_GC_LIBS =						\
-	`							\
+STATIC_GC_LIBS = $(shell echo $(STATIC_GC_LIBS_0))
+
+SHARED_GC_LIBS_0 =						\
+	 `							\
 	    case $(GRADE) in					\
 		*.par*.gc*.prof*) echo -lpar_gc_prof ;;		\
 		*.par*.gc*)	echo -lpar_gc ;;		\
@@ -119,48 +117,52 @@
 		*.gc*)		echo -lgc ;;			\
 	    esac						\
 	`
+SHARED_GC_LIBS = $(shell echo $(SHARED_GC_LIBS_0))
+
 
 ifeq ($(LINK_STATIC),yes)
 
-STATIC_LIBS := $(STATIC_GC_LIBS)
+STATIC_RT_LIBS=
+STATIC_STD_LIBS=
+STATIC_TRACE_LIBS=
 ifneq ($(LINK_BOEHM_GC_ONLY),yes)
-STATIC_LIBS := $(RUNTIME_DIR)/lib$(RT_LIB_NAME).$A $(STATIC_LIBS)
+STATIC_RT_LIBS = $(RUNTIME_DIR)/lib$(RT_LIB_NAME).$A
 ifneq ($(LINK_RUNTIME_ONLY),yes)
-STATIC_LIBS := $(LIBRARY_DIR)/lib$(STD_LIB_NAME).$A $(STATIC_LIBS)
+STATIC_STD_LIBS = $(LIBRARY_DIR)/lib$(STD_LIB_NAME).$A
 ifneq ($(LINK_STDLIB_ONLY),yes)
-STATIC_LIBS := $(TRACE_DIR)/lib$(TRACE_LIB_NAME).$A \
-		$(BROWSER_DIR)/lib$(BROWSER_LIB_NAME).$A $(STATIC_LIBS)
+STATIC_TRACE_LIBS = $(TRACE_DIR)/lib$(TRACE_LIB_NAME).$A \
+		$(BROWSER_DIR)/lib$(BROWSER_LIB_NAME).$A
 endif
 endif
 endif
-
-MLLIBS +=	$(STATIC_LIBS)
-MC_MAKE_FLAGS += $(patsubst %,--link-object %,$(STATIC_LIBS))
+MLOBJS += $(STATIC_TRACE_LIBS) $(STATIC_STD_LIBS) \
+		$(STATIC_RT_LIBS) $(STATIC_GC_LIBS)
 
 else # LINK_STATIC != yes
 
-NON_STATIC_LIBS := $(SHARED_GC_LIBS)
-NON_STATIC_LIB_DIRS := -L$(BOEHM_GC_DIR)
+LINK_RT_LIB_OPTS=
+LINK_STD_LIB_OPTS=
+LINK_TRACE_LIB_OPTS=
 ifneq ($(LINK_BOEHM_GC_ONLY),yes)
-NON_STATIC_LIBS := -l$(RT_LIB_NAME) $(NON_STATIC_LIBS)
-NON_STATIC_LIB_DIRS := -L$(RUNTIME_DIR) $(NON_STATIC_LIB_DIRS)
+LINK_RT_LIB_OPTS = -l$(RT_LIB_NAME)
 ifneq ($(LINK_RUNTIME_ONLY),yes)
-NON_STATIC_LIBS := -l$(STD_LIB_NAME) $(NON_STATIC_LIBS)
-NON_STATIC_LIB_DIRS := -L$(LIBRARY_DIR) $(NON_STATIC_LIB_DIRS)
+LINK_STD_LIB_OPTS = -l$(STD_LIB_NAME)
 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) -L$(BROWSER_DIR) $(NON_STATIC_LIB_DIRS)
+LINK_TRACE_LIB_OPTS = -l$(TRACE_LIB_NAME) -l$(BROWSER_LIB_NAME)
 endif
 endif
 endif
 
-MLFLAGS +=	$(NON_STATIC_LIB_DIRS)
-MLLIBS +=	$(NON_STATIC_LIBS)
-MC_MAKE_FLAGS += $(NON_STATIC_LIB_DIRS) $(NON_STATIC_LIBS)
+LINK_LIB_OPTS = $(LINK_TRACE_LIB_OPTS) $(LINK_RT_LIB_OPTS) \
+			$(LINK_STD_LIB_OPTS) $(SHARED_GC_LIBS) 
+LIB_DIR_OPTS = -L$(BOEHM_GC_DIR) -L$(RUNTIME_DIR) -L$(LIBRARY_DIR) \
+			-L$(TRACE_DIR) -L$(BROWSER_DIR)
+
+MLFLAGS +=	$(LIB_DIR_OPTS)
+MLLIBS +=	$(LINK_LIB_OPTS)
 
 ifeq ($(SET_RPATH),yes)
-MLFLAGS += $(NON_STATIC_LIB_DIRS:-L%,-R%)
-MC_MAKE_FLAGS += $(NON_STATIC_LIB_DIRS:-L%,--link-flags -R%)
+MLFLAGS += $(LIB_DIR_OPTS:-L%=-R%)
 endif
 
 endif # LINK_STATIC != yes
Index: compiler/modules.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/modules.m,v
retrieving revision 1.228
diff -u -u -r1.228 modules.m
--- compiler/modules.m	15 Apr 2002 05:04:08 -0000	1.228
+++ compiler/modules.m	4 May 2002 08:57:11 -0000
@@ -3825,10 +3825,12 @@
 			yes, SplitLibFileName),
 	io__write_strings(DepStream, [
 		SplitExeFileName, " : ", SplitLibFileName, " ",
-			InitObjFileName, " ", All_MLLibsDepString, "\n",
+			InitObjFileName, " ", All_MLObjsString, " ",
+			All_MLLibsDepString, "\n",
 		"\t$(ML) $(ALL_GRADEFLAGS) $(ALL_MLFLAGS) -- $(ALL_LDFLAGS) ",
 			"-o ", SplitExeFileName, " ", InitObjFileName, " \\\n",
-		"\t	", SplitLibFileName, " $(ALL_MLLIBS)\n\n"
+		"\t	", SplitLibFileName, " ", All_MLObjsString,
+			" $(ALL_MLLIBS)\n\n"
 	]),
 
 	io__write_strings(DepStream, [
Index: compiler/options.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/options.m,v
retrieving revision 1.369
diff -u -u -r1.369 options.m
--- compiler/options.m	3 May 2002 06:52:24 -0000	1.369
+++ compiler/options.m	3 May 2002 10:08:57 -0000
@@ -1072,7 +1072,7 @@
 	install_prefix		-	string("/usr/local/"),
 	install_command		-	string("cp"),
 	libgrades		-	accumulating([]),
-	options_files		-	accumulating([]),
+	options_files		-	accumulating(["Mercury.options"]),
 	options_search_directories -	accumulating(["."]),
 	use_subdirs		-	bool(no),
 	search_directories 	-	accumulating(["."]),
@@ -3384,9 +3384,9 @@
 		"\twhich a library to be installed should be built.",
 		"--options-file <file>",
 		"\tAdd <file> to the list of options files to be processed.",
-		"\tIf no `--options-file' options are given, the file",
-		"\t`Mercury.options' in the current directory will be read",
-		"\tif it exists.",
+		"\tIf <file> is `-', an options file will be read from the",
+		"\tstandard input.  By default the file `Mercury.options'",
+		"\tin the current directory will be read.",
 		"--options-search-directory <dir>",
 		"\tAdd <dir> to the list of directories to be searched for",
 		"\toptions files.",
Index: compiler/options_file.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/options_file.m,v
retrieving revision 1.4
diff -u -u -r1.4 options_file.m
--- compiler/options_file.m	1 May 2002 18:31:20 -0000	1.4
+++ compiler/options_file.m	4 May 2002 12:59:59 -0000
@@ -85,18 +85,21 @@
 			globals__io_lookup_accumulating_option(options_files,
 				OptionsFiles),
 			{ Variables0 = options_variables_init },
-			(
-			        { OptionsFiles = [_|_] },
-				list__foldl2(
-					read_options_file(error, search, no),
-					OptionsFiles, Variables0, Variables1)
-			;
-				{ OptionsFiles = [] },
-			    	read_options_file(no_error, no_search,
-					yes(dir__this_directory),
-					"Mercury.options",
-					Variables0, Variables1)
-			)
+			{ ReadFile =
+			    (pred(OptionsFile::in, Vars0::in, Vars::out,
+					di, uo) is det -->
+				{ OptionsFile = "Mercury.options" ->
+					ErrorIfNotExist = error,
+					Search = no_search
+				;
+					ErrorIfNotExist = no_error,
+					Search = search
+				},
+				read_options_file(ErrorIfNotExist, Search, no,
+					OptionsFile, Vars0, Vars)
+			    ) },
+			list__foldl2(ReadFile, OptionsFiles,
+				Variables0, Variables1)
 		    ), R)
 	    ), OptionsFileResult),
 	(
@@ -128,21 +131,32 @@
 		maybe(dir_name)::in, string::in, options_variables::in,
 		options_variables::out, io__state::di, io__state::uo) is det.
 
-read_options_file(ErrorIfNotExist, Search, MaybeDirName, OptionsFile0,
+read_options_file(ErrorIfNotExist0, Search, MaybeDirName, OptionsFile0,
 		Variables0, Variables) -->
-	( { Search = search } ->
+    ( { OptionsFile0 = "-" } ->
+	% Read from standard input.
+	read_options_lines(dir__this_directory, Variables0, Variables)
+    ;
+	( { OptionsFile0 = "Mercury.options" } ->
+		% Don't complain if the "Mercury.options"
+		% file doesn't exist.
+		{ ErrorIfNotExist = no_error },
+		{ SearchDirs = [dir__this_directory] }
+	; { Search = search } ->
+		{ ErrorIfNotExist = ErrorIfNotExist0 },
 		globals__io_lookup_accumulating_option(
 			options_search_directories, SearchDirs)
 	;
+		{ ErrorIfNotExist = ErrorIfNotExist0 },
 		{ SearchDirs = [dir__this_directory] }
 	),
-
 	{ dir__split_name(OptionsFile0, OptionsDir, OptionsFile) },
 	(
 		% Is it an absolute pathname?
 		% XXX This won't work on Windows
 		% (but GNU Make does it this way too).
-		{ string__index(OptionsDir, 0, dir__directory_separator) }
+		{ string__index(OptionsDir, 0,
+			dir__directory_separator) }
 	->
 		{ FileToFind = OptionsFile },
 		{ Dirs = [OptionsDir] }
@@ -181,7 +195,8 @@
 		;
 			[]
 		)
-	).
+	)
+    ).
 
 :- func maybe_add_path_name(dir_name, file_name) = file_name.
 
@@ -834,7 +849,7 @@
 mmc_option_type(mcpp_flags) = option(not_split, "--mcpp-flags").
 mmc_option_type(csharp_flags) = option(not_split, "--csharp-flags").
 mmc_option_type(ml_flags) = option(not_split, "--link-flags").
-mmc_option_type(ml_objs) = option(split, "--link_object").
+mmc_option_type(ml_objs) = option(split, "--link-object").
 mmc_option_type(ml_libs) = option(not_split, "--link-flags").
 mmc_option_type(c2init_args) = option(split, "--init-file").
 mmc_option_type(libraries) = option(split, "--mercury-library").
Index: scripts/Mmake.rules
===================================================================
RCS file: /home/mercury1/repository/mercury/scripts/Mmake.rules,v
retrieving revision 1.120
diff -u -u -r1.120 Mmake.rules
--- scripts/Mmake.rules	2 May 2002 05:53:00 -0000	1.120
+++ scripts/Mmake.rules	3 May 2002 12:22:28 -0000
@@ -293,13 +293,13 @@
 ifeq ($(findstring il,$(GRADE)),il)        
 $(os_subdir)%.dll : %.cpp
 	$(MS_CL) -CLR$(MS_CL_NOASM) $(ALL_MS_CLFLAGS) \
-		-I`cygpath -w $(MERC_C_INCL_DIR)` \
-		-AI`cygpath -w $(MERC_DLL_DIR)` $< \
+		-I`$(CYGPATH) $(MERC_C_INCL_DIR)` \
+		-AI`$(CYGPATH) $(MERC_DLL_DIR)` $< \
 		-link -noentry mscoree.lib -dll $(MS_CL_LIBS) -out:$@
 	rm -f $*.obj
 
 $(os_subdir)%.dll : %.cs
-	$(MS_CSC) /t:library /lib:`cygpath -w $(MERC_DLL_DIR)` /out:$@ \
+	$(MS_CSC) /t:library /lib:`$(CYGPATH) $(MERC_DLL_DIR)` /out:$@ \
 		$(CSHARP_ASSEMBLY_REFS-$*) $(ALL_MS_CSCFLAGS) $<
 
 $(os_subdir)%.dll : %.il
@@ -411,20 +411,20 @@
 
 .cpp.dll:
 	$(MS_CL) -CLR$(MS_CL_NOASM) $(ALL_MS_CLFLAGS) \
-		-I`cygpath -w $(MERC_C_INCL_DIR)` \
-		-AI`cygpath -w $(MERC_DLL_DIR)` $< \
+		-I`$(CYGPATH) $(MERC_C_INCL_DIR)` \
+		-AI`$(CYGPATH) $(MERC_DLL_DIR)` $< \
 		-link -noentry mscoree.lib -dll $(MS_CL_LIBS) -out:$@
 	rm -f $*.obj
 
 .cs.dll:
-	$(MS_CSC) /t:library /lib:`cygpath -w $(MERC_DLL_DIR)` /out:$@ \
+	$(MS_CSC) /t:library /lib:`$(CYGPATH) $(MERC_DLL_DIR)` /out:$@ \
 		$(CSHARP_ASSEMBLY_REFS-$*) $(EXTRA_CSCFLAGS) $<
 
 .cpp.exe:
 	$(MS_CL) -CLR$(MS_CL_NOASM) -I$(MERCURY_LIBRARY_PATH) $< -link -entry:main $(MS_CL_LIBS) -out:$@
 
 .cs.exe:
-	$(MS_CSC) /lib:`cygpath -w $(MERC_DLL_DIR)` /out:$@ \
+	$(MS_CSC) /lib:`$(CYGPATH) $(MERC_DLL_DIR)` /out:$@ \
 		$(CSHARP_ASSEMBLY_REFS-$*) $(EXTRA_CSCFLAGS) $<
 
 endif # $(findstring il,$(GRADE)) != ""
@@ -436,11 +436,11 @@
 # Always attempt to rebuild these files, even if they exist.
 .PHONY: $(ALL_MC_BUILD_FILES) *.err
 $(ALL_MC_BUILD_FILES) %.err:
-	$(MCM) $(ALL_GRADEFLAGS) $(ALL_MC_MAKE_FLAGS) $@
+	$(MCM) $@
 
 # If we don't know how to make the file, try using `mmc --make'.
 .DEFAULT:
-	$(MCM) $(ALL_GRADEFLAGS) $(ALL_MC_MAKE_FLAGS) $@
+	$(MCM) $@
 
 clean_local: $(MERCURY_MAIN_MODULES:%=%.clean)
 realclean_local: $(MERCURY_MAIN_MODULES:%=%.realclean)
Index: scripts/Mmake.vars.in
===================================================================
RCS file: /home/mercury1/repository/mercury/scripts/Mmake.vars.in,v
retrieving revision 1.69
diff -u -u -r1.69 Mmake.vars.in
--- scripts/Mmake.vars.in	2 May 2002 05:53:00 -0000	1.69
+++ scripts/Mmake.vars.in	4 May 2002 05:01:46 -0000
@@ -16,6 +16,7 @@
 EXTRA_LIB_DIRS		=
 EXTRA_LIBRARIES		=
 
+ifeq ($(MMAKE_USE_MMC_MAKE),no)
 EXTRA_INT_DIRS		= $(patsubst %,%/ints,$(EXTRA_LIB_DIRS))
 MERCURY_EXTRA_INT_DIRS	= $(EXTRA_INT_DIRS)
 EXTRA_C_LIB_DIRS	= \
@@ -24,6 +25,15 @@
 EXTRA_C_INCL_DIRS	= $(patsubst %,%/inc,$(EXTRA_LIB_DIRS))
 EXTRA_INIT_DIRS		= $(patsubst %,%/modules,$(EXTRA_LIB_DIRS))
 MERCURY_EXTRA_INIT_DIRS = $(EXTRA_INIT_DIRS)
+else
+# mmc handles these itself when invoked with `--make'.
+EXTRA_INT_DIRS =
+MERCURY_EXTRA_INT_DIRS =
+EXTRA_C_LIB_DIRS =
+EXTRA_C_INCL_DIRS =
+EXTRA_INIT_DIRS =
+MERCURY_EXTRA_INIT_DIRS	=
+endif
 
 # Set the directory search path. 
 # (See the GNU Make manual for documentation about VPATH and GPATH.)
@@ -97,7 +107,24 @@
 LIB_MCFLAGS	= $(patsubst %,-I %,$(EXTRA_INT_DIRS))
 
 # Flags for use with `mmc --make'.
-ALL_MC_MAKE_FLAGS = $(ALL_MCFLAGS) $(MC_MAKE_FLAGS) $(EXTRA_MC_MAKE_FLAGS)
+# Pass the options as a Mercury.options file on stdin rather
+# than on the command line. This avoids problems with quoting
+# and unwanted word splitting.
+ECHO_MERCURY_OPTIONS = { \
+	echo MCFLAGS += '$(ALL_GRADEFLAGS) $(ALL_MCFLAGS)'; \
+	echo MCFLAGS += '$(MC_MAKE_FLAGS) $(EXTRA_MC_MAKE_FLAGS)'; \
+	echo CFLAGS += '$(ALL_CFLAGS)'; \
+	echo JAVACFLAGS += '$(ALL_JAVACFLAGS)'; \
+	echo MS_CLFLAGS += '$(ALL_MS_CLFLAGS)'; \
+	echo MS_ILASMFLAGS += '$(ALL_MS_ILASMFLAGS)'; \
+	echo C2INITARGS += '$(ALL_C2INITARGS)'; \
+	echo MLFLAGS += '$(ALL_MLFLAGS)'; \
+	echo MLLIBS += '$(ALL_MLLIBS)'; \
+	echo MLOBJS += '$(ALL_MLOBJS)'; \
+	echo EXTRA_LIBRARIES += '$(EXTRA_LIBRARIES)'; \
+	echo EXTRA_LIB_DIRS += '$(EXTRA_LIB_DIRS)'; \
+	}
+
 MC_MAKE_FLAGS	=
 EXTRA_MC_MAKE_FLAGS =
 
@@ -111,7 +138,7 @@
 MCOI		= $(MC) --make-optimization-interface
 MCTOI		= $(MC) --make-transitive-optimization-interface
 MCOGS		= $(MC) --output-grade-string
-MCM		= $(MC) --make
+MCM		= $(ECHO_MERCURY_OPTIONS) | $(MC) --make --options-file -
 
 ALL_MCIFLAGS	= $(MCIFLAGS) $(EXTRA_MCIFLAGS) $(TARGET_MCFLAGS) \
 		  $(LIB_MCFLAGS)
@@ -171,13 +198,20 @@
 
 # MS_CL is the command line version of Microsoft Visual C++, which we
 # use to compile Managed C++ code in the .NET backend.
+CYGPATH		= @CYGPATH@
 MS_CL		= @MS_CL@
 MS_VISUALCPP_DIR = @MS_VISUALCPP_DIR@
 ALL_MS_CLFLAGS	= $(MS_CLFLAGS) $(EXTRA_MS_CLFLAGS) $(TARGET_MS_CLFLAGS) \
 		$(LIB_MS_CLFLAGS)
 MS_CLFLAGS	=
 EXTRA_MS_CLFLAGS =
-MS_VC7_INCLUDES = -I"`cygpath -w '$(MS_VISUALCPP_DIR)/include'`"
+# The $(shell ...) here is to cause make to evaluate the command substitution
+# when the variable is expanded. This is necessary because the result
+# will be single-quoted when passed to the shell via ECHO_MERCURY_OPTIONS
+# to preserve possible double-quotes, so the command substitution won't
+# be run then.
+MS_VC7_INCLUDE_DIR = $(shell echo `$(CYGPATH) "$(MS_VISUALCPP_DIR)/include"`)
+MS_VC7_INCLUDES = -I"$(MS_VC7_INCLUDE_DIR)"
 LIB_MS_CLFLAGS	= $(MS_VC7_INCLUDES) $(patsubst %,-I %,$(EXTRA_C_INCL_DIRS))
 
 # MS_CL_NOASM can be used to turn off assembly generation.  Use
Index: doc/user_guide.texi
===================================================================
RCS file: /home/mercury1/repository/mercury/doc/user_guide.texi,v
retrieving revision 1.307
diff -u -u -r1.307 user_guide.texi
--- doc/user_guide.texi	19 Apr 2002 14:59:29 -0000	1.307
+++ doc/user_guide.texi	4 May 2002 14:07:17 -0000
@@ -5615,9 +5615,9 @@
 @item --options-file @var{file}
 @findex --options-file
 Add @var{file} to the list of options files to be processed.
-If no @samp{--options-file} options are given, the file
- at file{Mercury.options} in the current directory will be
-read if it exists.
+If @var{file} is @samp{-}, an options file will be read from the
+standard input.  By default the file @file{Mercury.options}
+in the current directory will be read.
 
 @item --options-search-directory @var{dir}
 Add @var{dir} to the list of directories to be searched for
Index: tests/debugger/Mmakefile
===================================================================
RCS file: /home/mercury1/repository/tests/debugger/Mmakefile,v
retrieving revision 1.74
diff -u -u -r1.74 Mmakefile
--- tests/debugger/Mmakefile	1 May 2002 18:05:01 -0000	1.74
+++ tests/debugger/Mmakefile	4 May 2002 05:32:10 -0000
@@ -298,22 +298,19 @@
 # Note that interactive.out.orig depends on $(interactive.ints) because
 # interactive.inp contains interactive queries that require interactive.ints
 # to have been built.
-
-ifeq ($(MMAKE_USE_SUBDIRS),yes)
-USE_SUBDIRS_OPT = --use-subdirs
-else
-USE_SUBDIRS_OPT =
-endif
-
-interactive.out.orig: interactive interactive.inp $(interactive.ints)
+interactive.out.orig: Mercury.options.interactive interactive \
+			interactive.inp $(interactive.ints)
 	echo "echo on" > interactive.inp.tmp
-	echo mmc_options $(USE_SUBDIRS_OPT) \
-			$(shell echo $(ALL_MC_MAKE_FLAGS)) \
+	echo mmc_options --options-file Mercury.options.interactive \
 			--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
 
+.PHONY: Mercury.options.interactive
+Mercury.options.interactive:
+	$(ECHO_MERCURY_OPTIONS) > Mercury.options.interactive
+
 # We pipe the output through sed to avoid differences for `--use-subdirs',
 # and to remove some spurious warnings that `gcc' and `ld' issue.
 # XXX we should fix the spurious warnings about unresolved symbols.
@@ -389,6 +386,9 @@
 depend_local:	$(DEPENDS)
 check_local:	$(OUTS) $(RESS)
 all_local:	$(PROGS)
+
+realclean_local:
+	rm -f Mercury.options.interactive
 
 #-----------------------------------------------------------------------------#
 
--------------------------------------------------------------------------
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