summaryrefslogtreecommitdiff
path: root/Makefile.am
diff options
context:
space:
mode:
authorG. Branden Robinson <g.branden.robinson@gmail.com>2021-08-21 11:09:38 +1000
committerG. Branden Robinson <g.branden.robinson@gmail.com>2021-08-23 13:54:32 +1000
commitc1bb33e5beec25b4059bca3cc4529b738ec486c7 (patch)
tree7994eb89ad58f27ad53625acf88e90927577ac61 /Makefile.am
parent8ce8ca92c792d670628b8457f1b8519f630e0cbf (diff)
downloadgroff-git-c1bb33e5beec25b4059bca3cc4529b738ec486c7.tar.gz
Update .version file more aggressively.
* Makefile.am: Regenerate a temporary version string file on every build, but update the real version file's mtime only if its contents change. (.version.tree): New target. Mark it phony, populating it with `$(VERSION)` with every `make` if the `.tarball-version` file {created by `dist-hook`} doesn't exist. ($(top_srcdir)/.version): Depend on foregoing target. If the tarball version file and the target do not exist, copy `.tree` file into place. Compare this file with `.tree` file; if they differ, move the `.tree` file to this one. (MOSTLYCLEANFILES): Add `.version.tree`. Fixes <https://savannah.gnu.org/bugs/?61052>. Thanks to Bjarni Ingi Gislason for the report.
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