summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlejandro Colomar <alx@kernel.org>2024-02-11 00:50:58 +0100
committerAlejandro Colomar <alx@kernel.org>2024-02-11 01:29:52 +0100
commit882a732e5c76d2c20b5c5c028ad5c30d7acd94ae (patch)
treefb59f99613d173a103978d62ee74260660edc9af
parent81388023659986ad1a387c3cfd981a394c1a7030 (diff)
downloadliba2i-882a732e5c76d2c20b5c5c028ad5c30d7acd94ae.tar.gz
share/mk/: distcheck: Add target for checking the release tarball
Signed-off-by: Alejandro Colomar <alx@kernel.org>
-rw-r--r--GNUmakefile7
-rw-r--r--share/mk/configure/coreutils.mk1
-rw-r--r--share/mk/dist/check.mk31
3 files changed, 35 insertions, 4 deletions
diff --git a/GNUmakefile b/GNUmakefile
index 29b9486..bf9b8e8 100644
--- a/GNUmakefile
+++ b/GNUmakefile
@@ -47,6 +47,7 @@ help:
$(info build-obj-cpp Preprocess source TUs)
$(info build-obj-cc Compile TUs)
$(info build-obj-as Assemble TUs)
+ $(info check Check the built library)
$(info )
$(info lint Alias for "lint-c")
$(info lint-c Wrapper for lint-c-* targets)
@@ -56,8 +57,6 @@ help:
$(info lint-c-cpplint Lint C files with cpplint(1))
$(info lint-c-iwyu Lint C files with iwyu(1))
$(info )
- $(info check Check the built library)
- $(info )
$(info install Wrapper for install-* targets)
$(info install-dev Wrapper for install-dev-* targets)
$(info install-dev-include Install header files (.h))
@@ -66,7 +65,6 @@ help:
$(info install-lib-shared Install shared library (.so))
$(info install-lib-static Install static library (.a))
$(info install-man Install manual pages)
- $(info )
$(info installcheck Check the installed library)
$(info )
$(info dist Wrapper for dist-* targets)
@@ -76,6 +74,7 @@ help:
$(info dist-z-gz Create a compressed tarball (.tar.gz))
$(info dist-z-lz Create a compressed tarball (.tar.lz))
$(info dist-z-xz Create a compressed tarball (.tar.xz))
+ $(info distcheck Check the release tarball)
$(info )
$(info help Print this help)
$(info help-variables Print available variables, and default values)
@@ -116,7 +115,7 @@ help-variables:
$(info # Command variables (and flags):)
$(info )
$(info BASH)
- $(info CP, CUT, ECHO, INSTALL, LN, RM, SORT, TAC, TOUCH)
+ $(info CP, CUT, ECHO, INSTALL, LN, MKTEMP, RM, SORT, TAC, TOUCH)
$(info INSTALL_DATA, INSTALL_DIR, INSTALL_PROGRAM)
$(info FIND, XARGS)
$(info GREP)
diff --git a/share/mk/configure/coreutils.mk b/share/mk/configure/coreutils.mk
index 1662c82..61fcc9b 100644
--- a/share/mk/configure/coreutils.mk
+++ b/share/mk/configure/coreutils.mk
@@ -11,6 +11,7 @@ CUT := cut
ECHO := echo
INSTALL := install
LN := ln
+MKTEMP := mktemp
RM := rm
SORT := sort
TAC := tac
diff --git a/share/mk/dist/check.mk b/share/mk/dist/check.mk
new file mode 100644
index 0000000..cb0becb
--- /dev/null
+++ b/share/mk/dist/check.mk
@@ -0,0 +1,31 @@
+# Copyright 2024 Alejandro Colomar <alx@kernel.org>
+# SPDX-License-Identifier: LGPL-3.0-only WITH LGPL-3.0-linking-exception
+
+
+ifndef MAKEFILE_DIST_CHECK_INCLUDED
+MAKEFILE_DIST_CHECK_INCLUDED := 1
+
+
+include $(MAKEFILEDIR)/configure/coreutils.mk
+include $(MAKEFILEDIR)/configure/tar.mk
+include $(MAKEFILEDIR)/dist/tar.mk
+include $(MAKEFILEDIR)/version.mk
+
+
+TMPDIR1 := $(shell $(MKTEMP) -d)
+TMPDIR2 := $(shell $(MKTEMP) -d)
+
+
+$(builddir)/distcheck.touch: $(DISTFILE) | $$(@D)/
+ $(CP) $(DISTFILE) $(TMPDIR1)/$(DISTNAME).tar
+ cd $(TMPDIR1); $(TAR) xf $(DISTNAME).tar
+ $(MAKE) -C $(TMPDIR1)/$(DISTNAME) all
+ $(MAKE) -C $(TMPDIR1)/$(DISTNAME) install DESTDIR=$(TMPDIR2)
+ $(TOUCH) $@
+
+
+.PHONY: distcheck
+distcheck: $(builddir)/distcheck.touch
+
+
+endif # include guard