From ddb3e1236db89416bc233b8b876500b51fe0adbb Mon Sep 17 00:00:00 2001 From: Guilhem Moulin Date: Wed, 23 Feb 2022 00:12:39 +0100 Subject: Don't hardcode $(bindir) in .service files. --- Makefile | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index b91dce3..e25546d 100644 --- a/Makefile +++ b/Makefile @@ -1,12 +1,21 @@ srcdir ?= . builddir ?= build +prefix ?= /usr/local +exec_prefix ?= $(prefix) +bindir ?= $(exec_prefix)/bin +libdir ?= $(exec_prefix)/lib +datarootdir ?= $(prefix)/share +mandir ?= $(datarootdir)/man +man1dir ?= $(mandir)/man1 + CSS ?= /usr/share/javascript/bootstrap4/css/bootstrap.css HTML_TEMPLATE ?= $(srcdir)/doc/template.html HTML_FILES = $(patsubst $(srcdir)/doc/%.md,$(builddir)/doc/%.html,$(wildcard $(srcdir)/doc/*.md)) MANUAL_FILES = $(patsubst $(srcdir)/doc/%.md,$(builddir)/doc/%,$(wildcard $(srcdir)/doc/*.[1-9].md)) +SERVICE_FILES = $(patsubst $(srcdir)/%.service,$(builddir)/%.service,$(wildcard $(srcdir)/*.service)) -all: manual +all: manual $(SERVICE_FILES) manual: $(MANUAL_FILES) html: $(HTML_FILES) @@ -16,6 +25,10 @@ $(MANUAL_FILES): $(builddir)/doc/%: $(srcdir)/doc/%.md @mkdir -vp $(dir $@) pandoc -f markdown -t json -- "$<" | $(srcdir)/pandoc2man.jq | pandoc -s -f json -t man -o "$@" +$(SERVICE_FILES): $(builddir)/%.service: $(srcdir)/%.service + @mkdir -vp $(dir $@) + sed "s|@bindir@|$(bindir)|" <"$<" >"$@" + test: $(srcdir)/tests/certs/generate $(srcdir)/tests/run-all @@ -57,14 +70,6 @@ INSTALL ?= install INSTALL_PROGRAM ?= $(INSTALL) INSTALL_DATA ?= $(INSTALL) -m0644 -prefix ?= /usr/local -exec_prefix ?= $(prefix) -bindir ?= $(exec_prefix)/bin -libdir ?= $(exec_prefix)/lib -datarootdir ?= $(prefix)/share -mandir ?= $(datarootdir)/man -man1dir ?= $(mandir)/man1 - install: all $(INSTALL_PROGRAM) -vDt $(DESTDIR)$(bindir) $(srcdir)/interimap $(srcdir)/pullimap $(INSTALL_DATA) -vDT $(srcdir)/lib/Net/IMAP/InterIMAP.pm $(DESTDIR)$(datarootdir)/perl5/Net/IMAP/InterIMAP.pm @@ -72,7 +77,7 @@ install: all $(INSTALL_DATA) -vDt $(DESTDIR)$(datarootdir)/doc/pullimap $(srcdir)/pullimap.sample $(INSTALL_DATA) -vDt $(DESTDIR)$(datarootdir)/doc/interimap $(srcdir)/interimap.sample \ $(srcdir)/doc/getting-started.md $(srcdir)/doc/multi-account.md $(srcdir)/README - $(INSTALL_DATA) -vDt $(DESTDIR)$(libdir)/systemd/user $(srcdir)/*.service + $(INSTALL_DATA) -vDt $(DESTDIR)$(libdir)/systemd/user $(SERVICE_FILES) uninstall: rm -vf -- $(DESTDIR)$(bindir)/interimap $(DESTDIR)$(man1dir)/interimap.1 $(DESTDIR)$(libdir)/systemd/user/interimap*.service @@ -81,7 +86,7 @@ uninstall: rm -rvf -- $(DESTDIR)$(datarootdir)/doc/interimap $(DESTDIR)$(datarootdir)/doc/pullimap clean: - rm -vf -- $(MANUAL_FILES) $(HTML_FILES) + rm -vf -- $(MANUAL_FILES) $(HTML_FILES) $(SERVICE_FILES) -rmdir -vp --ignore-fail-on-non-empty -- $(builddir)/doc .PHONY: all manual html doc test release install uninstall clean -- cgit v1.2.3