Makefile: add "install" target

This commit is contained in:
Lars Kruse 2020-02-06 08:10:10 +01:00
parent 33bd18f7f7
commit c547314f3d
2 changed files with 10 additions and 3 deletions

View file

@ -6,6 +6,7 @@ PLUGIN_DIRECTORY ?= plugins
PLUGIN_FILES = $(patsubst %,$(PLUGIN_DIRECTORY)/%,$(PLUGINS))
VERSION ?= $(shell cat VERSION)
DIST_DIR = releases
DESTDIR ?= /usr/local/bin
TGZ_FILE ?= $(DIST_DIR)/muninlite-$(VERSION).tar.gz
@ -32,6 +33,7 @@ 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 install - install the standalone shell script)
@$(info help - show this overview)
@$(info lint - code style checks)
@$(info spelling - check spelling)
@ -66,6 +68,12 @@ $(TGZ_FILE):
git archive --prefix=muninlite-$(VERSION)/ --format=tar --output "$@.tmp" HEAD
mv "$@.tmp" "$@"
.PHONY: install
install: $(TARGET_FILE)
mkdir -p "$(dir $(DESTDIR))"
cp "$(TARGET_FILE)" "$(DESTDIR)/"
.PHONY: lint
lint:
shellcheck -s dash --exclude=SC2230 $(PLUGIN_FILES) "$(INPUT_FILE)"

View file

@ -55,11 +55,10 @@ You may assemble a reduced script by including only specific plugins:
$ make PLUGINS="cpu load uptime"
```
Copy munin-node to a suitable location (/usr/local/bin/) and make it
executable (there will be a "make install" at a later release)
Run `make install` or simply copy `munin-node` to a suitable location.
```shell
cp munin-node /usr/local/bin
make install
```
Two typical ways of using MuninLite as a `munin-node` replacement are: