diff --git a/Makefile.dep b/Makefile.dep index e99cda1519..730b30b732 100644 --- a/Makefile.dep +++ b/Makefile.dep @@ -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 diff --git a/Makefile.features b/Makefile.features index b5990e80e4..20cc8d9112 100644 --- a/Makefile.features +++ b/Makefile.features @@ -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)) diff --git a/makefiles/info.inc.mk b/makefiles/info.inc.mk index 5c7ec9440a..0c71f535f7 100644 --- a/makefiles/info.inc.mk +++ b/makefiles/info.inc.mk @@ -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 $($*)