]> git.proxmox.com Git - pve-docs.git/blame - Makefile
update link qemu documentation non web.archive
[pve-docs.git] / Makefile
CommitLineData
76909adf
TL
1include /usr/share/dpkg/pkg-info.mk
2
76937e7d
TL
3# overwriting below ensures that we can build without full PVE installed
4DGDIR=.
c38115e9 5ASCIIDOC_PVE=./asciidoc-pve
bef0c1b4 6
9015f48f
DM
7GEN_PACKAGE=pve-doc-generator
8DOC_PACKAGE=pve-docs
cfabc2e9 9MEDIAWIKI_PACKAGE=pve-docs-mediawiki
9344ee0d 10
60955877 11GITVERSION:=$(shell git rev-parse HEAD)
b4f3c18a 12
0a3c58e0
TL
13ARCH:=$(shell dpkg-architecture -qDEB_BUILD_ARCH)
14
76909adf
TL
15GEN_DEB=${GEN_PACKAGE}_${DEB_VERSION_UPSTREAM_REVISION}_${ARCH}.deb
16DOC_DEB=${DOC_PACKAGE}_${DEB_VERSION_UPSTREAM_REVISION}_all.deb
17MEDIAWIKI_DEB=${MEDIAWIKI_PACKAGE}_${DEB_VERSION_UPSTREAM_REVISION}_all.deb
9344ee0d 18
b965ad63
FG
19export SOURCE_DATE_EPOCH ?= $(shell dpkg-parsechangelog -STimestamp)
20SOURCE_DATE_HUMAN := $(shell date -d "@${SOURCE_DATE_EPOCH}")
516d1f2f 21
63a01806
DM
22all: index.html
23
7515acaf
DM
24.PHONY: verify-images
25verify-images:
26 for i in ./images/screenshot/*.png; do ./png-verify.pl $$i; done
516d1f2f
DM
27
28ADOC_SOURCES_GUESS=$(filter-out %-synopsis.adoc %-opts.adoc %-table.adoc, $(wildcard *.adoc))
29.pve-doc-depends link-refs.json: ${ADOC_SOURCES_GUESS} scan-adoc-refs
e6fc3b0c
DM
30 ./scan-adoc-refs *.adoc --depends .pve-doc-depends.tmp > link-refs.json.tmp
31 @cmp --quiet .pve-doc-depends .pve-doc-depends.tmp || mv .pve-doc-depends.tmp .pve-doc-depends
32 @cmp --quiet link-refs.json link-refs.json.tmp || mv link-refs.json.tmp link-refs.json
63a01806 33
1ed794c8
DM
34pve-doc-generator.mk: .pve-doc-depends pve-doc-generator.mk.in
35 cat pve-doc-generator.mk.in .pve-doc-depends > $@.tmp
76909adf 36 sed -i "s/@RELEASE@$$/${DEB_VERSION_UPSTREAM}/" $@.tmp
1ed794c8
DM
37 mv $@.tmp $@
38
fd880d44 39-include ./pve-doc-generator.mk
672abac1 40
9015f48f 41GEN_DEB_SOURCES= \
672abac1 42 pve-doc-generator.mk \
63a01806 43 ${MANUAL_SOURCES} \
54079101 44 pmxcfs.8-synopsis.adoc \
b08ec024 45 qmeventd.8-synopsis.adoc \
9344ee0d
DM
46 docinfo.xml
47
48GEN_SCRIPTS= \
8942fab2
DM
49 gen-ha-groups-opts.pl \
50 gen-ha-resources-opts.pl \
f6b81378
DM
51 gen-datacenter.cfg.5-opts.pl \
52 gen-pct.conf.5-opts.pl \
bac8c385 53 gen-pct-network-opts.pl \
fe154a4f 54 gen-pct-mountpoint-opts.pl \
9b4799ab 55 gen-qm.conf.5-opts.pl \
9e797d8c 56 gen-cpu-models.conf.5-opts.pl \
8eb81ff6 57 gen-qm-cloud-init-opts.pl \
500f1e1f 58 gen-vzdump.conf.5-opts.pl \
9344ee0d
DM
59 gen-pve-firewall-cluster-opts.pl \
60 gen-pve-firewall-host-opts.pl \
61 gen-pve-firewall-macros-adoc.pl \
62 gen-pve-firewall-rules-opts.pl \
441ae628
DM
63 gen-pve-firewall-vm-opts.pl \
64 gen-output-format-opts.pl
9344ee0d 65
356064f4
DM
66API_VIEWER_SOURCES= \
67 api-viewer/index.html \
68 api-viewer/apidoc.js
69
aa99b349
DM
70asciidoc-pve: asciidoc-pve.in link-refs.json
71 cat asciidoc-pve.in link-refs.json >asciidoc-pve.tmp
835dd63b 72 sed -e s/@RELEASE@/${DOCRELEASE}/ -i asciidoc-pve.tmp
aa99b349
DM
73 chmod +x asciidoc-pve.tmp
74 mv asciidoc-pve.tmp asciidoc-pve
75
b489b02c
DM
76pve-docs-mediawiki-import: pve-docs-mediawiki-import.in link-refs.json
77 cat pve-docs-mediawiki-import.in link-refs.json > pve-docs-mediawiki-import.tmp
78 chmod +x pve-docs-mediawiki-import.tmp
79 mv pve-docs-mediawiki-import.tmp pve-docs-mediawiki-import
80
f4defaeb
DM
81INDEX_INCLUDES= \
82 pve-admin-guide.pdf \
f4defaeb 83 pve-admin-guide.epub \
941ab9c7
DM
84 chapter-index-table.adoc \
85 man1-index-table.adoc \
86 man5-index-table.adoc \
87 man8-index-table.adoc \
63a01806 88 $(sort $(addsuffix .html, ${MANUAL_PAGES}) ${CHAPTER_LIST})
f4defaeb 89
b965ad63 90ADOC_STDARG=-b $(shell pwd)/asciidoc/pve-html -f asciidoc/asciidoc-pve.conf -a icons -a data-uri -a "date=${SOURCE_DATE_HUMAN}" -a "revnumber=${DOCRELEASE}" -a footer-style=revdate
deb7f2ea 91
fc1090ef 92BROWSER?=xdg-open
df41beec 93
9d17dbac 94README.html: README.adoc
6b70c786 95 asciidoc -a toc ${ADOC_STDARG} -o $@ $<
9d17dbac 96
8ace7110
DM
97.PHONY: index
98index: index.html
c0e4fdbd 99 test -z "$${PVE_DOC_INSTANTVIEW}" || $(BROWSER) index.html &
3f559975 100
fd02ab90
DM
101chapter-index-table.adoc: asciidoc-pve
102 ./asciidoc-pve chapter-table >$@.tmp
941ab9c7
DM
103 mv $@.tmp $@
104
fd02ab90
DM
105man1-index-table.adoc: asciidoc-pve
106 ./asciidoc-pve man1page-table >$@.tmp
941ab9c7
DM
107 mv $@.tmp $@
108
fd02ab90
DM
109man5-index-table.adoc: asciidoc-pve
110 ./asciidoc-pve man5page-table >$@.tmp
941ab9c7
DM
111 mv $@.tmp $@
112
fd02ab90
DM
113man8-index-table.adoc: asciidoc-pve
114 ./asciidoc-pve man8page-table >$@.tmp
941ab9c7
DM
115 mv $@.tmp $@
116
117index.html: index.adoc ${API_VIEWER_SOURCES} ${INDEX_INCLUDES}
c65b00e2 118 asciidoc ${ADOC_STDARG} -o $@ index.adoc
deb7f2ea 119
63a01806 120pve-admin-guide.html: ${PVE_ADMIN_GUIDE_ADOCDEPENDS}
ae0ad291 121 asciidoc -a pvelogo ${ADOC_STDARG} -o $@ pve-admin-guide.adoc
deb7f2ea 122
63a01806 123pve-admin-guide.chunked: ${PVE_ADMIN_GUIDE_ADOCDEPENDS}
959bc81c
FG
124 rm -rf $@.tmp $@
125 mkdir $@.tmp
126 a2x -D $@.tmp -a docinfo -a docinfo1 -a icons -f chunked pve-admin-guide.adoc
127 mv $@.tmp/$@ $@
59d89a51 128
2522a624 129PVE_DOCBOOK_CONF=-b $(shell pwd)/asciidoc/pve-docbook -f asciidoc/asciidoc-pve.conf
789c5c57 130PVE_DBLATEX_OPTS='-p ./asciidoc/pve-dblatex.xsl -s asciidoc/dblatex-custom.sty -c asciidoc/dblatex-export.conf'
2522a624 131
742e92ef 132YEAR:=$(shell date '+%Y')
384871f2 133pve-admin-guide-docinfo.xml: pve-admin-guide-docinfo.xml.in
742e92ef 134 sed -e 's/@RELEASE@/${DOCRELEASE}/' -e 's/@YEAR@/${YEAR}/' <$< >$@
384871f2 135
63a01806 136pve-admin-guide.pdf: ${PVE_ADMIN_GUIDE_ADOCDEPENDS} docinfo.xml pve-admin-guide-docinfo.xml
789c5c57
TL
137 rsvg-convert -f pdf -o proxmox-logo.pdf images/proxmox-logo.svg
138 rsvg-convert -f pdf -o proxmox-ci-header.pdf images/proxmox-ci-header.svg
bef0c1b4 139 grep ">Release ${DOCRELEASE}<" pve-admin-guide-docinfo.xml || (echo "wrong release in pve-admin-guide-docinfo.xml" && false);
789c5c57 140 a2x -a docinfo -a docinfo1 -f pdf -L --asciidoc-opts="${PVE_DOCBOOK_CONF}" --dblatex-opts ${PVE_DBLATEX_OPTS} pve-admin-guide.adoc
34ef065a 141 rm proxmox-logo.pdf proxmox-ci-header.pdf
deb7f2ea 142
63a01806 143pve-admin-guide.epub: ${PVE_ADMIN_GUIDE_ADOCDEPENDS}
959bc81c
FG
144 rm -rf $@.tmp $@
145 mkdir $@.tmp
146 a2x -D $@.tmp -f epub --asciidoc-opts="${PVE_DOCBOOK_CONF}" pve-admin-guide.adoc
147 mv $@.tmp/$@ $@
9344ee0d 148
356064f4 149api-viewer/apidata.js: extractapi.pl
61568a65
DM
150 ./extractapi.pl >$@
151
356064f4
DM
152api-viewer/apidoc.js: api-viewer/apidata.js api-viewer/PVEAPI.js
153 cat api-viewer/apidata.js api-viewer/PVEAPI.js >$@
61568a65 154
9344ee0d 155.PHONY: dinstall
cfabc2e9 156dinstall: ${GEN_DEB} ${DOC_DEB} ${MEDIAWIKI_DEB}
a45c999b 157 dpkg -i ${GEN_DEB} ${DOC_DEB} # ${MEDIAWIKI_DEB}
9015f48f 158
9344ee0d 159.PHONY: deb
fa764571
FG
160deb: $(DOC_DEB)
161$(MEDIAWIKI_DEB) $(GEN_DEB): $(DOC_DEB)
162$(DOC_DEB):
c8bdafbd 163 rm -f ${GEN_DEB} ${DOC_DEB} ${MEDIAWIKI_DEB}
fa764571
FG
164 rm -rf build
165 rsync -a * build/
166 echo "git clone git://git.proxmox.com/git/pve-docs.git\\ngit checkout ${GITVERSION}" > build/debian/SOURCE
167 cd build; dpkg-buildpackage -b -us -uc
168 lintian $(DOC_DEB) $(GEN_DEB) $(MEDIAWIKI_DEB)
f0d25f0d 169
c8bdafbd
WB
170.PHONY: clean-build
171clean-build:
9015f48f 172 rm -rf build
c8bdafbd 173
fa764571
FG
174.PHONY: install
175install: gen-install doc-install mediawiki-install
176
177.PHONY: gen-install
178gen-install: $(GEN_DEB_SOURCES) asciidoc-pve asciidoc/mediawiki.conf
179 install -dm755 $(DESTDIR)/usr/share/$(GEN_PACKAGE)
180 install -dm755 $(DESTDIR)/usr/share/doc/$(GEN_PACKAGE)
181 install -dm755 $(DESTDIR)/usr/bin
c8bdafbd 182 # install files
fa764571
FG
183 install -m 0644 ${GEN_DEB_SOURCES} $(DESTDIR)/usr/share/${GEN_PACKAGE}
184 install -m 0755 ${GEN_SCRIPTS} $(DESTDIR)/usr/share/${GEN_PACKAGE}
de7022fb 185 # install asciidoc-pve
fa764571
FG
186 install -m 0755 asciidoc-pve $(DESTDIR)/usr/bin/
187 install -D -m 0644 asciidoc/mediawiki.conf $(DESTDIR)/usr/share/${GEN_PACKAGE}/asciidoc/mediawiki.conf
188 install -m 0644 asciidoc/asciidoc-pve.conf $(DESTDIR)/usr/share/${GEN_PACKAGE}/asciidoc/
189 install -m 0644 asciidoc/pve-html.conf $(DESTDIR)/usr/share/${GEN_PACKAGE}/asciidoc/
190
191.PHONY: doc-install
b7a5c9c5 192doc-install: index.html $(WIKI_IMPORTS) $(API_VIEWER_SOURCES) verify-images examples
fa764571
FG
193 install -dm755 $(DESTDIR)/usr/share/$(DOC_PACKAGE)
194 install -dm755 $(DESTDIR)/usr/share/doc/$(DOC_PACKAGE)
ceb4ea5b 195 # install files for pvedocs package
fa764571
FG
196 install -dm755 $(DESTDIR)/usr/share/${DOC_PACKAGE}
197 install -dm755 $(DESTDIR)/usr/share/doc/${DOC_PACKAGE}
c2c8eb89 198 install -dm755 $(DESTDIR)/usr/share/${DOC_PACKAGE}/examples/
b7a5c9c5 199 install -m 755 examples/guest-example-hookscript.pl $(DESTDIR)/usr/share/${DOC_PACKAGE}/examples/
fa764571
FG
200 install -m 0644 index.html ${INDEX_INCLUDES} $(DESTDIR)/usr/share/${DOC_PACKAGE}
201 install -m 0644 ${WIKI_IMPORTS} $(DESTDIR)/usr/share/${DOC_PACKAGE}
50f88938 202 # install images
fa764571 203 make -C images install
8c8ae224 204 # install screenshot images
fa764571
FG
205 install -dm755 $(DESTDIR)/usr/share/${DOC_PACKAGE}/images/screenshot
206 install -m 0644 images/screenshot/*.png $(DESTDIR)/usr/share/${DOC_PACKAGE}/images/screenshot
61568a65 207 # install api doc viewer
fa764571
FG
208 install -dm755 $(DESTDIR)/usr/share/${DOC_PACKAGE}/api-viewer
209 install -m 0644 ${API_VIEWER_SOURCES} $(DESTDIR)/usr/share/${DOC_PACKAGE}/api-viewer
210
211.PHONY: mediawiki-install
b275db16 212mediawiki-install: pve-docs-mediawiki-import
fa764571
FG
213 install -dm755 $(DESTDIR)/usr/share/$(MEDIAWIKI_PACKAGE)
214 install -dm755 $(DESTDIR)/usr/share/doc/$(MEDIAWIKI_PACKAGE)
215 install -dm755 $(DESTDIR)/usr/bin
216 install -dm755 $(DESTDIR)/usr/share/$(MEDIAWIKI_PACKAGE)
217 install -dm755 $(DESTDIR)/usr/share/doc/$(MEDIAWIKI_PACKAGE)
218 install -m 0755 pve-docs-mediawiki-import $(DESTDIR)/usr/bin/
9344ee0d 219
89e93b38 220.PHONY: upload
cfabc2e9 221upload: ${GEN_DEB} ${DOC_DEB} ${MEDIAWIKI_DEB}
856993e4 222 tar cf - ${GEN_DEB} ${DOC_DEB} ${MEDIAWIKI_DEB} | ssh -X repoman@repo.proxmox.com -- upload --product pve --dist buster
deb7f2ea 223
56122987 224.PHONY: update
0fa28023
DM
225update:
226 make clean clean-static
227 make update-static
5cb4ef63
TL
228 make all
229
230.PHONY: update-static
0fa28023
DM
231update-static:
232 make clean-static
233 make $(filter %-synopsis.adoc %-opts.adoc, ${PVE_ADMIN_GUIDE_ADOCDEPENDS}) pve-firewall-macros.adoc api-viewer/apidata.js
5cb4ef63
TL
234
235.PHONY: clean-static
236clean-static:
51778acd 237 find . -regex '.*-\(opts\|synopsis\)\.adoc' -not -name pmxcfs.8-synopsis.adoc -not -name qmeventd.8-synopsis.adoc -exec rm -f \{\} \;
56122987 238 rm -f api-viewer/apidata.js
fe154a4f 239 rm -f pve-firewall-macros.adoc pct-network-opts.adoc pct-mountpoint-opts.adoc
deb7f2ea 240
5cb4ef63 241clean:
f00afaef
WB
242 rm -rf *.html *.pdf *.epub *.tmp *.1 *.5 *.8
243 rm -f *.deb *.changes *.buildinfo
5cb4ef63
TL
244 rm -f 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
245 rm -rf .pve-doc-depends
f00afaef 246 rm -f pve-doc-generator.mk chapter-index-table.adoc man1-index-table.adoc man5-index-table.adoc man8-index-table.adoc pve-admin-guide-docinfo.xml
2d11c868 247 rm -rf build