buildsys: use dpkg-dev makefile helpers for pkg info
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Wed, 22 May 2019 12:52:25 +0000 (14:52 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Wed, 22 May 2019 12:52:25 +0000 (14:52 +0200)
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Makefile

index 95e9b6e..8387ca6 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,31 +1,36 @@
+include /usr/share/dpkg/pkg-info.mk
+
 PACKAGE=pve-edk2-firmware
-# version and package release is controlled over d/changelog
-VER=$(shell dpkg-parsechangelog -S version)
 
 SRCDIR=edk2
-BUILDDIR=${SRCDIR}.build
+BUILDDIR ?= ${PACKAGE}-${DEB_VERSION_UPSTREAM}
 
 GITVERSION:=$(shell git rev-parse HEAD)
 
-DEB=${PACKAGE}_${VER}_all.deb
+DEB=${PACKAGE}_${DEB_VERSION_UPSTREAM_REVISION}_all.deb
+#DSC=${PACKAGE}_${DEB_VERSION_UPSTREAM_REVISION}.dsc # FIXME: TODO
 
 all: ${DEB}
        @echo ${DEB}
 
-.PHONY: deb
-deb: ${DEB}
-${DEB}: | submodule
+${BUILDDIR}: ${SRCDIR}/Readme.md
        rm -rf ${BUILDDIR}
        cp -rpa ${SRCDIR} ${BUILDDIR}
        cp -a debian ${BUILDDIR}
        echo "git clone git://git.proxmox.com/git/pve-edk2-firmware.git\\ngit checkout ${GITVERSION}" > ${BUILDDIR}/debian/SOURCE
+
+.PHONY: deb
+deb: ${DEB}
+${DEB}: ${BUILDDIR}
        cd ${BUILDDIR}; dpkg-buildpackage -b -uc -us
        lintian ${DEB}
        @echo ${DEB}
 
 .PHONY: submodule
 submodule:
-       test -f "${SRCDIR}/Readme.md" || git submodule update --init --recursive
+       git submodule update --init --recursive
+
+${SRCDIR}/Readme.md: submodule
 
 .PHONY: update_modules
 update_modules: submodule
@@ -35,10 +40,8 @@ update_modules: submodule
 upload: ${DEB}
        tar cf - ${DEB}|ssh -X repoman@repo.proxmox.com -- upload --product pve --dist stretch
 
-.PHONY: distclean
+.PHONY: distclean clean
 distclean: clean
-
-.PHONY: clean
 clean:
        rm -rf *~ debian/*~ *.deb ${BUILDDIR} *.changes *.dsc *.buildinfo