define DOCRELEASE=4.1 inside pve-doc-generator.mk
[pve-docs.git] / Makefile
CommitLineData
bef0c1b4
DM
1DGDIR=.
2
3include ./pve-doc-generator.mk
deb7f2ea 4
9344ee0d
DM
5PACKAGE=pve-doc-generator
6
7# also update debian/changelog
8PKGREL=1
9
bef0c1b4 10DEB=${PACKAGE}_${DOCRELEASE}-${PKGREL}_amd64.deb
9344ee0d
DM
11
12
13DEB_SOURCES= \
14 pve-doc-generator.mk \
15 attributes.txt \
16 pvesm.adoc \
17 pveum.adoc \
18 vzdump.adoc \
19 pve-firewall.adoc \
20 qm.adoc \
21 pct.adoc \
22 pveam.adoc \
23 ha-manager.adoc \
24 pve-copyright.adoc \
25 docinfo.xml
26
27GEN_SCRIPTS= \
28 gen-datacenter-cfg-opts-adoc.pl \
29 gen-pct-conf-opts-adoc.pl \
30 gen-pve-firewall-cluster-opts.pl \
31 gen-pve-firewall-host-opts.pl \
32 gen-pve-firewall-macros-adoc.pl \
33 gen-pve-firewall-rules-opts.pl \
34 gen-pve-firewall-vm-opts.pl \
35 gen-vm-conf-opts-adoc.pl
36
deb7f2ea
DM
37PVESM_SOURCES=attributes.txt pvesm.adoc pvesm.1-synopsis.adoc $(shell ls pve-storage-*.adoc)
38PVEUM_SOURCES=attributes.txt pveum.adoc pveum.1-synopsis.adoc
39VZDUMP_SOURCES=attributes.txt vzdump.adoc vzdump.1-synopsis.adoc
deb7f2ea
DM
40QM_SOURCES=attributes.txt qm.adoc qm.1-synopsis.adoc
41PCT_SOURCES=attributes.txt pct.adoc pct.1-synopsis.adoc
d61bab51 42PVEAM_SOURCES=attributes.txt pveam.adoc pveam.1-synopsis.adoc
22653ac8 43HA_SOURCES=attributes.txt ha-manager.1-synopsis.adoc ha-manager.adoc
deb7f2ea 44
d91f8c1e
DM
45SYSADMIN_SOURCES= \
46 getting-help.adoc \
47 pve-package-repos.adoc \
48 pve-installation.adoc \
49 system-software-updates.adoc \
50 sysadmin.adoc
51
deb7f2ea 52PVE_ADMIN_GUIDE_SOURCES= \
c016ebb7
DM
53 datacenter.cfg.adoc \
54 datacenter.cfg.5-opts.adoc \
7b2c36ae
DM
55 vm.conf.adoc \
56 vm.conf.5-opts.adoc \
71e16346
DM
57 pct.conf.adoc \
58 pct.conf.5-opts.adoc \
d91f8c1e 59 ${SYSADMIN_SOURCES} \
deb7f2ea
DM
60 pve-admin-guide.adoc \
61 pve-intro.adoc \
62 pmxcfs.adoc \
63 pve-faq.adoc \
9344ee0d 64 ${PVE_FIREWALL_MAN8_SOURCES} \
deb7f2ea
DM
65 ${QM_SOURCES} \
66 ${PCT_SOURCES} \
d61bab51 67 ${PVEAM_SOURCES} \
deb7f2ea
DM
68 ${PVEUM_SOURCES} \
69 ${PVESM_SOURCES} \
70 ${VZDUMP_SOURCES} \
22653ac8 71 ${HA_SOURCES} \
deb7f2ea
DM
72 images/cluster-nwdiag.svg \
73 images/node-nwdiag.svg \
74 pve-bibliography.adoc \
caf01dfc 75 GFDL.adoc \
deb7f2ea
DM
76 attributes.txt
77
78ADOC_STDARG= -a icons -a data-uri -a "date=$(shell date)"
bef0c1b4
DM
79ADOC_MAN1_HTML_ARGS=-a "manvolnum=1" ${ADOC_STDARG} -a "revnumber=${DOCRELEASE}"
80ADOC_MAN5_HTML_ARGS=-a "manvolnum=5" ${ADOC_STDARG} -a "revnumber=${DOCRELEASE}"
81ADOC_MAN8_HTML_ARGS=-a "manvolnum=8" ${ADOC_STDARG} -a "revnumber=${DOCRELEASE}"
deb7f2ea 82
fc1090ef 83BROWSER?=xdg-open
df41beec 84
7b2c36ae
DM
85all: pve-admin-guide.html
86
deb7f2ea
DM
87%-nwdiag.svg: %.nwdiag
88 nwdiag -T svg $*.nwdiag -o $@;
89
bef0c1b4
DM
90%.1: %.adoc %.1-synopsis.adoc docinfo.xml attributes.txt
91 a2x -a docinfo1 -a "manvolnum=1" -a "manversion=Release ${DOCRELEASE}" -f manpage $*.adoc
9344ee0d 92 test -n "$${NOVIEW}" || man -l $@
deb7f2ea 93
bef0c1b4 94%.1.html: %.adoc %.1-synopsis.adoc docinfo.xml attributes.txt
deb7f2ea 95 asciidoc ${ADOC_MAN1_HTML_ARGS} -o $@ $*.adoc
9344ee0d 96 test -n "$${NOVIEW}" || $(BROWSER) $@ &
deb7f2ea
DM
97
98
99%.8-synopsis.adoc:
100 perl -e "use PVE::Service::$(subst -,_,$*);print PVE::Service::$(subst -,_,$*)->generate_asciidoc_synopsys();" > $@.tmp
101 mv $@.tmp $@
102
103%.8: %.adoc %.8-synopsis.adoc docinfo.xml
bef0c1b4 104 a2x -a docinfo1 -a "manvolnum=8" -a "manversion=Release ${DOCRELEASE}" -f manpage $*.adoc
9344ee0d 105 test -n "$${NOVIEW}" || man -l $@
deb7f2ea
DM
106
107%.8.html: %.adoc %.8-synopsis.adoc docinfo.xml
108 asciidoc ${ADOC_MAN8_HTML_ARGS} -o $@ $*.adoc
9344ee0d 109 test -n "$${NOVIEW}" || $(BROWSER) $@ &
71e16346 110
c016ebb7 111%.5: %.adoc %.5-opts.adoc docinfo.xml
bef0c1b4 112 a2x -a docinfo1 -a "manvolnum=5" -a "manversion=Release ${DOCRELEASE}" -f manpage $*.adoc
9344ee0d 113 test -n "$${NOVIEW}" || man -l $@
c016ebb7
DM
114
115%.5.html: %.adoc %.5-opts.adoc docinfo.xml
116 asciidoc ${ADOC_MAN5_HTML_ARGS} -o $@ $*.adoc
9344ee0d 117 test -n "$${NOVIEW}" || $(BROWSER) $@ &
c016ebb7 118
deb7f2ea
DM
119index.html: index.adoc ${PVE_ADMIN_GUIDE_SOURCES}
120 $(MAKE) NOVIEW=1 pve-admin-guide.pdf pve-admin-guide.html pve-admin-guide.epub
71e16346 121 $(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
bef0c1b4 122 asciidoc -a "date=$(shell date)" -a "revnumber=${DOCRELEASE}" index.adoc
9344ee0d 123 test -n "$${NOVIEW}" || $(BROWSER) index.html &
deb7f2ea
DM
124
125pve-admin-guide.html: ${PVE_ADMIN_GUIDE_SOURCES}
bef0c1b4 126 asciidoc -a "revnumber=${DOCRELEASE}" -a "date=$(shell date)" pve-admin-guide.adoc
9344ee0d 127 test -n "$${NOVIEW}" || $(BROWSER) $@ &
deb7f2ea 128
2296c490 129pve-admin-guide.pdf: ${PVE_ADMIN_GUIDE_SOURCES} docinfo.xml pve-admin-guide-docinfo.xml
bef0c1b4 130 grep ">Release ${DOCRELEASE}<" pve-admin-guide-docinfo.xml || (echo "wrong release in pve-admin-guide-docinfo.xml" && false);
27125931 131 a2x -a docinfo -a docinfo1 -f pdf -L --dblatex-opts "-P latex.output.revhistory=0" --dblatex-opts "-P latex.class.options=12pt" --dblatex-opts "-P doc.section.depth=2 -P toc.section.depth=2" pve-admin-guide.adoc
9344ee0d 132 test -n "$${NOVIEW}" || $(BROWSER) $@ &
deb7f2ea
DM
133
134pve-admin-guide.epub: ${PVE_ADMIN_GUIDE_SOURCES}
135 a2x -f epub pve-admin-guide.adoc
9344ee0d
DM
136 test -n "$${NOVIEW}" || $(BROWSER) $@ &
137
138.PHONY: dinstall
139dinstall: ${DEB}
140 dpkg -i ${DEB}
141
142.PHONY: deb
143${DEB} deb:
144 rm -rf build
145 mkdir build
146 rsync -a debian/ build/debian
147 mkdir -p build/usr/share/${PACKAGE}
148 install -m 0644 ${DEB_SOURCES} build/usr/share/${PACKAGE}
149 install -m 0755 ${GEN_SCRIPTS} build/usr/share/${PACKAGE}
150 cd build; dpkg-buildpackage -rfakeroot -b -us -uc
151 lintian ${DEB}
152
deb7f2ea 153
c016ebb7
DM
154update: clean
155 rm -f *.5-opts.adoc .1-synopsis.adoc .8-synopsis.adoc
156 make all
deb7f2ea
DM
157
158clean:
9344ee0d
DM
159 rm -rf *~ *.html *.pdf *.epub *.tmp *.1 *.5 *.8 *.deb *.changes build
160