]> git.proxmox.com Git - pve-docs.git/blob - Makefile
9196915979546214e27952c3efe5bc14304e0b67
[pve-docs.git] / Makefile
1 DGDIR=.
2
3 include ./pve-doc-generator.mk
4
5 PACKAGE=pve-doc-generator
6
7 # also update debian/changelog
8 PKGREL=1
9
10 GITVERSION:=$(shell cat .git/refs/heads/master)
11
12 DEB=${PACKAGE}_${DOCRELEASE}-${PKGREL}_amd64.deb
13
14 COMMAND_LIST=pvecm qm qmrestore pct pveam pvesm pveum vzdump ha-manager
15
16 SERVICE_LIST=pve-firewall pve-ha-crm pve-ha-lrm pvestatd
17
18 CONFIG_LIST=datacenter.cfg qm.conf pct.conf
19
20 DEB_SOURCES= \
21 pve-doc-generator.mk \
22 attributes.txt \
23 $(addsuffix .adoc, ${COMMAND_LIST}) \
24 $(addsuffix .adoc, ${SERVICE_LIST}) \
25 $(addsuffix .adoc, ${CONFIG_LIST}) \
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-copyright.adoc \
35 docinfo.xml
36
37 GEN_SCRIPTS= \
38 gen-datacenter.cfg.5-opts.pl \
39 gen-pct.conf.5-opts.pl \
40 gen-qm.conf.5-opts.pl \
41 gen-pve-firewall-cluster-opts.pl \
42 gen-pve-firewall-host-opts.pl \
43 gen-pve-firewall-macros-adoc.pl \
44 gen-pve-firewall-rules-opts.pl \
45 gen-pve-firewall-vm-opts.pl
46
47 VZDUMP_SOURCES=attributes.txt vzdump.adoc vzdump.1-synopsis.adoc
48 PVEAM_SOURCES=attributes.txt pveam.adoc pveam.1-synopsis.adoc
49
50 SYSADMIN_SOURCES= \
51 getting-help.adoc \
52 pve-package-repos.adoc \
53 pve-installation.adoc \
54 system-software-updates.adoc \
55 sysadmin.adoc
56
57 PVE_ADMIN_GUIDE_SOURCES= \
58 ${DATACENTER_CONF_MAN5_SOURCES} \
59 ${QM_CONF_MAN5_SOURCES} \
60 ${PCT_CONF_MAN5_SOURCES} \
61 ${SYSADMIN_SOURCES} \
62 pve-admin-guide.adoc \
63 pve-intro.adoc \
64 pmxcfs.adoc \
65 pve-faq.adoc \
66 ${PVE_FIREWALL_MAN8_SOURCES} \
67 ${PVESM_MAN1_SOURCES} \
68 ${PCT_MAN1_SOURCES} \
69 ${PVECM_MAN1_SOURCES} \
70 ${PVEUM_MAN1_SOURCES} \
71 ${QM_MAN1_SOURCES} \
72 ${QMRESTORE_MAN1_SOURCES} \
73 ${HA_MANAGER_MAN1_SOURCES} \
74 ${PVE_HA_CRM_MAN8_SOURCES} \
75 ${PVE_HA_LRM_MAN8_SOURCES} \
76 ${PVEAM_SOURCES} \
77 ${VZDUMP_SOURCES} \
78 images/cluster-nwdiag.svg \
79 images/node-nwdiag.svg \
80 pve-bibliography.adoc \
81 $(addsuffix .adoc, ${COMMAND_LIST}) \
82 $(addsuffix .adoc, ${SERVICE_LIST}) \
83 $(addsuffix .adoc, ${CONFIG_LIST}) \
84 GFDL.adoc \
85 attributes.txt
86
87 ADOC_STDARG= -a icons -a data-uri -a "date=$(shell date)"
88 ADOC_MAN1_HTML_ARGS=-a "manvolnum=1" ${ADOC_STDARG} -a "revnumber=${DOCRELEASE}"
89 ADOC_MAN5_HTML_ARGS=-a "manvolnum=5" ${ADOC_STDARG} -a "revnumber=${DOCRELEASE}"
90 ADOC_MAN8_HTML_ARGS=-a "manvolnum=8" ${ADOC_STDARG} -a "revnumber=${DOCRELEASE}"
91
92 BROWSER?=xdg-open
93
94 all: pve-admin-guide.html
95
96 %-nwdiag.svg: %.nwdiag
97 nwdiag -T svg $*.nwdiag -o $@;
98
99 %.1: %.adoc %.1-synopsis.adoc docinfo.xml attributes.txt
100 a2x -a docinfo1 -a "manvolnum=1" -a "manversion=Release ${DOCRELEASE}" -f manpage $*.adoc
101 test -n "$${NOVIEW}" || man -l $@
102
103 %.1.html: %.adoc %.1-synopsis.adoc docinfo.xml attributes.txt
104 asciidoc ${ADOC_MAN1_HTML_ARGS} -o $@ $*.adoc
105 test -n "$${NOVIEW}" || $(BROWSER) $@ &
106
107
108 %.8-synopsis.adoc:
109 perl -e "use PVE::Service::$(subst -,_,$*);print PVE::Service::$(subst -,_,$*)->generate_asciidoc_synopsys();" > $@.tmp
110 mv $@.tmp $@
111
112 %.8: %.adoc %.8-synopsis.adoc docinfo.xml
113 a2x -a docinfo1 -a "manvolnum=8" -a "manversion=Release ${DOCRELEASE}" -f manpage $*.adoc
114 test -n "$${NOVIEW}" || man -l $@
115
116 %.8.html: %.adoc %.8-synopsis.adoc docinfo.xml
117 asciidoc ${ADOC_MAN8_HTML_ARGS} -o $@ $*.adoc
118 test -n "$${NOVIEW}" || $(BROWSER) $@ &
119
120 %.5.html: %.adoc %.5-opts.adoc docinfo.xml
121 asciidoc ${ADOC_MAN5_HTML_ARGS} -o $@ $*.adoc
122 test -n "$${NOVIEW}" || $(BROWSER) $@ &
123
124 index.html: index.adoc ${PVE_ADMIN_GUIDE_SOURCES}
125 $(MAKE) NOVIEW=1 pve-admin-guide.pdf pve-admin-guide.html pve-admin-guide.epub
126 $(MAKE) NOVIEW=1 $(addsuffix .1.html, ${COMMAND_LIST}) $(addsuffix .8.html, ${SERVICE_LIST}) $(addsuffix .5.html, ${CONFIG_LIST})
127 asciidoc -a "date=$(shell date)" -a "revnumber=${DOCRELEASE}" index.adoc
128 test -n "$${NOVIEW}" || $(BROWSER) index.html &
129
130 pve-admin-guide.html: ${PVE_ADMIN_GUIDE_SOURCES}
131 asciidoc -a "revnumber=${DOCRELEASE}" -a "date=$(shell date)" pve-admin-guide.adoc
132 test -n "$${NOVIEW}" || $(BROWSER) $@ &
133
134 pve-admin-guide.pdf: ${PVE_ADMIN_GUIDE_SOURCES} docinfo.xml pve-admin-guide-docinfo.xml
135 grep ">Release ${DOCRELEASE}<" pve-admin-guide-docinfo.xml || (echo "wrong release in pve-admin-guide-docinfo.xml" && false);
136 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
137 test -n "$${NOVIEW}" || $(BROWSER) $@ &
138
139 pve-admin-guide.epub: ${PVE_ADMIN_GUIDE_SOURCES}
140 a2x -f epub pve-admin-guide.adoc
141 test -n "$${NOVIEW}" || $(BROWSER) $@ &
142
143 .PHONY: dinstall
144 dinstall: ${DEB}
145 dpkg -i ${DEB}
146
147 .PHONY: deb
148 ${DEB} deb:
149 rm -rf build
150 mkdir build
151 rsync -a debian/ build/debian
152 mkdir -p build/usr/share/${PACKAGE}
153 mkdir -p build/usr/share/doc/${PACKAGE}
154 echo "git clone git://git.proxmox.com/git/pve-docs.git\\ngit checkout ${GITVERSION}" > build/usr/share/doc/${PACKAGE}/SOURCE
155 install -m 0644 ${DEB_SOURCES} build/usr/share/${PACKAGE}
156 install -m 0755 ${GEN_SCRIPTS} build/usr/share/${PACKAGE}
157 cd build; dpkg-buildpackage -rfakeroot -b -us -uc
158 lintian ${DEB}
159
160 .PHONY: upload
161 upload: ${DEB}
162 umount /pve/${DOCRELEASE}; mount /pve/${DOCRELEASE} -o rw
163 mkdir -p /pve/${DOCRELEASE}/extra
164 rm -f /pve/${DOCRELEASE}/extra/${PACKAGE}_*.deb
165 rm -f /pve/${DOCRELEASE}/extra/Packages*
166 cp ${DEB} /pve/${DOCRELEASE}/extra
167 cd /pve/${DOCRELEASE}/extra; dpkg-scanpackages . /dev/null > Packages; gzip -9c Packages > Packages.gz
168 umount /pve/${DOCRELEASE}; mount /pve/${DOCRELEASE} -o ro
169
170 update: clean
171 rm -f *.5-opts.adoc .1-synopsis.adoc .8-synopsis.adoc
172 make all
173
174 clean:
175 rm -rf *~ *.html *.pdf *.epub *.tmp *.1 *.5 *.8 *.deb *.changes build
176