aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile
blob: 467b83434df7e56190aba9e632073453156029d1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
DESTDIR ?= /usr/local
BUILD_DOCDIR ?= .
MANUAL_FILES = $(addprefix $(BUILD_DOCDIR)/,$(patsubst ./%.md,%,$(wildcard ./*.[1-9].md)))

all: manual
doc: manual

manual: $(MANUAL_FILES)

# upper case the headers and remove the links
$(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)/libexec
datarootdir ?= $(prefix)/share
sysconfdir ?= $(prefix)/etc
mandir ?= $(datarootdir)/man
man1dir ?= $(mandir)/man1
man8dir ?= $(mandir)/man8

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
	install -m0644 -vDt $(man8dir) $(BUILD_DOCDIR)/lacme.8
	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 $(man8dir)/lacme.8
	rm -rvf -- $(sysconfdir)/lacme $(datarootdir)/lacme $(libexecdir)/lacme

clean:
	rm -vf -- $(MANUAL_FILES)

.PHONY: all doc manual install uninstall clean