-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile.doc
49 lines (42 loc) · 1.59 KB
/
Makefile.doc
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
44
45
46
47
48
49
# This Makefile generates the manual pages from the markdown README.mds. It depends
# on https://github.com/mmarkdown/mmark to be installed. Generally we want this to be
# updated before doing a release. The Debian package, for instance, looks at these pages
# and will install them on your system.
MMARK:=mmark -man
PLUGINS:=$(wildcard plugin/*/README.md)
READMES:=$(subst plugin/,,$(PLUGINS))
READMES:=$(subst /README.md,,$(READMES))
PLUGINS:=$(subst plugin/,coredns-,$(PLUGINS))
PLUGINS:=$(subst /README.md,(7),$(PLUGINS))
ifeq (, $(shell which mmark))
$(warning "No mmark in $$PATH, exiting, see github.com/mmarkdown/mmark")
all:
@echo "noop"
else
all: man/coredns.1 man/corefile.5 plugins
endif
man/coredns.1: coredns.1.md
@/bin/echo -e '%%%\n title = "coredns 1"\n' \
'area = "CoreDNS"\n workgroup = "CoreDNS"\n%%%\n\n' > [email protected]
@sed -i -e "s/@@PLUGINS@@/$(PLUGINS)/" [email protected]
$(MMARK) [email protected] > $@ && rm [email protected]
man/corefile.5: corefile.5.md
@/bin/echo -e '%%%\n title = "corefile 5"\n' \
'area = "CoreDNS"\n workgroup = "CoreDNS"\n%%%\n\n' > [email protected]
$(MMARK) [email protected] > $@ && rm [email protected]
.PHONY: plugins
plugins:
for README in $(READMES); do \
$(MAKE) -f Makefile.doc man/coredns-$$README.7; \
done
man/coredns-%.7: plugin/%/README.md
@/bin/echo -e "%%%\n title = \"`basename $@ | sed s\/\.7\/\/` 7\"\n" \
'area = "CoreDNS"\n workgroup = "CoreDNS Plugins"\n%%%\n\n' > [email protected]
@sed -i '/^# .*/d' [email protected]
$(MMARK) [email protected] > $@ && rm [email protected]
PHONY: clean
clean:
rm -f man/*