[cig-commits] r1302 - trunk/aspect/tests

bangerth at dealii.org bangerth at dealii.org
Sun Oct 21 14:50:43 PDT 2012


Author: bangerth
Date: 2012-10-21 15:50:17 -0600 (Sun, 21 Oct 2012)
New Revision: 1302

Modified:
   trunk/aspect/tests/Makefile
Log:
Only touch the .prm file if necessary.

Modified: trunk/aspect/tests/Makefile
===================================================================
--- trunk/aspect/tests/Makefile	2012-10-21 17:03:18 UTC (rev 1301)
+++ trunk/aspect/tests/Makefile	2012-10-21 21:50:17 UTC (rev 1302)
@@ -44,12 +44,20 @@
 # creating the output involves running ../lib/aspect; at first, however,
 # we make sure that we don't care what the parameter file says
 # regarding the output directory, but that we simply set what is
-# appropriate
+# appropriate. we do so in a way that creates a temporary parameter
+# file with a fixed output directory and if the two are different
+# overwrite the original one
 output-%:
 	@echo =====$(SUBDIR)=======================testing============ $<
 	@rm -rf $@
 	@mkdir $@
-	@$(PERL) -pi -e 's/(Output directory\s*=).*/\1 $@/g;' $<
+	@cat $< | $(PERL) -pi -e 's/(Output directory\s*=).*/\1 $@/g;' \
+		> $(<).tmp
+	@if (diff -q $< $(<).tmp > /dev/null) ; then \
+		rm $(<).tmp ; \
+	 else \
+		mv $(<).tmp $< ; \
+	 fi
 	@MPI=`grep "MPI:" $< | perl -pi -e 's/.*: *(\d+).*/\1/g;'` ; \
 	    if test -z "$$MPI" ; then \
 		../lib/aspect $< > $@/screen-output ; \



More information about the CIG-COMMITS mailing list