5
0
mirror of git://git.proxmox.com/git/pve-docs.git synced 2025-01-08 21:17:52 +03:00
pve-docs/pve-doc-generator.mk.in
Fabian Grünbichler fff735f96d pve-doc-generator: add rules for bash-completion
while these are not strictly documentation, they use the same mechanisms
and are generated at the same time as the man pages.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2018-10-18 14:12:20 +02:00

90 lines
2.6 KiB
Makefile

# also update debian/changelog
DOCRELEASE=5.2
DGDIR?=/usr/share/pve-doc-generator
ASCIIDOC_PVE?=/usr/bin/asciidoc-pve
PERL_DOC_ENV=PVE_GENERATING_DOCS=1
PERL_DOC_INC_DIRS:=${PERL_DOC_INC_DIRS} .
PERL_DOC_INC=$(foreach dir,${PERL_DOC_INC_DIRS},-I${dir})
PVE_COMMON_DOC_SOURCES= \
${ASCIIDOC_PVE} \
pve-copyright.adoc \
docinfo.xml
all:
attributes.txt docinfo.xml pmxcfs.8-synopsis.adoc:
cp ${DGDIR}/$@ $@.tmp
mv $@.tmp $@
%-opts.adoc: ${DGDIR}/gen-%-opts.pl
$(PERL_DOC_ENV) perl ${PERL_DOC_INC} ${DGDIR}/gen-$*-opts.pl >$@.tmp
mv $@.tmp $@
%.adoc: ${DGDIR}/gen-%-adoc.pl
$(PERL_DOC_ENV) perl ${PERL_DOC_INC} ${DGDIR}/gen-$*-adoc.pl >$@.tmp
mv $@.tmp $@
pveperf.1-synopsis.adoc:
echo '*pveperf* `[PATH]`' > pveperf.1-synopsis.adoc
%.1-synopsis.adoc:
$(PERL_DOC_ENV) perl ${PERL_DOC_INC} -e "use PVE::CLI::$(subst -,_,$*);print PVE::CLI::$(subst -,_,$*)->generate_asciidoc_synopsis();" > $@.tmp
mv $@.tmp $@
%.8-synopsis.adoc:
$(PERL_DOC_ENV) perl ${PERL_DOC_INC} -e "use PVE::Service::$(subst -,_,$*);print PVE::Service::$(subst -,_,$*)->generate_asciidoc_synopsis();" > $@.tmp
mv $@.tmp $@
ifneq (${DGDIR},.)
%.adoc: ${DGDIR}/%.adoc
cp $< $@.tmp
mv $@.tmp $@
endif
%.service-bash-completion:
perl ${PERL_DOC_INC} -T -e "use PVE::Service::$*; PVE::Service::$*->generate_bash_completions();" >$@.tmp
mv $@.tmp $@
%.bash-completion:
perl ${PERL_DOC_INC} -T -e "use PVE::CLI::$*; PVE::CLI::$*->generate_bash_completions();" >$@.tmp
mv $@.tmp $@
%-plain.html: %.adoc ${PVE_COMMON_DOC_SOURCES}
${ASCIIDOC_PVE} compile-wiki -o $@ $*.adoc
chapter-%.html: %.adoc ${PVE_COMMON_DOC_SOURCES}
${ASCIIDOC_PVE} compile-chapter -o $@ $*.adoc
%.1: %.adoc %.1-synopsis.adoc ${PVE_COMMON_DOC_SOURCES}
${ASCIIDOC_PVE} compile-man -o $@ $*.adoc
test -n "$${NOVIEW}" || man -l $@
%.1.html: %.adoc %.1-synopsis.adoc ${PVE_COMMON_DOC_SOURCES}
${ASCIIDOC_PVE} compile-man-html -o $@ $*.adoc
%.8: %.adoc %.8-synopsis.adoc ${PVE_COMMON_DOC_SOURCES}
${ASCIIDOC_PVE} compile-man -o $@ $*.adoc
test -n "$${NOVIEW}" || man -l $@
%.8.html: %.adoc %.8-synopsis.adoc ${PVE_COMMON_DOC_SOURCES}
${ASCIIDOC_PVE} compile-man-html -o $@ $*.adoc
%.5: %.adoc %.5-opts.adoc ${PVE_COMMON_DOC_SOURCES}
${ASCIIDOC_PVE} compile-man -o $@ $*.adoc
test -n "$${NOVIEW}" || man -l $@
%.5.html: %.adoc %.5-opts.adoc ${PVE_COMMON_DOC_SOURCES}
${ASCIIDOC_PVE} compile-man-html -o $@ $*.adoc
%.5-plain.html: %.adoc %.5-opts.adoc ${PVE_COMMON_DOC_SOURCES}
${ASCIIDOC_PVE} compile-man-wiki -o $@ $*.adoc
.PHONY: cleanup-docgen
cleanup-docgen:
rm -f *.xml.tmp *.1 *.5 *.8 *.adoc docinfo.xml