[m-rev.] for review: Mmake.rules

Zoltan Somogyi zs at cs.mu.OZ.AU
Wed May 4 18:30:05 AEST 2005


For review by anyone.

Zoltan.

scripts/Mmake.rules:
	Improve the rules for creating the subdirs of Mercury in two ways.
	First, instead of letting make create a sh process for each subdir
	we want to create by creating each subdir in a separate action,
	make them all part of a single action, for which make generates
	a single sh process. Second, don't print this action unless the user
	explicitly requests this by setting MMAKE_USE_SUBDIRS_EXPLICIT to yes.

===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/scripts/Mmake.rules,v
retrieving revision 1.147
diff -u -b -r1.147 Mmake.rules
--- Mmake.rules	28 Jan 2005 07:11:58 -0000	1.147
+++ Mmake.rules	3 May 2005 07:25:49 -0000
@@ -81,43 +81,71 @@
 
 ifneq ($(MMAKE_USE_MMC_MAKE),yes)
 
-# beware the code for `%.depend' and `%.dep'/`%.dv' is duplicated
+# Beware the code for `%.depend' and `%.dep'/`%.dv' is duplicated,
+# with each copy having two variants that differ only by a @ and a comment.
 $(deps_subdir)%.dep $(deps_subdir)%.dv:
 	$(MCD) $(ALL_GRADEFLAGS) $(ALL_MCDFLAGS) $*
 ifeq ($(MMAKE_USE_SUBDIRS),yes)
+ifeq ($(MMAKE_USE_SUBDIRS_EXPLICIT),yes)
 	# javac doesn't create the destination directory for class files
 	# so we must create it manually
-	-[ -d $(classes_subdir) ] || mkdir $(classes_subdir)
 	# the following mkdirs work around a bug in GNU Make
-	-[ -d Mercury/dates ] || mkdir Mercury/dates
-	-[ -d Mercury/date0s ] || mkdir Mercury/date0s
-	-[ -d Mercury/date3s ] || mkdir Mercury/date3s
-	-[ -d Mercury/optdates ] || mkdir Mercury/optdates
-	-[ -d Mercury/trans_opt_dates ] || mkdir Mercury/trans_opt_dates
-	-[ -d Mercury/c_dates ] || mkdir Mercury/c_dates
-	-[ -d Mercury/il_dates ] || mkdir Mercury/il_dates
-	-[ -d Mercury/s_dates ] || mkdir Mercury/s_dates
-	-[ -d Mercury/pic_s_dates ] || mkdir Mercury/pic_s_dates
+	-[ -d $(classes_subdir) ] || mkdir $(classes_subdir) ; \
+	[ -d Mercury/dates ] || mkdir Mercury/dates ; \
+	[ -d Mercury/date0s ] || mkdir Mercury/date0s ; \
+	[ -d Mercury/date3s ] || mkdir Mercury/date3s ; \
+	[ -d Mercury/optdates ] || mkdir Mercury/optdates ; \
+	[ -d Mercury/trans_opt_dates ] || mkdir Mercury/trans_opt_dates ; \
+	[ -d Mercury/c_dates ] || mkdir Mercury/c_dates ; \
+	[ -d Mercury/il_dates ] || mkdir Mercury/il_dates ; \
+	[ -d Mercury/s_dates ] || mkdir Mercury/s_dates ; \
+	[ -d Mercury/pic_s_dates ] || mkdir Mercury/pic_s_dates
+else
+	@-[ -d $(classes_subdir) ] || mkdir $(classes_subdir) ; \
+	[ -d Mercury/dates ] || mkdir Mercury/dates ; \
+	[ -d Mercury/date0s ] || mkdir Mercury/date0s ; \
+	[ -d Mercury/date3s ] || mkdir Mercury/date3s ; \
+	[ -d Mercury/optdates ] || mkdir Mercury/optdates ; \
+	[ -d Mercury/trans_opt_dates ] || mkdir Mercury/trans_opt_dates ; \
+	[ -d Mercury/c_dates ] || mkdir Mercury/c_dates ; \
+	[ -d Mercury/il_dates ] || mkdir Mercury/il_dates ; \
+	[ -d Mercury/s_dates ] || mkdir Mercury/s_dates ; \
+	[ -d Mercury/pic_s_dates ] || mkdir Mercury/pic_s_dates
+endif
 endif
 
