From 9ecdf4d258478d45d83e6f188fcd6bfcae1288b4 Mon Sep 17 00:00:00 2001 From: "Dmitrij D. Czarkoff" Date: Mon, 25 Apr 2016 21:10:14 +0200 Subject: 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 --- Makefile | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'Makefile') 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) -- cgit v1.2.3