Makefile.features: declare FEATURES_CONFLICTING and make use of it

Define a variable for used features that conflict and use it in
`Makefie.include`.

It was not used by `info-global.inc.mk` and is still currently not.
This commit is contained in:
Gaëtan Harter 2019-05-03 17:47:42 +02:00
parent 9cccc30262
commit 6d7a70b16b
No known key found for this signature in database
GPG Key ID: 76DF6BCF1B1F883B
3 changed files with 16 additions and 3 deletions

View File

@ -19,3 +19,15 @@ FEATURES_OPTIONAL_MISSING = $(sort $(filter-out $(FEATURES_PROVIDED),$(FEATURES_
# Features that are used for an application
FEATURES_USED = $(sort $(FEATURES_REQUIRED) $(FEATURES_OPTIONAL_USED))
# Used features that conflict when used together
FEATURES_CONFLICTING = $(sort $(foreach conflict,$(FEATURES_CONFLICT),$(call _features_conflicting,$(conflict))))
# Return conflicting features from the conflict string feature1:feature2
# $1: feature1:feature2
# Return the list of conflicting features
_features_conflicting = $(if $(call _features_used_conflicting,$(subst :, ,$1)),$(subst :, ,$1))
# Check if all features from the list are used
# $1: list of features that conflict together
# Return non empty on error
_features_used_conflicting = $(filter $(words $1),$(words $(filter $(FEATURES_USED),$1)))

View File

@ -629,10 +629,9 @@ ifneq (, $(filter all flash, $(if $(MAKECMDGOALS), $(MAKECMDGOALS), all)))
endif
# Test if any used feature conflict with another one.
CONFLICT := $(foreach var,$(FEATURES_CONFLICT),$(if $(filter $(words $(subst :, ,$(var))),$(words $(filter $(FEATURES_USED),$(subst :, ,$(var))))),$(subst :, ,$(var))))
ifneq (, $(strip $(CONFLICT)))
ifneq (,$(FEATURES_CONFLICTING))
$(shell $(COLOR_ECHO) "$(COLOR_YELLOW)The following features may conflict:$(COLOR_RESET)"\
"$(COLOR_GREEN)$(sort $(filter $(FEATURES_USED), $(CONFLICT)))$(COLOR_RESET)" 1>&2)
"$(FEATURES_CONFLICTING)" 1>&2)
ifneq (, $(FEATURES_CONFLICT_MSG))
$(shell $(COLOR_ECHO) "$(COLOR_YELLOW)Rationale: $(COLOR_RESET)$(FEATURES_CONFLICT_MSG)" 1>&2)
endif

View File

@ -62,6 +62,8 @@ info-build:
@echo ''
@echo 'FEATURES_CONFLICT: $(FEATURES_CONFLICT)'
@echo 'FEATURES_CONFLICT_MSG: $(FEATURES_CONFLICT_MSG)'
@echo 'FEATURES_CONFLICTING:'
@echo ' $(or $(FEATURES_CONFLICTING), -none-)'
@echo ''
@echo -e 'INCLUDES:$(patsubst %, \n\t%, $(INCLUDES))'
@echo ''