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

make: allow tagged RIOT_VERSION

This commit is contained in:
René Kijewski 2014-10-30 22:40:41 +01:00
parent b4c3a06a8e
commit e4ae8eaa6e
2 changed files with 61 additions and 25 deletions

View File

@ -33,26 +33,6 @@ endif
OS := $(shell uname)
COLOR_GREEN :=
COLOR_RED :=
COLOR_PURPLE :=
COLOR_RESET :=
COLOR_ECHO := /bin/echo
ifeq (, ${JENKINS_URL})
ifeq (0, $(shell tput colors 2>&1 > /dev/null; echo $$?))
COLOR_GREEN := \033[1;32m
COLOR_RED := \033[1;31m
COLOR_PURPLE := \033[1;35m
COLOR_RESET := \033[0m
ifeq ($(OS),Darwin)
COLOR_ECHO := echo -e
SHELL=bash
else
COLOR_ECHO := /bin/echo -e
endif
endif
endif
buildtest:
@ \
BUILDTESTOK=true; \

View File

@ -1,5 +1,4 @@
# Provide a shallow sanity check. You cannot call `make` in a module directory.
export __RIOTBUILD_FLAG := RIOT
all:
# set undefined variables
RIOTBASE ?= $(shell dirname "$(lastword $(MAKEFILE_LIST))")
@ -12,7 +11,30 @@ RIOTBOARD ?= $(RIOTBASE)/boards
RIOTBOARD := $(abspath $(RIOTBOARD))
BINDIRBASE ?= $(CURDIR)/bin
BINDIR ?= $(abspath $(BINDIRBASE)/$(BOARD))/
BINDIRBASE := $(abspath $(BINDIRBASE))
BINDIR ?= $(BINDIRBASE)/$(BOARD)
BINDIR := $(abspath $(BINDIR))/
COLOR_GREEN :=
COLOR_RED :=
COLOR_PURPLE :=
COLOR_RESET :=
COLOR_ECHO := /bin/echo
ifeq (, ${JENKINS_URL})
ifeq (0, $(shell tput colors 2>&1 > /dev/null; echo $$?))
COLOR_GREEN := \033[1;32m
COLOR_RED := \033[1;31m
COLOR_PURPLE := \033[1;35m
COLOR_RESET := \033[0m
ifeq ($(OS),Darwin)
COLOR_ECHO := echo -e
SHELL=bash
else
COLOR_ECHO := /bin/echo -e
endif
endif
endif
ifeq ($(QUIET),1)
AD=@
@ -21,6 +43,11 @@ else
AD=
endif
ifneq (10,$(if ${RIOT_VERSION},1,0)$(if ${__RIOTBUILD_FLAG},1,0))
# Provide a shallow sanity check. You cannot call `make` in a module directory.
export __RIOTBUILD_FLAG := RIOT
BOARD := $(strip $(BOARD))
# provide common external programs for `Makefile.include`s
@ -134,7 +161,8 @@ endif
endif
..build-message:
@echo "Building application $(APPLICATION) for $(BOARD) w/ MCU $(MCU)."
@$(COLOR_ECHO) '${COLOR_GREEN}Building application "$(APPLICATION)" for "$(BOARD)" with MCU "$(MCU)".${COLOR_RESET}'
@$(COLOR_ECHO)
# add extra include paths for packages in $(USEMODULE)
export USEMODULE_INCLUDES =
@ -203,7 +231,6 @@ include $(RIOTBASE)/Makefile.vars
# Warn if the selected board and drivers don't provide all needed featues:
ifneq (, $(filter all, $(if $(MAKECMDGOALS), $(MAKECMDGOALS), all)))
EXPECT_ERRORS :=
# Test if there where dependencies against a module in DISABLE_MODULE.
@ -240,3 +267,32 @@ ifneq (, $(filter all, $(if $(MAKECMDGOALS), $(MAKECMDGOALS), all)))
$(shell $(COLOR_ECHO) "\n\n$(COLOR_RED)EXPECT ERRORS!$(COLOR_RESET)\n\n" 1>&2)
endif
endif
else # RIOT_VERSION
export __RIOTBUILD_FLAG := RIOT
NUM_RIOT_VERSION := $(shell cd $(RIOTBASE) && git rev-parse --verify --short "$(RIOT_VERSION)" 2>/dev/null)
ifeq (, ${NUM_RIOT_VERSION})
$(error The supplied RIOT_VERSION=$(RIOT_VERSION) is invalid!)
endif
all $(filter-out clean, ${MAKECMDGOALS}): ..delegate
ifneq (, $(filter clean, $(MAKECMDGOALS)))
all $(filter-out clean, ${MAKECMDGOALS}): clean
endif
clean:
-$(AD)rm -rf $(BINDIR)
$(BINDIR)riot-version/$(NUM_RIOT_VERSION)/Makefile.include:
$(AD)rm -rf $(@D)
$(AD)mkdir -p $(@D)
$(AD)cd $(RIOTBASE) && git archive --format=tar $(NUM_RIOT_VERSION) | ( cd $(@D) && tar x 1>&2 )
..delegate: $(BINDIR)riot-version/$(NUM_RIOT_VERSION)/Makefile.include
@$(COLOR_ECHO) '$(COLOR_GREEN)Using RIOT_VERSION=${NUM_RIOT_VERSION}$(COLOR_RESET)' 1>&2
@$(COLOR_ECHO)
$(MAKE) RIOTBASE=$(<D) $(filter-out clean, ${MAKECMDGOALS})
endif