From 6b713a1345302d8ee65d907591471a5de044c9c2 Mon Sep 17 00:00:00 2001 From: Thom Carlin Date: Tue, 21 May 2024 15:38:01 -0400 Subject: [PATCH] Display message when no tags are in local repository (#1047) --- Makefile | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index edd0d2025..a6f8c88ab 100644 --- a/Makefile +++ b/Makefile @@ -1,10 +1,13 @@ -# If the current commit has been tagged, use that as the version. -# Otherwise include short commit hash. +# If the current git commit has been tagged, use as the version. (e.g. v1.4.5) +# Otherwise the version is +git (e.g. 1.4.5+f031d2) OFFICIAL_VERSION := $(shell if VER=`git describe --exact-match --tags 2>/dev/null`; then echo $$VER; else echo ""; fi) -ifeq ($(OFFICIAL_VERSION),) -VERSION := $(shell git describe --tags | cut -d - -f -1)+$(shell git rev-parse --short HEAD) -else -VERSION := $(OFFICIAL_VERSION) +ifneq ($(OFFICIAL_VERSION),) + VERSION := $(OFFICIAL_VERSION) +else ifneq ($(shell git tag --list),) + VERSION := $(shell git describe --tags | cut -d - -f -1)+$(shell git rev-parse --short HEAD) +else ifeq ($(VERSION),) + VERSION := $(error No tags found in git repository) +# else VERSION was passed as a command-line argument to make endif