other: update version setting using git

This commit is contained in:
2025-12-08 17:03:50 +02:00
parent fa17840ad5
commit 88f41adea4
+1 -13
View File
@@ -7,19 +7,7 @@ LOCALSTATEDIR ?= $(PREFIX)/var
RUNSTATEDIR ?= $(LOCALSTATEDIR)/run
GO ?= $(shell type -a -P go | head -n 1)
# Set version variable
ifeq ($(VERSION),)
COMMIT := $(shell git rev-parse --short HEAD)
TAG_COMMIT := $(shell git rev-list --abbrev-commit --tags --max-count=1)
TAG := $(shell git describe --abbrev=0 --tags ${TAG_COMMIT} 2>/dev/null || true)
VERSION := $(COMMIT)
ifeq ($(COMMIT), $(TAG_COMMIT))
VERSION := $(TAG)
endif
ifneq ($(shell git status --porcelain),)
VERSION := $(VERSION)-dirty
endif
endif
VERSION ?= $(shell git describe --tags --dirty)
build:
mkdir -p build