[m-rev.] for review: fix installation of `.opt' files

Simon Taylor stayl at cs.mu.OZ.AU
Wed Jul 3 16:35:32 AEST 2002


Estimated hours taken: 10
Branches: main

In the presence of foreign code the `.opt' and `.trans_opt' files
aren't grade independent, so install them in grade-dependent
directories.

scripts/Mmake.vars.in:
	Define $(INSTALL_GRADE_INT_DIR), which holds `.opt'
	and `.trans_opt' files.

	Pass the extra libraries to mmc using `--ml' and `--mld'
	(`--mercury-library' and `--mercury-library-directory')
	options, rather than just a `-I' option. This is needed
	so that $(INSTALL_GRADE_INT_DIR) is searched for `.opt'
	files before $(INSTALL_INT_DIR)

	Fix a bug -- the `-I' options for libraries should
	go in CFLAGS, not MGNUCFLAGS.

scripts/Mmake.rules:
	Create INSTALL_GRADE_INT_DIR in the install_grade_dirs target.

compiler/modules.m:
	Install `.opt' and `.trans_opt' files in $(INSTALL_GRADE_INT_DIR).

	`.int0' files are needed by `.opt' files for sub-modules, so
	install them.

	<module>.int0s now only contains the names of modules with sub-modules
	(this is needed to avoid attempting to install nonexistent `.int0'
	files).

compiler/handle_options.m:
	Add $(INSTALL_GRADE_INT_DIR) for each `--mercury-library' option
	to `--intermod-directories'.

Mmakefile:
scripts/Mmake.vars.in:
scripts/Mmake.rules:
	Simplify the code to copy/remove the grade dependent files
	before building the libraries in a new grade when installing.

	Copy/remove all grade-dependent files, including `.opt' files
	and `.dv' files.

Index: Mmakefile
===================================================================
RCS file: /home/mercury1/repository/mercury/Mmakefile,v
retrieving revision 1.82
diff -u -u -r1.82 Mmakefile
--- Mmakefile	26 Jun 2002 06:59:03 -0000	1.82
+++ Mmakefile	2 Jul 2002 17:06:19 -0000
@@ -402,22 +402,18 @@
 
 .PHONY: install_grades
 install_grades: scripts
-	cd boehm_gc && rm -rf tmp_dir && mkdir tmp_dir && \
-		{ mv -f *.$O *.pic_o *.$A *.so tmp_dir || true; }
-	cd runtime && rm -rf tmp_dir && mkdir tmp_dir && \
-		{ mv -f *.$O *.pic_o *.$A *.so tmp_dir || true; }
-	cd library && rm -rf tmp_dir && mkdir tmp_dir && \
-		{ mv -f *.dep *.mih *.c *.c_date *.$O *.pic_o *.$A *.so \
-			*.used Mercury/useds/*.used Mercury/deps/*.dep \
-			Mercury/cs/*.c Mercury/c_dates/*.c_date \
-			Mercury/mihs/*.mih Mercury/os/*.$O tmp_dir || true; }
-	cd browser && rm -rf tmp_dir && mkdir tmp_dir && \
-		{ mv -f *.dep *.mih *.c *.c_date *.$O *.pic_o *.$A *.so \
-			*.used Mercury/useds/*.used Mercury/deps/*.dep \
-			Mercury/cs/*.c Mercury/c_dates/*.c_date \
-			Mercury/mihs/*.mih Mercury/os/*.$O tmp_dir || true; }
-	cd trace && rm -rf tmp_dir && mkdir tmp_dir && \
-		{ mv -f *.$O *.pic_o *.$A *.so tmp_dir || true; }
+	for dir in boehm_gc runtime trace; do \
+	    ( cd $$dir; rm -rf tmp_dir; mkdir tmp_dir; \
+		mv -f *.$O *.pic_o *.$A *.so tmp_dir; true ); \
+	done
+	for dir in library browser; do \
+	    ( cd $$dir && rm -rf tmp_dir && mkdir tmp_dir && \
+		for ext in $(GRADE_SUBDIR_EXTS); do \
+		    mv -f *.$$ext Mercury/$${ext}s/*.$$ext tmp_dir; \
+		done; \
+		mv -f $(deps_subdir)*.dep $(deps_subdir)*.dv *.$O \
+			Mercury/os/*.$O *.$A *.so tmp_dir; true ); \
+	done
 	#
 	# Use the newly installed compiler to build the libraries
 	# in various different grades.  We need to override MC=mmc
@@ -441,42 +437,32 @@
 		  $(SUBDIR_MMAKE) MC=mmc GRADE=$$grade install_library ) && \
 		( cd trace && \
 		  $(SUBDIR_MMAKE) MC=mmc GRADE=$$grade install_lib ) && \
-		( cd boehm_gc && rm -f *.$O *.pic_o *.$A *.so ) && \
-		( cd runtime && rm -f *.$O *.pic_o *.$A *.so ) && \
-		( cd library && rm -f *.dep *.mih *.c *.c_date \
-			*.$O *.pic_o *.$A *.so Mercury/cs/*.c \
-			Mercury/c_dates/*.c_date Mercury/mihs/*.mih \
-			Mercury/os/*.$O ) && \
-		( cd browser && rm -f *.dep *.mih *.c *.c_date \
-			*.$O *.pic_o *.$A *.so Mercury/cs/*.c \
-			Mercury/c_dates/*.c_date Mercury/mihs/*.mih \
-			Mercury/os/*.$O ) && \
-		( cd trace && rm -f *.$O *.pic_o *.$A *.so ) && \
-		true \
+		for dir in boehm_gc runtime trace; do \
+			( cd $$dir && rm -f *.$O *.pic_o *.$A *.so ); \
+		done && \
+		for dir in library browser; do \
+		   ( cd $$dir && \
+		   	for ext in $(GRADE_SUBDIR_EXTS); do \
+				rm -f *.$$ext Mercury/$${ext}s/*.$$ext; \
+			done && \
+			rm -f $(deps_subdir)*.dep $(deps_subdir)*.dv *.$O \
+				Mercury/os/*.$O *.$A *.so ); \
+		done \
 		|| { scripts/mercury_cleanup_install; exit 1; }; \
 	    fi; \
 	done
-	cd boehm_gc && { mv tmp_dir/* . ; rmdir tmp_dir; true; }
-	cd runtime  && { mv tmp_dir/* . ; rmdir tmp_dir; true; }
-	cd library  && { [ -d Mercury/cs ] && mv tmp_dir/*.c Mercury/cs; \
-			 [ -d Mercury/mihs ] && mv tmp_dir/*.mih Mercury/mihs; \
-			 [ -d Mercury/os ] && mv tmp_dir/*.$O Mercury/os; \
-			 [ -d Mercury/deps ] && mv tmp_dir/*.dep Mercury/deps;\
-			 [ -d Mercury/c_dates ] && \
-			 	mv tmp_dir/*.c_date Mercury/c_dates;\
-			 [ -d Mercury/useds ] && \
-			 	mv tmp_dir/*.used Mercury/useds;\
-			 mv tmp_dir/* . ; rmdir tmp_dir; true; }
-	cd browser  && { [ -d Mercury/cs ] && mv tmp_dir/*.c Mercury/cs; \
-			 [ -d Mercury/mihs ] && mv tmp_dir/*.mih Mercury/mihs; \
-			 [ -d Mercury/os ] && mv tmp_dir/*.$O Mercury/os; \
-			 [ -d Mercury/deps ] && mv tmp_dir/*.dep Mercury/deps;\
-			 [ -d Mercury/c_dates ] && \
-			 	mv tmp_dir/*.c_date Mercury/c_dates;\
-			 [ -d Mercury/useds ] && \
-			 	mv tmp_dir/*.used Mercury/useds;\
-			 mv tmp_dir/* . ; rmdir tmp_dir; true; }
-	cd trace    && { mv tmp_dir/* . ; rmdir tmp_dir; true; }
+	for dir in boehm_gc runtime trace; do \
+	    ( cd $$dir && { mv tmp_dir/* . ; rmdir tmp_dir; true; } ); \
+	done
+	for dir in library browser; do \
+	    ( cd $$dir && { \
+		for ext in $(GRADE_SUBDIR_EXTS); do \
+		    [ -d Mercury/$${ext}s ] && \
+		    	mv tmp_dir/*.$$ext Mercury/$${ext}s; \
+		done; \
+		mv tmp_dir/*.dep tmp_dir/*.dv $(deps_subdir).; \
+	    	mv tmp_dir/* . ; rmdir tmp_dir; true; } ); \
+	done
 
 .PHONY: install_split_library
 install_split_library: scripts dep_library
@@ -490,23 +476,25 @@
 	+cd library && \
 	rm -rf tmp_dir && \
 	mkdir tmp_dir && \
-	{ mv -f *.dir *.dep *.mih *.c *.c_date *.$O *.pic_o *.$A *.so \
-		Mercury/cs/*.c Mercury/c_dates/*.c Mercury/mihs/*.mih \
-		Mercury/c_dates Mercury/os/*.$O tmp_dir || true; } && \
+	for ext in $(GRADE_SUBDIR_EXTS); do \
+		mv -f *.$$ext Mercury/$${ext}s/*.$$ext $tmp_dir; \
+	done || true && \
+	{ mv -f $(deps_subdir)*.dep $(deps_subdir)*.dv *.$O Mercury/os/*.$O \
+		*.$A *.so tmp_dir || true; }) && \
 	for grade in $(GRADE) $(LIBGRADES); do \
 	        $(SUBDIR_MMAKE) MC=mmc GRADE=$$grade depend && \
 	        $(SUBDIR_MMAKE) MC=mmc GRADE=$$grade install_split_library || \
 			{ scripts/mercury_cleanup_install; exit 1; }; \
-	        rm -rf *.dir *.dep *.mih *.c *.$O *.pic_o *.$A *.so \
-			Mercury/cs/*.c Mercury/c_dates/*.c Mercury/mihs/*.mih \
-			Mercury/c_dates Mercury/os/*.$O; \
+		for ext in $(GRADE_SUBDIR_EXTS); do \
+			rm -f *.$$ext Mercury/$${ext}s/*.$$ext; \
+		done; \
+		rm -f *.$O Mercury/os/*.$O *.$A *.so; \
 	done && \
-	{ [ -d Mercury/cs ] && mv tmp_dir/*.c Mercury/cs; \
-	  [ -d Mercury/c_dates ] && mv tmp_dir/*.c_date Mercury/c_dates; \
-	  [ -d Mercury/mihs ] && mv tmp_dir/*.mih Mercury/mihs; \
-	  [ -d Mercury/os ] && mv tmp_dir/*.$O Mercury/os; \
-	  [ -d Mercury/deps ] && mv tmp_dir/*.dep Mercury/deps; \
-	  mv tmp_dir/* . ; rmdir tmp_dir; true; }
+	{ for $$ext in $(GRADE_SUBDIR_EXTS); do \
+	    [ -d Mercury/$${ext}s ] && mv tmp_dir/*.$$ext Mercury/$${ext}s; \
+	done; \
+	mv tmp_dir/*.dep tmp_dir/*.dv $(deps_subdir).; \
+	mv tmp_dir/* . ; rmdir tmp_dir; true; }
 
 #-----------------------------------------------------------------------------#
 #
Index: compiler/handle_options.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/handle_options.m,v
retrieving revision 1.141
diff -u -u -r1.141 handle_options.m
--- compiler/handle_options.m	28 Jun 2002 09:13:42 -0000	1.141
+++ compiler/handle_options.m	30 Jun 2002 17:26:51 -0000
@@ -892,8 +892,9 @@
 	),
 
 	%
-	% Handle C header and library search directories. These couldn't
-	% be handled by options.m because they are grade dependent.
+	% Handle the `.opt', C header and library search directories.
+	% These couldn't be handled by options.m because they are grade
+	% dependent.
 	%
 	globals__io_lookup_accumulating_option(mercury_library_directories,
 		MercuryLibDirs),
@@ -925,7 +926,19 @@
 		globals__io_lookup_accumulating_option(c_include_directory,
 			CIncludeDirs),
 		globals__io_set_option(c_include_directory,
-			accumulating(CIncludeDirs ++ ExtraCIncludeDirs))
+			accumulating(CIncludeDirs ++ ExtraCIncludeDirs)),
+
+		{ ExtraIntermodDirs = list__map(
+				(func(MercuryLibDir) =
+					dir__make_path_name(MercuryLibDir,
+					dir__make_path_name("ints",
+					GradeString
+					))
+				), MercuryLibDirs) },
+		globals__io_lookup_accumulating_option(intermod_directories,
+			IntermodDirs0),
+		globals__io_set_option(intermod_directories,
+			accumulating(IntermodDirs0 ++ ExtraIntermodDirs))
 	;
 		{ MercuryLibDirs = [] }
 	),
