]> git.proxmox.com Git - pve-docs.git/blobdiff - Makefile
buildsys: don't use rm -r on so many globs
[pve-docs.git] / Makefile
index 87230b909ddde8258ffef3d364f15a19c5f45e89..5494078db8ef954c7f2d24ab9b53543704c8a024 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -6,7 +6,7 @@ DOC_PACKAGE=pve-docs
 MEDIAWIKI_PACKAGE=pve-docs-mediawiki
 
 # also update debian/changelog
-PKGREL=11
+PKGREL=3
 
 GITVERSION:=$(shell cat .git/refs/heads/master)
 
@@ -15,10 +15,14 @@ ARCH:=$(shell dpkg-architecture -qDEB_BUILD_ARCH)
 GEN_DEB=${GEN_PACKAGE}_${DOCRELEASE}-${PKGREL}_${ARCH}.deb
 DOC_DEB=${DOC_PACKAGE}_${DOCRELEASE}-${PKGREL}_all.deb
 MEDIAWIKI_DEB=${MEDIAWIKI_PACKAGE}_${DOCRELEASE}-${PKGREL}_all.deb
+DOC_BUILDDEPS := pve-doc-generator, dblatex, source-highlight, inkscape, imagemagick
 
 
 all: index.html
 
+.PHONY: verify-images
+verify-images:
+       for i in ./images/screenshot/*.png; do ./png-verify.pl $$i; done
 
 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
@@ -39,6 +43,8 @@ GEN_DEB_SOURCES=                              \
        docinfo.xml
 
 GEN_SCRIPTS=                                   \
+       gen-ha-groups-opts.pl                   \
+       gen-ha-resources-opts.pl                \
        gen-datacenter.cfg.5-opts.pl            \
        gen-pct.conf.5-opts.pl                  \
        gen-pct-network-opts.pl                 \
@@ -75,7 +81,7 @@ INDEX_INCLUDES=                                                               \
        man8-index-table.adoc                                           \
        $(sort $(addsuffix .html, ${MANUAL_PAGES}) ${CHAPTER_LIST})
 
-ADOC_STDARG= -b html5 -a icons -a data-uri -a "date=$(shell date)" -a "revnumber=${DOCRELEASE}"
+ADOC_STDARG=-b $(shell pwd)/asciidoc/pve-html -f asciidoc/asciidoc-pve.conf -a icons -a data-uri -a "date=$(shell date)" -a "revnumber=${DOCRELEASE}"
 
 BROWSER?=xdg-open
 
@@ -84,7 +90,7 @@ BROWSER?=xdg-open
        nwdiag -T svg $*.nwdiag -o $@;
 
 README.html: README.adoc
-       asciidoc ${ADOC_STDARG} -o $@ $<
+       asciidoc -a toc ${ADOC_STDARG} -o $@ $<
 
 .PHONY: index
 index: index.html
@@ -110,21 +116,26 @@ index.html: index.adoc ${API_VIEWER_SOURCES} ${INDEX_INCLUDES}
        asciidoc ${ADOC_STDARG} -o $@ index.adoc
 
 pve-admin-guide.html: ${PVE_ADMIN_GUIDE_ADOCDEPENDS}
-       asciidoc -a pvelogo ${ADOC_STDARG} pve-admin-guide.adoc
+       asciidoc -a pvelogo ${ADOC_STDARG} -o $@ pve-admin-guide.adoc
 
 pve-admin-guide.chunked: ${PVE_ADMIN_GUIDE_ADOCDEPENDS}
        rm -rf pve-admin-guide.chunked
        a2x -a docinfo -a docinfo1 -a icons -f chunked pve-admin-guide.adoc
 
+PVE_DOCBOOK_CONF=-b $(shell pwd)/asciidoc/pve-docbook -f asciidoc/asciidoc-pve.conf
+
+pve-admin-guide-docinfo.xml: pve-admin-guide-docinfo.xml.in
+       sed -e 's/@RELEASE@/${DOCRELEASE}/' <$< >$@
+
 pve-admin-guide.pdf: ${PVE_ADMIN_GUIDE_ADOCDEPENDS} docinfo.xml pve-admin-guide-docinfo.xml
        inkscape -z -D --export-pdf=proxmox-logo.pdf images/proxmox-logo.svg
        inkscape -z -D --export-pdf=proxmox-ci-header.pdf images/proxmox-ci-header.svg
        grep ">Release ${DOCRELEASE}<" pve-admin-guide-docinfo.xml || (echo "wrong release in  pve-admin-guide-docinfo.xml" && false);
-       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
+       a2x -a docinfo -a docinfo1 -f pdf -L --asciidoc-opts="${PVE_DOCBOOK_CONF}" --dblatex-opts "-p ./asciidoc/pve-dblatex.xsl -s asciidoc/dblatex-custom.sty" pve-admin-guide.adoc
        rm proxmox-logo.pdf proxmox-ci-header.pdf
 
 pve-admin-guide.epub: ${PVE_ADMIN_GUIDE_ADOCDEPENDS}
-       a2x -f epub pve-admin-guide.adoc
+       a2x -f epub --asciidoc-opts="${PVE_DOCBOOK_CONF}" pve-admin-guide.adoc
 
 api-viewer/apidata.js: extractapi.pl
        ./extractapi.pl >$@
@@ -138,35 +149,66 @@ dinstall: ${GEN_DEB} ${DOC_DEB} ${MEDIAWIKI_DEB}
 
 .PHONY: deb
 deb:
-       rm -f ${GEN_DEB} ${DOC_DEB} ${MEDIAWIKI_DEB};
-       make ${GEN_DEB} ${DOC_DEB} ${MEDIAWIKI_DEB};
+       rm -f ${GEN_DEB} ${DOC_DEB} ${MEDIAWIKI_DEB}
+       make all-debs
 
-${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
+.PHONY: clean-build
+clean-build:
        rm -rf build
-       mkdir build
-       rsync -a debian/ build/debian
-       cp pve-docs-mediawiki-import build/debian/tree/pve-docs-mediawiki/pve-docs-mediawiki-import
-       echo "git clone git://git.proxmox.com/git/pve-docs.git\\ngit checkout ${GITVERSION}" > build/debian/SOURCE
-       # install files for pve-doc-generator package
-       mkdir -p build/usr/share/${GEN_PACKAGE}
-       mkdir -p build/usr/share/doc/${GEN_PACKAGE}
-       mkdir -p build/usr/bin
-       install -m 0644 ${GEN_DEB_SOURCES} build/usr/share/${GEN_PACKAGE}
-       install -m 0755 ${GEN_SCRIPTS} build/usr/share/${GEN_PACKAGE}
-       install -m 0755 asciidoc-pve build/usr/bin/
-       install -D -m 0644 asciidoc/mediawiki.conf build/etc/asciidoc/mediawiki.conf
+
+define prepare_build
+       rm -rf build-$1
+       mkdir build-$1
+       cp -a debian build-$1/debian
+       mv build-$1/debian/control.in build-$1/debian/control
+       echo >> build-$1/debian/control
+       cat debian/$1.control >> build-$1/debian/control
+       echo "git clone git://git.proxmox.com/git/pve-docs.git\\ngit checkout ${GITVERSION}" > build-$1/debian/SOURCE
+       install -dm755 build-$1/usr/share/$1
+       install -dm755 build-$1/usr/share/doc/$1
+endef
+
+.PHONY: gen-deb
+gen-deb: $(GEN_DEB)
+$(GEN_DEB): $(GEN_DEB_SOURCES) asciidoc-pve asciidoc/mediawiki.conf
+       $(call prepare_build,$(GEN_PACKAGE))
+       install -dm755 build-$(GEN_PACKAGE)/usr/bin
+       # install files
+       install -m 0644 ${GEN_DEB_SOURCES} build-$(GEN_PACKAGE)/usr/share/${GEN_PACKAGE}
+       install -m 0755 ${GEN_SCRIPTS} build-$(GEN_PACKAGE)/usr/share/${GEN_PACKAGE}
+       # install asciidoc-pve
+       install -m 0755 asciidoc-pve build-$(GEN_PACKAGE)/usr/bin/
+       install -D -m 0644 asciidoc/mediawiki.conf build-$(GEN_PACKAGE)/usr/share/${GEN_PACKAGE}/asciidoc/mediawiki.conf
+       install -m 0644 asciidoc/asciidoc-pve.conf build-$(GEN_PACKAGE)/usr/share/${GEN_PACKAGE}/asciidoc/
+       install -m 0644 asciidoc/pve-html.conf build-$(GEN_PACKAGE)/usr/share/${GEN_PACKAGE}/asciidoc/
+       cd build-$(GEN_PACKAGE) && dpkg-buildpackage -rfakeroot -b -us -uc
+       lintian ${GEN_DEB}
+
+.PHONY: doc-deb
+doc-deb: $(DOC_DEB)
+$(DOC_DEB): index.html $(WIKI_IMPORTS) $(API_VIEWER_SOURCES) verify-images
+       $(call prepare_build,$(DOC_PACKAGE))
+       sed -i -e '/^Build-Depends/{s/$$/$(DOC_BUILDDEPS)/}' build-$(DOC_PACKAGE)/debian/control
        # install files for pvedocs package
-       mkdir -p build/usr/share/${DOC_PACKAGE}
-       mkdir -p build/usr/share/doc/${DOC_PACKAGE}
-       install -m 0644 index.html ${INDEX_INCLUDES} build/usr/share/${DOC_PACKAGE}
-       install -m 0644 ${WIKI_IMPORTS} build/usr/share/${DOC_PACKAGE}
+       install -dm755 build-$(DOC_PACKAGE)/usr/share/${DOC_PACKAGE}
+       install -dm755 build-$(DOC_PACKAGE)/usr/share/doc/${DOC_PACKAGE}
+       install -m 0644 index.html ${INDEX_INCLUDES} build-$(DOC_PACKAGE)/usr/share/${DOC_PACKAGE}
+       install -m 0644 ${WIKI_IMPORTS} build-$(DOC_PACKAGE)/usr/share/${DOC_PACKAGE}
+       # install screenshot images
+       install -dm755 build-$(DOC_PACKAGE)/usr/share/${DOC_PACKAGE}/images/screenshot
+       install -m 0644 images/screenshot/*.png build-$(DOC_PACKAGE)/usr/share/${DOC_PACKAGE}/images/screenshot
        # install api doc viewer
-       mkdir build/usr/share/${DOC_PACKAGE}/api-viewer
-       install -m 0644 ${API_VIEWER_SOURCES} build/usr/share/${DOC_PACKAGE}/api-viewer
-       # build Debian packages
-       cd build; dpkg-buildpackage -rfakeroot -b -us -uc
-       lintian ${GEN_DEB}
+       install -dm755 build-$(DOC_PACKAGE)/usr/share/${DOC_PACKAGE}/api-viewer
+       install -m 0644 ${API_VIEWER_SOURCES} build-$(DOC_PACKAGE)/usr/share/${DOC_PACKAGE}/api-viewer
+       cd build-$(DOC_PACKAGE) && dpkg-buildpackage -rfakeroot -b -us -uc
        lintian ${DOC_DEB}
+
+.PHONY: mediawiki-deb
+mediawiki-deb: $(MEDIAWIKI_DEB)
+$(MEDIAWIKI_DEB): pve-docs-mediawiki-import
+       $(call prepare_build,$(MEDIAWIKI_PACKAGE))
+       cp pve-docs-mediawiki-import build-$(MEDIAWIKI_PACKAGE)/debian/tree/pve-docs-mediawiki/pve-docs-mediawiki-import
+       cd build-$(MEDIAWIKI_PACKAGE) && dpkg-buildpackage -rfakeroot -b -us -uc
        lintian ${MEDIAWIKI_DEB}
 
 .PHONY: upload
@@ -181,5 +223,9 @@ update: clean
        make all
 
 clean: 
-       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
-       find . -name '*~' -exec rm {} ';'
+       rm -rf *.html *.pdf *.epub *.tmp *.1 *.5 *.8
+       rm -f *.deb *.changes *.buildinfo
+       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 
+       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
+       rm -rf build-*