From e5613d308a0461f9abbfd453ff93665e8e51eea3 Mon Sep 17 00:00:00 2001 From: Ludwig Ortmann <ludwig.ortmann@fu-berlin.de> Date: Sun, 27 Jul 2014 13:44:52 +0200 Subject: [PATCH] make: allow setting RIOT_VERSION externally also make the RIOT_VERSION variable available in buildtest --- Makefile.buildtests | 1 + Makefile.include | 18 ++++++++++-------- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/Makefile.buildtests b/Makefile.buildtests index 20dba3f5c6..bcac8c93ed 100644 --- a/Makefile.buildtests +++ b/Makefile.buildtests @@ -55,6 +55,7 @@ buildtest: RIOTCPU=$${RIOTCPU} \ BINDIRBASE=$${BINDIRBASE} \ RIOTNOLINK=$${RIOTNOLINK} \ + RIOT_VERSION=$${RIOT_VERSION} \ $(MAKE) -j$(NPROC) 2>&1 >/dev/null) ; \ if [ "$${?}" = "0" ]; then \ $${ECHO} "$${GREEN}success$${RESET}"; \ diff --git a/Makefile.include b/Makefile.include index d4f4c7aa80..ccab20d05b 100644 --- a/Makefile.include +++ b/Makefile.include @@ -64,16 +64,18 @@ endif include $(RIOTBASE)/Makefile.cflags # make the RIOT version available to the program -GIT_STRING := $(shell git describe --always --abbrev=4 --dirty=-`hostname`) -ifneq (,$(GIT_STRING)) - GIT_BRANCH := $(shell git rev-parse --abbrev-ref HEAD) - ifeq ($(strip $(GIT_BRANCH)),master) - RIOT_VERSION := $(GIT_STRING) +ifeq ($(origin RIOT_VERSION), undefined) + GIT_STRING := $(shell git describe --always --abbrev=4 --dirty=-`hostname`) + ifneq (,$(GIT_STRING)) + GIT_BRANCH := $(shell git rev-parse --abbrev-ref HEAD) + ifeq ($(strip $(GIT_BRANCH)),master) + RIOT_VERSION := $(GIT_STRING) + else + RIOT_VERSION := $(GIT_STRING)-$(GIT_BRANCH) + endif else - RIOT_VERSION := $(GIT_STRING)-$(GIT_BRANCH) + RIOT_VERSION := UNKNOWN endif -else - RIOT_VERSION := UNKNOWN endif export CFLAGS += -DRIOT_VERSION='"$(RIOT_VERSION)"' -- GitLab