@@ -937,12 +950,11 @@
 		UseSearchDirs),
 	( { UseSearchDirs = yes } ->
 		globals__io_lookup_accumulating_option(intermod_directories,
-			IntermodDirs0),
+			IntermodDirs1),
 		globals__io_lookup_accumulating_option(search_directories,
 			SearchDirs),
-		{ list__append(IntermodDirs0, SearchDirs, IntermodDirs) },
 		globals__io_set_option(intermod_directories,
-			accumulating(IntermodDirs))
+			accumulating(IntermodDirs1 ++ SearchDirs))
 	;
 		[]
 	),
Index: compiler/modules.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/modules.m,v
retrieving revision 1.239
diff -u -u -r1.239 modules.m
--- compiler/modules.m	30 Jun 2002 17:06:33 -0000	1.239
+++ compiler/modules.m	2 Jul 2002 15:34:13 -0000
@@ -860,6 +860,7 @@
 			; Ext = ".realclean"
 			; Ext = ".depend"
 			; Ext = ".install_ints"
+			; Ext = ".install_opts"
 			; Ext = ".install_hdrs"
 			; Ext = ".install_grade_hdrs"
 			; Ext = ".check"
@@ -3791,13 +3792,16 @@
 					Basis, DepStream),
 	io__write_string(DepStream, "\n"),
 
