From 069a3ecb4dd48dace60ca4a6e4f304fb12bf203e Mon Sep 17 00:00:00 2001 From: Lars Kruse Date: Sun, 9 Feb 2020 00:44:21 +0100 Subject: [PATCH] Makefile: replace "tgz" target with "dist" The new target also creates a signed checksum of the archive. --- Makefile | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index 488a599..f84fd51 100644 --- a/Makefile +++ b/Makefile @@ -8,6 +8,8 @@ VERSION ?= $(shell cat VERSION) DIST_DIR = releases DESTDIR ?= /usr/local/bin TGZ_FILE ?= $(DIST_DIR)/muninlite-$(VERSION).tar.gz +TGZ_FILE_CHECKSUM ?= $(TGZ_FILE).sha256sum +TGZ_FILE_SIGNATURE ?= $(TGZ_FILE).asc $(TARGET_FILE): $(INPUT_FILE) $(PLUGIN_FILES) $(CONFIGURATION_FILE) @@ -33,12 +35,12 @@ help: @$(info all - assemble 'TARGET_FILE' ($(TARGET_FILE))) @$(info clean - remove assembled 'TARGET_FILE' ($(TARGET_FILE))) @$(info clean-all - remove old releases from 'DIST_DIR' ($(DIST_DIR))) + @$(info dist - create release archive) @$(info install - install the standalone shell script) @$(info help - show this overview) @$(info lint - code style checks) @$(info spelling - check spelling) @$(info test - run tests) - @$(info tgz - create release archive) .PHONY: all all: $(TARGET_FILE) @@ -48,8 +50,8 @@ clean-node: @echo "Removing $(TARGET_FILE)" @rm -f "$(TARGET_FILE)" -.PHONY: clean-tgz -clean-tgz: +.PHONY: clean-dist +clean-dist: @echo "Removing old releases" @rm -rf "$(DIST_DIR)" @@ -57,10 +59,7 @@ clean-tgz: clean: clean-node .PHONY: clean-all -clean-all: clean-node clean-tgz - -.PHONY: tgz -tgz: $(TGZ_FILE) +clean-all: clean-node clean-dist $(TGZ_FILE): @echo "Building $@ ..." @@ -68,6 +67,15 @@ $(TGZ_FILE): git archive --prefix=muninlite-$(VERSION)/ --format=tar --output "$@.tmp" HEAD mv "$@.tmp" "$@" +$(TGZ_FILE_CHECKSUM): $(TGZ_FILE) + sha256sum "$<" >"$@" + +$(TGZ_FILE_SIGNATURE): $(TGZ_FILE_CHECKSUM) + gpg --armor --detach-sign --sign "$<" + +.PHONY: dist +dist: $(TGZ_FILE_SIGNATURE) + .PHONY: install install: $(TARGET_FILE) mkdir -p "$(dir $(DESTDIR))"