export pct.1 pct.conf.5 vm.conf.5 and datacenter.conf.5
[pve-docs.git] / pve-doc-generator.mk
1 # also update debian/changelog
2 DOCRELEASE=4.1
3
4 DGDIR?=/usr/share/pve-doc-generator
5
6 all:
7
8 PVE_COMMON_DOC_SOURCES=                 \
9         attributes.txt                  \
10         pve-copyright.adoc              \
11         docinfo.xml
12
13 PVE_FIREWALL_MAN8_SOURCES=              \
14         pve-firewall.adoc               \
15         pve-firewall.8-synopsis.adoc    \
16         pve-firewall-cluster-opts.adoc  \
17         pve-firewall-host-opts.adoc     \
18         pve-firewall-vm-opts.adoc       \
19         pve-firewall-rules-opts.adoc    \
20         pve-firewall-macros.adoc        \
21         ${PVE_COMMON_DOC_SOURCES}
22
23 PVESM_MAN1_SOURCES=                     \
24         pvesm.adoc                      \
25         pvesm.1-synopsis.adoc           \
26         pve-storage-dir.adoc            \
27         pve-storage-glusterfs.adoc      \
28         pve-storage-iscsi.adoc          \
29         pve-storage-iscsidirect.adoc    \
30         pve-storage-lvm.adoc            \
31         pve-storage-nfs.adoc            \
32         pve-storage-rbd.adoc            \
33         pve-storage-zfspool.adoc        \
34         ${PVE_COMMON_DOC_SOURCES}
35
36 PCT_MAN1_SOURCES=                       \
37         pct.adoc                        \
38         pct.1-synopsis.adoc             \
39         ${PVE_COMMON_DOC_SOURCES}
40
41 attributes.txt docinfo.xml:
42         cp ${DGDIR}/$@ $@.tmp
43         mv $@.tmp $@
44
45 %-opts.adoc: ${DGDIR}/gen-%-opts.pl
46         ${DGDIR}/gen-$*-opts.pl >$@.tmp
47         mv $@.tmp $@
48
49 %.adoc: ${DGDIR}/gen-%-adoc.pl
50         ${DGDIR}/gen-$*-adoc.pl >$@.tmp
51         mv $@.tmp $@
52
53 %.1-synopsis.adoc:
54         perl -I. -e "use PVE::CLI::$(subst -,_,$*);print PVE::CLI::$(subst -,_,$*)->generate_asciidoc_synopsys();" > $@.tmp
55         mv $@.tmp $@
56
57 %.8-synopsis.adoc:
58         perl -I. -e "use PVE::Service::$(subst -,_,$*);print PVE::Service::$(subst -,_,$*)->generate_asciidoc_synopsys();" > $@.tmp
59         mv $@.tmp $@
60
61 ifneq (${DGDIR},.)
62 %.adoc: ${DGDIR}/%.adoc
63         cp $< $@.tmp
64         mv $@.tmp $@
65 endif
66
67 pve-firewall.8: ${PVE_FIREWALL_MAN8_SOURCES}
68         a2x -a docinfo1 -a "manvolnum=8" -a "manversion=Release ${DOCRELEASE}" -f manpage pve-firewall.adoc
69         test -n "$${NOVIEW}" || man -l $@
70
71 pvesm.1: ${PVESM_MAN1_SOURCES}
72         a2x -a docinfo1 -a "manvolnum=1" -a "manversion=Release ${DOCRELEASE}" -f manpage pvesm.adoc
73         test -n "$${NOVIEW}" || man -l $@
74
75 pct.1: ${PCT_MAN1_SOURCES}
76         a2x -a docinfo1 -a "manvolnum=1" -a "manversion=Release ${DOCRELEASE}" -f manpage pct.adoc
77         test -n "$${NOVIEW}" || man -l $@
78
79 pct.conf.5: pct.conf.adoc pct.conf.5-opts.adoc ${PVE_COMMON_DOC_SOURCES}
80         a2x -a docinfo1 -a "manvolnum=5" -a "manversion=Release ${DOCRELEASE}" -f manpage pct.conf.adoc
81         test -n "$${NOVIEW}" || man -l $@
82
83 vm.conf.5: vm.conf.adoc vm.conf.5-opts.adoc ${PVE_COMMON_DOC_SOURCES}
84         a2x -a docinfo1 -a "manvolnum=5" -a "manversion=Release ${DOCRELEASE}" -f manpage vm.conf.adoc
85         test -n "$${NOVIEW}" || man -l $@
86
87 datacenter.conf.5: datacenter.conf.adoc datacenter.conf.5-opts.adoc ${PVE_COMMON_DOC_SOURCES}
88         a2x -a docinfo1 -a "manvolnum=5" -a "manversion=Release ${DOCRELEASE}" -f manpage datacenter.conf.adoc
89         test -n "$${NOVIEW}" || man -l $@
90
91 .PHONY: cleanup-docgen
92 cleanup-docgen:
93         rm -f *.1 *.8 *.adoc attributes.txt docinfo.xml