Improve getting version from git describe

* To determine version, only consider tags starting with v{digit}
* Strip v prefix from version
This commit is contained in:
Vadim Mikhailov
2020-05-22 13:17:51 -07:00
parent aaf87accad
commit 8ba36bd8df

View File

@@ -14,7 +14,7 @@ RM := rm -rf
CC ?= gcc
CFLAGS ?= -g -O0
CFLAGS += -Wall -Wextra -std=c99 -pedantic
GIT_VERSION := $(shell git describe --abbrev=8 --dirty --always --tags)
GIT_VERSION := $(shell git describe --match "v[0-9]*" --abbrev=8 --dirty --always --tags | cut -c2-)
ifeq ($(GIT_VERSION),)
GIT_VERSION := $(shell cat VERSION)
endif