summaryrefslogtreecommitdiff
path: root/lib/make/CCTK_Functions.sh
diff options
context:
space:
mode:
authorgoodale <goodale@17b73243-c579-4c4c-a9d2-2d5706c11dac>2001-06-25 11:20:18 +0000
committergoodale <goodale@17b73243-c579-4c4c-a9d2-2d5706c11dac>2001-06-25 11:20:18 +0000
commit46fbdd867059f083b0bf2cbc9d97b5f48303b101 (patch)
tree4a6d68b1ecc7aa6b66bae465e60774af9c3b415b /lib/make/CCTK_Functions.sh
parent334456c26052c4a422287d4e3ea996a06606ac2a (diff)
Added function CCTK_WriteFiles which compares file against old version and
only overwrites if the new version is genuinely new. Now CCTK_CreateFile saves a list of files it has created. Changed the stuff in configure.in to use CCTK_CreateFile to create the architecture and extras files and to always use CCTK_WriteLine to write to a file. Now if you reconfigure with precisely the same config options you don't end up rebuilding the whole configuration if you have MPI or HDF5. Tom git-svn-id: http://svn.cactuscode.org/flesh/trunk@2248 17b73243-c579-4c4c-a9d2-2d5706c11dac
Diffstat (limited to 'lib/make/CCTK_Functions.sh')
-rw-r--r--lib/make/CCTK_Functions.sh49
1 files changed, 47 insertions, 2 deletions
diff --git a/lib/make/CCTK_Functions.sh b/lib/make/CCTK_Functions.sh
index 6ca2e490..97f61f40 100644
--- a/lib/make/CCTK_Functions.sh
+++ b/lib/make/CCTK_Functions.sh
@@ -10,6 +10,7 @@
#
# @@*/
+_CCTKI_FILES=""
# /*@@
# @routine CCTK_Search
@@ -70,7 +71,17 @@ CCTK_Search()
CCTK_CreateFile()
{
- echo $2 > $1
+ # Remove old file
+ if test -f "$1.tmp" ; then
+ rm $1.tmp
+ fi
+
+ # Create temporary file
+ echo "$2" > $1.tmp
+
+ # Remember this file
+ _CCTKI_FILES="$_CCTKI_FILES $1"
+
return
}
@@ -91,7 +102,7 @@ CCTK_CreateFile()
CCTK_WriteLine()
{
- echo "$2" >> $1
+ echo "$2" >> $1.tmp
return
}
@@ -187,3 +198,37 @@ CCTK_Wrap()
unset _cctk_wrap_retval
}
+
+# /*@@
+# @file CCTK_Functions.sh
+# @date Mon Jun 25 13:14:08 2001
+# @author Tom Goodale
+# @desc
+# Write out all files created with CCTK_CreateFile.
+# Compares against old version and only overwrites
+# if the file and its contents is genuinely new.
+# @enddesc
+# @@*/
+CCTK_FinishFiles()
+{
+ if test -n "$_CCTKI_FILES" ; then
+ for i in $_CCTKI_FILES ; do
+ echo "creating $i"
+ done
+ for i in $_CCTKI_FILES ; do
+ if test -f $i ; then
+ if cmp -s $i $i.tmp 2>/dev/null ; then
+ echo "$i is unchanged"
+ rm $i.tmp
+ else
+ rm $i
+ mv $i.tmp $i
+ fi
+ else
+ mv $i.tmp $i
+ fi
+ done
+ fi
+
+ return
+}