From bee72777a0f2bd17a7ca3ec17783cfa80aa7b303 Mon Sep 17 00:00:00 2001 From: Arun Isaac Date: Fri, 27 Jan 2023 01:21:31 +0000 Subject: Makefile: Add tarball generation rules. * Makefile (version, GIT, GPG, LZIP, distribute_files, dist_archive): New variables. (.PHONY): Add dist. (dist, $(dist_archive), %.asc): New targets. --- Makefile | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index bc40150..f4537e1 100644 --- a/Makefile +++ b/Makefile @@ -17,11 +17,15 @@ # along with tissue. If not, see . 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 \ -- cgit v1.2.3