From: Sebastien Douheret Date: Fri, 20 Oct 2017 17:01:29 +0000 (+0200) Subject: Extract version from git tag. X-Git-Tag: v1.0.0-rc1~30 X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?p=src%2Fxds%2Fxds-agent.git;a=commitdiff_plain;h=4afc24d8b2894ca49035a4d5fa04ab2c91dc0ede Extract version from git tag. Signed-off-by: Sebastien Douheret --- diff --git a/Makefile b/Makefile index db4d874..51e1795 100644 --- a/Makefile +++ b/Makefile @@ -1,26 +1,16 @@ -# Makefile used to build XDS daemon Web Server - -# Application Version -VERSION := 0.2.0 +# Makefile used to build XDS Agent # Syncthing version to install SYNCTHING_VERSION = 0.14.38 SYNCTHING_INOTIFY_VERSION = 0.8.7 -# Retrieve git tag/commit to set sub-version string -ifeq ($(origin SUB_VERSION), undefined) - SUB_VERSION := $(shell git describe --exact-match --tags 2>/dev/null | sed 's/^v//') - ifneq ($(SUB_VERSION), ) - VERSION := $(firstword $(subst -, ,$(SUB_VERSION))) - SUB_VERSION := $(word 2,$(subst -, ,$(SUB_VERSION))) - endif - ifeq ($(SUB_VERSION), ) - SUB_VERSION := $(shell git rev-parse --short HEAD) - ifeq ($(SUB_VERSION), ) - SUB_VERSION := unknown-dev - endif - endif +# Retrieve git tag/commit to set version & sub-version strings +GIT_DESC := $(shell git describe --always --tags) +VERSION := $(firstword $(subst -, ,$(GIT_DESC))) +SUB_VERSION := $(subst $(VERSION)-,,$(GIT_DESC)) +ifeq ($(VERSION), ) + VERSION := unknown-dev endif # Configurable variables for installation (default /opt/AGL/...)