Makefile: replace "tgz" target with "dist"

The new target also creates a signed checksum of the archive.
This commit is contained in:
Lars Kruse 2020-02-09 00:44:21 +01:00
parent 2503aa737b
commit 069a3ecb4d
1 changed files with 15 additions and 7 deletions

View File

@ -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))"