commit bfa6233863be21c2f53fdd3743844b7a06449980
parent 11f0a1cfe3bfc4ffec5371f1515c614495e8ec5c
Author: mdnrz <mehdeenoroozi@gmail.com>
Date: Wed, 23 Jul 2025 10:35:14 +0330
fix version hash extraction; check for tags
Diffstat:
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/src/globals/make-version.mk b/src/globals/make-version.mk
@@ -1,11 +1,16 @@
GLOBAL_DIR = $(SRC_DIR)/globals
###############################################################################
# Versioning
+HAS_TAG := $(shell git tag -l "v[0-9]*.[0-9]*")
+ifeq ($(HAS_TAG),)
+$(info No tags found. Define a tag like 'v0.1' to get versioning in build outputs)
+else
VERSION = $(shell git describe --always --abbrev=4 --long)
VERSION_MAJOR = $(shell git describe --always --long | sed "s/^v\([0-9]\+\).*/\1/")
VERSION_MINOR = $(shell git describe --always --long | sed "s/^v[0-9]\+\.\([0-9]\+\).*/\1/")
VERSION_PATCH = $(shell git describe --always --long | sed "s/^v[0-9]\+\.[0-9]\+-\([0-9]\+\).*/\1/")
-VERSION_HASH = $(shell git describe --always --abbrev=4 --long | sed "s/^v[0-9]\+\.[0-9]\+-[0-9]\+-\([a-Z0-9]\{5\}\).*/\1/")
+VERSION_HASH = $(shell git describe --always --abbrev=4 --long | sed "s/^v[0-9]\+\.[0-9]\+-[0-9]\+-\([a-z0-9]\{5\}\).*/\1/")
+endif
VERSION_FILE = $(GLOBAL_DIR)/version.h