]> git.proxmox.com Git - pve-docs.git/blame - Makefile
pvecm: add chapter reference
[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
2a505911 9PKGREL=16
9344ee0d 10
60955877 11GITVERSION:=$(shell git rev-parse HEAD)
b4f3c18a 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
789c5c57 18DOC_BUILDDEPS := asciidoc-dblatex, source-highlight, librsvg2-bin
9344ee0d 19
b965ad63
FG
20export SOURCE_DATE_EPOCH ?= $(shell dpkg-parsechangelog -STimestamp)
21SOURCE_DATE_HUMAN := $(shell date -d "@${SOURCE_DATE_EPOCH}")
516d1f2f 22
63a01806
DM
23all: index.html
24
7515acaf
DM
25.PHONY: verify-images
26verify-images:
27 for i in ./images/screenshot/*.png; do ./png-verify.pl $$i; done
516d1f2f
DM
28
29ADOC_SOURCES_GUESS=$(filter-out %-synopsis.adoc %-opts.adoc %-table.adoc, $(wildcard *.adoc))
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
35pve-doc-generator.mk: .pve-doc-depends pve-doc-generator.mk.in
36 cat pve-doc-generator.mk.in .pve-doc-depends > $@.tmp
37 mv $@.tmp $@
38
39include ./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 \
9344ee0d
DM
45 docinfo.xml
46
47GEN_SCRIPTS= \
8942fab2
DM
48 gen-ha-groups-opts.pl \
49 gen-ha-resources-opts.pl \
f6b81378
DM
50 gen-datacenter.cfg.5-opts.pl \
51 gen-pct.conf.5-opts.pl \
bac8c385 52 gen-pct-network-opts.pl \
fe154a4f 53 gen-pct-mountpoint-opts.pl \
9b4799ab 54 gen-qm.conf.5-opts.pl \
500f1e1f 55 gen-vzdump.conf.5-opts.pl \
9344ee0d
DM
56 gen-pve-firewall-cluster-opts.pl \
57 gen-pve-firewall-host-opts.pl \
58 gen-pve-firewall-macros-adoc.pl \
59 gen-pve-firewall-rules-opts.pl \
f6b81378 60 gen-pve-firewall-vm-opts.pl
9344ee0d 61
356064f4
DM
62API_VIEWER_SOURCES= \
63 api-viewer/index.html \
64 api-viewer/apidoc.js
65
aa99b349
DM
66asciidoc-pve: asciidoc-pve.in link-refs.json
67 cat asciidoc-pve.in link-refs.json >asciidoc-pve.tmp
835dd63b 68 sed -e s/@RELEASE@/${DOCRELEASE}/ -i asciidoc-pve.tmp
aa99b349
DM
69 chmod +x asciidoc-pve.tmp
70 mv asciidoc-pve.tmp asciidoc-pve
71
b489b02c
DM
72pve-docs-mediawiki-import: pve-docs-mediawiki-import.in link-refs.json
73 cat pve-docs-mediawiki-import.in link-refs.json > pve-docs-mediawiki-import.tmp
74 chmod +x pve-docs-mediawiki-import.tmp
75 mv pve-docs-mediawiki-import.tmp pve-docs-mediawiki-import
76
f4defaeb
DM
77INDEX_INCLUDES= \
78 pve-admin-guide.pdf \
f4defaeb 79 pve-admin-guide.epub \
941ab9c7
DM
80 chapter-index-table.adoc \
81 man1-index-table.adoc \
82 man5-index-table.adoc \
83 man8-index-table.adoc \
63a01806 84 $(sort $(addsuffix .html, ${MANUAL_PAGES}) ${CHAPTER_LIST})
f4defaeb 85
b965ad63 86ADOC_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 87
fc1090ef 88BROWSER?=xdg-open
df41beec 89
7b2c36ae 90
deb7f2ea
DM
91%-nwdiag.svg: %.nwdiag
92 nwdiag -T svg $*.nwdiag -o $@;
93
9d17dbac 94README.html: README.adoc
6b70c786 95 asciidoc -a toc ${ADOC_STDARG} -o $@ $<
9d17dbac 96
8ace7110
DM
97.PHONY: index
98index: index.html
3f559975
DM
99 $(BROWSER) index.html &
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}
59d89a51
DM
124 rm -rf pve-admin-guide.chunked
125 a2x -a docinfo -a docinfo1 -a icons -f chunked pve-admin-guide.adoc
59d89a51 126
2522a624 127PVE_DOCBOOK_CONF=-b $(shell pwd)/asciidoc/pve-docbook -f asciidoc/asciidoc-pve.conf
789c5c57 128PVE_DBLATEX_OPTS='-p ./asciidoc/pve-dblatex.xsl -s asciidoc/dblatex-custom.sty -c asciidoc/dblatex-export.conf'
2522a624 129
384871f2
DM
130pve-admin-guide-docinfo.xml: pve-admin-guide-docinfo.xml.in
131 sed -e 's/@RELEASE@/${DOCRELEASE}/' <$< >$@
132
63a01806 133pve-admin-guide.pdf: ${PVE_ADMIN_GUIDE_ADOCDEPENDS} docinfo.xml pve-admin-guide-docinfo.xml
789c5c57
TL
134 rsvg-convert -f pdf -o proxmox-logo.pdf images/proxmox-logo.svg
135 rsvg-convert -f pdf -o proxmox-ci-header.pdf images/proxmox-ci-header.svg
bef0c1b4 136 grep ">Release ${DOCRELEASE}<" pve-admin-guide-docinfo.xml || (echo "wrong release in pve-admin-guide-docinfo.xml" && false);
789c5c57 137 a2x -a docinfo -a docinfo1 -f pdf -L --asciidoc-opts="${PVE_DOCBOOK_CONF}" --dblatex-opts ${PVE_DBLATEX_OPTS} pve-admin-guide.adoc
34ef065a 138 rm proxmox-logo.pdf proxmox-ci-header.pdf
deb7f2ea 139
63a01806 140pve-admin-guide.epub: ${PVE_ADMIN_GUIDE_ADOCDEPENDS}
2522a624 141 a2x -f epub --asciidoc-opts="${PVE_DOCBOOK_CONF}" pve-admin-guide.adoc
9344ee0d 142
356064f4 143api-viewer/apidata.js: extractapi.pl
61568a65
DM
144 ./extractapi.pl >$@
145
356064f4
DM
146api-viewer/apidoc.js: api-viewer/apidata.js api-viewer/PVEAPI.js
147 cat api-viewer/apidata.js api-viewer/PVEAPI.js >$@
61568a65 148
9344ee0d 149.PHONY: dinstall
cfabc2e9
DM
150dinstall: ${GEN_DEB} ${DOC_DEB} ${MEDIAWIKI_DEB}
151 dpkg -i ${GEN_DEB} ${DOC_DEB} ${MEDIAWIKI_DEB}
9015f48f 152
9344ee0d 153.PHONY: deb
9015f48f 154deb:
c8bdafbd
WB
155 rm -f ${GEN_DEB} ${DOC_DEB} ${MEDIAWIKI_DEB}
156 make all-debs
9015f48f 157
f0d25f0d
WB
158.PHONY: all-debs
159all-debs: ${GEN_DEB} ${DOC_DEB} ${MEDIAWIKI_DEB}
160
c8bdafbd
WB
161.PHONY: clean-build
162clean-build:
9015f48f 163 rm -rf build
c8bdafbd
WB
164
165define prepare_build
166 rm -rf build-$1
167 mkdir build-$1
168 cp -a debian build-$1/debian
169 mv build-$1/debian/control.in build-$1/debian/control
170 echo >> build-$1/debian/control
171 cat debian/$1.control >> build-$1/debian/control
172 echo "git clone git://git.proxmox.com/git/pve-docs.git\\ngit checkout ${GITVERSION}" > build-$1/debian/SOURCE
173 install -dm755 build-$1/usr/share/$1
174 install -dm755 build-$1/usr/share/doc/$1
175endef
176
177.PHONY: gen-deb
178gen-deb: $(GEN_DEB)
179$(GEN_DEB): $(GEN_DEB_SOURCES) asciidoc-pve asciidoc/mediawiki.conf
180 $(call prepare_build,$(GEN_PACKAGE))
181 install -dm755 build-$(GEN_PACKAGE)/usr/bin
182 # install files
183 install -m 0644 ${GEN_DEB_SOURCES} build-$(GEN_PACKAGE)/usr/share/${GEN_PACKAGE}
184 install -m 0755 ${GEN_SCRIPTS} build-$(GEN_PACKAGE)/usr/share/${GEN_PACKAGE}
de7022fb 185 # install asciidoc-pve
c8bdafbd
WB
186 install -m 0755 asciidoc-pve build-$(GEN_PACKAGE)/usr/bin/
187 install -D -m 0644 asciidoc/mediawiki.conf build-$(GEN_PACKAGE)/usr/share/${GEN_PACKAGE}/asciidoc/mediawiki.conf
188 install -m 0644 asciidoc/asciidoc-pve.conf build-$(GEN_PACKAGE)/usr/share/${GEN_PACKAGE}/asciidoc/
189 install -m 0644 asciidoc/pve-html.conf build-$(GEN_PACKAGE)/usr/share/${GEN_PACKAGE}/asciidoc/
190 cd build-$(GEN_PACKAGE) && dpkg-buildpackage -rfakeroot -b -us -uc
191 lintian ${GEN_DEB}
192
193.PHONY: doc-deb
194doc-deb: $(DOC_DEB)
195$(DOC_DEB): index.html $(WIKI_IMPORTS) $(API_VIEWER_SOURCES) verify-images
196 $(call prepare_build,$(DOC_PACKAGE))
421ad500 197 sed -i -e '/^Build-Depends/{s/$$/, $(DOC_BUILDDEPS)/}' build-$(DOC_PACKAGE)/debian/control
ceb4ea5b 198 # install files for pvedocs package
c8bdafbd
WB
199 install -dm755 build-$(DOC_PACKAGE)/usr/share/${DOC_PACKAGE}
200 install -dm755 build-$(DOC_PACKAGE)/usr/share/doc/${DOC_PACKAGE}
201 install -m 0644 index.html ${INDEX_INCLUDES} build-$(DOC_PACKAGE)/usr/share/${DOC_PACKAGE}
202 install -m 0644 ${WIKI_IMPORTS} build-$(DOC_PACKAGE)/usr/share/${DOC_PACKAGE}
8c8ae224 203 # install screenshot images
c8bdafbd
WB
204 install -dm755 build-$(DOC_PACKAGE)/usr/share/${DOC_PACKAGE}/images/screenshot
205 install -m 0644 images/screenshot/*.png build-$(DOC_PACKAGE)/usr/share/${DOC_PACKAGE}/images/screenshot
61568a65 206 # install api doc viewer
c8bdafbd
WB
207 install -dm755 build-$(DOC_PACKAGE)/usr/share/${DOC_PACKAGE}/api-viewer
208 install -m 0644 ${API_VIEWER_SOURCES} build-$(DOC_PACKAGE)/usr/share/${DOC_PACKAGE}/api-viewer
209 cd build-$(DOC_PACKAGE) && dpkg-buildpackage -rfakeroot -b -us -uc
ceb4ea5b 210 lintian ${DOC_DEB}
c8bdafbd
WB
211
212.PHONY: mediawiki-deb
213mediawiki-deb: $(MEDIAWIKI_DEB)
214$(MEDIAWIKI_DEB): pve-docs-mediawiki-import
215 $(call prepare_build,$(MEDIAWIKI_PACKAGE))
216 cp pve-docs-mediawiki-import build-$(MEDIAWIKI_PACKAGE)/debian/tree/pve-docs-mediawiki/pve-docs-mediawiki-import
217 cd build-$(MEDIAWIKI_PACKAGE) && dpkg-buildpackage -rfakeroot -b -us -uc
cfabc2e9 218 lintian ${MEDIAWIKI_DEB}
9344ee0d 219
89e93b38 220.PHONY: upload
cfabc2e9 221upload: ${GEN_DEB} ${DOC_DEB} ${MEDIAWIKI_DEB}
821cf643 222 tar cf - ${GEN_DEB} ${DOC_DEB} ${MEDIAWIKI_DEB} | ssh -X repoman@repo.proxmox.com -- upload --product pve --dist stretch
deb7f2ea 223
56122987 224.PHONY: update
5cb4ef63
TL
225update: clean clean-static | update-static
226 make all
227
228.PHONY: update-static
229update-static: clean-static | $(filter %-synopsis.adoc %-opts.adoc, ${PVE_ADMIN_GUIDE_ADOCDEPENDS}) pve-firewall-macros.adoc api-viewer/apidata.js
230
231.PHONY: clean-static
232clean-static:
5bf279bd 233 find . -regex '.*-\(opts\|synopsis\)\.adoc' -not -name pmxcfs.8-synopsis.adoc -exec rm -f \{\} \;
56122987 234 rm -f api-viewer/apidata.js
fe154a4f 235 rm -f pve-firewall-macros.adoc pct-network-opts.adoc pct-mountpoint-opts.adoc
deb7f2ea 236
5cb4ef63 237clean:
f00afaef
WB
238 rm -rf *.html *.pdf *.epub *.tmp *.1 *.5 *.8
239 rm -f *.deb *.changes *.buildinfo
5cb4ef63
TL
240 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
241 rm -rf .pve-doc-depends
f00afaef 242 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
c8bdafbd 243 rm -rf build-*