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