+# Get version either via git or from VERSION file. Allow either
+# to be overwritten by setting DIST_VERSION on the command line.
+ifneq (,$(wildcard .git))
+GITDESC = $(subst tig-,,$(shell git describe))
+WTDIRTY = $(if $(shell git diff-index HEAD 2>/dev/null),-dirty)
+VERSION = $(GITDESC)$(WTDIRTY)
+else
+VERSION = $(shell test -f VERSION && cat VERSION || echo "unknown-version")
+endif
+ifdef DIST_VERSION
+VERSION = $(DIST_VERSION)
+endif
+
+RPM_VERSION = $(subst -,.,$(VERSION))
+
+LDLIBS = -lcurses