1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

make: allow setting RIOT_VERSION externally

also make the RIOT_VERSION variable available in buildtest
This commit is contained in:
Ludwig Ortmann 2014-07-27 13:44:52 +02:00
parent 1b3f3450a7
commit e5613d308a
2 changed files with 11 additions and 8 deletions

View File

@ -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}"; \

View File

@ -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)"'