From 46c6a88e3dec4d5a51861ac182fb63d55c2c87c9 Mon Sep 17 00:00:00 2001 From: Daniel Richman Date: Fri, 23 Dec 2011 20:00:49 +0000 Subject: [PATCH] Make version.cxx updating a little less aggressive --- Makefile.am | 3 +++ build-aux/versionify | 17 +++++++++++++++-- src/Makefile.am | 8 ++++---- 3 files changed, 22 insertions(+), 6 deletions(-) diff --git a/Makefile.am b/Makefile.am index ed91bcac..30b7573b 100644 --- a/Makefile.am +++ b/Makefile.am @@ -25,4 +25,7 @@ hamlib-static: endif endif +check-version: + @build-aux/versionify src/dl_fldigi/version.cxx + EXTRA_DIST = build-aux/config.rpath diff --git a/build-aux/versionify b/build-aux/versionify index 880460d8..a9ec7156 100755 --- a/build-aux/versionify +++ b/build-aux/versionify @@ -12,7 +12,7 @@ fi COMMIT=`git log -1 | head -n1 | cut -d ' ' -f2` SHORT_COMMIT=`git log -1 --oneline | cut -d ' ' -f1` -cat > $FILE < $FILE.new < $FILE" +if [ ! -e $FILE ]; then + mv $FILE.new $FILE + echo "Created $FILE ($COMMIT $SHORT_COMMIT)" +else + CHANGED=0 + diff -q $FILE $FILE.new >> /dev/null || CHANGED=1 + if [ $CHANGED -eq 1 ]; then + mv $FILE.new $FILE + echo "Updated $FILE ($COMMIT $SHORT_COMMIT)" + else + rm $FILE.new + echo "$FILE does not require updating" + fi +fi diff --git a/src/Makefile.am b/src/Makefile.am index 9f7e5e64..decbf5ee 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -699,9 +699,9 @@ EXTRA_DIST = \ $(FLDIGI_FL_SRC) \ $(FLARQ_FL_SRC) -dl_fldigi/version.cxx : - @test -f $(srcdir)/../build-aux/versionify && $(srcdir)/../build-aux/versionify $@ || true +../.git/logs/HEAD : -dist-hook : dl_fldigi/version.cxx +dl_fldigi/version.cxx : ../.git/logs/HEAD + @test -f ../build-aux/versionify && ../build-aux/versionify dl_fldigi/version.cxx || true -.PHONY : dl_fldigi/version.cxx +dist-local : versionify