2019-05-21 18:31:13 +02:00
DGDIR = . # overwriting this ensures that we can build without full PVE installed
2016-10-11 10:28:30 +02:00
ASCIIDOC_PVE = ./asciidoc-pve
2016-04-06 10:35:58 +02:00
2016-04-29 11:22:28 +02:00
GEN_PACKAGE = pve-doc-generator
DOC_PACKAGE = pve-docs
2016-08-09 07:52:59 +02:00
MEDIAWIKI_PACKAGE = pve-docs-mediawiki
2016-04-06 09:38:55 +02:00
# also update debian/changelog
2019-05-21 17:46:34 +02:00
PKGREL = 0+1
2016-04-06 09:38:55 +02:00
2018-02-20 11:10:25 +01:00
GITVERSION := $( shell git rev-parse HEAD)
2016-04-07 12:19:44 +02:00
2016-08-05 12:34:02 +02:00
ARCH := $( shell dpkg-architecture -qDEB_BUILD_ARCH)
GEN_DEB = ${ GEN_PACKAGE } _${ DOCRELEASE } -${ PKGREL } _${ ARCH } .deb
2016-05-25 07:24:28 +02:00
DOC_DEB = ${ DOC_PACKAGE } _${ DOCRELEASE } -${ PKGREL } _all.deb
2016-08-09 07:52:59 +02:00
MEDIAWIKI_DEB = ${ MEDIAWIKI_PACKAGE } _${ DOCRELEASE } -${ PKGREL } _all.deb
2016-04-06 09:38:55 +02:00
2018-02-20 11:10:24 +01:00
export SOURCE_DATE_EPOCH ?= $( shell dpkg-parsechangelog -STimestamp)
SOURCE_DATE_HUMAN := $( shell date -d " @ ${ SOURCE_DATE_EPOCH } " )
2016-10-21 07:46:37 +02:00
2016-10-14 12:26:55 +02:00
all : index .html
2016-11-07 13:44:17 +01:00
.PHONY : verify -images
verify-images :
for i in ./images/screenshot/*.png; do ./png-verify.pl $$ i; done
2016-10-21 07:46:37 +02:00
ADOC_SOURCES_GUESS = $( filter-out %-synopsis.adoc %-opts.adoc %-table.adoc, $( wildcard *.adoc) )
.pve-doc-depends link-refs.json : ${ADOC_SOURCES_GUESS } scan -adoc -refs
2016-10-18 12:37:09 +02:00
./scan-adoc-refs *.adoc --depends .pve-doc-depends.tmp > link-refs.json.tmp
@cmp --quiet .pve-doc-depends .pve-doc-depends.tmp || mv .pve-doc-depends.tmp .pve-doc-depends
@cmp --quiet link-refs.json link-refs.json.tmp || mv link-refs.json.tmp link-refs.json
2016-10-14 12:26:55 +02:00
2016-10-14 13:10:35 +02:00
pve-doc-generator.mk : .pve -doc -depends pve -doc -generator .mk .in
cat pve-doc-generator.mk.in .pve-doc-depends > $@ .tmp
mv $@ .tmp $@
2018-09-13 09:40:55 +02:00
- i n c l u d e . / p v e - d o c - g e n e r a t o r . m k
2016-04-09 11:05:23 +02:00
2016-04-29 11:22:28 +02:00
GEN_DEB_SOURCES = \
2016-04-09 11:05:23 +02:00
pve-doc-generator.mk \
2016-10-14 12:26:55 +02:00
${ MANUAL_SOURCES } \
2016-10-14 13:35:03 +02:00
pmxcfs.8-synopsis.adoc \
2018-11-09 11:05:42 +01:00
qmeventd.8-synopsis.adoc \
2016-04-06 09:38:55 +02:00
docinfo.xml
GEN_SCRIPTS = \
2016-11-20 10:25:42 +01:00
gen-ha-groups-opts.pl \
gen-ha-resources-opts.pl \
2016-04-06 12:31:14 +02:00
gen-datacenter.cfg.5-opts.pl \
gen-pct.conf.5-opts.pl \
2016-05-07 11:16:32 +02:00
gen-pct-network-opts.pl \
2016-05-07 14:15:22 +02:00
gen-pct-mountpoint-opts.pl \
2016-04-09 09:46:54 +02:00
gen-qm.conf.5-opts.pl \
2018-03-20 14:06:46 +01:00
gen-qm-cloud-init-opts.pl \
2016-04-14 12:51:38 +02:00
gen-vzdump.conf.5-opts.pl \
2016-04-06 09:38:55 +02:00
gen-pve-firewall-cluster-opts.pl \
gen-pve-firewall-host-opts.pl \
gen-pve-firewall-macros-adoc.pl \
gen-pve-firewall-rules-opts.pl \
2018-07-27 10:41:49 +02:00
gen-pve-firewall-vm-opts.pl \
gen-output-format-opts.pl
2016-04-06 09:38:55 +02:00
2016-04-29 14:13:12 +02:00
API_VIEWER_SOURCES = \
api-viewer/index.html \
api-viewer/apidoc.js
2016-10-06 17:29:03 +02:00
asciidoc-pve : asciidoc -pve .in link -refs .json
cat asciidoc-pve.in link-refs.json >asciidoc-pve.tmp
2016-10-07 12:56:55 +02:00
sed -e s/@RELEASE@/${ DOCRELEASE } / -i asciidoc-pve.tmp
2016-10-06 17:29:03 +02:00
chmod +x asciidoc-pve.tmp
mv asciidoc-pve.tmp asciidoc-pve
2016-10-10 09:14:25 +02:00
pve-docs-mediawiki-import : pve -docs -mediawiki -import .in link -refs .json
cat pve-docs-mediawiki-import.in link-refs.json > pve-docs-mediawiki-import.tmp
chmod +x pve-docs-mediawiki-import.tmp
mv pve-docs-mediawiki-import.tmp pve-docs-mediawiki-import
2016-05-03 20:07:03 +02:00
INDEX_INCLUDES = \
pve-admin-guide.pdf \
pve-admin-guide.epub \
2016-10-20 13:10:07 +02:00
chapter-index-table.adoc \
man1-index-table.adoc \
man5-index-table.adoc \
man8-index-table.adoc \
2016-10-14 12:26:55 +02:00
$( sort $( addsuffix .html, ${ MANUAL_PAGES } ) ${ CHAPTER_LIST } )
2016-05-03 20:07:03 +02:00
2018-02-20 11:10:24 +01:00
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
2016-01-05 11:20:35 +01:00
2016-03-03 10:01:14 +01:00
BROWSER ?= xdg-open
2016-01-23 10:01:28 +01:00
2016-09-23 09:28:14 +02:00
README.html : README .adoc
2016-12-01 11:48:28 +01:00
asciidoc -a toc ${ ADOC_STDARG } -o $@ $<
2016-09-23 09:28:14 +02:00
2016-04-30 11:13:12 +02:00
.PHONY : index
index : index .html
2016-05-03 19:52:13 +02:00
$( BROWSER) index.html &
2016-10-21 06:34:01 +02:00
chapter-index-table.adoc : asciidoc -pve
./asciidoc-pve chapter-table >$@ .tmp
2016-10-20 13:10:07 +02:00
mv $@ .tmp $@
2016-10-21 06:34:01 +02:00
man1-index-table.adoc : asciidoc -pve
./asciidoc-pve man1page-table >$@ .tmp
2016-10-20 13:10:07 +02:00
mv $@ .tmp $@
2016-10-21 06:34:01 +02:00
man5-index-table.adoc : asciidoc -pve
./asciidoc-pve man5page-table >$@ .tmp
2016-10-20 13:10:07 +02:00
mv $@ .tmp $@
2016-10-21 06:34:01 +02:00
man8-index-table.adoc : asciidoc -pve
./asciidoc-pve man8page-table >$@ .tmp
2016-10-20 13:10:07 +02:00
mv $@ .tmp $@
index.html : index .adoc ${API_VIEWER_SOURCES } ${INDEX_INCLUDES }
2016-10-18 13:12:15 +02:00
asciidoc ${ ADOC_STDARG } -o $@ index.adoc
2016-01-05 11:20:35 +01:00
2016-10-14 12:26:55 +02:00
pve-admin-guide.html : ${PVE_ADMIN_GUIDE_ADOCDEPENDS }
2016-11-07 18:12:36 +01:00
asciidoc -a pvelogo ${ ADOC_STDARG } -o $@ pve-admin-guide.adoc
2016-01-05 11:20:35 +01:00
2016-10-14 12:26:55 +02:00
pve-admin-guide.chunked : ${PVE_ADMIN_GUIDE_ADOCDEPENDS }
2018-09-12 19:41:57 +02:00
rm -rf $@ .tmp $@
mkdir $@ .tmp
a2x -D $@ .tmp -a docinfo -a docinfo1 -a icons -f chunked pve-admin-guide.adoc
mv $@ .tmp/$@ $@
2016-04-29 18:16:33 +02:00
2016-11-07 17:41:51 +01:00
PVE_DOCBOOK_CONF = -b $( shell pwd ) /asciidoc/pve-docbook -f asciidoc/asciidoc-pve.conf
2017-06-27 15:42:00 +02:00
PVE_DBLATEX_OPTS = '-p ./asciidoc/pve-dblatex.xsl -s asciidoc/dblatex-custom.sty -c asciidoc/dblatex-export.conf'
2016-11-07 17:41:51 +01:00
2019-02-20 10:05:05 +01:00
YEAR := $( shell date '+%Y' )
2016-12-09 16:46:38 +01:00
pve-admin-guide-docinfo.xml : pve -admin -guide -docinfo .xml .in
2019-02-20 10:05:05 +01:00
sed -e 's/@RELEASE@/${DOCRELEASE}/' -e 's/@YEAR@/${YEAR}/' <$< >$@
2016-12-09 16:46:38 +01:00
2016-10-14 12:26:55 +02:00
pve-admin-guide.pdf : ${PVE_ADMIN_GUIDE_ADOCDEPENDS } docinfo .xml pve -admin -guide -docinfo .xml
2017-06-27 15:42:00 +02:00
rsvg-convert -f pdf -o proxmox-logo.pdf images/proxmox-logo.svg
rsvg-convert -f pdf -o proxmox-ci-header.pdf images/proxmox-ci-header.svg
2016-04-06 10:35:58 +02:00
grep " >Release ${ DOCRELEASE } < " pve-admin-guide-docinfo.xml || ( echo "wrong release in pve-admin-guide-docinfo.xml" && false ) ;
2017-06-27 15:42:00 +02:00
a2x -a docinfo -a docinfo1 -f pdf -L --asciidoc-opts= " ${ PVE_DOCBOOK_CONF } " --dblatex-opts ${ PVE_DBLATEX_OPTS } pve-admin-guide.adoc
2016-10-01 16:23:12 +02:00
rm proxmox-logo.pdf proxmox-ci-header.pdf
2016-01-05 11:20:35 +01:00
2016-10-14 12:26:55 +02:00
pve-admin-guide.epub : ${PVE_ADMIN_GUIDE_ADOCDEPENDS }
2018-09-12 19:41:57 +02:00
rm -rf $@ .tmp $@
mkdir $@ .tmp
a2x -D $@ .tmp -f epub --asciidoc-opts= " ${ PVE_DOCBOOK_CONF } " pve-admin-guide.adoc
mv $@ .tmp/$@ $@
2016-04-06 09:38:55 +02:00
2016-04-29 14:13:12 +02:00
api-viewer/apidata.js : extractapi .pl
2016-04-29 12:22:23 +02:00
./extractapi.pl >$@
2016-04-29 14:13:12 +02:00
api-viewer/apidoc.js : api -viewer /apidata .js api -viewer /PVEAPI .js
cat api-viewer/apidata.js api-viewer/PVEAPI.js >$@
2016-04-29 12:22:23 +02:00
2016-04-06 09:38:55 +02:00
.PHONY : dinstall
2016-08-09 07:52:59 +02:00
dinstall : ${GEN_DEB } ${DOC_DEB } ${MEDIAWIKI_DEB }
dpkg -i ${ GEN_DEB } ${ DOC_DEB } ${ MEDIAWIKI_DEB }
2016-04-29 11:22:28 +02:00
2016-04-06 09:38:55 +02:00
.PHONY : deb
2018-09-12 19:41:53 +02:00
deb : $( DOC_DEB )
$(MEDIAWIKI_DEB) $(GEN_DEB) : $( DOC_DEB )
$(DOC_DEB) :
2017-02-03 12:19:30 +01:00
rm -f ${ GEN_DEB } ${ DOC_DEB } ${ MEDIAWIKI_DEB }
2018-09-12 19:41:53 +02:00
rm -rf build
rsync -a * build/
echo " git clone git://git.proxmox.com/git/pve-docs.git\\ngit checkout ${ GITVERSION } " > build/debian/SOURCE
cd build; dpkg-buildpackage -b -us -uc
lintian $( DOC_DEB) $( GEN_DEB) $( MEDIAWIKI_DEB)
2017-02-06 15:38:12 +01:00
2017-02-03 12:19:30 +01:00
.PHONY : clean -build
clean-build :
2016-04-29 11:22:28 +02:00
rm -rf build
2017-02-03 12:19:30 +01:00
2018-09-12 19:41:53 +02:00
.PHONY : install
install : gen -install doc -install mediawiki -install
.PHONY : gen -install
gen-install : $( GEN_DEB_SOURCES ) asciidoc -pve asciidoc /mediawiki .conf
install -dm755 $( DESTDIR) /usr/share/$( GEN_PACKAGE)
install -dm755 $( DESTDIR) /usr/share/doc/$( GEN_PACKAGE)
install -dm755 $( DESTDIR) /usr/bin
2017-02-03 12:19:30 +01:00
# install files
2018-09-12 19:41:53 +02:00
install -m 0644 ${ GEN_DEB_SOURCES } $( DESTDIR) /usr/share/${ GEN_PACKAGE }
install -m 0755 ${ GEN_SCRIPTS } $( DESTDIR) /usr/share/${ GEN_PACKAGE }
2016-11-07 08:19:04 +01:00
# install asciidoc-pve
2018-09-12 19:41:53 +02:00
install -m 0755 asciidoc-pve $( DESTDIR) /usr/bin/
install -D -m 0644 asciidoc/mediawiki.conf $( DESTDIR) /usr/share/${ GEN_PACKAGE } /asciidoc/mediawiki.conf
install -m 0644 asciidoc/asciidoc-pve.conf $( DESTDIR) /usr/share/${ GEN_PACKAGE } /asciidoc/
install -m 0644 asciidoc/pve-html.conf $( DESTDIR) /usr/share/${ GEN_PACKAGE } /asciidoc/
.PHONY : doc -install
2019-02-01 13:48:24 +01:00
doc-install : index .html $( WIKI_IMPORTS ) $( API_VIEWER_SOURCES ) verify -images examples
2018-09-12 19:41:53 +02:00
install -dm755 $( DESTDIR) /usr/share/$( DOC_PACKAGE)
install -dm755 $( DESTDIR) /usr/share/doc/$( DOC_PACKAGE)
2016-05-25 07:24:28 +02:00
# install files for pvedocs package
2018-09-12 19:41:53 +02:00
install -dm755 $( DESTDIR) /usr/share/${ DOC_PACKAGE }
install -dm755 $( DESTDIR) /usr/share/doc/${ DOC_PACKAGE }
2019-01-31 14:33:41 +01:00
install -dm755 $( DESTDIR) /usr/share/${ DOC_PACKAGE } /examples/
2019-02-01 13:48:24 +01:00
install -m 755 examples/guest-example-hookscript.pl $( DESTDIR) /usr/share/${ DOC_PACKAGE } /examples/
2018-09-12 19:41:53 +02:00
install -m 0644 index.html ${ INDEX_INCLUDES } $( DESTDIR) /usr/share/${ DOC_PACKAGE }
install -m 0644 ${ WIKI_IMPORTS } $( DESTDIR) /usr/share/${ DOC_PACKAGE }
2018-08-16 10:10:08 +02:00
# install images
2018-09-12 19:41:53 +02:00
make -C images install
2016-11-07 17:03:55 +01:00
# install screenshot images
2018-09-12 19:41:53 +02:00
install -dm755 $( DESTDIR) /usr/share/${ DOC_PACKAGE } /images/screenshot
install -m 0644 images/screenshot/*.png $( DESTDIR) /usr/share/${ DOC_PACKAGE } /images/screenshot
2016-04-29 12:22:23 +02:00
# install api doc viewer
2018-09-12 19:41:53 +02:00
install -dm755 $( DESTDIR) /usr/share/${ DOC_PACKAGE } /api-viewer
install -m 0644 ${ API_VIEWER_SOURCES } $( DESTDIR) /usr/share/${ DOC_PACKAGE } /api-viewer
.PHONY : mediawiki -install
mediawiki-install : pve -docs -mediawiki -import
install -dm755 $( DESTDIR) /usr/share/$( MEDIAWIKI_PACKAGE)
install -dm755 $( DESTDIR) /usr/share/doc/$( MEDIAWIKI_PACKAGE)
install -dm755 $( DESTDIR) /usr/bin
install -dm755 $( DESTDIR) /usr/share/$( MEDIAWIKI_PACKAGE)
install -dm755 $( DESTDIR) /usr/share/doc/$( MEDIAWIKI_PACKAGE)
install -m 0755 pve-docs-mediawiki-import $( DESTDIR) /usr/bin/
2016-04-06 09:38:55 +02:00
2016-04-06 10:45:54 +02:00
.PHONY : upload
2016-08-09 07:52:59 +02:00
upload : ${GEN_DEB } ${DOC_DEB } ${MEDIAWIKI_DEB }
2019-05-21 18:23:41 +02:00
tar cf - ${ GEN_DEB } ${ DOC_DEB } ${ MEDIAWIKI_DEB } | ssh -X repoman@repo.proxmox.com -- upload --product pve --dist buster
2016-01-05 11:20:35 +01:00
2016-04-30 11:24:10 +02:00
.PHONY : update
2018-05-14 12:22:18 +02:00
update :
make clean clean-static
make update-static
2017-10-18 10:12:46 +02:00
make all
.PHONY : update -static
2018-05-14 12:22:18 +02:00
update-static :
make clean-static
make $( filter %-synopsis.adoc %-opts.adoc, ${ PVE_ADMIN_GUIDE_ADOCDEPENDS } ) pve-firewall-macros.adoc api-viewer/apidata.js
2017-10-18 10:12:46 +02:00
.PHONY : clean -static
clean-static :
2018-11-23 14:07:30 +01:00
find . -regex '.*-\(opts\|synopsis\)\.adoc' -not -name pmxcfs.8-synopsis.adoc -not -name qmeventd.8-synopsis.adoc -exec rm -f \{ \} \;
2016-04-30 11:24:10 +02:00
rm -f api-viewer/apidata.js
2016-05-07 14:15:22 +02:00
rm -f pve-firewall-macros.adoc pct-network-opts.adoc pct-mountpoint-opts.adoc
2016-01-05 11:20:35 +01:00
2017-10-18 10:12:46 +02:00
clean :
2017-02-03 13:30:54 +01:00
rm -rf *.html *.pdf *.epub *.tmp *.1 *.5 *.8
rm -f *.deb *.changes *.buildinfo
2017-10-18 10:12:46 +02:00
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
rm -rf .pve-doc-depends
2017-02-03 13:30:54 +01:00
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
2018-12-11 11:57:23 +01:00
rm -rf build