#!/usr/bin/make -f

VERSION=$(shell debian/vercheck)

include /usr/share/cdbs/1/rules/debhelper.mk
include /usr/share/cdbs/1/class/autotools.mk

#DEB_MAKE_CHECK_TARGET := check

# Store build information
common-binary-post-install-arch common-binary-post-install-indep::
	dh_buildinfo

vercheck:
	debian/vercheck > /dev/null

debsrc: vercheck
	test -z "`git diff --cached`" || (echo "There are uncommitted changes in the index" >&2; /bin/false)
	test -e Makefile || ./configure
	make dist
	fakeroot debian/rules clean
	rm -rf buildpkg
	mkdir buildpkg
	mv guessnet-$(VERSION).tar.gz buildpkg/guessnet_$(VERSION).orig.tar.gz
	cd buildpkg && tar zxf guessnet_$(VERSION).orig.tar.gz
	cp -a debian buildpkg/guessnet-$(VERSION)/
	cd buildpkg/guessnet-$(VERSION) && debuild -S -us -uc -I.git -i.git
	rm -f buildpkg/*_source.*
