]> git.proxmox.com Git - pmg-docs.git/blobdiff - Makefile
rule system: explain new and mode and invert flag
[pmg-docs.git] / Makefile
index 6402ab560ed42ad61262efeb9a6ffcb713aa091a..443138e1df94b10096c69f181eeb857bc8771df7 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -3,17 +3,13 @@ include /usr/share/dpkg/pkg-info.mk
 DGDIR=.
 ASCIIDOC_PMG=./asciidoc-pmg
 
+BUILDDIR ?= $(DEB_SOURCE)-$(DEB_VERSION)
+DSC=$(DEB_SOURCE)_$(DEB_VERSION).dsc
+
 GEN_PACKAGE=pmg-doc-generator
 DOC_PACKAGE=pmg-docs
 
-# also update debian/changelog
-PKGREL=1
-
-GITVERSION:=$(shell git rev-parse HEAD)
-
-ARCH:=$(shell dpkg-architecture -qDEB_BUILD_ARCH)
-
-GEN_DEB=$(GEN_PACKAGE)_$(DEB_VERSION_UPSTREAM_REVISION)_$(ARCH).deb
+GEN_DEB=$(GEN_PACKAGE)_$(DEB_VERSION_UPSTREAM_REVISION)_all.deb
 DOC_DEB=$(DOC_PACKAGE)_$(DEB_VERSION_UPSTREAM_REVISION)_all.deb
 
 export SOURCE_DATE_EPOCH ?= $(shell dpkg-parsechangelog -STimestamp)
@@ -146,26 +142,39 @@ api-viewer/apidoc.js: $(API_VIEWER_FILES)
        cat $(API_VIEWER_FILES) >$@.tmp
        mv $@.tmp $@
 
+$(BUILDDIR):
+       rm -rf $@ $@.tmp
+       rsync -a * $@.tmp
+       echo "git clone git://git.proxmox.com/git/pmg-docs.git\\ngit checkout $(shell git rev-parse HEAD)" > $@.tmp/debian/SOURCE
+       mv $@.tmp $@
+
 .PHONY: dinstall
 dinstall: $(GEN_DEB) $(DOC_DEB)
        dpkg -i $(GEN_DEB) $(DOC_DEB)
 
-.PHONY: deb
+.PHONY: dsc deb
+dsc: $(DSC)
+$(DSC): $(BUILDDIR)
+       cd $(BUILDDIR); dpkg-buildpackage -S -us -uc -d
+       lintian $(DSC)
+
+sbuild: $(DSC)
+       sbuild $(DSC)
+
 deb: $(DOC_DEB)
+       rm -f $(GEN_DEB) $(DOC_DEB)
+       rm -rf $(BUILDDIR)
+       $(MAKE) $(DOC_DEB)
 
 $(GEN_DEB): $(DOC_DEB)
 
-$(DOC_DEB):
-       rm -f $(GEN_DEB) $(DOC_DEB)
-       rm -rf build
-       rsync -a * build/
-       echo "git clone git://git.proxmox.com/git/pmg-docs.git\\ngit checkout $(GITVERSION)" > build/debian/SOURCE
-       cd build; dpkg-buildpackage -b -us -uc
+$(DOC_DEB): $(BUILDDIR)
+       cd $(BUILDDIR); dpkg-buildpackage -b -us -uc
        lintian $(DOC_DEB) $(GEN_DEB)
 
 .PHONY: clean-build
 clean-build:
-       rm -rf build
+       rm -rf $(BUILDDIR)
 
 .PHONY: install
 install: gen-install doc-install
@@ -197,8 +206,9 @@ doc-install: index.html $(API_VIEWER_SOURCES) verify-images
        install -m 0644 $(API_VIEWER_SOURCES) $(DESTDIR)/usr/share/$(DOC_PACKAGE)/api-viewer
 
 .PHONY: upload
+upload: UPLOAD_DIST ?= $(DEB_DISTRIBUTION)
 upload: $(GEN_DEB) $(DOC_DEB)
-       tar cf - $(GEN_DEB) $(DOC_DEB) | ssh -X repoman@repo.proxmox.com -- upload --product pmg --dist bullseye
+       tar cf - $(GEN_DEB) $(DOC_DEB) | ssh -X repoman@repo.proxmox.com -- upload --product pmg --dist $(UPLOAD_DIST)
 
 .PHONY: update
 update: clean
@@ -209,8 +219,8 @@ update: clean
 clean:
        find . -name '*~' -exec rm {} ';'
        rm -rf *.html *.pdf *.epub *.tmp *.1 *.5 *.8
-       rm -f *.deb *.changes *.buildinfo
+       rm -f *.deb *dsc *.tar.* *.changes *.buildinfo *.build
        rm -f api-viewer/apidoc.js chapter-*.html *-plain.html chapter-*.html pmg-admin-guide.chunked asciidoc-pmg link-refs.json .asciidoc-pmg-tmp_* pmg-smtp-filter.8-synopsis.adoc pmgpolicy.8-synopsis.adoc pmgsh.1-synopsis.adoc
        rm -rf .pmg-doc-depends 
        rm -f pmg-doc-generator.mk chapter-index-table.adoc man1-index-table.adoc man5-index-table.adoc man8-index-table.adoc pmg-admin-guide-docinfo.xml pmg-copyright.adoc
-       rm -rf build*
+       rm -rf $(DEB_SOURCE)-[0-9]*