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