aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlejandro Colomar <alx@kernel.org>2024-02-24 01:15:13 +0100
committerAlejandro Colomar <alx@kernel.org>2024-02-25 10:50:54 +0100
commit5fabf2b0c87e75792b5298e85efc536d6ba618ab (patch)
tree1e0200b872aedc800a33a90a351059cdf5aadeca
parentcb497121b5fa4be0bb344b8f4bbbdcfb691b016d (diff)
downloadman-pages-5fabf2b0c87e75792b5298e85efc536d6ba618ab.tar.gz
share/mk/: dist: FORCE regeneration of version file if necessary
If any of $DISTVERSION, $DISTNAME, or $DISTDATE have changed since the last 'make dist', force regeneration of the version file, even if it wouldn't change due to normal dependencies. This makes sure that the tarball has correct values. It doesn't need to depend on all $DISTFILES. Signed-off-by: Alejandro Colomar <alx@kernel.org>
-rw-r--r--GNUmakefile1
-rw-r--r--share/mk/dist/files.mk18
2 files changed, 18 insertions, 1 deletions
diff --git a/GNUmakefile b/GNUmakefile
index 830a30fc17..9fbe482e9b 100644
--- a/GNUmakefile
+++ b/GNUmakefile
@@ -220,3 +220,4 @@ nothing:;
.DELETE_ON_ERROR:
.SILENT:
+FORCE:
diff --git a/share/mk/dist/files.mk b/share/mk/dist/files.mk
index 08883280e2..cdc54398d4 100644
--- a/share/mk/dist/files.mk
+++ b/share/mk/dist/files.mk
@@ -21,6 +21,22 @@ _DISTVERSION:= $(_DISTDIR)/share/mk/configure/version.mk
_DISTOTHERS := $(filter-out $(_DISTPAGES) $(_DISTVERSION), $(_DISTFILES))
+FORCE_DISTVERSION := \
+ $(shell \
+ if $(TEST) -f $(_DISTVERSION); then \
+ <$(_DISTVERSION) \
+ $(GREP) \
+ -e '^DISTVERSION :=' \
+ -e '^DISTNAME :=' \
+ -e '^DISTDATE :=' \
+ | $(GREP) -v '^DISTVERSION := $(DISTVERSION)$$' \
+ | $(GREP) -v '^DISTNAME := $(DISTNAME)$$' \
+ | $(GREP) -v '^DISTDATE := $(DISTDATE)$$' $(HIDE_ERR) >&2 \
+ && $(ECHO) FORCE; \
+ fi; \
+ )
+
+
$(_DISTPAGES): $(_DISTDIR)/man%: $(srcdir)/man% $(MK) | $$(@D)/
$(info $(INFO_)INSTALL $@)
<$< \
@@ -28,7 +44,7 @@ $(_DISTPAGES): $(_DISTDIR)/man%: $(srcdir)/man% $(MK) | $$(@D)/
| $(SED) '/^.TH/s/(unreleased)/$(DISTVERSION)/' \
| $(INSTALL_DATA) -T /dev/stdin $@
-$(_DISTVERSION): $(MAKEFILEDIR)/configure/version.mk $(DISTFILES) | $$(@D)/
+$(_DISTVERSION): $(MAKEFILEDIR)/configure/version.mk $(MK) $(FORCE_DISTVERSION) | $$(@D)/
$(info $(INFO_)SED $@)
<$< \
$(SED) 's/^DISTVERSION *:=.*/DISTVERSION := $(DISTVERSION)/' \