dcaacee105ebe6c7769ebeccdc5c43bdc5cf1481
[pve-docs.git] / Makefile
1 RELEASE=4.1
2
3 PVESM_SOURCES=attributes.txt pvesm.adoc pvesm.1-synopsis.adoc $(shell ls pve-storage-*.adoc)
4 PVEUM_SOURCES=attributes.txt pveum.adoc pveum.1-synopsis.adoc
5 VZDUMP_SOURCES=attributes.txt vzdump.adoc vzdump.1-synopsis.adoc
6 PVEFW_SOURCES=attributes.txt pve-firewall.adoc pve-firewall-rules-opts.adoc pve-firewall.8-synopsis.adoc
7 QM_SOURCES=attributes.txt qm.adoc qm.1-synopsis.adoc
8 PCT_SOURCES=attributes.txt pct.adoc pct.1-synopsis.adoc
9 PVEAM_SOURCES=attributes.txt pveam.adoc pveam.1-synopsis.adoc
10 HA_SOURCES=attributes.txt ha-manager.1-synopsis.adoc ha-manager.adoc
11
12 SYSADMIN_SOURCES=                       \
13         getting-help.adoc               \
14         pve-package-repos.adoc          \
15         pve-installation.adoc           \
16         system-software-updates.adoc    \
17         sysadmin.adoc
18
19 PVE_ADMIN_GUIDE_SOURCES=                \
20         datacenter.cfg.adoc             \
21         datacenter.cfg.5-opts.adoc      \
22         vm.conf.adoc                    \
23         vm.conf.5-opts.adoc             \
24         pct.conf.adoc                   \
25         pct.conf.5-opts.adoc            \
26         ${SYSADMIN_SOURCES}             \
27         pve-admin-guide.adoc            \
28         pve-intro.adoc                  \
29         pmxcfs.adoc                     \
30         pve-faq.adoc                    \
31         ${QM_SOURCES}                   \
32         ${PCT_SOURCES}                  \
33         ${PVEAM_SOURCES}                \
34         ${PVEFW_SOURCES}                \
35         ${PVEUM_SOURCES}                \
36         ${PVESM_SOURCES}                \
37         ${VZDUMP_SOURCES}               \
38         ${HA_SOURCES}                   \
39         images/cluster-nwdiag.svg       \
40         images/node-nwdiag.svg          \
41         pve-bibliography.adoc           \
42         GFDL.adoc                       \
43         attributes.txt
44
45 ADOC_STDARG= -a icons -a data-uri -a "date=$(shell date)"
46 ADOC_MAN1_HTML_ARGS=-a "manvolnum=1" ${ADOC_STDARG} -a "revnumber=${RELEASE}"
47 ADOC_MAN5_HTML_ARGS=-a "manvolnum=5" ${ADOC_STDARG} -a "revnumber=${RELEASE}"
48 ADOC_MAN8_HTML_ARGS=-a "manvolnum=8" ${ADOC_STDARG} -a "revnumber=${RELEASE}"
49
50 BROWSER?=xdg-open
51
52 all: pve-admin-guide.html
53
54 %-nwdiag.svg: %.nwdiag
55         nwdiag -T svg $*.nwdiag -o $@;
56
57 %.1-synopsis.adoc:
58         perl -e "use PVE::CLI::$(subst -,_,$*);print PVE::CLI::$(subst -,_,$*)->generate_asciidoc_synopsys();" > $@.tmp
59         mv $@.tmp $@
60
61 %.1: %.adoc %.1-synopsis.adoc docinfo.xml
62         a2x -a docinfo1 -a "manvolnum=1" -a "manversion=Release ${RELEASE}" -f manpage $*.adoc
63         test -z "$${NOVIEW}" && man -l $@
64
65 %.1.html: %.adoc %.1-synopsis.adoc docinfo.xml
66         asciidoc ${ADOC_MAN1_HTML_ARGS} -o $@ $*.adoc
67         test -z "$${NOVIEW}" && $(BROWSER) $@ &
68
69
70 %.8-synopsis.adoc:
71         perl -e "use PVE::Service::$(subst -,_,$*);print PVE::Service::$(subst -,_,$*)->generate_asciidoc_synopsys();" > $@.tmp
72         mv $@.tmp $@
73
74 %.8: %.adoc %.8-synopsis.adoc docinfo.xml
75         a2x -a docinfo1 -a "manvolnum=8" -a "manversion=Release ${RELEASE}" -f manpage $*.adoc
76         test -z "$${NOVIEW}" && man -l $@
77
78 %.8.html: %.adoc %.8-synopsis.adoc docinfo.xml
79         asciidoc ${ADOC_MAN8_HTML_ARGS} -o $@ $*.adoc
80         test -z "$${NOVIEW}" && $(BROWSER) $@ &
81
82 pve-firewall-rules-opts.adoc:
83         ./gen-pve-firewall-rules-opts-adoc.pl >$@.tmp
84         mv $@.tmp $@
85
86 datacenter.cfg.5-opts.adoc:
87         ./gen-datacenter-cfg-opts-adoc.pl >$@.tmp
88         mv $@.tmp $@
89
90 vm.conf.5-opts.adoc:
91         ./gen-vm-conf-opts-adoc.pl >$@.tmp
92         mv $@.tmp $@
93
94 pct.conf.5-opts.adoc:
95         ./gen-pct-conf-opts-adoc.pl >$@.tmp
96         mv $@.tmp $@
97
98 %.5: %.adoc %.5-opts.adoc docinfo.xml
99         a2x -a docinfo1 -a "manvolnum=5" -a "manversion=Release ${RELEASE}" -f manpage $*.adoc
100         test -z "$${NOVIEW}" && man -l $@
101
102 %.5.html: %.adoc %.5-opts.adoc docinfo.xml
103         asciidoc ${ADOC_MAN5_HTML_ARGS} -o $@ $*.adoc
104         test -z "$${NOVIEW}" && $(BROWSER) $@ &
105
106 index.html: index.adoc ${PVE_ADMIN_GUIDE_SOURCES}
107         $(MAKE) NOVIEW=1 pve-admin-guide.pdf pve-admin-guide.html pve-admin-guide.epub
108         $(MAKE) NOVIEW=1 qm.1.html pct.1.html pveam.1.html pvesm.1.html pveum.1.html vzdump.1.html pve-firewall.8.html ha-manager.1.html datacenter.cfg.5.html vm.conf.5.html pct.conf.5.html
109         asciidoc -a "date=$(shell date)" -a "revnumber=${RELEASE}" index.adoc
110         $(BROWSER) index.html &
111
112 pve-admin-guide.html: ${PVE_ADMIN_GUIDE_SOURCES}
113         asciidoc -a "revnumber=${RELEASE}" -a "date=$(shell date)" pve-admin-guide.adoc
114         test -z "$${NOVIEW}" && $(BROWSER) $@ &
115
116 pve-admin-guide.pdf: ${PVE_ADMIN_GUIDE_SOURCES} docinfo.xml pve-admin-guide-docinfo.xml
117         grep ">Release ${RELEASE}<" pve-admin-guide-docinfo.xml || (echo "wrong release in  pve-admin-guide-docinfo.xml" && false);
118         a2x -a docinfo -a docinfo1 -f pdf -L --dblatex-opts "-P latex.output.revhistory=0" --dblatex-opts "-P latex.class.options=12pt" pve-admin-guide.adoc
119         test -z "$${NOVIEW}" && $(BROWSER) $@ &
120
121 pve-admin-guide.epub: ${PVE_ADMIN_GUIDE_SOURCES}
122         a2x -f epub pve-admin-guide.adoc
123         test -z "$${NOVIEW}" && $(BROWSER) $@ &
124
125 update: clean
126         rm -f *.5-opts.adoc .1-synopsis.adoc .8-synopsis.adoc
127         make all
128
129 clean:
130         rm -rf *~ *.html *.pdf *.epub *.tmp *.1 *.5 *.8