]> git.proxmox.com Git - pve-docs.git/blobdiff - Makefile
fix clean-static find call
[pve-docs.git] / Makefile
index 64826faff06aa3c9525c51713d521d6df7c2a469..c049edaaa3728ea5e7eca25af0691e84218f10ab 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -6,9 +6,9 @@ DOC_PACKAGE=pve-docs
 MEDIAWIKI_PACKAGE=pve-docs-mediawiki
 
 # also update debian/changelog
-PKGREL=13
+PKGREL=10
 
-GITVERSION:=$(shell cat .git/refs/heads/master)
+GITVERSION:=$(shell git rev-parse HEAD)
 
 ARCH:=$(shell dpkg-architecture -qDEB_BUILD_ARCH)
 
@@ -16,9 +16,14 @@ GEN_DEB=${GEN_PACKAGE}_${DOCRELEASE}-${PKGREL}_${ARCH}.deb
 DOC_DEB=${DOC_PACKAGE}_${DOCRELEASE}-${PKGREL}_all.deb
 MEDIAWIKI_DEB=${MEDIAWIKI_PACKAGE}_${DOCRELEASE}-${PKGREL}_all.deb
 
+export SOURCE_DATE_EPOCH ?= $(shell dpkg-parsechangelog -STimestamp)
+SOURCE_DATE_HUMAN := $(shell date -d "@${SOURCE_DATE_EPOCH}")
 
 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
@@ -30,26 +35,31 @@ pve-doc-generator.mk: .pve-doc-depends pve-doc-generator.mk.in
        cat pve-doc-generator.mk.in .pve-doc-depends > $@.tmp
        mv $@.tmp $@
 
-include ./pve-doc-generator.mk
+-include ./pve-doc-generator.mk
 
 GEN_DEB_SOURCES=                               \
        pve-doc-generator.mk                    \
        ${MANUAL_SOURCES}                       \
        pmxcfs.8-synopsis.adoc                  \
+       qmeventd.8-synopsis.adoc                \
        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                 \
        gen-pct-mountpoint-opts.pl              \
        gen-qm.conf.5-opts.pl                   \
+       gen-qm-cloud-init-opts.pl               \
        gen-vzdump.conf.5-opts.pl               \
        gen-pve-firewall-cluster-opts.pl        \
        gen-pve-firewall-host-opts.pl           \
        gen-pve-firewall-macros-adoc.pl         \
        gen-pve-firewall-rules-opts.pl          \
-       gen-pve-firewall-vm-opts.pl
+       gen-pve-firewall-vm-opts.pl             \
+       gen-output-format-opts.pl
 
 API_VIEWER_SOURCES=                            \
        api-viewer/index.html                   \
@@ -75,16 +85,12 @@ 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=${SOURCE_DATE_HUMAN}" -a "revnumber=${DOCRELEASE}" -a footer-style=revdate
 
 BROWSER?=xdg-open
 
-
-%-nwdiag.svg: %.nwdiag
-       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,32 @@ 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
+       rm -rf $@.tmp $@
+       mkdir $@.tmp
+       a2x -D $@.tmp -a docinfo -a docinfo1 -a icons -f chunked pve-admin-guide.adoc
+       mv $@.tmp/$@ $@
+
+PVE_DOCBOOK_CONF=-b $(shell pwd)/asciidoc/pve-docbook -f asciidoc/asciidoc-pve.conf
+PVE_DBLATEX_OPTS='-p ./asciidoc/pve-dblatex.xsl -s asciidoc/dblatex-custom.sty -c asciidoc/dblatex-export.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
+       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
        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 ./asciidoc/pve-dblatex.xsl -s asciidoc/dblatex-custom.sty" pve-admin-guide.adoc
+       a2x -a docinfo -a docinfo1 -f pdf -L --asciidoc-opts="${PVE_DOCBOOK_CONF}" --dblatex-opts ${PVE_DBLATEX_OPTS} 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
+       rm -rf $@.tmp $@
+       mkdir $@.tmp
+       a2x -D $@.tmp -f epub --asciidoc-opts="${PVE_DOCBOOK_CONF}" pve-admin-guide.adoc
+       mv $@.tmp/$@ $@
 
 api-viewer/apidata.js: extractapi.pl
        ./extractapi.pl >$@
