From 6df6a50900ccecf223b2560aee65924ca07a9343 Mon Sep 17 00:00:00 2001 From: Benedikt Heine Date: Sat, 2 Feb 2019 16:37:24 +0100 Subject: [PATCH 1/2] Use BINDIR, DATADIR and MANDIR in Makefile --- Makefile | 8 ++++---- README.md | 4 +++- config.mk | 5 ++++- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index 43d0d76..19971c6 100644 --- a/Makefile +++ b/Makefile @@ -157,11 +157,11 @@ clean-coverage-run: install: install-dunst install-doc install-service install-dunst: dunst doc - install -Dm755 dunst ${DESTDIR}${PREFIX}/bin/dunst + install -Dm755 dunst ${DESTDIR}${BINDIR}/dunst install -Dm644 docs/dunst.1 ${DESTDIR}${MANPREFIX}/man1/dunst.1 install-doc: - install -Dm644 dunstrc ${DESTDIR}${PREFIX}/share/dunst/dunstrc + install -Dm644 dunstrc ${DESTDIR}${DATADIR}/dunst/dunstrc install-service: install-service-dbus install-service-dbus: service-dbus @@ -173,9 +173,9 @@ install-service-systemd: service-systemd endif uninstall: uninstall-service - rm -f ${DESTDIR}${PREFIX}/bin/dunst + rm -f ${DESTDIR}${BINDIR}/dunst rm -f ${DESTDIR}${MANPREFIX}/man1/dunst.1 - rm -rf ${DESTDIR}${PREFIX}/share/dunst + rm -rf ${DESTDIR}${DATADIR}/dunst uninstall-service: uninstall-service-dbus uninstall-service-dbus: diff --git a/README.md b/README.md index 10c7e97..9102d5b 100644 --- a/README.md +++ b/README.md @@ -38,7 +38,9 @@ sudo make install ### Make parameters - `PREFIX=`: Set the prefix of the installation. (Default: `/usr/local`) -- `MANPREFIX=`: Set the prefix of the manpage. (Default: `${PREFIX}/share/man`) +- `BINDIR=`: Set the `dunst` executable's path (Default: `${PREFIX}/bin`) +- `DATADIR=`: Set the path for shared files. (Default: `${PREFIX}/share`) +- `MANDIR=`: Set the prefix of the manpage. (Default: `${DATADIR}/man`) - `SYSTEMD=(0|1)`: Enable/Disable the systemd unit. (Default: detected via `pkg-config`) - `SERVICEDIR_SYSTEMD=`: The path to put the systemd user service file. Unused, if `SYSTEMD=0`. (Default: detected via `pkg-config`) - `SERVICEDIR_DBUS=`: The path to put the dbus service file. (Default: detected via `pkg-config`) diff --git a/config.mk b/config.mk index c242dd9..f3a0c6e 100644 --- a/config.mk +++ b/config.mk @@ -1,6 +1,9 @@ # paths PREFIX ?= /usr/local -MANPREFIX = ${PREFIX}/share/man +BINDIR ?= ${PREFIX}/bin +DATADIR ?= ${PREFIX}/share +MANPREFIX ?= ${DATADIR}/man # around for backwards compatibility +MANDIR ?= ${MANPREFIX} PKG_CONFIG ?= pkg-config From 45905149063a0838b09ebeb80f53a06895d146dd Mon Sep 17 00:00:00 2001 From: Benedikt Heine Date: Sat, 2 Feb 2019 16:43:30 +0100 Subject: [PATCH 2/2] Replace Makefile commands with default variables --- Makefile | 28 ++++++++++++++-------------- config.mk | 8 ++++++++ 2 files changed, 22 insertions(+), 14 deletions(-) diff --git a/Makefile b/Makefile index 19971c6..5ae1024 100644 --- a/Makefile +++ b/Makefile @@ -5,13 +5,13 @@ include config.mk VERSION := "1.3.2-non-git" ifneq ($(wildcard ./.git/),) -VERSION := $(shell git describe --tags) +VERSION := $(shell ${GIT} describe --tags) endif ifeq (,${SYSTEMD}) # Check for systemctl to avoid discrepancies on systems, where # systemd is installed, but systemd.pc is in another package -systemctl := $(shell command -v systemctl >/dev/null && echo systemctl) +systemctl := $(shell command -v ${SYSTEMCTL} >/dev/null && echo systemctl) ifeq (systemctl,${systemctl}) SYSTEMD := 1 else @@ -45,9 +45,9 @@ endif CFLAGS := ${DEFAULT_CPPFLAGS} ${CPPFLAGS} ${DEFAULT_CFLAGS} ${CFLAGS} ${INCS} -MMD -MP LDFLAGS := ${DEFAULT_LDFLAGS} ${LDFLAGS} ${LIBS} -SRC := $(sort $(shell find src/ -name '*.c')) +SRC := $(sort $(shell ${FIND} src/ -name '*.c')) OBJ := ${SRC:.c=.o} -TEST_SRC := $(sort $(shell find test/ -name '*.c')) +TEST_SRC := $(sort $(shell ${FIND} test/ -name '*.c')) TEST_OBJ := $(TEST_SRC:.c=.o) DEPS := ${SRC:.c=.d} ${TEST_SRC:.c=.d} @@ -78,7 +78,7 @@ test: test/test clean-coverage-run ./test/test -v test-valgrind: test/test - valgrind \ + ${VALGRIND} \ --suppressions=.valgrind.suppressions \ --leak-check=full \ --show-leak-kinds=definite \ @@ -92,7 +92,7 @@ test-coverage: test test-coverage-report: test-coverage mkdir -p docs/internal/coverage - gcovr \ + ${GCOVR} \ -r . \ --exclude=test \ --html \ @@ -108,18 +108,18 @@ test/test: ${OBJ} ${TEST_OBJ} .PHONY: doc doc-doxygen doc: docs/dunst.1 docs/dunst.1: docs/dunst.pod - pod2man --name=dunst -c "Dunst Reference" --section=1 --release=${VERSION} $< > $@ + ${POD2MAN} --name=dunst -c "Dunst Reference" --section=1 --release=${VERSION} $< > $@ doc-doxygen: - doxygen docs/internal/Doxyfile + ${DOXYGEN} docs/internal/Doxyfile .PHONY: service service-dbus service-systemd service: service-dbus service-dbus: - @sed "s|##PREFIX##|$(PREFIX)|" org.knopwob.dunst.service.in > org.knopwob.dunst.service + @${SED} "s|##PREFIX##|$(PREFIX)|" org.knopwob.dunst.service.in > org.knopwob.dunst.service ifneq (0,${SYSTEMD}) service: service-systemd service-systemd: - @sed "s|##PREFIX##|$(PREFIX)|" dunst.systemd.service.in > dunst.systemd.service + @${SED} "s|##PREFIX##|$(PREFIX)|" dunst.systemd.service.in > dunst.systemd.service endif .PHONY: clean clean-dunst clean-dunstify clean-doc clean-tests clean-coverage clean-coverage-run @@ -143,12 +143,12 @@ clean-tests: rm -f test/test test/*.o test/*.d clean-coverage: clean-coverage-run - find . -type f -name '*.gcno' -delete - find . -type f -name '*.gcna' -delete + ${FIND} . -type f -name '*.gcno' -delete + ${FIND} . -type f -name '*.gcna' -delete # Cleans the coverage data before every run to not double count any lines clean-coverage-run: - find . -type f -name '*.gcov' -delete - find . -type f -name '*.gcda' -delete + ${FIND} . -type f -name '*.gcov' -delete + ${FIND} . -type f -name '*.gcda' -delete .PHONY: install install-dunst install-doc \ install-service install-service-dbus install-service-systemd \ diff --git a/config.mk b/config.mk index f3a0c6e..2326893 100644 --- a/config.mk +++ b/config.mk @@ -5,7 +5,15 @@ DATADIR ?= ${PREFIX}/share MANPREFIX ?= ${DATADIR}/man # around for backwards compatibility MANDIR ?= ${MANPREFIX} +DOXYGEN ?= doxygen +FIND ?= find +GCOVR ?= gcovr +GIT ?= git PKG_CONFIG ?= pkg-config +POD2MAN ?= pod2man +SED ?= sed +SYSTEMCTL ?= systemctl +VALGRIND ?= valgrind # Disable systemd service file installation, # if you don't want to use systemd albeit installed