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

make: allow feature based blacklisting (FEATURES_BLACKLIST)

This commit is contained in:
Kaspar Schleiser 2018-05-04 15:43:41 +02:00
parent 9946e24bc9
commit cc80961b5f
4 changed files with 15 additions and 2 deletions

View File

@ -22,9 +22,11 @@ endif
# Resolve FEATURES_ variables
# Their value will only be complete after resolving dependencies
# Features that are required by the application but not provided by the BSP
# Features that are required by the application but not provided by the BSP and
# features that are used but blacklisted (prepended with "!").
# Having features missing may case the build to fail.
FEATURES_MISSING = $(sort $(filter-out $(FEATURES_PROVIDED),$(FEATURES_REQUIRED)))
FEATURES_MISSING = $(sort $(filter-out $(FEATURES_PROVIDED),$(FEATURES_REQUIRED)) \
$(call _features_used_blacklisted))
# Features that are only optional and not required at the same time.
# The policy is to by default use by features if they are provided by the BSP.
@ -47,3 +49,7 @@ _features_conflicting = $(if $(call _features_used_conflicting,$(subst :, ,$1)),
# $1: list of features that conflict together
# Return non empty on error
_features_used_conflicting = $(filter $(words $1),$(words $(filter $(FEATURES_USED),$1)))
# Return features that are used but blacklisted as
# "!<feature>" ("not feature")
_features_used_blacklisted = $(addprefix !,$(sort $(filter $(FEATURES_USED), $(FEATURES_BLACKLIST))))

View File

@ -732,6 +732,9 @@ ifneq (, $(filter all flash, $(if $(MAKECMDGOALS), $(MAKECMDGOALS), all)))
EXPECT_ERRORS := 1
endif
# turn provided but blacklisted features into required "!<feature>"
FEATURES_REQUIRED += $(addprefix !,$(sort $(filter $(FEATURES_PROVIDED), $(FEATURES_BLACKLIST))))
# Test if all feature requirements were met by the selected board.
ifneq (,$(FEATURES_MISSING))
$(shell $(COLOR_ECHO) "$(COLOR_RED)There are unsatisfied feature requirements:$(COLOR_RESET)"\

View File

@ -9,6 +9,7 @@ FEATURES_CONFLICT_GLOBAL := $(FEATURES_CONFLICT)
FEATURES_CONFLICT_MSG_GLOBAL := $(FEATURES_MSG_CONFLICT)
DISABLE_MODULE_GLOBAL := $(DISABLE_MODULE)
DEFAULT_MODULE_GLOBAL := $(DEFAULT_MODULE)
FEATURES_BLACKLIST_GLOBAL := $(FEATURES_BLACKLIST)
define board_missing_features
BOARD := $(1)
@ -20,6 +21,7 @@ define board_missing_features
FEATURES_OPTIONAL := $(FEATURES_OPTIONAL_GLOBAL)
FEATURES_CONFLICT := $(FEATURES_CONFLICT_GLOBAL)
FEATURES_CONFLICT_MSG := $(FEATURES_CONFLICT_MSG_GLOBAL)
FEATURES_BLACKLIST:= $(FEATURES_BLACKLIST_GLOBAL)
# Remove board specific variables set by Makefile.features/Makefile.dep
FEATURES_PROVIDED :=

View File

@ -60,6 +60,8 @@ info-build:
@echo ' $(or $(sort $(FEATURES_PROVIDED)), -none-)'
@echo 'FEATURES_MISSING (only non optional features):'
@echo ' $(or $(FEATURES_MISSING), -none-)'
@echo 'FEATURES_BLACKLIST (blacklisted features):'
@echo ' $(or $(sort $(FEATURES_BLACKLIST)), -none-)'
@echo ''
@echo 'FEATURES_CONFLICT: $(FEATURES_CONFLICT)'
@echo 'FEATURES_CONFLICT_MSG: $(FEATURES_CONFLICT_MSG)'