]> git.proxmox.com Git - ifupdown2.git/blobdiff - Makefile
bump version to 3.2.0-1+pmx3
[ifupdown2.git] / Makefile
index 0955b6278db32ffa41c8a936b8ca51f55df104de..4b6aba6ae3a933735d74161f76ff6797153a8abe 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,42 +1,56 @@
+include /usr/share/dpkg/pkg-info.mk
+
 PACKAGE=ifupdown2
-VER=1.2.0
-PKGREL=1+pvetest1
 
 SRCDIR=ifupdown2
-BUILDDIR=${SRCDIR}.tmp
+BUILDDIR=$(SRCDIR)-$(DEB_VERSION)
 
 GITVERSION:=$(shell git rev-parse HEAD)
 
-DEB=${PACKAGE}_${VER}-${PKGREL}_all.deb
+ORIG_SRC_TAR=$(PACKAGE)_$(DEB_VERSION_UPSTREAM).orig.tar.gz
+DSC=$(PACKAGE)_$(DEB_VERSION).dsc
+DEB=$(PACKAGE)_$(DEB_VERSION)_all.deb
 
-all: ${DEB}
-       @echo ${DEB}
+all: $(DEB)
+       @echo $(DEB)
 
 .PHONY: submodule
 submodule:
-       test -f "${SRCDIR}/debian/changelog" || git submodule update --init
-
-.PHONY: deb
-deb: ${DEB}
-${DEB}: | submodule
-       rm -f *.deb
-       rm -rf $(BUILDDIR)
-       mkdir $(BUILDDIR)
-       cp -a $(SRCDIR)/* $(BUILDDIR)/
-       cp -R debian/* $(BUILDDIR)/debian/
-       cd ${BUILDDIR}; dpkg-buildpackage -rfakeroot -b -uc -us
+       test -f "$(SRCDIR)/debian/changelog" || git submodule update --init
+
+buildir: $(BUILDDIR)
+$(BUILDDIR): submodule
+       rm -rf $@ $@.tmp
+       cp -a $(SRCDIR)/ $@.tmp/
+       rm -rf $@.tmp/debian
+       cp -a debian $@.tmp/
+       mv $@.tmp $@
+
+.PHONY: deb dsc
+deb: $(DEB)
+$(DEB): $(BUILDDIR)
+       cd $(BUILDDIR); dpkg-buildpackage -b -uc -us
+
+$(ORIG_SRC_TAR): $(BUILDDIR)
+       tar czf $(ORIG_SRC_TAR) --exclude="$(BUILDDIR)/debian" $(BUILDDIR)
+
+dsc: $(DSC)
+$(DSC): $(BUILDDIR) $(ORIG_SRC_TAR)
+       cd $(BUILDDIR); dpkg-buildpackage -S -uc -us -d
+
+sbuild: $(DSC)
+       sbuild $(DSC)
 
 .PHONY: upload
-upload: ${DEB}
-       tar cf - ${DEB} | ssh -X repoman@repo.proxmox.com -- upload --product pve --dist stretch
+upload: UPLOAD_DIST ?= $(DEB_DISTRIBUTION)
+upload: $(DEB)
+       tar cf - $(DEB) | ssh -X repoman@repo.proxmox.com -- upload --product pve,pmg,pbs --dist $(UPLOAD_DIST)
 
-.PHONY: distclean
+.PHONY: distclean clean
 distclean: clean
-
-.PHONY: clean
 clean:
-       rm -rf ${BUILDDIR} *.deb *.changes *.dsc *.buildinfo
+       rm -rf $(PACKAGE)-*/ *.deb *.dsc *.changes *.buildinfo *.build $(PACKAGE)*.tar.*
 
 .PHONY: dinstall
 dinstall: deb
-       dpkg -i ${DEB}
+       dpkg -i $(DEB)