fix CT rule generation with ipfilter set
[pve-firewall.git] / Makefile
index baf430a..c98886d 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,54 +1,51 @@
-VERSION=3.0
-PKGREL=15
+include /usr/share/dpkg/pkg-info.mk
+include /usr/share/dpkg/architecture.mk
 
 PACKAGE=pve-firewall
 
-PREFIX=/usr
-BINDIR=${PREFIX}/bin
-SBINDIR=${PREFIX}/sbin
-MANDIR=${PREFIX}/share/man
-DOCDIR=${PREFIX}/share/doc
-MAN1DIR=${MANDIR}/man1/
-PERLDIR=${PREFIX}/share/perl5
-
-ARCH:=$(shell dpkg-architecture -qDEB_BUILD_ARCH)
+BUILDDIR ?= ${PACKAGE}-${DEB_VERSION_UPSTREAM}
 GITVERSION:=$(shell git rev-parse HEAD)
 
-DEB=${PACKAGE}_${VERSION}-${PKGREL}_${ARCH}.deb
+DEB=${PACKAGE}_${DEB_VERSION_UPSTREAM_REVISION}_${DEB_BUILD_ARCH}.deb
+DSC=${PACKAGE}_${DEB_VERSION_UPSTREAM_REVISION}.dsc
+DEB2=${PACKAGE}-dbgsym_${DEB_VERSION_UPSTREAM_REVISION}_${DEB_BUILD_ARCH}.deb
+DEBS=$(DEB) $(DEB2)
 
-all: ${DEB}
+all: $(DEBS)
 
 .PHONY: dinstall
 dinstall: deb
-       dpkg -i ${DEB}
+       dpkg -i $(DEBS)
 
+${BUILDDIR}:
+       rm -rf ${BUILDDIR}
+       rsync -a  src/ debian ${BUILDDIR}
+       echo "git clone git://git.proxmox.com/git/pve-firewall.git\\ngit checkout ${GITVERSION}" > ${BUILDDIR}/debian/SOURCE
 
 .PHONY: deb
-deb: ${DEB}
-${DEB}: src test debian
-       make check
-       rm -rf build
-       rsync -a src/ build
-       rsync -a debian/ build/debian
-       echo "git clone git://git.proxmox.com/git/pve-firewall.git\\ngit checkout ${GITVERSION}" > build/debian/SOURCE
-       # install
-       cd build; dpkg-buildpackage -b -us -uc
-       lintian ${DEB}
+deb: $(DEBS)
+$(DEB2): $(DEB)
+$(DEB): ${BUILDDIR} check
+       cd ${BUILDDIR}; dpkg-buildpackage -b -us -uc
+       lintian ${DEBS}
+
+.PHONY: dsc
+dsc: ${DSC}
+${DSC}: ${BUILDDIR}
+       cd ${BUILDDIR}; dpkg-buildpackage -S -us -uc -d
+       lintian ${DSC}
 
 .PHONY: check
-check: 
+check:
        make -C test check
 
-.PHONY: clean
-clean:         
+.PHONY: clean distclean
+distclean: clean
+clean:
        make -C src clean
        make -C test clean
-       rm -rf *~ debian/*~ example/*~ *.deb *.changes *.buildinfo build ${PACKAGE}-*.tar.gz
-
-.PHONY: distclean
-distclean: clean
-
+       rm -rf *~ debian/*~ example/*~ *.deb *.changes *.buildinfo ${BUILDDIR} ${PACKAGE}*.tar.gz *.dsc
 
 .PHONY: upload
-upload: ${DEB}
-       tar cf - ${DEB} | ssh repoman@repo.proxmox.com -- upload --product pve --dist stretch --arch ${ARCH}
+upload: $(DEBS)
+       tar cf - $(DEBS) | ssh repoman@repo.proxmox.com -- upload --product pve --dist buster --arch ${DEB_BUILD_ARCH}