diff --git a/src/Makefile b/src/Makefile index 548a4e3f1..3e443e328 100644 --- a/src/Makefile +++ b/src/Makefile @@ -210,8 +210,9 @@ install : # # Version number calculations # -ifneq ($(wildcard ../.git),) -VERSIONS := $(shell git describe --tags --always --long --abbrev=1 --match "v*") +VERSIONS := $(if $(wildcard ../.git),$(shell git describe --tags --always --long --abbrev=32 --match "v*")) + +ifneq ($(filter v%, $(VERSIONS)),) VERSION_TUPLE := $(subst ., ,$(subst -, ,$(patsubst v%,%,$(VERSIONS)))) VERSION_MAJOR := $(word 1,$(VERSION_TUPLE)) VERSION_MINOR := $(word 2,$(VERSION_TUPLE)) @@ -227,11 +228,12 @@ VERSION_MAJOR = 1 VERSION_MINOR = 0 VERSION_PATCH = 0 EXTRAVERSION = + +GITVERSION = $(VERSIONS) endif MM_VERSION = $(VERSION_MAJOR).$(VERSION_MINOR) VERSION = $(MM_VERSION).$(VERSION_PATCH)$(EXTRAVERSION) ifneq ($(GITVERSION),) -VERSION += ($(GITVERSION)) +VERSION += ($(shell echo $(GITVERSION) | cut -c1-8)) endif version : @$(ECHO) "$(VERSION)"