# Get the upstream version number from the debian changelog ;)
VERSION=$(shell dpkg-parsechangelog | grep '^Version: ' | sed 's/^Version: \(.*\)-[^-]*$$/\1/')
FULLVERSION=$(shell dpkg-parsechangelog | grep '^Version: ' | sed 's/^Version: //')

clean:
	fakeroot debian/rules clean
	-rm -rf buildpkg

deb: clean
	svn up
	[ `svn st | grep -c ""` == 0 ] # Check if directory is clean
	mkdir buildpkg
	svn export . buildpkg/smart-notifier-$(VERSION)
	cd buildpkg && tar -czf smart-notifier_$(VERSION).orig.tar.gz \
				smart-notifier-$(VERSION)
	cd buildpkg/smart-notifier-$(VERSION) && sidpdebuild
	cd buildpkg && lintian -i smart-notifier_$(FULLVERSION)_i386.changes
