aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
authorGuilhem Moulin <guilhem@fripost.org>2022-02-23 00:12:39 +0100
committerGuilhem Moulin <guilhem@fripost.org>2022-02-23 01:53:05 +0100
commitddb3e1236db89416bc233b8b876500b51fe0adbb (patch)
treefcc99eb4297a02dd5ebf97068df5fdbcae4d8b77 /Makefile
parent733ed91162b02cd0fa5d7d1c443c780d3d4405e9 (diff)
Don't hardcode $(bindir) in .service files.
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile27
1 files changed, 16 insertions, 11 deletions
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