Update Makefile to get version from $APP_VERSION

If git describe fails, check $APP_VERSION, otherwise set the version
to "Unknown".
This commit is contained in:
Geoffrey D. Bennett
2023-11-15 00:00:04 +10:30
parent a9a180d5f4
commit 3595f5ccf5

View File

@@ -4,7 +4,11 @@
# Credit to Tom Tromey and Paul D. Smith:
# http://make.mad-scientist.net/papers/advanced-auto-dependency-generation/
VERSION := $(shell git describe --abbrev=4 --dirty --always --tags)
VERSION := $(shell \
git describe --abbrev=4 --dirty --always --tags 2>/dev/null || \
echo $${APP_VERSION:-Unknown} \
)
DEPDIR := .deps
DEPFLAGS = -MT $@ -MMD -MP -MF $(DEPDIR)/$*.d