aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuilhem Moulin <guilhem@fripost.org>2020-08-03 21:58:25 +0200
committerGuilhem Moulin <guilhem@fripost.org>2020-08-03 22:31:19 +0200
commit615f98315ce17751a703d4933ae690befdae82e1 (patch)
tree0f701451c7907864298136875c1d15377a861d3f
parent0cf8517bea1e939d7054e682cde24767e7ed6e04 (diff)
Makefile: Major refactoring, add install and uninstall targets.
Honor BUILD_DOCDIR and DESTDIR variables.
-rw-r--r--Changelog8
-rw-r--r--Makefile59
-rw-r--r--lacme-accountd.1.md (renamed from lacme-accountd.md)0
-rw-r--r--lacme.1.md (renamed from lacme.md)0
-rwxr-xr-xpandoc2man.jq (renamed from fixman.jq)10
5 files changed, 46 insertions, 31 deletions
diff --git a/Changelog b/Changelog
index 2010c52..6aa31e8 100644
--- a/Changelog
+++ b/Changelog
@@ -1,8 +1,10 @@
lacme (0.7) UNRELEASED;
- + Default listening socket for the webserver component is now
- /run/lacme-www.socket. (It was previously under the legacy directory
- /var/run.)
+ + Default listening socket for the webserver component is now
+ /run/lacme-www.socket. (It was previously under the legacy directory
+ /var/run.)
+ * Makefile: major refactoring, add install and uninstall targets, honor
+ BUILD_DOCDIR and DESTDIR variables.
-- Guilhem Moulin <guilhem@debian.org> Thu, 22 Aug 2019 00:31:35 +0200
diff --git a/Makefile b/Makefile
index 0aa3046..6bfa739 100644
--- a/Makefile
+++ b/Makefile
@@ -1,30 +1,41 @@
-MANPAGES = lacme-accountd.1 lacme.1
+DESTDIR ?= /usr/local
+BUILD_DOCDIR ?= .
+MANUAL_FILES = $(addprefix $(BUILD_DOCDIR)/,$(patsubst ./%.md,%,$(wildcard ./*.[1-9].md)))
-all: ${MANPAGES}
+all: manual
+doc: manual
+
+manual: $(MANUAL_FILES)
# upper case the headers and remove the links
-%.1: %.md
- @pandoc -f markdown -t json "$<" | \
- jq -f fixman.jq | \
- pandoc -s -f json -t man+smart -o "$@"
-
-install: ${MANPAGES}
- install -d $(DESTDIR)/etc/lacme
- install -d $(DESTDIR)/etc/lacme/lacme-certs.conf.d
- install -m0644 -t $(DESTDIR)/etc/lacme config/*.conf
- install -m0644 -t $(DESTDIR)/etc/lacme snippets/*.conf
- install -d $(DESTDIR)/usr/share/lacme
- install -m0644 -t $(DESTDIR)/usr/share/lacme certs/lets-encrypt-x[1-4]-cross-signed.pem
- install -d $(DESTDIR)/usr/lib/lacme
- install -m0755 -t $(DESTDIR)/usr/lib/lacme client webserver
- install -d $(DESTDIR)/usr/share/man/man1
- install -m0644 -t $(DESTDIR)/usr/share/man/man1 lacme-accountd.1 lacme.1
- install -d $(DESTDIR)/usr/bin
- install -m0644 -t $(DESTDIR)/usr/bin lacme-accountd
- install -d $(DESTDIR)/usr/sbin
- install -m0644 -t $(DESTDIR)/usr/bin lacme
+$(MANUAL_FILES): $(BUILD_DOCDIR)/%: ./%.md
+ pandoc -f markdown -t json -- "$<" | ./pandoc2man.jq | pandoc -s -f json -t man -o "$@"
+
+prefix ?= $(DESTDIR)
+exec_prefix ?= $(prefix)
+bindir ?= $(exec_prefix)/bin
+sbindir ?= $(exec_prefix)/sbin
+libexecdir ?= $(exec_prefix)/lib
+datarootdir ?= $(prefix)/share
+sysconfdir ?= $(prefix)/etc
+mandir ?= $(datarootdir)/man
+man1dir ?= $(mandir)/man1
+
+install: all
+ install -m0644 -vDt $(sysconfdir)/lacme config/*.conf snippets/*.conf
+ install -vd $(sysconfdir)/lacme/lacme-certs.conf.d
+ install -m0644 -vDt $(datarootdir)/lacme certs/lets-encrypt-x[1-4]-cross-signed.pem
+ install -m0755 -vDt $(libexecdir)/lacme ./client ./webserver
+ install -m0644 -vDt $(man1dir) $(BUILD_DOCDIR)/lacme-accountd.1 $(BUILD_DOCDIR)/lacme.1
+ install -m0644 -vDt $(bindir) ./lacme-accountd
+ install -m0644 -vDt $(sbindir) ./lacme
+
+uninstall:
+ rm -vf -- $(bindir)/lacme-accountd $(sbindir)/lacme
+ rm -vf -- $(man1dir)/lacme-accountd.1 $(man1dir)/lacme.1
+ rm -rvf -- $(sysconfdir)/lacme $(datarootdir)/lacme $(libexecdir)/lacme
clean:
- rm -vf ${MANPAGES}
+ rm -vf -- $(MANUAL_FILES)
-.PHONY: all install clean
+.PHONY: all doc manual install uninstall clean
diff --git a/lacme-accountd.md b/lacme-accountd.1.md
index 403c68c..403c68c 100644
--- a/lacme-accountd.md
+++ b/lacme-accountd.1.md
diff --git a/lacme.md b/lacme.1.md
index 5d86f40..5d86f40 100644
--- a/lacme.md
+++ b/lacme.1.md
diff --git a/fixman.jq b/pandoc2man.jq
index 3524420..69802a5 100755
--- a/fixman.jq
+++ b/pandoc2man.jq
@@ -1,4 +1,5 @@
-#!/usr/bin/jq -f
+#!/usr/bin/jq -f
+
def fixheaders:
if .t == "Header" then
.c[2][] |= (if .t == "Str" then .c |= ascii_upcase else . end)
@@ -20,7 +21,8 @@ def fixlinks:
end
end;
-{ "pandoc-api-version"
-, meta
-, blocks: .blocks | map(fixheaders) | map(fixlinks)
+{
+ "pandoc-api-version"
+ , meta
+ , blocks: .blocks | map(fixheaders | fixlinks)
}