Use version from VERSION file if git describe fails

This fixes issue #100.

We prefer to determine version from git tags (using git describe).
However, sometimes people don't use git or don't have it installed,
which leads to empty version used.
To solve this, we use version from VERSION file as a backup.
This commit is contained in:
Vadim Mikhailov
2019-04-28 11:38:17 -07:00
parent fc7aabb529
commit e93d1a06a2
2 changed files with 4 additions and 0 deletions

View File

@@ -15,6 +15,9 @@ CC ?= gcc
CFLAGS ?= -g -O0
CFLAGS += -Wall -Wextra -std=c99 -pedantic
GIT_VERSION := $(shell git describe --abbrev=4 --dirty --always --tags)
ifeq ($(GIT_VERSION),)
GIT_VERSION := $(shell cat VERSION)
endif
CFLAGS += -DPROGRAM_VERSION=\"$(GIT_VERSION)\"
ifeq ($(UNAME_S),Linux)

1
VERSION Normal file
View File

@@ -0,0 +1 @@
v2.0.0-dev