-	% The .int0s list should really only include modules that
-	% contain sub-modules.  But currently it's only used for
-	% the `mmake clean' rule, so it doesn't matter.
+	% `.int0' files are only generated for modules with sub-modules.
+	{ ModulesWithSubModules = list__filter(
+			(pred(Module::in) is semidet :-
+			    map__lookup(DepsMap, Module,
+			    		deps(_, ModuleImports)),
+			    ModuleImports ^ children \= []
+			), Modules) },
 	io__write_string(DepStream, MakeVarName),
 	io__write_string(DepStream, ".int0s = "),
-	write_compact_dependencies_list(Modules, "$(int0s_subdir)", ".int0",
-					Basis, DepStream),
+	write_dependencies_list(ModulesWithSubModules, ".int0", DepStream),
 	io__write_string(DepStream, "\n"),
 
 	io__write_string(DepStream, MakeVarName),
@@ -4067,9 +4071,31 @@
 	module_name_to_lib_file_name("lib", ModuleName, ".install_ints", no,
 				LibInstallIntsTargetName),
 	{ Intermod = yes -> OptStr = " opt" ; OptStr = "" },
+	{
+		Intermod = yes,
+		map__member(DepsMap, _, deps(_, Imports)),
+		Imports ^ children \= []
+	->
+		% The `.int0' files only need to be installed with
+		% `--intermodule-optimization'.
+		Int0Str = " int0",
+		MaybeInt0sVar = "$(" ++ MakeVarName ++ ".int0s) "
+	;
+		Int0Str = "",
+		MaybeInt0sVar = ""
+	},
 	{ TransOpt = yes -> TransOptStr = " trans_opt" ; TransOptStr = "" },
 	{ MmcMakeDeps = yes -> DepStr = " module_dep" ; DepStr = "" },
