public inbox for linux-man@vger.kernel.org
 help / color / mirror / Atom feed
From: Alejandro Colomar <alx.manpages@gmail.com>
To: mtk.manpages@gmail.com, linux-man@vger.kernel.org,
	"Branden Robinson" <g.branden.robinson@gmail.com>,
	наб <nabijaczleweli@nabijaczleweli.xyz>
Cc: Alejandro Colomar <alx.manpages@gmail.com>
Subject: [RFC v3 3/3] Makefile: dist: Add target to create distribution archives
Date: Sat, 16 Apr 2022 15:02:40 +0200	[thread overview]
Message-ID: <20220416130239.36773-1-alx.manpages@gmail.com> (raw)
In-Reply-To: <20220415233048.70477-4-alx.manpages@gmail.com>

Other subtargets are also created, with the obvious results:
dist-tar, dist-gz, and dist-xz.

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
---

v2: Fix some accidents (forgot to send this one to the list)
v3: Simplify


 Makefile | 41 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 41 insertions(+)

diff --git a/Makefile b/Makefile
index 38ea89c69..889e356b3 100644
--- a/Makefile
+++ b/Makefile
@@ -316,6 +316,47 @@ uninstall-man: $(_mandir_rmdir) $(uninstall_manX)
 	@:
 
 
+########################################################################
+# dist
+
+DISTNAME    := $(shell git describe 2>/dev/null)
+DISTFILE    := $(builddir)/$(DISTNAME).tar
+compression := gz xz
+dist        := $(foreach x,$(compression),dist-$(x))
+
+
+$(DISTFILE): $(shell git ls-files) | $$(@D)/.
+	$(info TAR	$@)
+	tar cf $@ -T /dev/null
+	git ls-files \
+	| xargs tar rf $@
+
+$(DISTFILE).gz: %.gz: % | $$(@D)/.
+	$(info GZIP	$@)
+	gzip -knf $<
+
+$(DISTFILE).xz: %.xz: % | $$(@D)/.
+	$(info XZ	$@)
+	xz -kf $<
+
+
+.PHONY: dist-tar
+dist-tar: $(DISTFILE) | builddirs-dist
+	@:
+
+.PHONY: $(dist)
+$(dist): dist-%: $(DISTFILE).% | builddirs-dist
+	@:
+
+.PHONY: builddirs-dist
+builddirs-dist: $(builddir)/.
+	@:
+
+.PHONY: dist
+dist: $(dist)
+	@:
+
+
 ########################################################################
 # src
 
-- 
2.30.2


  reply	other threads:[~2022-04-16 13:04 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-15 23:30 [RFC 0/3] Prepare the Makefile and scripts/ for releasing Alejandro Colomar
2022-04-15 23:30 ` [PATCH 1/3] scripts/remove_COLOPHON.sh: Allow passing directories to the script Alejandro Colomar
2022-04-15 23:30 ` [PATCH 2/3] scripts/append_COLOPHON.sh: Add script to append the COLOPHON section Alejandro Colomar
2022-04-15 23:30 ` [PATCH 3/3] Makefile: dist: Add target to create distribution archives Alejandro Colomar
2022-04-16 13:02   ` Alejandro Colomar [this message]
2022-04-15 23:33 ` [RFC 0/3] Prepare the Makefile and scripts/ for releasing Alejandro Colomar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220416130239.36773-1-alx.manpages@gmail.com \
    --to=alx.manpages@gmail.com \
    --cc=g.branden.robinson@gmail.com \
    --cc=linux-man@vger.kernel.org \
    --cc=mtk.manpages@gmail.com \
    --cc=nabijaczleweli@nabijaczleweli.xyz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox