backup: clarify that CLI means FS-level and highlight retention-note
[pve-docs.git] / Makefile
... / ...
CommitLineData
1include /usr/share/dpkg/pkg-info.mk
2
3# overwriting below ensures that we can build without full PVE installed
4DGDIR=.
5ASCIIDOC_PVE=./asciidoc-pve
6
7GEN_PACKAGE=pve-doc-generator
8DOC_PACKAGE=pve-docs
9MEDIAWIKI_PACKAGE=pve-docs-mediawiki
10
11GITVERSION:=$(shell git rev-parse HEAD)
12
13ARCH:=$(shell dpkg-architecture -qDEB_BUILD_ARCH)
14
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
18
19export SOURCE_DATE_EPOCH ?= $(shell dpkg-parsechangelog -STimestamp)
20SOURCE_DATE_HUMAN := $(shell date -d "@${SOURCE_DATE_EPOCH}")
21
22all: index.html
23
24.PHONY: verify-images
25verify-images:
26 for i in ./images/screenshot/*.png; do ./png-verify.pl $$i; done
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
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
33
34pve-doc-generator.mk: .pve-doc-depends pve-doc-generator.mk.in
35 cat pve-doc-generator.mk.in .pve-doc-depends > $@.tmp
36 sed -i "s/@RELEASE@$$/${DEB_VERSION_UPSTREAM}/" $@.tmp
37 mv $@.tmp $@
38
39-include ./pve-doc-generator.mk
40
41GEN_DEB_SOURCES= \
42 pve-doc-generator.mk \
43 ${MANUAL_SOURCES} \
44 pmxcfs.8-synopsis.adoc \
45 qmeventd.8-synopsis.adoc \
46 docinfo.xml
47
48GEN_SCRIPTS= \
49 gen-ha-groups-opts.pl \
50 gen-ha-resources-opts.pl \
51 gen-datacenter.cfg.5-opts.pl \
52 gen-pct.conf.5-opts.pl \
53 gen-pct-network-opts.pl \
54 gen-pct-mountpoint-opts.pl \
55 gen-qm.conf.5-opts.pl \
56 gen-cpu-models.conf.5-opts.pl \
57 gen-qm-cloud-init-opts.pl \
58 gen-vzdump.conf.5-opts.pl \
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 \
63 gen-pve-firewall-vm-opts.pl \
64 gen-output-format-opts.pl
65
66API_VIEWER_FILES= \
67 api-viewer/apidata.js \
68 api-viewer/PVEAPI.js \
69 /usr/share/javascript/proxmox-widget-toolkit-dev/APIViewer.js
70
71API_VIEWER_SOURCES= \
72 api-viewer/index.html \
73 api-viewer/apidoc.js
74
75asciidoc-pve: asciidoc-pve.in link-refs.json
76 cat asciidoc-pve.in link-refs.json >asciidoc-pve.tmp
77 sed -e s/@RELEASE@/${DOCRELEASE}/ -i asciidoc-pve.tmp
78 chmod +x asciidoc-pve.tmp
79 mv asciidoc-pve.tmp asciidoc-pve
80
81pve-docs-mediawiki-import: pve-docs-mediawiki-import.in link-refs.json
82 cat pve-docs-mediawiki-import.in link-refs.json > pve-docs-mediawiki-import.tmp
83 chmod +x pve-docs-mediawiki-import.tmp
84 mv pve-docs-mediawiki-import.tmp pve-docs-mediawiki-import
85
86INDEX_INCLUDES= \
87 pve-admin-guide.pdf \
88 pve-admin-guide.epub \
89 chapter-index-table.adoc \
90 man1-index-table.adoc \
91 man5-index-table.adoc \
92 man8-index-table.adoc \
93 $(sort $(addsuffix .html, ${MANUAL_PAGES}) ${CHAPTER_LIST})
94
95ADOC_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
96
97BROWSER?=xdg-open
98
99README.html: README.adoc
100 asciidoc -a toc ${ADOC_STDARG} -o $@ $<
101
102.PHONY: index
103index: index.html
104 test -z "$${PVE_DOC_INSTANTVIEW}" || $(BROWSER) index.html &
105
106chapter-index-table.adoc: asciidoc-pve
107 ./asciidoc-pve chapter-table >$@.tmp
108 mv $@.tmp $@
109
110man1-index-table.adoc: asciidoc-pve
111 ./asciidoc-pve man1page-table >$@.tmp
112 mv $@.tmp $@
113
114man5-index-table.adoc: asciidoc-pve
115 ./asciidoc-pve man5page-table >$@.tmp
116 mv $@.tmp $@
117
118man8-index-table.adoc: asciidoc-pve
119 ./asciidoc-pve man8page-table >$@.tmp
120 mv $@.tmp $@
121
122index.html: index.adoc ${API_VIEWER_SOURCES} ${INDEX_INCLUDES}
123 asciidoc ${ADOC_STDARG} -o $@ index.adoc
124
125pve-admin-guide.html: ${PVE_ADMIN_GUIDE_ADOCDEPENDS}
126 asciidoc -a pvelogo ${ADOC_STDARG} -o $@ pve-admin-guide.adoc
127
128pve-admin-guide.chunked: ${PVE_ADMIN_GUIDE_ADOCDEPENDS}
129 rm -rf $@.tmp $@
130 mkdir $@.tmp
131 a2x -D $@.tmp -a docinfo -a docinfo1 -a icons -f chunked pve-admin-guide.adoc
132 mv $@.tmp/$@ $@
133
134PVE_DOCBOOK_CONF=-b $(shell pwd)/asciidoc/pve-docbook -f asciidoc/asciidoc-pve.conf
135PVE_DBLATEX_OPTS='-p ./asciidoc/pve-dblatex.xsl -s asciidoc/dblatex-custom.sty -c asciidoc/dblatex-export.conf'
136
137YEAR:=$(shell date '+%Y')
138pve-admin-guide-docinfo.xml: pve-admin-guide-docinfo.xml.in
139 sed -e 's/@RELEASE@/${DOCRELEASE}/' -e 's/@YEAR@/${YEAR}/' <$< >$@
140
141pve-admin-guide.pdf: ${PVE_ADMIN_GUIDE_ADOCDEPENDS} docinfo.xml pve-admin-guide-docinfo.xml
142 rsvg-convert -f pdf -o proxmox-logo.pdf images/proxmox-logo.svg
143 rsvg-convert -f pdf -o proxmox-ci-header.pdf images/proxmox-ci-header.svg
144 grep ">Release ${DOCRELEASE}<" pve-admin-guide-docinfo.xml || (echo "wrong release in pve-admin-guide-docinfo.xml" && false);
145 a2x -a docinfo -a docinfo1 -f pdf -L --asciidoc-opts="${PVE_DOCBOOK_CONF}" --dblatex-opts ${PVE_DBLATEX_OPTS} pve-admin-guide.adoc
146 rm proxmox-logo.pdf proxmox-ci-header.pdf
147
148pve-admin-guide.epub: ${PVE_ADMIN_GUIDE_ADOCDEPENDS}
149 rm -rf $@.tmp $@
150 mkdir $@.tmp
151 a2x -D $@.tmp -f epub --asciidoc-opts="${PVE_DOCBOOK_CONF}" pve-admin-guide.adoc
152 mv $@.tmp/$@ $@
153
154api-viewer/apidata.js: extractapi.pl
155 ./extractapi.pl >$@
156
157api-viewer/apidoc.js: ${API_VIEWER_FILES}
158 cat ${API_VIEWER_FILES} >$@.tmp
159 mv $@.tmp $@
160
161.PHONY: dinstall
162dinstall: ${GEN_DEB} ${DOC_DEB} ${MEDIAWIKI_DEB}
163 dpkg -i ${GEN_DEB} ${DOC_DEB} # ${MEDIAWIKI_DEB}
164
165.PHONY: deb
166deb: $(DOC_DEB)
167$(MEDIAWIKI_DEB) $(GEN_DEB): $(DOC_DEB)
168$(DOC_DEB):
169 rm -f ${GEN_DEB} ${DOC_DEB} ${MEDIAWIKI_DEB}
170 rm -rf build
171 rsync -a * build/
172 echo "git clone git://git.proxmox.com/git/pve-docs.git\\ngit checkout ${GITVERSION}" > build/debian/SOURCE
173 cd build; dpkg-buildpackage -b -us -uc
174 lintian $(DOC_DEB) $(GEN_DEB) $(MEDIAWIKI_DEB)
175
176.PHONY: clean-build
177clean-build:
178 rm -rf build
179
180.PHONY: install
181install: gen-install doc-install mediawiki-install
182
183.PHONY: gen-install
184gen-install: $(GEN_DEB_SOURCES) asciidoc-pve asciidoc/mediawiki.conf
185 install -dm755 $(DESTDIR)/usr/share/$(GEN_PACKAGE)
186 install -dm755 $(DESTDIR)/usr/share/doc/$(GEN_PACKAGE)
187 install -dm755 $(DESTDIR)/usr/bin
188 # install files
189 install -m 0644 ${GEN_DEB_SOURCES} $(DESTDIR)/usr/share/${GEN_PACKAGE}
190 install -m 0755 ${GEN_SCRIPTS} $(DESTDIR)/usr/share/${GEN_PACKAGE}
191 # install asciidoc-pve
192 install -m 0755 asciidoc-pve $(DESTDIR)/usr/bin/
193 install -D -m 0644 asciidoc/mediawiki.conf $(DESTDIR)/usr/share/${GEN_PACKAGE}/asciidoc/mediawiki.conf
194 install -m 0644 asciidoc/asciidoc-pve.conf $(DESTDIR)/usr/share/${GEN_PACKAGE}/asciidoc/
195 install -m 0644 asciidoc/pve-html.conf $(DESTDIR)/usr/share/${GEN_PACKAGE}/asciidoc/
196
197.PHONY: doc-install
198doc-install: index.html $(WIKI_IMPORTS) $(API_VIEWER_SOURCES) verify-images examples
199 install -dm755 $(DESTDIR)/usr/share/$(DOC_PACKAGE)
200 install -dm755 $(DESTDIR)/usr/share/doc/$(DOC_PACKAGE)
201 # install files for pvedocs package
202 install -dm755 $(DESTDIR)/usr/share/${DOC_PACKAGE}
203 install -dm755 $(DESTDIR)/usr/share/doc/${DOC_PACKAGE}
204 install -dm755 $(DESTDIR)/usr/share/${DOC_PACKAGE}/examples/
205 install -m 755 examples/guest-example-hookscript.pl $(DESTDIR)/usr/share/${DOC_PACKAGE}/examples/
206 install -m 0644 index.html ${INDEX_INCLUDES} $(DESTDIR)/usr/share/${DOC_PACKAGE}
207 install -m 0644 ${WIKI_IMPORTS} $(DESTDIR)/usr/share/${DOC_PACKAGE}
208 # install images
209 make -C images install
210 # install screenshot images
211 install -dm755 $(DESTDIR)/usr/share/${DOC_PACKAGE}/images/screenshot
212 install -m 0644 images/screenshot/*.png $(DESTDIR)/usr/share/${DOC_PACKAGE}/images/screenshot
213 # install api doc viewer
214 install -dm755 $(DESTDIR)/usr/share/${DOC_PACKAGE}/api-viewer
215 install -m 0644 ${API_VIEWER_SOURCES} $(DESTDIR)/usr/share/${DOC_PACKAGE}/api-viewer
216
217.PHONY: mediawiki-install
218mediawiki-install: pve-docs-mediawiki-import
219 install -dm755 $(DESTDIR)/usr/share/$(MEDIAWIKI_PACKAGE)
220 install -dm755 $(DESTDIR)/usr/share/doc/$(MEDIAWIKI_PACKAGE)
221 install -dm755 $(DESTDIR)/usr/bin
222 install -dm755 $(DESTDIR)/usr/share/$(MEDIAWIKI_PACKAGE)
223 install -dm755 $(DESTDIR)/usr/share/doc/$(MEDIAWIKI_PACKAGE)
224 install -m 0755 pve-docs-mediawiki-import $(DESTDIR)/usr/bin/
225
226.PHONY: upload
227upload: ${GEN_DEB} ${DOC_DEB} ${MEDIAWIKI_DEB}
228 tar cf - ${GEN_DEB} ${DOC_DEB} ${MEDIAWIKI_DEB} | ssh -X repoman@repo.proxmox.com -- upload --product pve --dist bullseye
229
230.PHONY: update
231update:
232 make clean clean-static
233 make update-static
234 make all
235
236.PHONY: update-static
237update-static:
238 make clean-static
239 make $(filter %-synopsis.adoc %-opts.adoc, ${PVE_ADMIN_GUIDE_ADOCDEPENDS}) pve-firewall-macros.adoc api-viewer/apidata.js
240
241.PHONY: clean-static
242clean-static:
243 find . -regex '.*-\(opts\|synopsis\)\.adoc' -not -name pmxcfs.8-synopsis.adoc -not -name qmeventd.8-synopsis.adoc -exec rm -f \{\} \;
244 rm -f api-viewer/apidata.js
245 rm -f pve-firewall-macros.adoc pct-network-opts.adoc pct-mountpoint-opts.adoc
246
247clean:
248 rm -rf *.html *.pdf *.epub *.tmp *.1 *.5 *.8
249 rm -f *.deb *.changes *.buildinfo
250 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
251 rm -rf .pve-doc-depends
252 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
253 rm -rf build