aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorDmitrij D. Czarkoff <czarkoff@gmail.com>2016-04-25 21:10:14 +0200
committerDmitrij D. Czarkoff <czarkoff@gmail.com>2016-04-25 21:13:50 +0200
commit9ecdf4d258478d45d83e6f188fcd6bfcae1288b4 (patch)
treeccf569011fa1c5b2c06bb2b87f025b5d6d94ba52 /Makefile
parent7e6a8d4db179dd5afff43c223533edd2afe2476e (diff)
downloadimv-9ecdf4d258478d45d83e6f188fcd6bfcae1288b4.tar.gz
Include git commit hash in version number
When operating in git repo, build system will include abbreviated git hash in imv version number. If there is no git repo around (eg. building from tarball), fall back to version number in Makefile. Fixes #90
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile7
1 files changed, 5 insertions, 2 deletions
diff --git a/Makefile b/Makefile
index 88880a8..bb75ed8 100644
--- a/Makefile
+++ b/Makefile
@@ -21,9 +21,12 @@ OBJECTS := $(patsubst src/%.c,$(BUILDDIR)/%.o,$(SOURCES))
TESTS := $(patsubst test/%.c,$(BUILDDIR)/test_%,$(wildcard test/*.c))
TFLAGS ?= -g ${CFLAGS}
-VERSION = "v2.0.0"
+VERSION := $(shell git describe --abbrev=8 --dirty --always --tags 2> /dev/null)
+ifeq ($(VERSION),)
+VERSION := 2.0.0
+endif
-CFLAGS += -DIMV_VERSION=\"$(VERSION)\"
+CFLAGS += -DIMV_VERSION=\""$(VERSION)"\"
imv: $(TARGET)