pmg-docs/pmg-doc-generator.mk.in
Thomas Lamprecht 1e94bc8164 make changelog single source of version
Adapted from pve-docs respective commit [0]

[0]: https://git.proxmox.com/?p=pve-docs.git;a=commitdiff;h=76909adf48fc211e7799795fcb96eed5447e2b9a

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-07-23 19:43:15 +02:00

104 lines
2.8 KiB
Makefile

DOCRELEASE=@RELEASE@
DGDIR?=/usr/share/pmg-doc-generator
ASCIIDOC_PMG?=/usr/bin/asciidoc-pmg
PERL_DOC_ENV=PMG_GENERATING_DOCS=1
PMG_COMMON_DOC_SOURCES= \
${ASCIIDOC_PMG} \
pmg-copyright.adoc \
docinfo.xml
all:
pmgsh.1-synopsis.adoc:
@echo 'Interactive session:' >$@.tmp
@echo '' >>$@.tmp
@echo '*pmgsh*' >>$@.tmp
@echo '' >>$@.tmp
@echo 'Directly call API functions:' >>$@.tmp
@echo '' >>$@.tmp
@echo '*pmgsh* `(get|set|create|help)` `<path>` `[OPTIONS]`' >>$@.tmp
mv $@.tmp $@
pmg-smtp-filter.8-synopsis.adoc:
@echo 'Please use systemd tools to manage this service.' >$@.tmp
@echo '' >>$@.tmp
@echo '*systemctl* `(start|stop|restart|reload|status)` `pmg-smtp-filter`' >>$@.tmp
mv $@.tmp $@
pmgpolicy.8-synopsis.adoc:
@echo 'Please use systemd tools to manage this service.' >$@.tmp
@echo '' >>$@.tmp
@echo '*systemctl* `(start|stop|restart|reload|status)` `pmgpolicy`' >>$@.tmp
mv $@.tmp $@
docinfo.xml:
cp ${DGDIR}/$@ $@.tmp
mv $@.tmp $@
%-opts.adoc: ${DGDIR}/gen-%-opts.pl
$(PERL_DOC_ENV) perl -I. ${DGDIR}/gen-$*-opts.pl >$@.tmp
mv $@.tmp $@
pmg.%-conf-opts.adoc: ${DGDIR}/gen-pmg.conf.5-opts.pl
$(PERL_DOC_ENV) perl -I. ${DGDIR}/gen-pmg.conf.5-opts.pl $* >$@.tmp
mv $@.tmp $@
%.adoc: ${DGDIR}/gen-%-adoc.pl
$(PERL_DOC_ENV) perl -I. ${DGDIR}/gen-$*-adoc.pl >$@.tmp
mv $@.tmp $@
%.1-synopsis.adoc:
$(PERL_DOC_ENV) perl -I. -e "use PMG::CLI::$(subst -,_,$*);print PMG::CLI::$(subst -,_,$*)->generate_asciidoc_synopsis();" > $@.tmp
mv $@.tmp $@
%.8-synopsis.adoc:
$(PERL_DOC_ENV) perl -I. -e "use PMG::Service::$(subst -,_,$*);print PMG::Service::$(subst -,_,$*)->generate_asciidoc_synopsis();" > $@.tmp
mv $@.tmp $@
ifneq (${DGDIR},.)
%.adoc: ${DGDIR}/%.adoc
cp $< $@.tmp
mv $@.tmp $@
endif
%-plain.html: %.adoc ${PMG_COMMON_DOC_SOURCES}
${ASCIIDOC_PMG} compile-wiki -o $@ $*.adoc
chapter-%.html: %.adoc ${PMG_COMMON_DOC_SOURCES}
${ASCIIDOC_PMG} compile-chapter -o $@ $*.adoc
%.1: %.adoc %.1-synopsis.adoc ${PMG_COMMON_DOC_SOURCES}
${ASCIIDOC_PMG} compile-man -o $@ $*.adoc
test -n "$${NOVIEW}" || man -l $@
%.1.html: %.adoc %.1-synopsis.adoc ${PMG_COMMON_DOC_SOURCES}
${ASCIIDOC_PMG} compile-man-html -o $@ $*.adoc
%.8: %.adoc %.8-synopsis.adoc ${PMG_COMMON_DOC_SOURCES}
${ASCIIDOC_PMG} compile-man -o $@ $*.adoc
test -n "$${NOVIEW}" || man -l $@
%.8.html: %.adoc %.8-synopsis.adoc ${PMG_COMMON_DOC_SOURCES}
${ASCIIDOC_PMG} compile-man-html -o $@ $*.adoc
%.5: %.adoc %.5-opts.adoc ${PMG_COMMON_DOC_SOURCES}
${ASCIIDOC_PMG} compile-man -o $@ $*.adoc
test -n "$${NOVIEW}" || man -l $@
%.5.html: %.adoc %.5-opts.adoc ${PMG_COMMON_DOC_SOURCES}
${ASCIIDOC_PMG} compile-man-html -o $@ $*.adoc
%.5-plain.html: %.adoc %.5-opts.adoc ${PMG_COMMON_DOC_SOURCES}
${ASCIIDOC_PMG} compile-man-wiki -o $@ $*.adoc
.PHONY: cleanup-docgen
cleanup-docgen:
rm -f *.xml.tmp *.1 *.5 *.8 *.adoc docinfo.xml