aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Makefile27
-rw-r--r--interimap.service2
-rw-r--r--interimap@.service2
-rw-r--r--pullimap@.service2
4 files changed, 19 insertions, 14 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
diff --git a/interimap.service b/interimap.service
index 6d7fa45..eef7a1c 100644
--- a/interimap.service
+++ b/interimap.service
@@ -5,7 +5,7 @@ Wants=network-online.target
After=network-online.target
[Service]
-ExecStart=/usr/bin/interimap --watch=60
+ExecStart=@bindir@/interimap --watch=60
RestartSec=10min
Restart=on-failure
diff --git a/interimap@.service b/interimap@.service
index 6957b79..54791d8 100644
--- a/interimap@.service
+++ b/interimap@.service
@@ -6,7 +6,7 @@ Wants=network-online.target
After=network-online.target
[Service]
-ExecStart=/usr/bin/interimap --config=%i --watch=60
+ExecStart=@bindir@/interimap --config=%i --watch=60
RestartSec=10min
Restart=on-failure
diff --git a/pullimap@.service b/pullimap@.service
index a9ce09a..aefc4f6 100644
--- a/pullimap@.service
+++ b/pullimap@.service
@@ -5,7 +5,7 @@ Wants=network-online.target
After=network-online.target
[Service]
-ExecStart=/usr/bin/pullimap --idle %i
+ExecStart=@bindir@/pullimap --idle %i
RestartSec=2min
Restart=always