diff: Mmake bug fix

Fergus Henderson fjh at cs.mu.OZ.AU
Fri Jun 12 14:10:56 AEST 1998


Fix a problem where the dependency files were being remade unnecessarily.
The problem was caused by the following change:

> Instead of deleting the `_init.c' file every time we recreate
> the `.dep' file, just tell make that the `_init.c' file depends on
> the `.dep' file, so that make will remake it if the `.dep' file
> changes.  (I don't know why I didn't do it that way in the
> first place.)

The reason we didn't want the `_init.c' file to define on the `.dep'
file is that the `.dep' file is listed as depending on the top-level
`.m' file.  The fix is to change things so that the `.dep' file
is not listed as depending on the `.m' file.

scripts/Mmake.rules:
	Fix some code duplication (and subsequent code rot, caused by
	changes in one place but not the other) in the rules for `.dep'
	and `.depend'.
	Delete the `.m' file from the dependencies for the `.dep' file.

Index: scripts/Mmake.rules
===================================================================
RCS file: /home/mercury1/repository/mercury/scripts/Mmake.rules,v
retrieving revision 1.61
diff -u -r1.61 Mmake.rules
--- Mmake.rules	1998/05/29 04:20:32	1.61
+++ Mmake.rules	1998/06/12 04:02:31
@@ -73,9 +73,9 @@
 # Rules for building dependency files
 #
 
-$(deps_subdir)%.dep: %.m
-	@-[ ! -f $(deps_subdir)$*.dep ] || chmod +w $(deps_subdir)$*.dep
-	$(MCD) $(MCDFLAGS) $<
+.PHONY: %.depend
+%.depend : $(deps_subdir)%.dep
+	@:
 
 # When creating the dependencies with `--use-subdirs' enabled,
 # we need to create the `Mercury/dates' directory manually
@@ -84,10 +84,8 @@
 # I have sent off a bug report to the GNU Make maintainers (19 March 1998).
 #	-fjh.
 
-.PHONY: %.depend
-%.depend : %.m
-	$(MCD) $(MCDFLAGS) $<
-	-rm -f $(cs_subdir)$*_init.c
+$(deps_subdir)%.dep:
+	$(MCD) $(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.



More information about the developers mailing list