-# beware the code for `%.depend' and `%.dep'/`%.dv' is duplicated
+# Beware the code for `%.depend' and `%.dep'/`%.dv' is duplicated,
+# with each copy having two variants that differ only by a @ and a comment.
 .PHONY: %.depend
 %.depend :
 	$(MCD) $(ALL_GRADEFLAGS) $(ALL_MCDFLAGS) $*
 ifeq ($(MMAKE_USE_SUBDIRS),yes)
+ifeq ($(MMAKE_USE_SUBDIRS_EXPLICIT),yes)
 	# javac doesn't create the destination directory for class files
 	# so we must create it manually
-	-[ -d $(classes_subdir) ] || mkdir $(classes_subdir)
 	# the following mkdirs work around a bug in GNU Make
-	-[ -d Mercury/dates ] || mkdir Mercury/dates
-	-[ -d Mercury/date0s ] || mkdir Mercury/date0s
-	-[ -d Mercury/date3s ] || mkdir Mercury/date3s
-	-[ -d Mercury/optdates ] || mkdir Mercury/optdates
-	-[ -d Mercury/trans_opt_dates ] || mkdir Mercury/trans_opt_dates
-	-[ -d Mercury/c_dates ] || mkdir Mercury/c_dates
-	-[ -d Mercury/il_dates ] || mkdir Mercury/il_dates
-	-[ -d Mercury/s_dates ] || mkdir Mercury/s_dates
-	-[ -d Mercury/pic_s_dates ] || mkdir Mercury/pic_s_dates
+	-[ -d $(classes_subdir) ] || mkdir $(classes_subdir) ; \
+	[ -d Mercury/dates ] || mkdir Mercury/dates ; \
+	[ -d Mercury/date0s ] || mkdir Mercury/date0s ; \
+	[ -d Mercury/date3s ] || mkdir Mercury/date3s ; \
+	[ -d Mercury/optdates ] || mkdir Mercury/optdates ; \
+	[ -d Mercury/trans_opt_dates ] || mkdir Mercury/trans_opt_dates ; \
+	[ -d Mercury/c_dates ] || mkdir Mercury/c_dates ; \
+	[ -d Mercury/il_dates ] || mkdir Mercury/il_dates ; \
+	[ -d Mercury/s_dates ] || mkdir Mercury/s_dates ; \
+	[ -d Mercury/pic_s_dates ] || mkdir Mercury/pic_s_dates
+else
+	@-[ -d $(classes_subdir) ] || mkdir $(classes_subdir) ; \
+	[ -d Mercury/dates ] || mkdir Mercury/dates ; \
+	[ -d Mercury/date0s ] || mkdir Mercury/date0s ; \
+	[ -d Mercury/date3s ] || mkdir Mercury/date3s ; \
+	[ -d Mercury/optdates ] || mkdir Mercury/optdates ; \
+	[ -d Mercury/trans_opt_dates ] || mkdir Mercury/trans_opt_dates ; \
+	[ -d Mercury/c_dates ] || mkdir Mercury/c_dates ; \
+	[ -d Mercury/il_dates ] || mkdir Mercury/il_dates ; \
+	[ -d Mercury/s_dates ] || mkdir Mercury/s_dates ; \
+	[ -d Mercury/pic_s_dates ] || mkdir Mercury/pic_s_dates
+endif
 endif
 
 endif	# MMAKE_USE_MMC_MAKE != yes
@@ -301,6 +329,10 @@
 # the new .err file is also of size zero,
 # the time-stamp doesn't get updated!
 # (Is that a bug in unix? In bash?)
+# zs: It is neither. The timestamp is updated by the write system call:
+# if the new file is of zero size, write is never called.
+# touch has code to test specifically for this situation,
+# and adds a byte to the file and then removes it.
 
 .m.err:
 	$(MCE) $(ALL_GRADEFLAGS) $(ALL_MCFLAGS) $(*F) $(ERR_REDIRECT)
--------------------------------------------------------------------------
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