diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile22
1 file changed, 21 insertions, 1 deletion
diff --git a/Makefile b/Makefile
index 3eb0ff5..7d53028 100644
--- a/Makefile
+++ b/Makefile
@@ -43,6 +43,13 @@ mandir = $(prefix)/share/man
ASSETS = cgit.css cgit.js cgit.png favicon.ico robots.txt
FILTER_FILES = $(notdir $(wildcard $(EXTDIR)/*.lua))
+# Extra files and whole trees the dist target bundles into the release tarball,
+# alongside the binary and the assets above.
+DIST_DOCS = cgitrc.5.txt README.txt LICENSE.txt AUTHORS
+DIST_TREES = $(EXTDIR) examples
+DIST_NAME = cgit-$(CGIT_VERSION)
+DIST_DIR = $(BUILDDIR)/$(DIST_NAME)
+
# The man-page source (*.5.txt) sits at the project root and is rendered into
# build/. Only one man section exists, so DOC_* derive straight from MAN5_TXT.
MAN5_TXT = $(wildcard *.5.txt)
@@ -131,6 +138,19 @@ uninstall-html:
rm -fv $(DESTDIR)$(htmldir)/$$i; \
done
+# Stage a release tarball under build/ from an already-built binary. It has no
+# `all` prerequisite on purpose, so tools/release-build.sh keeps ownership of
+# the hardening flags rather than triggering a plain rebuild here.
+dist:
+ @test -f $(BUILDDIR)/cgit || { echo 'build/cgit missing, run make first' >&2; exit 1; }
+ $(RM) -r $(DIST_DIR)
+ $(INSTALL) -m 0755 -d $(DIST_DIR)
+ $(INSTALL) -m 0755 $(BUILDDIR)/cgit $(DIST_DIR)/$(CGIT_SCRIPT_NAME)
+ $(INSTALL) -m 0644 $(addprefix $(ASSETDIR)/,$(ASSETS)) $(DIST_DIR)
+ $(INSTALL) -m 0644 $(DIST_DOCS) $(DIST_DIR)
+ $(COPYTREE) $(DIST_TREES) $(DIST_DIR)
+ tar czf $(DIST_DIR).tar.gz -C $(BUILDDIR) $(DIST_NAME)
+
# Compiled output lives under build/; the test suite writes into tests/, so
# cleaning removes both. The tests descent is guarded because tests/Makefile
# includes git's config.mak.uname, which needs the submodule present.
@@ -155,4 +175,4 @@ tags:
.PHONY: doc doc-man doc-html
.PHONY: install install-doc install-man install-html
.PHONY: uninstall uninstall-doc uninstall-man uninstall-html
-.PHONY: clean cleanall get-git tags
+.PHONY: dist clean cleanall get-git tags