-VERSION:=$(shell git describe --tags --abbrev=0)
-GIT_VERSION:="$(shell git describe --tags --always) ($(shell git log --pretty=format:%cd --date=short -n1))"
-CPPFLAGS += -DVERSION=\"${GIT_VERSION}\"
+ifeq ($(wildcard .git),)
+ # not in git repository
+ VERSION := $(shell [ -f $(TOPDIR)/I3LOCK_VERSION ] && cat $(TOPDIR)/I3LOCK_VERSION | cut -d '-' -f 1)
+ I3LOCK_VERSION := '$(shell [ -f $(TOPDIR)/I3LOCK_VERSION ] && cat $(TOPDIR)/I3LOCK_VERSION)'
+else
+ VERSION:=$(shell git describe --tags --abbrev=0)
+ I3LOCK_VERSION:="$(shell git describe --tags --always) ($(shell git log --pretty=format:%cd --date=short -n1))"
+endif
+CPPFLAGS += -DVERSION=\"${I3LOCK_VERSION}\"