[m-dev.] diff: MLDS back-end: fixes for Mmake support

Fergus Henderson fjh at cs.mu.OZ.AU
Wed Apr 19 17:31:39 AEST 2000


Estimated hours taken: 1

Some fixes to the Mmake auto-dependency support for
the MLDS back-end.

scripts/Mmake.rules:
	When creating the dependencies, pass $(ALL_GRADEFLAGS) to mmc,
	since the `--high-level-code' option, which is a grade option
	(it corresponds to the `hlc' base grade) affects the dependencies.

compiler/mlds_to_c.m:
	Put the `#include' statements in the `.c' files rather than
	in the `.h' files.

Workspace: /home/pgrad/fjh/ws/hg
Index: compiler/mlds_to_c.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/mlds_to_c.m,v
retrieving revision 1.24
diff -u -d -r1.24 mlds_to_c.m
--- compiler/mlds_to_c.m	2000/04/18 16:41:52	1.24
+++ compiler/mlds_to_c.m	2000/04/19 06:21:54
@@ -131,19 +131,21 @@
 :- pred mlds_output_hdr_imports(indent, mlds__imports, io__state, io__state).
 :- mode mlds_output_hdr_imports(in, in, di, uo) is det.
 
-mlds_output_hdr_imports(Indent, Imports) -->
-	list__foldl(mlds_output_hdr_import(Indent), Imports).
+% XXX currently we assume all imports are source imports,
+% i.e. that the header file does not depend on any types
+% defined in other header files.
+mlds_output_hdr_imports(_Indent, _Imports) --> [].
 
 :- pred mlds_output_src_imports(indent, mlds__imports, io__state, io__state).
 :- mode mlds_output_src_imports(in, in, di, uo) is det.
 
-% XXX currently we assume all imports are header imports
-mlds_output_src_imports(_Indent, _Imports) --> [].
+mlds_output_src_imports(Indent, Imports) -->
+	list__foldl(mlds_output_src_import(Indent), Imports).
 
-:- pred mlds_output_hdr_import(indent, mlds__import, io__state, io__state).
-:- mode mlds_output_hdr_import(in, in, di, uo) is det.
+:- pred mlds_output_src_import(indent, mlds__import, io__state, io__state).
+:- mode mlds_output_src_import(in, in, di, uo) is det.
 
-mlds_output_hdr_import(_Indent, Import) -->
+mlds_output_src_import(_Indent, Import) -->
 	{ SymName = mlds_module_name_to_sym_name(Import) },
 	module_name_to_file_name(SymName, ".h", no, HeaderFile),
 	io__write_strings(["#include """, HeaderFile, """\n"]).
@@ -210,7 +212,7 @@
 	mlds_indent(Indent),
 	io__write_string("/* :- implementation. */\n"),
 	io__nl,
-	mlds_output_hdr_import(Indent,
+	mlds_output_src_import(Indent,
 		mercury_module_name_to_mlds(ModuleName)),
 	io__nl.
 
Index: scripts/Mmake.rules
===================================================================
RCS file: /home/mercury1/repository/mercury/scripts/Mmake.rules,v
retrieving revision 1.76
diff -u -d -r1.76 Mmake.rules
--- scripts/Mmake.rules	2000/02/10 08:19:33	1.76
+++ scripts/Mmake.rules	2000/04/19 05:59:40
@@ -83,7 +83,7 @@
 
 # beware the code for `%.depend' and `%.dep'/`%.dv' is duplicated
 $(deps_subdir)%.dep $(deps_subdir)%.dv:
-	$(MCD) $(ALL_MCDFLAGS) $*
+	$(MCD) $(ALL_GRADEFLAGS) $(ALL_MCDFLAGS) $*
 ifeq ($(MMAKE_USE_SUBDIRS),yes)
 	# the following mkdirs work around a bug in GNU Make
 	-[ -d Mercury/dates ] || mkdir Mercury/dates
@@ -95,7 +95,7 @@
 # beware the code for `%.depend' and `%.dep'/`%.dv' is duplicated
 .PHONY: %.depend
 %.depend :
-	$(MCD) $(ALL_MCDFLAGS) $*
+	$(MCD) $(ALL_GRADEFLAGS) $(ALL_MCDFLAGS) $*
 ifeq ($(MMAKE_USE_SUBDIRS),yes)
 	# the following mkdirs work around a bug in GNU Make
 	-[ -d Mercury/dates ] || mkdir Mercury/dates

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh>  |  of excellence is a lethal habit"
PGP: finger fjh at 128.250.37.3        |     -- the last words of T. S. Garp.
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list