From ace814321feda4460e3964d6c0529f4007e12d2a Mon Sep 17 00:00:00 2001 From: Kai Krakow Date: Sun, 21 Jan 2018 01:31:42 +0100 Subject: [PATCH] Makefile: Auto-detect systemd unit path This uses pkg-config to detect the system unit dir. Signed-off-by: Kai Krakow --- Makefile | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 51d404e..11116ed 100644 --- a/Makefile +++ b/Makefile @@ -2,8 +2,8 @@ PREFIX ?= / LIBDIR ?= lib USR_PREFIX ?= $(PREFIX)/usr USRLIB_PREFIX ?= $(USR_PREFIX)/$(LIBDIR) -SYSTEMD_LIB_PREFIX ?= $(PREFIX)/lib/systemd LIBEXEC_PREFIX ?= $(USRLIB_PREFIX)/bees +SYSTEMD_SYSTEM_UNIT_DIR ?= $(shell pkg-config systemd --variable=systemdsystemunitdir) MARKDOWN := $(firstword $(shell which markdown markdown2 markdown_py 2>/dev/null || echo markdown)) @@ -62,7 +62,9 @@ install_scripts: ## Install scipts install_scripts: scripts install -Dm755 scripts/beesd $(DESTDIR)$(USR_PREFIX)/sbin/beesd install -Dm644 scripts/beesd.conf.sample $(DESTDIR)$(PREFIX)/etc/bees/beesd.conf.sample - install -Dm644 scripts/beesd@.service $(DESTDIR)$(SYSTEMD_LIB_PREFIX)/system/beesd@.service +ifneq (SYSTEMD_SYSTEM_UNIT_DIR,) + install -Dm644 scripts/beesd@.service $(DESTDIR)$(SYSTEMD_SYSTEM_UNIT_DIR)/beesd@.service +endif install: ## Install distribution install: install_bees install_scripts $(OPTIONAL_INSTALL_TARGETS)