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 DIST_DIR = releases
DESTDIR ?= /usr/local/bin DESTDIR ?= /usr/local/bin
TGZ_FILE ?= $(DIST_DIR)/muninlite-$(VERSION).tar.gz 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) $(TARGET_FILE): $(INPUT_FILE) $(PLUGIN_FILES) $(CONFIGURATION_FILE)
@ -33,12 +35,12 @@ help:
@$(info all - assemble 'TARGET_FILE' ($(TARGET_FILE))) @$(info all - assemble 'TARGET_FILE' ($(TARGET_FILE)))
@$(info clean - remove assembled 'TARGET_FILE' ($(TARGET_FILE))) @$(info clean - remove assembled 'TARGET_FILE' ($(TARGET_FILE)))
@$(info clean-all - remove old releases from 'DIST_DIR' ($(DIST_DIR))) @$(info clean-all - remove old releases from 'DIST_DIR' ($(DIST_DIR)))
@$(info dist - create release archive)
@$(info install - install the standalone shell script) @$(info install - install the standalone shell script)
@$(info help - show this overview) @$(info help - show this overview)
@$(info lint - code style checks) @$(info lint - code style checks)
@$(info spelling - check spelling) @$(info spelling - check spelling)
@$(info test - run tests) @$(info test - run tests)
@$(info tgz - create release archive)
.PHONY: all .PHONY: all
all: $(TARGET_FILE) all: $(TARGET_FILE)
@ -48,8 +50,8 @@ clean-node:
@echo "Removing $(TARGET_FILE)" @echo "Removing $(TARGET_FILE)"
@rm -f "$(TARGET_FILE)" @rm -f "$(TARGET_FILE)"
.PHONY: clean-tgz .PHONY: clean-dist
clean-tgz: clean-dist:
@echo "Removing old releases" @echo "Removing old releases"
@rm -rf "$(DIST_DIR)" @rm -rf "$(DIST_DIR)"
@ -57,10 +59,7 @@ clean-tgz:
clean: clean-node clean: clean-node
.PHONY: clean-all .PHONY: clean-all
clean-all: clean-node clean-tgz clean-all: clean-node clean-dist
.PHONY: tgz
tgz: $(TGZ_FILE)
$(TGZ_FILE): $(TGZ_FILE):
@echo "Building $@ ..." @echo "Building $@ ..."
@ -68,6 +67,15 @@ $(TGZ_FILE):
git archive --prefix=muninlite-$(VERSION)/ --format=tar --output "$@.tmp" HEAD git archive --prefix=muninlite-$(VERSION)/ --format=tar --output "$@.tmp" HEAD
mv "$@.tmp" "$@" 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 .PHONY: install
install: $(TARGET_FILE) install: $(TARGET_FILE)
mkdir -p "$(dir $(DESTDIR))" mkdir -p "$(dir $(DESTDIR))"