summaryrefslogtreecommitdiff
path: root/Makefile.am
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile.am')
-rw-r--r--Makefile.am13
1 files changed, 11 insertions, 2 deletions
diff --git a/Makefile.am b/Makefile.am
index a6b016dc2..5303dae93 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -922,8 +922,17 @@ SUFFIXES += .man
# Version files - see script 'build-aux/git-gen-version'
EXTRA_DIST += $(top_srcdir)/.version
BUILT_SOURCES += $(top_srcdir)/.version
-$(top_srcdir)/.version:
- echo $(VERSION) > $@-t && mv $@-t $@
+# Regenerate a temporary version string file on every build, but update
+# the real version file's mtime only if its contents change.
+.PHONY: .version.tree
+.version.tree:
+ @test -f $(distdir)/.tarball-verion || echo $(VERSION) > $@
+$(top_srcdir)/.version: .version.tree
+ @if ! test -f $(distdir)/.tarball-version; then \
+ test -f $@ || cp .version.tree $@; \
+ cmp -s .version.tree $@ || cp .version.tree $@; \
+ fi
+MOSTLYCLEANFILES += .version.tree
dist-hook:
echo $(VERSION) > $(distdir)/.tarball-version