mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
make: evaluate the Git SHA only once
This commit is contained in:
parent
9384b2435a
commit
1d34522703
@ -21,18 +21,6 @@ endif
|
||||
OBJ = $(SRC:%.c=$(BINDIR)$(MODULE)/%.o)
|
||||
DEP = $(SRC:%.c=$(BINDIR)$(MODULE)/%.d)
|
||||
|
||||
GIT_STRING := $(shell git describe --always --abbrev=4 --dirty=-`hostname`)
|
||||
GIT_BRANCH := $(shell git rev-parse --abbrev-ref HEAD)
|
||||
ifeq ($(strip $(GIT_BRANCH)),master)
|
||||
GIT_VERSION = $(GIT_STRING)
|
||||
else
|
||||
GIT_VERSION = $(shell echo $(GIT_STRING) $(GIT_BRANCH) | sed 's/ /-/')
|
||||
endif
|
||||
ifeq ($(strip $(GIT_VERSION)),)
|
||||
GIT_VERSION := "UNKNOWN"
|
||||
endif
|
||||
export CFLAGS += -DVERSION=\"$(GIT_VERSION)\"
|
||||
|
||||
$(BINDIR)$(MODULE).a: $(OBJ) $(ASMOBJ)
|
||||
$(AD)$(AR) -rc $(BINDIR)$(MODULE).a $(OBJ) $(ASMOBJ)
|
||||
|
||||
|
@ -60,6 +60,19 @@ endif
|
||||
# Feature test default CFLAGS and LINKFLAGS for the set compiled.
|
||||
include $(RIOTBASE)/Makefile.cflags
|
||||
|
||||
# make the RIOT version available to the program
|
||||
GIT_STRING := $(shell git describe --always --abbrev=4 --dirty=-`hostname`)
|
||||
GIT_BRANCH := $(shell git rev-parse --abbrev-ref HEAD)
|
||||
ifeq ($(strip $(GIT_BRANCH)),master)
|
||||
GIT_VERSION = $(GIT_STRING)
|
||||
else
|
||||
GIT_VERSION = $(shell echo $(GIT_STRING) $(GIT_BRANCH) | sed 's/ /-/')
|
||||
endif
|
||||
ifeq ($(strip $(GIT_VERSION)),)
|
||||
GIT_VERSION := "UNKNOWN"
|
||||
endif
|
||||
export CFLAGS += -DVERSION=\"$(GIT_VERSION)\"
|
||||
|
||||
# the binaries to link
|
||||
BASELIBS += $(BINDIR)$(BOARD)_base.a
|
||||
BASELIBS += $(BINDIR)${APPLICATION}.a
|
||||
|
Loading…
Reference in New Issue
Block a user