summaryrefslogtreecommitdiffstats
path: root/share/mk/dist/files.mk
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-15 19:41:07 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-15 19:41:07 +0000
commit3af6d22bb3850ab2bac67287e3a3d3b0e32868e5 (patch)
tree3ee7a3ec64525911fa865bb984c86d997d855527 /share/mk/dist/files.mk
parentAdding debian version 6.05.01-1. (diff)
downloadmanpages-3af6d22bb3850ab2bac67287e3a3d3b0e32868e5.tar.xz
manpages-3af6d22bb3850ab2bac67287e3a3d3b0e32868e5.zip
Merging upstream version 6.7.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'share/mk/dist/files.mk')
-rw-r--r--share/mk/dist/files.mk62
1 files changed, 62 insertions, 0 deletions
diff --git a/share/mk/dist/files.mk b/share/mk/dist/files.mk
new file mode 100644
index 0000000..bc3f7ff
--- /dev/null
+++ b/share/mk/dist/files.mk
@@ -0,0 +1,62 @@
+# Copyright 2021-2024, Alejandro Colomar <alx@kernel.org>
+# SPDX-License-Identifier: LGPL-3.0-only WITH LGPL-3.0-linking-exception
+
+
+ifndef MAKEFILE_DIST_FILES_INCLUDED
+MAKEFILE_DIST_FILES_INCLUDED := 1
+
+
+include $(MAKEFILEDIR)/configure/build-depends/coreutils.mk
+include $(MAKEFILEDIR)/configure/build-depends/git.mk
+include $(MAKEFILEDIR)/configure/build-depends/grep.mk
+include $(MAKEFILEDIR)/configure/build-depends/sed.mk
+include $(MAKEFILEDIR)/configure/verbose.mk
+include $(MAKEFILEDIR)/configure/version.mk
+include $(MAKEFILEDIR)/dist/_.mk
+
+
+DISTFILES := $(shell $(DISTFILESCMD) | $(SED) 's,:,\\:,g')
+_DISTFILES := $(patsubst $(srcdir)/%,$(_DISTDIR)/%,$(DISTFILES))
+_DISTPAGES := $(filter $(_DISTDIR)/man%,$(_DISTFILES))
+_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 :=' \
+ | $(SED) '/^DISTVERSION := $(DISTVERSION)$$/d' \
+ | $(SED) '/^DISTNAME := $(DISTNAME)$$/d' \
+ | $(SED) '/^DISTDATE := $(DISTDATE)$$/d' \
+ | $(GREP) ^ $(HIDE_ERR) >&2 \
+ && $(ECHO) FORCE; \
+ fi; \
+ )
+
+
+$(_DISTPAGES): $(_DISTDIR)/man%: $(srcdir)/man% $(MK) | $$(@D)/
+ $(info $(INFO_)SED $@)
+ <$< \
+ $(SED) "/^.TH/s/(date)/$$($(GIT) log --format=%cs -1 -- $< $(HIDE_ERR))/" \
+ | $(SED) '/^.TH/s/(unreleased)/$(DISTVERSION)/' \
+ | $(INSTALL_DATA) -T /dev/stdin $@
+
+$(_DISTVERSION): $(MAKEFILEDIR)/configure/version.mk $(MK) $(FORCE_DISTVERSION) | $$(@D)/
+ $(info $(INFO_)SED $@)
+ <$< \
+ $(SED) 's/^DISTVERSION *:=.*/DISTVERSION := $(DISTVERSION)/' \
+ | $(SED) 's/^DISTNAME *:=.*/DISTNAME := $(DISTNAME)/' \
+ | $(SED) 's/^DISTDATE *:=.*/DISTDATE := $(DISTDATE)/' \
+ | $(INSTALL_DATA) -T /dev/stdin $@
+
+$(_DISTOTHERS): $(_DISTDIR)/%: $(srcdir)/% $(MK) | $$(@D)/
+ $(info $(INFO_)CP $@)
+ $(CP) -dT $< $@
+
+
+endif # include guard