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

Makefile.features: declare FEATURES_USED and make use of it

Put the definition of `FEATURES_USED` in common and use the variable
instead of duplicating code.

This required defining 'FEATURES_OPTIONAL_ONLY|USED' to not overwrite
the value of 'FEATURES_OPTIONAL' as was done before.

Also add 'FEATURES_OPTIONAL_MISSING' to list optional features that were
not included as not provided.

This removes the need to print FEATURES_MISSING with the optional
features too.
This commit is contained in:
Gaëtan Harter 2019-05-03 16:19:20 +02:00
parent e1c60ead36
commit 9cccc30262
No known key found for this signature in database
GPG Key ID: 76DF6BCF1B1F883B
3 changed files with 21 additions and 8 deletions

View File

@ -865,10 +865,9 @@ FEATURES_OPTIONAL += periph_pm
# include package dependencies
-include $(USEPKG:%=$(RIOTPKG)/%/Makefile.dep)
# add all optional but provided features to the list of used features
FEATURES_USED := $(sort $(FEATURES_REQUIRED) $(filter $(FEATURES_OPTIONAL),$(FEATURES_PROVIDED)))
# all periph features correspond to a periph submodule
# FEATURES_USED is defined in Makefile.features
USEMODULE += $(filter periph_%,$(FEATURES_USED))
# select cpu_check_address pseudomodule if the corresponding feature is used

View File

@ -9,3 +9,13 @@ include $(RIOTBOARD)/$(BOARD)/Makefile.features
# Features that are required by the application but not provided by the BSP
# Having features missing may case the build to fail.
FEATURES_MISSING = $(sort $(filter-out $(FEATURES_PROVIDED),$(FEATURES_REQUIRED)))
# 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.
FEATURES_OPTIONAL_ONLY = $(sort $(filter-out $(FEATURES_REQUIRED),$(FEATURES_OPTIONAL)))
FEATURES_OPTIONAL_USED = $(sort $(filter $(FEATURES_PROVIDED),$(FEATURES_OPTIONAL_ONLY)))
# Optional features that will not be used because they are not provided
FEATURES_OPTIONAL_MISSING = $(sort $(filter-out $(FEATURES_PROVIDED),$(FEATURES_OPTIONAL_ONLY)))
# Features that are used for an application
FEATURES_USED = $(sort $(FEATURES_REQUIRED) $(FEATURES_OPTIONAL_USED))

View File

@ -1,6 +1,7 @@
.PHONY: info-objsize info-buildsizes info-build info-boards-supported \
info-features-missing info-modules info-cpu \
info-features-provided info-features-required \
info-features-used \
info-debug-variable-% info-toolchains-supported \
check-toolchain-supported
@ -46,16 +47,16 @@ info-build:
@echo 'HEXFILE: $(HEXFILE)'
@echo 'FLASHFILE: $(FLASHFILE)'
@echo ''
@echo 'FEATURES_USED:'
@echo ' $(or $(FEATURES_USED), -none-)'
@echo 'FEATURES_REQUIRED:'
@echo ' $(or $(sort $(FEATURES_REQUIRED)), -none-)'
@echo 'FEATURES_OPTIONAL (optional that are not required, strictly "nice to have"):'
@echo ' $(or $(sort $(filter-out $(FEATURES_REQUIRED),$(FEATURES_OPTIONAL))),-none)'
@echo 'FEATURES_OPTIONAL (unused optional features):'
@echo ' $(or $(sort $(filter-out $(FEATURES_PROVIDED),$(FEATURES_OPTIONAL))), -none-)'
@echo 'FEATURES_OPTIONAL_ONLY (optional that are not required, strictly "nice to have"):'
@echo ' $(or $(FEATURES_OPTIONAL_ONLY), -none-)'
@echo 'FEATURES_OPTIONAL_MISSING (missing optional features):'
@echo ' $(or $(FEATURES_OPTIONAL_MISSING), -none-)'
@echo 'FEATURES_PROVIDED (by the board or USEMODULE'"'"'d drivers):'
@echo ' $(or $(sort $(FEATURES_PROVIDED)), -none-)'
@echo 'FEATURES_MISSING (incl. optional features):'
@echo ' $(or $(sort $(filter-out $(FEATURES_PROVIDED), $(FEATURES_REQUIRED) $(FEATURES_OPTIONAL))), -none-)'
@echo 'FEATURES_MISSING (only non optional features):'
@echo ' $(or $(FEATURES_MISSING), -none-)'
@echo ''
@ -132,6 +133,9 @@ info-features-required:
info-features-missing:
@for i in $(FEATURES_MISSING); do echo $$i; done
info-features-used:
@for i in $(FEATURES_USED); do echo $$i; done
info-debug-variable-%:
@echo $($*)