]> git.proxmox.com Git - pve-docs.git/blame - Makefile
pve-docs-mediawiki-import.in: avoid to add newlines
[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
7e69098c 9PKGREL=10
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
63a01806
DM
19all: index.html
20
21.pve-doc-depends link-refs.json: $(wildcard *.adoc) scan-adoc-refs
22 ./scan-adoc-refs *.adoc --depends .pve-doc-depends > link-refs.json
23
1ed794c8
DM
24pve-doc-generator.mk: .pve-doc-depends pve-doc-generator.mk.in
25 cat pve-doc-generator.mk.in .pve-doc-depends > $@.tmp
26 mv $@.tmp $@
27
28include ./pve-doc-generator.mk
672abac1 29
9015f48f 30GEN_DEB_SOURCES= \
672abac1 31 pve-doc-generator.mk \
63a01806 32 ${MANUAL_SOURCES} \
54079101 33 pmxcfs.8-synopsis.adoc \
9344ee0d
DM
34 docinfo.xml
35
36GEN_SCRIPTS= \
f6b81378
DM
37 gen-datacenter.cfg.5-opts.pl \
38 gen-pct.conf.5-opts.pl \
bac8c385 39 gen-pct-network-opts.pl \
fe154a4f 40 gen-pct-mountpoint-opts.pl \
9b4799ab 41 gen-qm.conf.5-opts.pl \
500f1e1f 42 gen-vzdump.conf.5-opts.pl \
9344ee0d
DM
43 gen-pve-firewall-cluster-opts.pl \
44 gen-pve-firewall-host-opts.pl \
45 gen-pve-firewall-macros-adoc.pl \
46 gen-pve-firewall-rules-opts.pl \
f6b81378 47 gen-pve-firewall-vm-opts.pl
9344ee0d 48
356064f4
DM
49API_VIEWER_SOURCES= \
50 api-viewer/index.html \
51 api-viewer/apidoc.js
52
aa99b349
DM
53asciidoc-pve: asciidoc-pve.in link-refs.json
54 cat asciidoc-pve.in link-refs.json >asciidoc-pve.tmp
835dd63b 55 sed -e s/@RELEASE@/${DOCRELEASE}/ -i asciidoc-pve.tmp
aa99b349
DM
56 chmod +x asciidoc-pve.tmp
57 mv asciidoc-pve.tmp asciidoc-pve
58
b489b02c
DM
59pve-docs-mediawiki-import: pve-docs-mediawiki-import.in link-refs.json
60 cat pve-docs-mediawiki-import.in link-refs.json > pve-docs-mediawiki-import.tmp
61 chmod +x pve-docs-mediawiki-import.tmp
62 mv pve-docs-mediawiki-import.tmp pve-docs-mediawiki-import
63
f4defaeb
DM
64INDEX_INCLUDES= \
65 pve-admin-guide.pdf \
f4defaeb 66 pve-admin-guide.epub \
63a01806 67 $(sort $(addsuffix .html, ${MANUAL_PAGES}) ${CHAPTER_LIST})
f4defaeb 68
0e25828e 69ADOC_STDARG= -a icons -a data-uri -a "date=$(shell date)" -a "revnumber=${DOCRELEASE}"
deb7f2ea 70
fc1090ef 71BROWSER?=xdg-open
df41beec 72
7b2c36ae 73
deb7f2ea
DM
74%-nwdiag.svg: %.nwdiag
75 nwdiag -T svg $*.nwdiag -o $@;
76
9d17dbac
DM
77README.html: README.adoc
78 asciidoc ${ADOC_STDARG} -o $@ $<
79
8ace7110
DM
80.PHONY: index
81index: index.html
3f559975
DM
82 $(BROWSER) index.html &
83
f4defaeb 84index.html: index.adoc ${API_VIEWER_SOURCES} ${INDEX_INCLUDES}
bef0c1b4 85 asciidoc -a "date=$(shell date)" -a "revnumber=${DOCRELEASE}" index.adoc
deb7f2ea 86
63a01806 87pve-admin-guide.html: ${PVE_ADMIN_GUIDE_ADOCDEPENDS}
683e3b93 88 asciidoc -a pvelogo -a "revnumber=${DOCRELEASE}" -a "date=$(shell date)" pve-admin-guide.adoc
deb7f2ea 89
63a01806 90pve-admin-guide.chunked: ${PVE_ADMIN_GUIDE_ADOCDEPENDS}
59d89a51
DM
91 rm -rf pve-admin-guide.chunked
92 a2x -a docinfo -a docinfo1 -a icons -f chunked pve-admin-guide.adoc
59d89a51 93
63a01806 94pve-admin-guide.pdf: ${PVE_ADMIN_GUIDE_ADOCDEPENDS} docinfo.xml pve-admin-guide-docinfo.xml
34ef065a 95 inkscape -z -D --export-pdf=proxmox-logo.pdf images/proxmox-logo.svg
333a2f49 96 inkscape -z -D --export-pdf=proxmox-ci-header.pdf images/proxmox-ci-header.svg
bef0c1b4 97 grep ">Release ${DOCRELEASE}<" pve-admin-guide-docinfo.xml || (echo "wrong release in pve-admin-guide-docinfo.xml" && false);
72470ed6 98 a2x -a docinfo -a docinfo1 -f pdf -L --dblatex-opts "-P latex.output.revhistory=0" --dblatex-opts "-P latex.class.options=12pt" --dblatex-opts "-P doc.section.depth=2 -P toc.section.depth=2" --dblatex-opts "-P doc.publisher.show=0 -s asciidoc-dblatex-custom.sty" pve-admin-guide.adoc
34ef065a 99 rm proxmox-logo.pdf proxmox-ci-header.pdf
deb7f2ea 100
63a01806 101pve-admin-guide.epub: ${PVE_ADMIN_GUIDE_ADOCDEPENDS}
deb7f2ea 102 a2x -f epub pve-admin-guide.adoc
9344ee0d 103
356064f4 104api-viewer/apidata.js: extractapi.pl
61568a65
DM
105 ./extractapi.pl >$@
106
356064f4
DM
107api-viewer/apidoc.js: api-viewer/apidata.js api-viewer/PVEAPI.js
108 cat api-viewer/apidata.js api-viewer/PVEAPI.js >$@
61568a65 109
9344ee0d 110.PHONY: dinstall
cfabc2e9
DM
111dinstall: ${GEN_DEB} ${DOC_DEB} ${MEDIAWIKI_DEB}
112 dpkg -i ${GEN_DEB} ${DOC_DEB} ${MEDIAWIKI_DEB}
9015f48f 113
9344ee0d 114.PHONY: deb
9015f48f 115deb:
cfabc2e9
DM
116 rm -f ${GEN_DEB} ${DOC_DEB} ${MEDIAWIKI_DEB};
117 make ${GEN_DEB} ${DOC_DEB} ${MEDIAWIKI_DEB};
9015f48f 118
b489b02c 119${GEN_DEB} ${DOC_DEB} ${MEDIAWIKI_DEB}: index.html ${INDEX_INCLUDES} ${WIKI_IMPORTS} ${API_VIEWER_SOURCES} ${GEN_DEB_SOURCES} asciidoc-pve pve-docs-mediawiki-import
9015f48f
DM
120 rm -rf build
121 mkdir build
ceb4ea5b 122 rsync -a debian/ build/debian
b489b02c 123 cp pve-docs-mediawiki-import build/debian/tree/pve-docs-mediawiki/pve-docs-mediawiki-import
ceb4ea5b
DM
124 echo "git clone git://git.proxmox.com/git/pve-docs.git\\ngit checkout ${GITVERSION}" > build/debian/SOURCE
125 # install files for pve-doc-generator package
126 mkdir -p build/usr/share/${GEN_PACKAGE}
127 mkdir -p build/usr/share/doc/${GEN_PACKAGE}
bb3c27a7 128 mkdir -p build/usr/bin
ceb4ea5b
DM
129 install -m 0644 ${GEN_DEB_SOURCES} build/usr/share/${GEN_PACKAGE}
130 install -m 0755 ${GEN_SCRIPTS} build/usr/share/${GEN_PACKAGE}
bb3c27a7 131 install -m 0755 asciidoc-pve build/usr/bin/
ceb4ea5b 132 # install files for pvedocs package
9015f48f
DM
133 mkdir -p build/usr/share/${DOC_PACKAGE}
134 mkdir -p build/usr/share/doc/${DOC_PACKAGE}
ad2bfc41 135 install -m 0644 index.html ${INDEX_INCLUDES} build/usr/share/${DOC_PACKAGE}
251666be 136 install -m 0644 ${WIKI_IMPORTS} build/usr/share/${DOC_PACKAGE}
61568a65 137 # install api doc viewer
356064f4
DM
138 mkdir build/usr/share/${DOC_PACKAGE}/api-viewer
139 install -m 0644 ${API_VIEWER_SOURCES} build/usr/share/${DOC_PACKAGE}/api-viewer
cfabc2e9 140 # build Debian packages
9344ee0d 141 cd build; dpkg-buildpackage -rfakeroot -b -us -uc
9015f48f 142 lintian ${GEN_DEB}
ceb4ea5b 143 lintian ${DOC_DEB}
cfabc2e9 144 lintian ${MEDIAWIKI_DEB}
9344ee0d 145
89e93b38 146.PHONY: upload
cfabc2e9 147upload: ${GEN_DEB} ${DOC_DEB} ${MEDIAWIKI_DEB}
d7b4925a 148 tar cf - ${GEN_DEB} ${DOC_DEB} ${MEDIAWIKI_DEB} | ssh repoman@repo.proxmox.com upload
deb7f2ea 149
56122987 150.PHONY: update
c016ebb7 151update: clean
7aacca6f 152 rm -f *.5-opts.adoc *.1-synopsis.adoc *.8-synopsis.adoc
56122987 153 rm -f api-viewer/apidata.js
fe154a4f 154 rm -f pve-firewall-macros.adoc pct-network-opts.adoc pct-mountpoint-opts.adoc
c016ebb7 155 make all
deb7f2ea 156
bca311e4 157clean:
1ed794c8 158 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
de9cbbd6 159 find . -name '*~' -exec rm {} ';'