mirror of
https://github.com/coredns/coredns.git
synced 2025-10-26 15:54:16 -04:00
each readme starts with the plugin's name as a header, this needs to be chopped off to provide a good manual page. Signed-off-by: Miek Gieben <miek@miek.nl>
45 lines
1.3 KiB
Makefile
45 lines
1.3 KiB
Makefile
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' > $@.header
|
|
@cat $@.header $< > $@.md && rm $@.header
|
|
@sed -i -e "s/@@PLUGINS@@/$(PLUGINS)/" $@.md
|
|
$(MMARK) $@.md > $@ && rm $@.md
|
|
|
|
man/corefile.5: corefile.5.md
|
|
@/bin/echo -e '%%%\n title = "corefile 5"\n' \
|
|
'area = "CoreDNS"\n workgroup = "CoreDNS"\n%%%\n\n' > $@.header
|
|
@cat $@.header $< > $@.md && rm $@.header
|
|
$(MMARK) $@.md > $@ && rm $@.md
|
|
|
|
.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' > $@.header
|
|
@cat $@.header $< > $@.md && rm $@.header
|
|
@sed -i '/^# .*/d' $@.md
|
|
$(MMARK) $@.md > $@ && rm $@.md
|
|
|
|
PHONY: clean
|
|
clean:
|
|
rm -f man/*
|