-VERSION=1.0
+include /usr/share/dpkg/default.mk
+
PACKAGE=pve-ha-manager
SIMPACKAGE=pve-ha-simulator
-PKGREL=38
-GITVERSION:=$(shell cat .git/refs/heads/master)
+GITVERSION:=$(shell git rev-parse HEAD)
+BUILDDIR ?= $(PACKAGE)-$(DEB_VERSION)
+
+DEB=$(PACKAGE)_$(DEB_VERSION)_$(DEB_HOST_ARCH).deb
+DBG_DEB=$(PACKAGE)-dbgsym_$(DEB_VERSION)_$(DEB_HOST_ARCH).deb
-ARCH:=$(shell dpkg-architecture -qDEB_BUILD_ARCH)
+DSC=$(PACKAGE)_$(DEB_VERSION).dsc
+SIMDEB=$(SIMPACKAGE)_$(DEB_VERSION)_all.deb
+SIMDSC=$(SIMPACKAGE)_$(DEB_VERSION).dsc
-DEB=${PACKAGE}_${VERSION}-${PKGREL}_${ARCH}.deb
-SIMDEB=${SIMPACKAGE}_${VERSION}-${PKGREL}_all.deb
+all: deb
+$(BUILDDIR):
+ rm -rf $@ $@.tmp
+ cp -a src/ $@.tmp
+ cp -a debian $@.tmp/
+ echo "git clone git://git.proxmox.com/git/pve-ha-manager.git\\ngit checkout $(GITVERSION)" > $@.tmp/debian/SOURCE
+ mv $@.tmp $@
-all: ${DEB} ${SIMDEB}
+.PHONY: dinstall
+dinstall: $(DEB) $(SIMDEB)
+ dpkg -i $(DEB) $(SIMDEB)
-.PHONY: dinstall simdeb
-dinstall: deb simdeb
- dpkg -i ${DEB} ${SIMDEB}
+.PHONY: deb
+deb: $(DEB) $(SIMDEB)
+$(DEB) $(DBG_DEB): $(BUILDDIR)
+ cd $(BUILDDIR); dpkg-buildpackage -b -us -uc
+ lintian $(DEB)
+ lintian $(SIMDEB)
+.PHONY: dsc
+dsc:
+ $(MAKE) clean
+ $(MAKE) $(DSC)
+ lintian $(DSC)
-.PHONY: simdeb ${SIMDEB}
-simdeb ${SIMDEB}:
- rm -rf build
- mkdir build
- rsync -a src/ build
- rsync -a simdebian/ build/debian
- cp changelog.Debian build/debian/changelog
- echo "git clone git://git.proxmox.com/git/pve-ha-manager.git\\ngit checkout ${GITVERSION}" > build/debian/SOURCE
- cd build; dpkg-buildpackage -rfakeroot -b -us -uc
- lintian ${SIMDEB}
+$(DSC): $(BUILDDIR)
+ cd $(BUILDDIR); dpkg-buildpackage -S -us -uc -d
-.PHONY: deb ${DEB}
-deb ${DEB}:
- rm -rf build
- mkdir build
- rsync -a src/ build
- rsync -a debian/ build/debian
- cp changelog.Debian build/debian/changelog
- echo "git clone git://git.proxmox.com/git/pve-ha-manager.git\\ngit checkout ${GITVERSION}" > build/debian/SOURCE
- cd build; dpkg-buildpackage -rfakeroot -b -us -uc
- lintian ${DEB}
+sbuild: $(DSC)
+ sbuild $(DSC)
.PHONY: clean
clean:
make -C src clean
- rm -rf build *.deb ${PACKAGE}-*.tar.gz *.changes
- find . -name '*~' -exec rm {} ';'
+ rm -rf $(PACKAGE)-[0-9]*/ *.dsc *.deb $(PACKAGE)*.tar* *.changes *.build *.buildinfo
.PHONY: distclean
distclean: clean
.PHONY: upload
-upload: ${DEB} ${SIMDEB}
- tar cf - ${DEB} ${SIMDEB}|ssh repoman@repo.proxmox.com upload
-
+upload: UPLOAD_DIST ?= $(DEB_DISTRIBUTION)
+upload: $(DEB) $(SIMDEB)
+ tar cf - $(DEB) $(DBG_DEB) $(SIMDEB)|ssh repoman@repo.proxmox.com -- upload --product pve --dist $(UPLOAD_DIST) --arch $(DEB_HOST_ARCH)