summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--Makefile19
1 files changed, 18 insertions, 1 deletions
diff --git a/Makefile b/Makefile
index bc40150..f4537e1 100644
--- a/Makefile
+++ b/Makefile
@@ -17,11 +17,15 @@
 # along with tissue.  If not, see <https://www.gnu.org/licenses/>.
 
 project = tissue
+version = $(subst v,,$(shell git describe --abbrev=0))
 # FIXME: Do not hardcode the effective version.
 guile_effective_version = 3.0
 
+GIT ?= git
+GPG ?= gpg
 GUILD ?= guild
 GUILE ?= guile
+LZIP ?= lzip
 
 prefix ?= /usr/local
 exec_prefix ?= $(prefix)
@@ -36,11 +40,13 @@ sources = $(wildcard $(top_level_module_dir)/*.scm) \
 objects = $(sources:.scm=.go)
 scripts = $(wildcard bin/*)
 tests = $(wildcard tests/*)
+distribute_files = $(sources) $(scripts) $(tests) \
+		   COPYING guix.scm Makefile
 
 scmdir = $(datarootdir)/guile/site/$(guile_effective_version)
 godir = $(libdir)/guile/$(guile_effective_version)/site-ccache
 
-.PHONY: all check install clean
+.PHONY: all check install clean dist
 
 all: $(objects)
 
@@ -52,6 +58,17 @@ check:
 		./pre-inst-env $(GUILE) $$test; \
 	done
 
+dist_archive = $(project)-$(version).tar.lz
+
+dist: $(dist_archive) $(dist_archive).asc
+
+$(dist_archive): .git/refs/heads/main
+	$(GIT) archive --prefix $(basename $(basename $@))/ --format=tar main $(distribute_files) \
+		| $(LZIP) --force --output $@
+
+%.asc: %
+	$(GPG) --detach-sign --armor $<
+
 install:
 	install -D $(scripts) --target-directory $(bindir)
 	for source in $(sources); do \