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