-	{ InstallIntsRuleBody = string__append_list([
+
+	io__write_strings(DepStream, [
+		".PHONY : ", LibInstallIntsTargetName, "\n",
+		LibInstallIntsTargetName, " : $(", MakeVarName, ".ints) $(",
+			MakeVarName, ".int3s) ", MaybeInt0sVar, MaybeOptsVar,
+			MaybeTransOptsVar, MaybeModuleDepsVar,
+			" install_lib_dirs\n",
+		"\tfiles=""$(", MakeVarName, ".ints) $(", MakeVarName,
+			".int3s) ", MaybeInt0sVar, MaybeOptsVar,
+			MaybeTransOptsVar, MaybeModuleDepsVar, """; \\\n",
 "		for file in $$files; do \\
 			target=""$(INSTALL_INT_DIR)/`basename $$file`""; \\
 			if cmp -s ""$$file"" ""$$target""; then \\
@@ -4082,7 +4108,8 @@
 		# The following is needed to support the `--use-subdirs' option
 		# We try using `ln -s', but if that fails, then we just use
 		# `$(INSTALL)'.
-		for ext in int int2 int3", OptStr, TransOptStr, DepStr, "; do \\
+		for ext in int int2 int3", Int0Str, OptStr,
+				TransOptStr, DepStr, "; do \\
 			dir=""$(INSTALL_INT_DIR)/Mercury/$${ext}s""; \\
 			rm -f ""$$dir""; \\
 			ln -s .. ""$$dir"" || { \\
@@ -4091,20 +4118,51 @@
 				$(INSTALL) ""$(INSTALL_INT_DIR)""/*.$$ext \\
 					""$$dir""; \\
 			} || exit 1; \\
-		done\n\n"]) },
-
-	io__write_strings(DepStream, [
-		".PHONY : ", LibInstallIntsTargetName, "\n",
-		LibInstallIntsTargetName, " : $(", MakeVarName, ".ints) $(",
-			MakeVarName, ".int3s) ", MaybeOptsVar,
-			MaybeTransOptsVar, MaybeModuleDepsVar,
-			"install_lib_dirs\n",
-		"\tfiles=""$(", MakeVarName, ".ints) $(", MakeVarName,
-			".int3s) ", MaybeOptsVar, MaybeTransOptsVar,
-			MaybeModuleDepsVar, """; \\\n",
-		InstallIntsRuleBody
+		done\n\n"
 	]),
 
+	%
+	% XXX  Note that we install the `.opt' and `.trans_opt' files
+	% in two places: in the `lib/$(GRADE)/opts/inc' directory, so
+	% that mmc will find them, and also in the `ints' directory,
+	% so that Mmake will find them.  That's not ideal, but it works.
+	%
+	module_name_to_lib_file_name("lib", ModuleName,
+		".install_opts", no, LibInstallOptsTargetName),
+	io__write_strings(DepStream,
+		[".PHONY : ", LibInstallOptsTargetName, "\n",
+		LibInstallOptsTargetName, " : "]),
+	( { Intermod \= yes, TransOpt \= yes } ->
+	    io__write_string(DepStream, "\n\t@:\n\n")
+	;
+	    io__write_strings(DepStream, [
+		MaybeOptsVar, MaybeTransOptsVar, "install_grade_dirs\n",
+		"\tfiles=""", MaybeOptsVar, MaybeTransOptsVar, """; \\\n",
+"		for file in $$files; do \\
+			target=""$(INSTALL_GRADE_INT_DIR)/`basename $$file`"";\\
+			if cmp -s ""$$file"" ""$$target""; then \\
+				echo \"$$target unchanged\"; \\
+			else \\
+				echo \"installing $$target\"; \\
+				$(INSTALL) ""$$file"" ""$$target""; \\
+			fi; \\
+		done
+		# The following is needed to support the `--use-subdirs' option
+		# We try using `ln -s', but if that fails, then we just use
+		# `$(INSTALL)'.
+		for ext in ", OptStr, TransOptStr, "; do \\
+			dir=""$(INSTALL_GRADE_INT_DIR)/Mercury/$${ext}s""; \\
+			rm -f ""$$dir""; \\
+			ln -s .. ""$$dir"" || { \\
+				{ [ -d ""$$dir"" ] || \\
+					$(INSTALL_MKDIR) ""$$dir""; } && \\
+				$(INSTALL) ""$(INSTALL_GRADE_INT_DIR)""/*.$$ext \\
+					""$$dir""; \\
+			} || exit 1; \\
+		done\n\n"
+	    ])
+	),
+	
 	%
 	% XXX  Note that we install the header files in two places:
 	% in the `lib/inc' or `lib/$(GRADE)/$(FULLARCH)/inc' directory,
Index: scripts/Mmake.rules
===================================================================
RCS file: /home/mercury1/repository/mercury/scripts/Mmake.rules,v
retrieving revision 1.129
diff -u -u -r1.129 Mmake.rules
--- scripts/Mmake.rules	26 Jun 2002 08:20:55 -0000	1.129
+++ scripts/Mmake.rules	2 Jul 2002 16:16:02 -0000
@@ -472,52 +472,68 @@
 
 .PHONY: lib%.install_library
 lib%.install_library: lib%.a lib%.$(EXT_FOR_SHARED_LIB) \
-			install_grade_dirs lib%.install_grade_hdrs
+			install_grade_dirs lib%.install_grade_hdrs \
+			lib%.install_opts
 	$(INSTALL) `vpath_find lib$*.a lib$*.$(EXT_FOR_SHARED_LIB)` \
 			$(INSTALL_MERC_LIB_DIR)
 
 lib%.install_split_library: %.split.a install_grade_dirs
 	$(INSTALL) `vpath_find $*.split.a` $(INSTALL_MERC_LIB_DIR)/lib$*.a
 
+# XXX grade_files only contains the files for the default grade, not the
+# current grade in each iteration of the loop over ALL_LIBGRADES below.
 lib%.install_grades:
 	rm -rf tmp_dir && \
 	mkdir tmp_dir && \
-	{ mv -f $(deps_subdir)$*.dep $($*.mihs) $($*.cs) $($*.c_dates) \
-		$($*.os) $($*.pic_os) *.a *.so tmp_dir || true; } && \
+	grade_files="$(foreach ext,$(GRADE_SUBDIR_EXTS),$($*.$(ext)s))" && \
+	for file in x $$grade_files; do \
+		if [ "$$file" != "x" ]; then \
+			mv -f $$file tmp_dir > /dev/null 2>&1; \
+		fi; \
+	done && \
+	{ mv -f $(deps_subdir)$*.dep $(deps_subdir)$*.dv \
+		*.a *.so tmp_dir || true; } && \
 	for grade in x $(ALL_LIBGRADES); do \
 		if [ "$$grade" != "x" ]; then \
 			$(MMAKE) GRADE=$$grade $*.depend || \
 				exit 1; \
 			$(MMAKE) GRADE=$$grade lib$*.install_library || \
 				exit 1; \
-			rm -f $(deps_subdir)$*.dep $($*.mihs) $($*.cs) \
-				$($*.c_dates) $($*.os) $($*.pic_os) *.a *.so; \
+			for file in x $$grade_files; do \
+				if [ "$$file" != "x" ]; then \
+					rm -f $$file; \
+				fi; \
+			done; \
+			rm -f $(deps_subdir)$*.dep $(deps_subdir)$*.dv \
+				*.a *.so; \
 		fi; \
 	done && \
-	{ mv tmp_dir/*.c $(cs_subdir). ; \
-	  mv tmp_dir/*.$O $(os_subdir). ; \
-	  mv tmp_dir/*.c_date $(c_dates_subdir). ; \
-	  mv tmp_dir/*.pic_o $(os_subdir). ; \
-	  mv tmp_dir/*.dep $(deps_subdir). ; \
-	  mv tmp_dir/* . ; rmdir tmp_dir ; true; }
+	for file in x $$grade_files; do \
+		if [ "$$file" != "x" ]; then \
+		    mv -f tmp_dir/`basename $$file` $$file > /dev/null 2>&1; \
+		fi; \
+	done && \
+	{ mv -f tmp_dir/*.dep tmp_dir/*.dv $(deps_subdir).; \
+		mv -f tmp_dir/* .; rmdir tmp_dir; true; }
 
 lib%.install_split_grades:
 	rm -rf tmp_dir && \
 	mkdir tmp_dir && \
-	{ mv -f $(deps_subdir)$*.dep $($*.mihs) $($*.dirs) *.a *.so \
-		tmp_dir || true; } && \
+	{ mv -f $(deps_subdir)$*.dep $(deps_subdir)$*.dv $($*.mihs) \
+		$($*.dirs) *.a *.so tmp_dir || true; } && \
 	for grade in x $(ALL_LIBGRADES); do \
 		if [ "$$grade" != "x" ]; then \
 			$(MMAKE) GRADE=$$grade $*.depend || \
 				exit 1; \
 			$(MMAKE) GRADE=$$grade lib$*.install_split_library || \
 				exit 1; \
-			rm -rf $(deps_subdir)$*.dep $($*.mihs) $($*.dirs) \
-				*.a *.so; \
+			rm -rf $(deps_subdir)$*.dep $(deps_subdir)$*.dv \
+				$($*.mihs) $($*.dirs) *.a *.so; \
 		fi; \
 	done && \
 	{ mv tmp_dir/*.dir $(dirs_subdir). ; \
 	  mv tmp_dir/*.dep $(deps_subdir). ; \
+	  mv tmp_dir/*.dv $(deps_subdir). ; \
 	  mv tmp_dir/* . ; rmdir tmp_dir ; true; }
 
 
@@ -536,8 +552,12 @@
 		$(INSTALL_MKDIR) $(INSTALL_MERC_LIB_DIR)
 	-[ -d $(INSTALL_GRADE_INC_DIR) ] || \
 		$(INSTALL_MKDIR) $(INSTALL_GRADE_INC_DIR)
+	-[ -d $(INSTALL_GRADE_INT_DIR) ] || \
+		$(INSTALL_MKDIR) $(INSTALL_GRADE_INT_DIR)
 	# The following is needed to support the `--use-subdirs' option
 	-[ -d $(INSTALL_GRADE_INC_DIR)/Mercury ] || \
 		$(INSTALL_MKDIR) $(INSTALL_GRADE_INC_DIR)/Mercury
+	-[ -d $(INSTALL_GRADE_INT_DIR)/Mercury ] || \
+		$(INSTALL_MKDIR) $(INSTALL_GRADE_INT_DIR)/Mercury
 
 #-----------------------------------------------------------------------------#
Index: scripts/Mmake.vars.in
===================================================================
RCS file: /home/mercury1/repository/mercury/scripts/Mmake.vars.in,v
retrieving revision 1.74
diff -u -u -r1.74 Mmake.vars.in
--- scripts/Mmake.vars.in	24 Jun 2002 16:15:22 -0000	1.74
+++ scripts/Mmake.vars.in	2 Jul 2002 16:42:13 -0000
@@ -105,7 +105,8 @@
 ALL_MCFLAGS	= $(MCFLAGS) $(EXTRA_MCFLAGS) $(TARGET_MCFLAGS) $(LIB_MCFLAGS)
 MCFLAGS		=
 EXTRA_MCFLAGS	=
-LIB_MCFLAGS	= $(patsubst %,-I %,$(EXTRA_INT_DIRS))
+LIB_MCFLAGS	= $(patsubst %,--mld %,$(EXTRA_LIB_DIRS)) \
+			$(patsubst %,--ml %,$(EXTRA_LIBRARIES))
 
 # Flags for use with `mmc --make'.
 # Pass the options as a Mercury.options file on stdin rather
@@ -185,14 +186,14 @@
 
 MGNUC		= mgnuc
 ALL_MGNUCFLAGS	= $(MGNUCFLAGS) $(EXTRA_MGNUCFLAGS) $(TARGET_MGNUCFLAGS) \
-		  $(LIB_MGNUCFLAGS) -- $(ALL_CFLAGS)
+		  -- $(ALL_CFLAGS)
 MGNUCFLAGS	=
 EXTRA_MGNUCFLAGS =
-LIB_MGNUCFLAGS	= $(patsubst %,-I %,$(EXTRA_C_INCL_DIRS))
 
-ALL_CFLAGS	= $(CFLAGS) $(EXTRA_CFLAGS) $(TARGET_CFLAGS)
+ALL_CFLAGS	= $(CFLAGS) $(EXTRA_CFLAGS) $(TARGET_CFLAGS) $(LIB_CFLAGS)
 CFLAGS		=
 EXTRA_CFLAGS	=
+LIB_CFLAGS	= $(patsubst %,-I %,$(EXTRA_C_INCL_DIRS))
 
 #-----------------------------------------------------------------------------#
 #
@@ -525,6 +526,14 @@
 # `--use-subdirs' option.
 #
 
+# Extensions for which the subdirectory contains grade-dependent files
+# which need to be moved away or deleted before building a library
+# in another grade. There must be a $(main_module.$(ext)s) variable
+# for each of these extensions.
+GRADE_SUBDIR_EXTS = \
+	mih optdate trans_opt trans_opt_date c c_date java java_date \
+	class il il_date dll s s_date pic_s pic_s_date o pic_o
+
 ifeq ($(MMAKE_USE_SUBDIRS),yes)
 
 # If you change any of these, you may need to update
@@ -676,6 +685,7 @@
 
 INSTALL_MODULE_DIR	= $(INSTALL_LIBDIR)/modules
 INSTALL_INT_DIR		= $(INSTALL_LIBDIR)/ints
+INSTALL_GRADE_INT_DIR	= $(INSTALL_LIBDIR)/ints/$(GRADESTRING)
 INSTALL_INC_DIR		= $(INSTALL_LIBDIR)/inc
 INSTALL_MMAKE_DIR	= $(INSTALL_LIBDIR)/mmake
 FULLARCH		= @FULLARCH@
--------------------------------------------------------------------------
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