]> git.proxmox.com Git - pve-docs.git/blame - Makefile
Add a chapter explaining how online help is added to the GUI
[pve-docs.git] / Makefile
CommitLineData
bef0c1b4 1DGDIR=.
c38115e9 2ASCIIDOC_PVE=./asciidoc-pve
bef0c1b4 3
9015f48f
DM
4GEN_PACKAGE=pve-doc-generator
5DOC_PACKAGE=pve-docs
cfabc2e9 6MEDIAWIKI_PACKAGE=pve-docs-mediawiki
9344ee0d
DM
7
8# also update debian/changelog
7228091a 9PKGREL=18
9344ee0d 10
b4f3c18a
DM
11GITVERSION:=$(shell cat .git/refs/heads/master)
12
0a3c58e0
TL
13ARCH:=$(shell dpkg-architecture -qDEB_BUILD_ARCH)
14
15GEN_DEB=${GEN_PACKAGE}_${DOCRELEASE}-${PKGREL}_${ARCH}.deb
ceb4ea5b 16DOC_DEB=${DOC_PACKAGE}_${DOCRELEASE}-${PKGREL}_all.deb
cfabc2e9 17MEDIAWIKI_DEB=${MEDIAWIKI_PACKAGE}_${DOCRELEASE}-${PKGREL}_all.deb
9344ee0d 18
516d1f2f 19
63a01806
DM
20all: index.html
21
7515acaf
DM
22.PHONY: verify-images
23verify-images:
24 for i in ./images/screenshot/*.png; do ./png-verify.pl $$i; done
516d1f2f
DM
25
26ADOC_SOURCES_GUESS=$(filter-out %-synopsis.adoc %-opts.adoc %-table.adoc, $(wildcard *.adoc))
27.pve-doc-depends link-refs.json: ${ADOC_SOURCES_GUESS} scan-adoc-refs
e6fc3b0c
DM
28 ./scan-adoc-refs *.adoc --depends .pve-doc-depends.tmp > link-refs.json.tmp
29 @cmp --quiet .pve-doc-depends .pve-doc-depends.tmp || mv .pve-doc-depends.tmp .pve-doc-depends
30 @cmp --quiet link-refs.json link-refs.json.tmp || mv link-refs.json.tmp link-refs.json
63a01806 31
1ed794c8
DM
32pve-doc-generator.mk: .pve-doc-depends pve-doc-generator.mk.in
33 cat pve-doc-generator.mk.in .pve-doc-depends > $@.tmp
34 mv $@.tmp $@
35
36include ./pve-doc-generator.mk
672abac1 37
9015f48f 38GEN_DEB_SOURCES= \
672abac1 39 pve-doc-generator.mk \
63a01806 40 ${MANUAL_SOURCES} \
54079101 41 pmxcfs.8-synopsis.adoc \
9344ee0d
DM
42 docinfo.xml
43
44GEN_SCRIPTS= \
8942fab2
DM
45 gen-ha-groups-opts.pl \
46 gen-ha-resources-opts.pl \
f6b81378
DM
47 gen-datacenter.cfg.5-opts.pl \
48 gen-pct.conf.5-opts.pl \
bac8c385 49 gen-pct-network-opts.pl \
fe154a4f 50 gen-pct-mountpoint-opts.pl \
9b4799ab 51 gen-qm.conf.5-opts.pl \
500f1e1f 52 gen-vzdump.conf.5-opts.pl \
9344ee0d
DM
53 gen-pve-firewall-cluster-opts.pl \
54 gen-pve-firewall-host-opts.pl \
55 gen-pve-firewall-macros-adoc.pl \
56 gen-pve-firewall-rules-opts.pl \
f6b81378 57 gen-pve-firewall-vm-opts.pl
9344ee0d 58
356064f4
DM
59API_VIEWER_SOURCES= \
60 api-viewer/index.html \
61 api-viewer/apidoc.js
62
aa99b349
DM
63asciidoc-pve: asciidoc-pve.in link-refs.json
64 cat asciidoc-pve.in link-refs.json >asciidoc-pve.tmp
835dd63b 65 sed -e s/@RELEASE@/${DOCRELEASE}/ -i asciidoc-pve.tmp
aa99b349
DM
66 chmod +x asciidoc-pve.tmp
67 mv asciidoc-pve.tmp asciidoc-pve
68
b489b02c
DM
69pve-docs-mediawiki-import: pve-docs-mediawiki-import.in link-refs.json
70 cat pve-docs-mediawiki-import.in link-refs.json > pve-docs-mediawiki-import.tmp
71 chmod +x pve-docs-mediawiki-import.tmp
72 mv pve-docs-mediawiki-import.tmp pve-docs-mediawiki-import
73
f4defaeb
DM
74INDEX_INCLUDES= \
75 pve-admin-guide.pdf \
f4defaeb 76 pve-admin-guide.epub \
941ab9c7
DM
77 chapter-index-table.adoc \
78 man1-index-table.adoc \
79 man5-index-table.adoc \
80 man8-index-table.adoc \
63a01806 81 $(sort $(addsuffix .html, ${MANUAL_PAGES}) ${CHAPTER_LIST})
f4defaeb 82
ae0ad291 83ADOC_STDARG=-b $(shell pwd)/asciidoc/pve-html -f asciidoc/asciidoc-pve.conf -a icons -a data-uri -a "date=$(shell date)" -a "revnumber=${DOCRELEASE}"
deb7f2ea 84
fc1090ef 85BROWSER?=xdg-open
df41beec 86
7b2c36ae 87
deb7f2ea
DM
88%-nwdiag.svg: %.nwdiag
89 nwdiag -T svg $*.nwdiag -o $@;
90
9d17dbac
DM
91README.html: README.adoc
92 asciidoc ${ADOC_STDARG} -o $@ $<
93
8ace7110
DM
94.PHONY: index
95index: index.html
3f559975
DM
96 $(BROWSER) index.html &
97
fd02ab90
DM
98chapter-index-table.adoc: asciidoc-pve
99 ./asciidoc-pve chapter-table >$@.tmp
941ab9c7
DM
100 mv $@.tmp $@
101
fd02ab90
DM
102man1-index-table.adoc: asciidoc-pve
103 ./asciidoc-pve man1page-table >$@.tmp
941ab9c7
DM
104 mv $@.tmp $@
105
fd02ab90
DM
106man5-index-table.adoc: asciidoc-pve
107 ./asciidoc-pve man5page-table >$@.tmp
941ab9c7
DM
108 mv $@.tmp $@
109
fd02ab90
DM
110man8-index-table.adoc: asciidoc-pve
111 ./asciidoc-pve man8page-table >$@.tmp
941ab9c7
DM
112 mv $@.tmp $@
113
114index.html: index.adoc ${API_VIEWER_SOURCES} ${INDEX_INCLUDES}
c65b00e2 115 asciidoc ${ADOC_STDARG} -o $@ index.adoc
deb7f2ea 116
63a01806 117pve-admin-guide.html: ${PVE_ADMIN_GUIDE_ADOCDEPENDS}
ae0ad291 118 asciidoc -a pvelogo ${ADOC_STDARG} -o $@ pve-admin-guide.adoc
deb7f2ea 119
63a01806 120pve-admin-guide.chunked: ${PVE_ADMIN_GUIDE_ADOCDEPENDS}
59d89a51
DM
121 rm -rf pve-admin-guide.chunked
122 a2x -a docinfo -a docinfo1 -a icons -f chunked pve-admin-guide.adoc
59d89a51 123
2522a624
DM
124PVE_DOCBOOK_CONF=-b $(shell pwd)/asciidoc/pve-docbook -f asciidoc/asciidoc-pve.conf
125
63a01806 126pve-admin-guide.pdf: ${PVE_ADMIN_GUIDE_ADOCDEPENDS} docinfo.xml pve-admin-guide-docinfo.xml
34ef065a 127 inkscape -z -D --export-pdf=proxmox-logo.pdf images/proxmox-logo.svg
333a2f49 128 inkscape -z -D --export-pdf=proxmox-ci-header.pdf images/proxmox-ci-header.svg
bef0c1b4 129 grep ">Release ${DOCRELEASE}<" pve-admin-guide-docinfo.xml || (echo "wrong release in pve-admin-guide-docinfo.xml" && false);
2522a624 130 a2x -a docinfo -a docinfo1 -f pdf -L --asciidoc-opts="${PVE_DOCBOOK_CONF}" --dblatex-opts "-p ./asciidoc/pve-dblatex.xsl -s asciidoc/dblatex-custom.sty" pve-admin-guide.adoc
34ef065a 131 rm proxmox-logo.pdf proxmox-ci-header.pdf
deb7f2ea 132
63a01806 133pve-admin-guide.epub: ${PVE_ADMIN_GUIDE_ADOCDEPENDS}
2522a624 134 a2x -f epub --asciidoc-opts="${PVE_DOCBOOK_CONF}" pve-admin-guide.adoc
9344ee0d 135
356064f4 136api-viewer/apidata.js: extractapi.pl
61568a65
DM
137 ./extractapi.pl >$@
138
356064f4
DM
139api-viewer/apidoc.js: api-viewer/apidata.js api-viewer/PVEAPI.js
140 cat api-viewer/apidata.js api-viewer/PVEAPI.js >$@
61568a65 141
9344ee0d 142.PHONY: dinstall
cfabc2e9
DM
143dinstall: ${GEN_DEB} ${DOC_DEB} ${MEDIAWIKI_DEB}
144 dpkg -i ${GEN_DEB} ${DOC_DEB} ${MEDIAWIKI_DEB}
9015f48f 145
9344ee0d 146.PHONY: deb
9015f48f 147deb:
cfabc2e9
DM
148 rm -f ${GEN_DEB} ${DOC_DEB} ${MEDIAWIKI_DEB};
149 make ${GEN_DEB} ${DOC_DEB} ${MEDIAWIKI_DEB};
9015f48f 150
f250356f 151${GEN_DEB} ${DOC_DEB} ${MEDIAWIKI_DEB}: index.html ${INDEX_INCLUDES} ${WIKI_IMPORTS} ${API_VIEWER_SOURCES} ${GEN_DEB_SOURCES} asciidoc-pve pve-docs-mediawiki-import asciidoc/mediawiki.conf verify-images
9015f48f
DM
152 rm -rf build
153 mkdir build
ceb4ea5b 154 rsync -a debian/ build/debian
b489b02c 155 cp pve-docs-mediawiki-import build/debian/tree/pve-docs-mediawiki/pve-docs-mediawiki-import
ceb4ea5b
DM
156 echo "git clone git://git.proxmox.com/git/pve-docs.git\\ngit checkout ${GITVERSION}" > build/debian/SOURCE
157 # install files for pve-doc-generator package
158 mkdir -p build/usr/share/${GEN_PACKAGE}
159 mkdir -p build/usr/share/doc/${GEN_PACKAGE}
bb3c27a7 160 mkdir -p build/usr/bin
ceb4ea5b
DM
161 install -m 0644 ${GEN_DEB_SOURCES} build/usr/share/${GEN_PACKAGE}
162 install -m 0755 ${GEN_SCRIPTS} build/usr/share/${GEN_PACKAGE}
de7022fb 163 # install asciidoc-pve
bb3c27a7 164 install -m 0755 asciidoc-pve build/usr/bin/
de7022fb
DM
165 install -D -m 0644 asciidoc/mediawiki.conf build/usr/share/${GEN_PACKAGE}/asciidoc/mediawiki.conf
166 install -m 0644 asciidoc/asciidoc-pve.conf build/usr/share/${GEN_PACKAGE}/asciidoc/
ae0ad291 167 install -m 0644 asciidoc/pve-html.conf build/usr/share/${GEN_PACKAGE}/asciidoc/
ceb4ea5b 168 # install files for pvedocs package
9015f48f
DM
169 mkdir -p build/usr/share/${DOC_PACKAGE}
170 mkdir -p build/usr/share/doc/${DOC_PACKAGE}
ad2bfc41 171 install -m 0644 index.html ${INDEX_INCLUDES} build/usr/share/${DOC_PACKAGE}
251666be 172 install -m 0644 ${WIKI_IMPORTS} build/usr/share/${DOC_PACKAGE}
8c8ae224
DM
173 # install screenshot images
174 mkdir -p build/usr/share/${DOC_PACKAGE}/images/screenshot
175 install -m 0644 images/screenshot/*.png build/usr/share/${DOC_PACKAGE}/images/screenshot
61568a65 176 # install api doc viewer
356064f4
DM
177 mkdir build/usr/share/${DOC_PACKAGE}/api-viewer
178 install -m 0644 ${API_VIEWER_SOURCES} build/usr/share/${DOC_PACKAGE}/api-viewer
cfabc2e9 179 # build Debian packages
9344ee0d 180 cd build; dpkg-buildpackage -rfakeroot -b -us -uc
9015f48f 181 lintian ${GEN_DEB}
ceb4ea5b 182 lintian ${DOC_DEB}
cfabc2e9 183 lintian ${MEDIAWIKI_DEB}
9344ee0d 184
89e93b38 185.PHONY: upload
cfabc2e9 186upload: ${GEN_DEB} ${DOC_DEB} ${MEDIAWIKI_DEB}
d7b4925a 187 tar cf - ${GEN_DEB} ${DOC_DEB} ${MEDIAWIKI_DEB} | ssh repoman@repo.proxmox.com upload
deb7f2ea 188
56122987 189.PHONY: update
c016ebb7 190update: clean
5bf279bd 191 find . -regex '.*-\(opts\|synopsis\)\.adoc' -not -name pmxcfs.8-synopsis.adoc -exec rm -f \{\} \;
56122987 192 rm -f api-viewer/apidata.js
fe154a4f 193 rm -f pve-firewall-macros.adoc pct-network-opts.adoc pct-mountpoint-opts.adoc
c016ebb7 194 make all
deb7f2ea 195
bca311e4 196clean:
941ab9c7 197 rm -rf *.html *.pdf *.epub *.tmp *.1 *.5 *.8 *.deb *.changes build api-viewer/apidoc.js chapter-*.html *-plain.html chapter-*.html pve-admin-guide.chunked asciidoc-pve link-refs.json .asciidoc-pve-tmp_* pve-docs-mediawiki-import .pve-doc-depends pve-doc-generator.mk chapter-index-table.adoc man1-index-table.adoc man5-index-table.adoc man8-index-table.adoc
de9cbbd6 198 find . -name '*~' -exec rm {} ';'