]> git.proxmox.com Git - pve-docs.git/blame - Makefile
replace gui-datacenter-search.png image (fix colors)
[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
68b85693 9PKGREL=13
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= \
f6b81378
DM
45 gen-datacenter.cfg.5-opts.pl \
46 gen-pct.conf.5-opts.pl \
bac8c385 47 gen-pct-network-opts.pl \
fe154a4f 48 gen-pct-mountpoint-opts.pl \
9b4799ab 49 gen-qm.conf.5-opts.pl \
500f1e1f 50 gen-vzdump.conf.5-opts.pl \
9344ee0d
DM
51 gen-pve-firewall-cluster-opts.pl \
52 gen-pve-firewall-host-opts.pl \
53 gen-pve-firewall-macros-adoc.pl \
54 gen-pve-firewall-rules-opts.pl \
f6b81378 55 gen-pve-firewall-vm-opts.pl
9344ee0d 56
356064f4
DM
57API_VIEWER_SOURCES= \
58 api-viewer/index.html \
59 api-viewer/apidoc.js
60
aa99b349
DM
61asciidoc-pve: asciidoc-pve.in link-refs.json
62 cat asciidoc-pve.in link-refs.json >asciidoc-pve.tmp
835dd63b 63 sed -e s/@RELEASE@/${DOCRELEASE}/ -i asciidoc-pve.tmp
aa99b349
DM
64 chmod +x asciidoc-pve.tmp
65 mv asciidoc-pve.tmp asciidoc-pve
66
b489b02c
DM
67pve-docs-mediawiki-import: pve-docs-mediawiki-import.in link-refs.json
68 cat pve-docs-mediawiki-import.in link-refs.json > pve-docs-mediawiki-import.tmp
69 chmod +x pve-docs-mediawiki-import.tmp
70 mv pve-docs-mediawiki-import.tmp pve-docs-mediawiki-import
71
f4defaeb
DM
72INDEX_INCLUDES= \
73 pve-admin-guide.pdf \
f4defaeb 74 pve-admin-guide.epub \
941ab9c7
DM
75 chapter-index-table.adoc \
76 man1-index-table.adoc \
77 man5-index-table.adoc \
78 man8-index-table.adoc \
63a01806 79 $(sort $(addsuffix .html, ${MANUAL_PAGES}) ${CHAPTER_LIST})
f4defaeb 80
8faad89e 81ADOC_STDARG= -b html5 -a icons -a data-uri -a "date=$(shell date)" -a "revnumber=${DOCRELEASE}"
deb7f2ea 82
fc1090ef 83BROWSER?=xdg-open
df41beec 84
7b2c36ae 85
deb7f2ea
DM
86%-nwdiag.svg: %.nwdiag
87 nwdiag -T svg $*.nwdiag -o $@;
88
9d17dbac
DM
89README.html: README.adoc
90 asciidoc ${ADOC_STDARG} -o $@ $<
91
8ace7110
DM
92.PHONY: index
93index: index.html
3f559975
DM
94 $(BROWSER) index.html &
95
fd02ab90
DM
96chapter-index-table.adoc: asciidoc-pve
97 ./asciidoc-pve chapter-table >$@.tmp
941ab9c7
DM
98 mv $@.tmp $@
99
fd02ab90
DM
100man1-index-table.adoc: asciidoc-pve
101 ./asciidoc-pve man1page-table >$@.tmp
941ab9c7
DM
102 mv $@.tmp $@
103
fd02ab90
DM
104man5-index-table.adoc: asciidoc-pve
105 ./asciidoc-pve man5page-table >$@.tmp
941ab9c7
DM
106 mv $@.tmp $@
107
fd02ab90
DM
108man8-index-table.adoc: asciidoc-pve
109 ./asciidoc-pve man8page-table >$@.tmp
941ab9c7
DM
110 mv $@.tmp $@
111
112index.html: index.adoc ${API_VIEWER_SOURCES} ${INDEX_INCLUDES}
c65b00e2 113 asciidoc ${ADOC_STDARG} -o $@ index.adoc
deb7f2ea 114
63a01806 115pve-admin-guide.html: ${PVE_ADMIN_GUIDE_ADOCDEPENDS}
9242ce61 116 asciidoc -a pvelogo ${ADOC_STDARG} pve-admin-guide.adoc
deb7f2ea 117
63a01806 118pve-admin-guide.chunked: ${PVE_ADMIN_GUIDE_ADOCDEPENDS}
59d89a51
DM
119 rm -rf pve-admin-guide.chunked
120 a2x -a docinfo -a docinfo1 -a icons -f chunked pve-admin-guide.adoc
59d89a51 121
63a01806 122pve-admin-guide.pdf: ${PVE_ADMIN_GUIDE_ADOCDEPENDS} docinfo.xml pve-admin-guide-docinfo.xml
34ef065a 123 inkscape -z -D --export-pdf=proxmox-logo.pdf images/proxmox-logo.svg
333a2f49 124 inkscape -z -D --export-pdf=proxmox-ci-header.pdf images/proxmox-ci-header.svg
bef0c1b4 125 grep ">Release ${DOCRELEASE}<" pve-admin-guide-docinfo.xml || (echo "wrong release in pve-admin-guide-docinfo.xml" && false);
37ea112e 126 a2x -a docinfo -a docinfo1 -f pdf -L --dblatex-opts "-p ./asciidoc/pve-dblatex.xsl -s asciidoc/dblatex-custom.sty" pve-admin-guide.adoc
34ef065a 127 rm proxmox-logo.pdf proxmox-ci-header.pdf
deb7f2ea 128
63a01806 129pve-admin-guide.epub: ${PVE_ADMIN_GUIDE_ADOCDEPENDS}
deb7f2ea 130 a2x -f epub pve-admin-guide.adoc
9344ee0d 131
356064f4 132api-viewer/apidata.js: extractapi.pl
61568a65
DM
133 ./extractapi.pl >$@
134
356064f4
DM
135api-viewer/apidoc.js: api-viewer/apidata.js api-viewer/PVEAPI.js
136 cat api-viewer/apidata.js api-viewer/PVEAPI.js >$@
61568a65 137
9344ee0d 138.PHONY: dinstall
cfabc2e9
DM
139dinstall: ${GEN_DEB} ${DOC_DEB} ${MEDIAWIKI_DEB}
140 dpkg -i ${GEN_DEB} ${DOC_DEB} ${MEDIAWIKI_DEB}
9015f48f 141
9344ee0d 142.PHONY: deb
9015f48f 143deb:
cfabc2e9
DM
144 rm -f ${GEN_DEB} ${DOC_DEB} ${MEDIAWIKI_DEB};
145 make ${GEN_DEB} ${DOC_DEB} ${MEDIAWIKI_DEB};
9015f48f 146
f250356f 147${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
148 rm -rf build
149 mkdir build
ceb4ea5b 150 rsync -a debian/ build/debian
b489b02c 151 cp pve-docs-mediawiki-import build/debian/tree/pve-docs-mediawiki/pve-docs-mediawiki-import
ceb4ea5b
DM
152 echo "git clone git://git.proxmox.com/git/pve-docs.git\\ngit checkout ${GITVERSION}" > build/debian/SOURCE
153 # install files for pve-doc-generator package
154 mkdir -p build/usr/share/${GEN_PACKAGE}
155 mkdir -p build/usr/share/doc/${GEN_PACKAGE}
bb3c27a7 156 mkdir -p build/usr/bin
ceb4ea5b
DM
157 install -m 0644 ${GEN_DEB_SOURCES} build/usr/share/${GEN_PACKAGE}
158 install -m 0755 ${GEN_SCRIPTS} build/usr/share/${GEN_PACKAGE}
de7022fb 159 # install asciidoc-pve
bb3c27a7 160 install -m 0755 asciidoc-pve build/usr/bin/
de7022fb
DM
161 install -D -m 0644 asciidoc/mediawiki.conf build/usr/share/${GEN_PACKAGE}/asciidoc/mediawiki.conf
162 install -m 0644 asciidoc/asciidoc-pve.conf build/usr/share/${GEN_PACKAGE}/asciidoc/
ceb4ea5b 163 # install files for pvedocs package
9015f48f
DM
164 mkdir -p build/usr/share/${DOC_PACKAGE}
165 mkdir -p build/usr/share/doc/${DOC_PACKAGE}
ad2bfc41 166 install -m 0644 index.html ${INDEX_INCLUDES} build/usr/share/${DOC_PACKAGE}
251666be 167 install -m 0644 ${WIKI_IMPORTS} build/usr/share/${DOC_PACKAGE}
8c8ae224
DM
168 # install screenshot images
169 mkdir -p build/usr/share/${DOC_PACKAGE}/images/screenshot
170 install -m 0644 images/screenshot/*.png build/usr/share/${DOC_PACKAGE}/images/screenshot
61568a65 171 # install api doc viewer
356064f4
DM
172 mkdir build/usr/share/${DOC_PACKAGE}/api-viewer
173 install -m 0644 ${API_VIEWER_SOURCES} build/usr/share/${DOC_PACKAGE}/api-viewer
cfabc2e9 174 # build Debian packages
9344ee0d 175 cd build; dpkg-buildpackage -rfakeroot -b -us -uc
9015f48f 176 lintian ${GEN_DEB}
ceb4ea5b 177 lintian ${DOC_DEB}
cfabc2e9 178 lintian ${MEDIAWIKI_DEB}
9344ee0d 179
89e93b38 180.PHONY: upload
cfabc2e9 181upload: ${GEN_DEB} ${DOC_DEB} ${MEDIAWIKI_DEB}
d7b4925a 182 tar cf - ${GEN_DEB} ${DOC_DEB} ${MEDIAWIKI_DEB} | ssh repoman@repo.proxmox.com upload
deb7f2ea 183
56122987 184.PHONY: update
c016ebb7 185update: clean
5bf279bd 186 find . -regex '.*-\(opts\|synopsis\)\.adoc' -not -name pmxcfs.8-synopsis.adoc -exec rm -f \{\} \;
56122987 187 rm -f api-viewer/apidata.js
fe154a4f 188 rm -f pve-firewall-macros.adoc pct-network-opts.adoc pct-mountpoint-opts.adoc
c016ebb7 189 make all
deb7f2ea 190
bca311e4 191clean:
941ab9c7 192 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 193 find . -name '*~' -exec rm {} ';'