[m-rev.] for review: mmake error redirection

Fergus Henderson fjh at cs.mu.OZ.AU
Thu Sep 12 22:54:48 AEST 2002


Branches: main
Estimated hours taken: 1

scripts/Mmake.rules:
	Make the redirection of errors into `.err' files configurable,
	by abstracting out the code to redirect errors into a variable
	ERR_REDIRECT.  By default the behaviour remains the same, but if
	you run `mmake ERR_REDIRECT=', then errors will not be redirected.

Workspace: /home/earth/fjh/ws-earth3/mercury
Index: scripts/Mmake.rules
===================================================================
RCS file: /home/mercury1/repository/mercury/scripts/Mmake.rules,v
retrieving revision 1.132
diff -u -d -u -r1.132 Mmake.rules
--- scripts/Mmake.rules	24 Aug 2002 11:54:26 -0000	1.132
+++ scripts/Mmake.rules	12 Sep 2002 12:54:21 -0000
@@ -191,13 +191,22 @@
 $(pic_ss_subdir)%.pic_s : $(pic_s_dates_subdir)%.pic_s_date
 	@:
 
+# This variable contains the shell syntax to redirect the output of
+# a compilation command to a file.  Normally the file chosen is *.err.
+# However, you can override this variable to modify that behaviour.
+# Setting this variable to the empty string will cause all errors to
+# go to stdout/stderr.
+# Setting this variable to ">> allerrs 2>&1" will cause errors
+# to be accumulated into a single file.
+ERR_REDIRECT = > $(*F).err 2>&1
+
 $(s_dates_subdir)%.s_date : %.m
 	$(MCG) $(ALL_GRADEFLAGS) --target-code-only $(ALL_MCGFLAGS) \
-		$(*F) > $(*F).err 2>&1
+		$(*F) $(ERR_REDIRECT)
 
 $(pic_s_dates_subdir)%.pic_s_date : %.m
 	$(MCG) $(ALL_GRADEFLAGS) --target-code-only $(ALL_MCGFLAGS) \
-		--pic --cflags "$(GCCFLAGS_FOR_PIC)" $(*F) > $(*F).err 2>&1
+		--pic --cflags "$(GCCFLAGS_FOR_PIC)" $(*F) $(ERR_REDIRECT)
 
 $(os_subdir)%.$O : $(ss_subdir)%.s
 	$(AS) $< $(OBJFILE_OPT)$@
@@ -227,12 +236,12 @@
 	@:
 
 $(c_dates_subdir)%.c_date : %.m
-	$(MCG) $(ALL_GRADEFLAGS) $(ALL_MCGFLAGS) $(*F) > $(*F).err 2>&1
+	$(MCG) $(ALL_GRADEFLAGS) $(ALL_MCGFLAGS) $(*F) $(ERR_REDIRECT)
 
 # Aditi-RL back-end
 $(rlos_subdir)%.rlo : %.m
 	$(MCG) $(ALL_GRADEFLAGS) $(ALL_MCGFLAGS) \
-		--aditi-only $(*F) > $(*F).err 2>&1
+		--aditi-only $(*F) $(ERR_REDIRECT)
 
 # Java back-end
 
@@ -250,7 +259,7 @@
 
 $(java_dates_subdir)%.java_date : %.m
 	$(MCG) $(ALL_GRADEFLAGS) $(ALL_MCGFLAGS) \
-		--java-only $(*F) > $(*F).err 2>&1
+		--java-only $(*F) $(ERR_REDIRECT)
 
 # .NET back-end
 
@@ -261,7 +270,7 @@
 
 $(il_dates_subdir)%.il_date : %.m
 	$(MCG) $(ALL_GRADEFLAGS) $(ALL_MCGFLAGS) \
-		--il-only $(*F) > $(*F).err 2>&1
+		--il-only $(*F) $(ERR_REDIRECT)
 
 # These rules are only available in *il* backends, because we'd like to avoid
 # processing user code that is in a .cpp file, and we'd like to avoid going via
@@ -292,7 +301,7 @@
 # (Is that a bug in unix? In bash?)
 
 .m.err:
-	$(MCE) $(ALL_MCFLAGS) $(*F) > $@ 2>&1
+	$(MCE) $(ALL_MCFLAGS) $(*F) $(ERR_REDIRECT)
 	@touch $@
 
 endif	# MMAKE_USE_MMC_MAKE == no

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
The University of Melbourne         |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.
--------------------------------------------------------------------------
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