@@ -137,51 +154,89 @@ dinstall: ${GEN_DEB} ${DOC_DEB} ${MEDIAWIKI_DEB}
        dpkg -i ${GEN_DEB} ${DOC_DEB} ${MEDIAWIKI_DEB}
 
 .PHONY: deb
-deb:
-       rm -f ${GEN_DEB} ${DOC_DEB} ${MEDIAWIKI_DEB};
-       make ${GEN_DEB} ${DOC_DEB} ${MEDIAWIKI_DEB};
-
-${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
+deb: $(DOC_DEB)
+$(MEDIAWIKI_DEB) $(GEN_DEB): $(DOC_DEB)
+$(DOC_DEB):
+       rm -f ${GEN_DEB} ${DOC_DEB} ${MEDIAWIKI_DEB}
        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
+       rsync -a * build/
        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}
+       cd build; dpkg-buildpackage -b -us -uc
+       lintian $(DOC_DEB) $(GEN_DEB) $(MEDIAWIKI_DEB)
+
+.PHONY: clean-build
+clean-build:
+       rm -rf build
+
+.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
+       # install files
+       install -m 0644 ${GEN_DEB_SOURCES} $(DESTDIR)/usr/share/${GEN_PACKAGE}
+       install -m 0755 ${GEN_SCRIPTS} $(DESTDIR)/usr/share/${GEN_PACKAGE}
        # install asciidoc-pve
-       install -m 0755 asciidoc-pve build/usr/bin/
-       install -D -m 0644 asciidoc/mediawiki.conf build/usr/share/${GEN_PACKAGE}/asciidoc/mediawiki.conf
-       install -m 0644 asciidoc/asciidoc-pve.conf build/usr/share/${GEN_PACKAGE}/asciidoc/
+       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
+doc-install: index.html $(WIKI_IMPORTS) $(API_VIEWER_SOURCES) verify-images
+       install -dm755 $(DESTDIR)/usr/share/$(DOC_PACKAGE)
+       install -dm755 $(DESTDIR)/usr/share/doc/$(DOC_PACKAGE)
        # 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 $(DESTDIR)/usr/share/${DOC_PACKAGE}
+       install -dm755 $(DESTDIR)/usr/share/doc/${DOC_PACKAGE}
+       install -m 0644 index.html ${INDEX_INCLUDES} $(DESTDIR)/usr/share/${DOC_PACKAGE}
+       install -m 0644 ${WIKI_IMPORTS} $(DESTDIR)/usr/share/${DOC_PACKAGE}
+       # install images
+       make -C images install
+       # install screenshot images
+       install -dm755 $(DESTDIR)/usr/share/${DOC_PACKAGE}/images/screenshot
+       install -m 0644 images/screenshot/*.png $(DESTDIR)/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}
-       lintian ${DOC_DEB}
-       lintian ${MEDIAWIKI_DEB}
+       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/
 
 .PHONY: upload
 upload: ${GEN_DEB} ${DOC_DEB} ${MEDIAWIKI_DEB}
-       tar cf - ${GEN_DEB} ${DOC_DEB} ${MEDIAWIKI_DEB} | ssh repoman@repo.proxmox.com upload
+       tar cf - ${GEN_DEB} ${DOC_DEB} ${MEDIAWIKI_DEB} | ssh -X repoman@repo.proxmox.com -- upload --product pve --dist stretch
 
 .PHONY: update
-update: clean
-       find . -regex '.*-\(opts\|synopsis\)\.adoc' -not -name pmxcfs.8-synopsis.adoc -exec rm -f \{\} \;
+update:
+       make clean clean-static
+       make update-static
+       make all
+
+.PHONY: update-static
+update-static:
+       make clean-static
+       make $(filter %-synopsis.adoc %-opts.adoc, ${PVE_ADMIN_GUIDE_ADOCDEPENDS}) pve-firewall-macros.adoc api-viewer/apidata.js
+
+.PHONY: clean-static
+clean-static:
+       find . -regex '.*-\(opts\|synopsis\)\.adoc' -not -name pmxcfs.8-synopsis.adoc -not -name qmeventd.8-synopsis.adoc -exec rm -f \{\} \;
        rm -f api-viewer/apidata.js
        rm -f pve-firewall-macros.adoc pct-network-opts.adoc pct-mountpoint-opts.adoc
-       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 {} ';'
+clean:
+       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-*