[m-dev.] for review: uniform interface to tests

Mark Anthony BROWN dougl at cs.mu.OZ.AU
Thu Jul 8 19:42:07 AEST 1999


Fergus Henderson writes:
> 
> I thought about this a bit more.  I think it would be better if the targets
> `check', `dep', etc. were always recursive, for consistency with the way
> that most people structure their Makefiles, and with the way our top-level
> Makefile is structured, and with the way that `cvs' works.
> 
> Instead of changing the semantics of these targets, I think it would be
> better to add new targets `check_local', `dep_local', etc.  that acted
> only on the directory itself, not on subdirs.  This is analogous with
> the "local directory only" option (`-l') to cvs.  It also satisfies the
> goal you mentioned above of treating each directory the same, regardless
> of whether it is a top-level directory or not.
> 

OK, but this involves a bit more change, since the targets `clean'
and `realclean' normally operate in the current directory only.
This adds the new targets (and also retains the old ones); I will
post a new diff of the previous change after this has been committed.

Cheers,
Mark.

Estimated hours taken: 1

Add two new mmake targets, clean_local and realclean_local, which
are the same as clean and realclean except that the former retain their
original meanings if rules are added to the latter.  This is useful
if users want to add rules for a recursive mmake clean.

compiler/modules.m:
	Output `clean_local: module.clean' to generated .dep files
	instead of `clean: module.clean'.  Same for `realclean'.

scripts/Mmake.rules:
	Add dependencies to implement the original targets in terms of
	the new targets.

Index: compiler/modules.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/modules.m,v
retrieving revision 1.98
diff -u -r1.98 modules.m
--- modules.m	1999/05/11 03:59:39	1.98
+++ modules.m	1999/07/08 08:16:53
@@ -2565,7 +2565,7 @@
 	module_name_to_file_name(SourceModuleName, ".clean", no,
 				CleanTargetName),
 	io__write_strings(DepStream, [
-		"clean : ", CleanTargetName, "\n"
+		"clean_local : ", CleanTargetName, "\n"
 	]),
 	io__write_strings(DepStream, [
 		".PHONY : ", CleanTargetName, "\n",
@@ -2612,7 +2612,7 @@
 	module_name_to_file_name(SourceModuleName, ".realclean", no,
 			RealCleanTargetName),
 	io__write_strings(DepStream, [
-		"realclean : ", RealCleanTargetName, "\n"
+		"realclean_local : ", RealCleanTargetName, "\n"
 	]),
 	io__write_strings(DepStream, [
 		".PHONY : ", RealCleanTargetName, "\n",
Index: scripts/Mmake.rules
===================================================================
RCS file: /home/mercury1/repository/mercury/scripts/Mmake.rules,v
retrieving revision 1.67
diff -u -r1.67 Mmake.rules
--- Mmake.rules	1999/03/29 10:33:20	1.67
+++ Mmake.rules	1999/07/08 08:40:29
@@ -300,11 +300,24 @@
 
 .PHONY: clean realclean change_clean clean_nu clean_sicstus clean_prof_files
 
-realclean: clean
-
-clean: clean_prof_files
-
 clean_prof_files:
 	-rm -f Prof.CallPair Prof.Counts Prof.Decl Prof.MemWords Prof.MemCells
+
+#
+# The `clean' and `realclean' targets are implemented via `clean_local'
+# and `realclean_local'.  This allows a user to add rules in their
+# Mmakefile to do a recursive mmake clean, for example, while still being
+# able to use the local versions in their original form.
+#
+
+.PHONY: clean_local realclean_local
+
+realclean: realclean_local
+
+clean: clean_local
+
+realclean_local: clean_local
+
+clean_local: clean_prof_files
 
 #-----------------------------------------------------------------------------#

-- 
Mark Brown, PhD student            )O+  |  "Another of Fortran's breakthroughs
(m.brown at cs.mu.oz.au)                   |  was the GOTO statement, which was...
Dept. of Computer Science and Software  |  uniquely simple and understandable"
Engineering, University of Melbourne    |              -- IEEE, 1994
--------------------------------------------------------------------------
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