1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-28 23:49:47 +01:00
RIOT/makefiles/git_version.inc.mk
Gaëtan Harter 21649b2cb3
makefiles/git_version.inc.mk: deferred GIT_VERSION definition
Move git version evaluation to a separate file.

The definition has been updated it to a deferred only definition.
This way git is not called when GIT_VERSION is not used.
2019-07-22 12:00:45 +02:00

12 lines
538 B
Makefile

# GIT_VERSION is git description + branch name if it not master
# Empty when not in a git repository
#
# 2019.10-devel-97-g3bcc72
# 2019.10-devel-97-g3bcc72-pr/git_version
GIT_DESCRIBE = $(call memoized,GIT_DESCRIBE,$(shell git --git-dir="$(RIOTBASE)/.git" describe --always --abbrev=4 2> /dev/null))
GIT_BRANCH = $(call memoized,GIT_BRANCH,$(shell git --git-dir="$(RIOTBASE)/.git" rev-parse --abbrev-ref HEAD))
_GIT_VERSION = $(GIT_DESCRIBE)$(addprefix -,$(GIT_BRANCH:master=))
GIT_VERSION ?= $(if $(GIT_DESCRIBE),$(_GIT_VERSION))