+
+IS_GIT=$(shell if [ -d .git ] ; then echo yes ; else echo no; fi)
+
+VERSION:=$(shell cat ${srcdir}/version)
+ifneq ($(MAKECMDGOALS),release)
+ifneq ($(MAKECMDGOALS),release-message)
+ifneq ($(MAKECMDGOALS),pre-release)
+ifeq ($(IS_GIT),yes)
+VERSION:=$(shell git describe --match '[0-9.]*')
+endif
+endif
+endif
+endif
+
+UPSTREAM_TAG=$(subst ~,_,$(VERSION))
+DEB_TAG=debian/$(UPSTREAM_TAG)-1