summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Makefile11
1 files changed, 10 insertions, 1 deletions
diff --git a/Makefile b/Makefile
index 5351774..5b44ec8 100644
--- a/Makefile
+++ b/Makefile
@@ -1,12 +1,21 @@
VERSION = 0.1
+GIT_REV := $(shell test -d .git && git describe || echo exported)
+ifneq ($(GIT_REV), exported)
+FULL_VERSION := $(GIT_REV)
+FULL_VERSION := $(patsubst v%,%,$(FULL_VERSION))
+else
+FULL_VERSION := $(VERSION)
+endif
+
+
OBJS = rc.o
LIBS = -lrc
DEBUGFLAGS = -g -Wall -Werror
CFLAGS += $(DEBUGFLAGS)
-CFLAGS += -DVERSION=\"$(VERSION)\"
+CFLAGS += -DVERSION=\"$(FULL_VERSION)\"
LDFLAGS += -L/lib