]> git.proxmox.com Git - libxdgmime-perl.git/blobdiff - Makefile
buildsys: use full DEB_VERSION and correct DEB_HOST_ARCH
[libxdgmime-perl.git] / Makefile
index 75ac71cc59cfe53106a44c226c59fa7d38b30331..b1e97e74ead3ecbbe66546caa09faf31c974040b 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,33 +1,61 @@
-include /usr/share/dpkg/pkg-info.mk
-include /usr/share/dpkg/architecture.mk
+include /usr/share/dpkg/default.mk
 
-PACKAHE=libxdgmime
+PACKAGE=libxdgmime-perl
 
-DEB = libxdgmime-perl_${DEB_VERSION_UPSTREAM_REVISION}_${DEB_BUILD_ARCH}.deb
+BUILDSRC=$(PACKAGE)-$(DEB_VERSION)
+DSC = $(PACKAGE)_$(DEB_VERSION).dsc
+
+DEB = $(PACKAGE)_$(DEB_VERSION)_$(DEB_HOST_ARCH).deb
 
 OPKGNAME=Xdgmime
 UPSTREAM=xdgmime-source/src
 
-${DEB}: ${OPKGNAME}/Xdgmime.xs
-       -rm -rf build
-       cp -a ${OPKGNAME} build
-       cp -a ${UPSTREAM}/xdgmime*.[ch] build/
-       perl -MDevel::PPPort -e 'Devel::PPPort::WriteFile("build/ppport.h");'
-       cp -a debian build
-       cd build; dpkg-buildpackage -b -us -uc -rfakeroot
-       lintian ${DEB}
+all: $(DEB)
+.PHONY: update-bindings
+update-bindings:
+       cp -a $(UPSTREAM)/xdgmime*.[ch] $(OPKGNAME)/
+       h2xs -P -v $(DEB_VERSION_UPSTREAM) -F -DHAVE_MMAP -M '^XDG_' -t PV -Ofan Xdgmime xdgmime.h
+       rm -f $(OPKGNAME)/xdgmime*.[ch]
+       echo "Please manually check and add the diff of the automatically generated update"
+
+.PHONY: $(BUILDSRC)
+$(BUILDSRC):
+       -rm -rf $(BUILDSRC)
+       cp -a $(OPKGNAME) $(BUILDSRC)
+       cp -a $(UPSTREAM)/xdgmime*.[ch] $(BUILDSRC)/
+       perl -MDevel::PPPort -e 'Devel::PPPort::WriteFile("$(BUILDSRC)/ppport.h");'
+       cp -a debian $(BUILDSRC)
+
+.PHONY: dsc
+dsc:
+       $(MAKE) $(DSC)
+       lintian $(DSC)
+
+$(DSC): $(BUILDSRC)
+       cd $(BUILDSRC); dpkg-buildpackage -S -us -uc -d -nc
+
+.PHONY: sbuild
+sbuild: $(DSC)
+       sbuild $(DSC)
+
+.PHONY: deb
+deb: $(DEB)
+$(DEB): $(OPKGNAME)/Xdgmime.xs $(BUILDSRC)
+       cd $(BUILDSRC); dpkg-buildpackage -b -us -uc
+       lintian $(DEB)
 
-.PHONY: upload
-upload: ${DEB}
-       tar cf - ${DEB} | ssh -X repoman@repo.proxmox.com -- upload --product pmg --dist stretch
+.phony: upload
+upload: UPLOAD_DIST ?= $(DEB_DISTRIBUTION)
+upload: $(DEB)
+       tar cf - $(DEB) | ssh -X repoman@repo.proxmox.com -- upload --product pmg --dist $(UPLOAD_DIST)
 
 
-CLEANFILES = *~ debian/*~ *.deb build libxdgmime-perl_*
+CLEANFILES = *~ debian/*~ *.deb $(BUILDSRC) libxdgmime-perl* *.buildinfo *.build *.dsc *tar.?z
 
 .PHONY: clean
 clean: 
-       rm -rf ${CLEANFILES}
+       rm -rf $(CLEANFILES)
 
 .PHONY: dinstall
-dinstall: ${DEB}
-       dpkg -i ${DEB}
+dinstall: $(DEB)
+       dpkg -i $(DEB)