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

88 lines
4.6 KiB
Makefile
Raw Normal View History

build system: Restructure dependency resolution Goals: - Untangle dependency resolution and feature checking for better maintainability - Improve performance of "make info-boards-supported" Changes: - Makefile.dep - Dropped handling of default modules and recursion - Now only dependencies of the current set of used modules and pkgs are added ==> External recursion is needed to catch transient dependencies - Changed Makefile.features: - Dropped checking of provided features - Dropped populating FEATURES_USED with provided features that are required or optional - Dropped populating FEATURES_MISSING with required but not provided features - Dropped adding modules implementing used features to USE_MODULE ==> This now only populates FEATURES_PROVIDED, nothing more - Added makefiles/features_check.inc.mk: - This performs the population of FEATURES_USED and FEATURES_MISSING now - Added makefiles/features_modules.inc.mk: - This performs now the addition of modules implementing used features - Added makefiles/dependency_resolution.inc.mk: - This now performs the recursion required to catch transient dependencies - Also the feature check is performed recursively to handle also required and optional features of the transient dependencies - DEFAULT_MODULES are added repeatedly to allow it to be extended based on used features and modules ==> This allows modules to have optional dependencies, as these dependencies can be blacklisted - Use simply expanded variables instead of recursively expended variables (`foo := $(bar)` instead `foo = $(bar)`) for internal variables during feature resolution. This improves performance significantly for `make info-boards-supported`. - Reduce dependency resolution steps in `make info-boards-supported` - Globally resolve dependencies without any features (including arch) provided ==> This results in the common subset of feature requirements and modules used - But for individual boards additional modules might be used on top due to architecture specific dependencies or optional features - Boards not supporting this subset of commonly required features are not supported, so no additional dependency resolution is needed for them - For each board supporting the common set of requirements a complete dependency resolution is still needed to also catch architecture specific hacks - But this resolution is seeded with the common set of dependencies to speed this up
2020-03-19 14:06:47 +01:00
# Check if all required FEATURES are provided
# Features that are used without taking "one out of" dependencies into account
FEATURES_USED_SO_FAR := $(sort $(FEATURES_REQUIRED) $(FEATURES_OPTIONAL_USED))
# Get features which inclusion would cause a conflict
# Parameter 1: Features currently used
# Parameter 2: A set of features that would conflict (separated by spaces)
# Algorithm: If interaction of the two lists is empty, return an empty set. Otherwise return
# the set of conflicting features without the feature in it that is already used
_features_would_conflict = $(if $(filter $1,$2),$(filter-out $1,$2))
# Adding any of the following features would result in a feature conflict with the already used
# features:
FEATURES_WOULD_CONFLICT := $(foreach conflict,$(FEATURES_CONFLICT),\
$(call _features_would_conflict,\
$(FEATURES_USED_SO_FAR),$(subst :, ,$(conflict))))
# Features that are provided, not blacklisted, and do not conflict with any used feature
FEATURES_USABLE := $(filter-out $(FEATURES_BLACKLIST) $(FEATURES_WOULD_CONFLICT),\
$(FEATURES_PROVIDED))
# Features that may be used, if provided.
build system: Restructure dependency resolution Goals: - Untangle dependency resolution and feature checking for better maintainability - Improve performance of "make info-boards-supported" Changes: - Makefile.dep - Dropped handling of default modules and recursion - Now only dependencies of the current set of used modules and pkgs are added ==> External recursion is needed to catch transient dependencies - Changed Makefile.features: - Dropped checking of provided features - Dropped populating FEATURES_USED with provided features that are required or optional - Dropped populating FEATURES_MISSING with required but not provided features - Dropped adding modules implementing used features to USE_MODULE ==> This now only populates FEATURES_PROVIDED, nothing more - Added makefiles/features_check.inc.mk: - This performs the population of FEATURES_USED and FEATURES_MISSING now - Added makefiles/features_modules.inc.mk: - This performs now the addition of modules implementing used features - Added makefiles/dependency_resolution.inc.mk: - This now performs the recursion required to catch transient dependencies - Also the feature check is performed recursively to handle also required and optional features of the transient dependencies - DEFAULT_MODULES are added repeatedly to allow it to be extended based on used features and modules ==> This allows modules to have optional dependencies, as these dependencies can be blacklisted - Use simply expanded variables instead of recursively expended variables (`foo := $(bar)` instead `foo = $(bar)`) for internal variables during feature resolution. This improves performance significantly for `make info-boards-supported`. - Reduce dependency resolution steps in `make info-boards-supported` - Globally resolve dependencies without any features (including arch) provided ==> This results in the common subset of feature requirements and modules used - But for individual boards additional modules might be used on top due to architecture specific dependencies or optional features - Boards not supporting this subset of commonly required features are not supported, so no additional dependency resolution is needed for them - For each board supporting the common set of requirements a complete dependency resolution is still needed to also catch architecture specific hacks - But this resolution is seeded with the common set of dependencies to speed this up
2020-03-19 14:06:47 +01:00
FEATURES_OPTIONAL_ONLY := $(sort $(filter-out $(FEATURES_REQUIRED),$(FEATURES_OPTIONAL)))
# Optional features that end up being used
FEATURES_OPTIONAL_USED := $(sort $(filter $(FEATURES_USABLE),$(FEATURES_OPTIONAL_ONLY)))
# Optional features that will not be used because they are not provided or blacklisted
FEATURES_OPTIONAL_MISSING := $(sort $(filter-out $(FEATURES_USABLE),$(FEATURES_OPTIONAL_ONLY)))
build system: Restructure dependency resolution Goals: - Untangle dependency resolution and feature checking for better maintainability - Improve performance of "make info-boards-supported" Changes: - Makefile.dep - Dropped handling of default modules and recursion - Now only dependencies of the current set of used modules and pkgs are added ==> External recursion is needed to catch transient dependencies - Changed Makefile.features: - Dropped checking of provided features - Dropped populating FEATURES_USED with provided features that are required or optional - Dropped populating FEATURES_MISSING with required but not provided features - Dropped adding modules implementing used features to USE_MODULE ==> This now only populates FEATURES_PROVIDED, nothing more - Added makefiles/features_check.inc.mk: - This performs the population of FEATURES_USED and FEATURES_MISSING now - Added makefiles/features_modules.inc.mk: - This performs now the addition of modules implementing used features - Added makefiles/dependency_resolution.inc.mk: - This now performs the recursion required to catch transient dependencies - Also the feature check is performed recursively to handle also required and optional features of the transient dependencies - DEFAULT_MODULES are added repeatedly to allow it to be extended based on used features and modules ==> This allows modules to have optional dependencies, as these dependencies can be blacklisted - Use simply expanded variables instead of recursively expended variables (`foo := $(bar)` instead `foo = $(bar)`) for internal variables during feature resolution. This improves performance significantly for `make info-boards-supported`. - Reduce dependency resolution steps in `make info-boards-supported` - Globally resolve dependencies without any features (including arch) provided ==> This results in the common subset of feature requirements and modules used - But for individual boards additional modules might be used on top due to architecture specific dependencies or optional features - Boards not supporting this subset of commonly required features are not supported, so no additional dependency resolution is needed for them - For each board supporting the common set of requirements a complete dependency resolution is still needed to also catch architecture specific hacks - But this resolution is seeded with the common set of dependencies to speed this up
2020-03-19 14:06:47 +01:00
# Update to account for change in FEATURES_OPTIONAL_USED
build system: Restructure dependency resolution Goals: - Untangle dependency resolution and feature checking for better maintainability - Improve performance of "make info-boards-supported" Changes: - Makefile.dep - Dropped handling of default modules and recursion - Now only dependencies of the current set of used modules and pkgs are added ==> External recursion is needed to catch transient dependencies - Changed Makefile.features: - Dropped checking of provided features - Dropped populating FEATURES_USED with provided features that are required or optional - Dropped populating FEATURES_MISSING with required but not provided features - Dropped adding modules implementing used features to USE_MODULE ==> This now only populates FEATURES_PROVIDED, nothing more - Added makefiles/features_check.inc.mk: - This performs the population of FEATURES_USED and FEATURES_MISSING now - Added makefiles/features_modules.inc.mk: - This performs now the addition of modules implementing used features - Added makefiles/dependency_resolution.inc.mk: - This now performs the recursion required to catch transient dependencies - Also the feature check is performed recursively to handle also required and optional features of the transient dependencies - DEFAULT_MODULES are added repeatedly to allow it to be extended based on used features and modules ==> This allows modules to have optional dependencies, as these dependencies can be blacklisted - Use simply expanded variables instead of recursively expended variables (`foo := $(bar)` instead `foo = $(bar)`) for internal variables during feature resolution. This improves performance significantly for `make info-boards-supported`. - Reduce dependency resolution steps in `make info-boards-supported` - Globally resolve dependencies without any features (including arch) provided ==> This results in the common subset of feature requirements and modules used - But for individual boards additional modules might be used on top due to architecture specific dependencies or optional features - Boards not supporting this subset of commonly required features are not supported, so no additional dependency resolution is needed for them - For each board supporting the common set of requirements a complete dependency resolution is still needed to also catch architecture specific hacks - But this resolution is seeded with the common set of dependencies to speed this up
2020-03-19 14:06:47 +01:00
FEATURES_USED_SO_FAR := $(sort $(FEATURES_REQUIRED) $(FEATURES_OPTIONAL_USED))
# Additionally required features due to the "one out of" dependencies
# Algorithm:
# - For each list in FEATURES_REQUIRED_ANY as "item":
# - Store the intersection of FEATURES_USED_SO_FAR and the features in
# "item" in "tmp"
# - Append the intersection of FEATURES_USABLE and the features in "item"
# to "tmp"
# - Append "item" to "tmp" (with pipes between features, e.g.
# "periph_spi|periph_i2c")
# - Append the first element of "tmp" to FEATURES_REQUIRED_ONE_OUT_OF
# ==> If one (or more) already used features is listed in item, this (or
# one of these) will be in the front of "tmp" and be taken
# ==> If one (or more) usable features is listed in item, this will come
# afterwards. If no feature in item is used so far, one of the
build system: Restructure dependency resolution Goals: - Untangle dependency resolution and feature checking for better maintainability - Improve performance of "make info-boards-supported" Changes: - Makefile.dep - Dropped handling of default modules and recursion - Now only dependencies of the current set of used modules and pkgs are added ==> External recursion is needed to catch transient dependencies - Changed Makefile.features: - Dropped checking of provided features - Dropped populating FEATURES_USED with provided features that are required or optional - Dropped populating FEATURES_MISSING with required but not provided features - Dropped adding modules implementing used features to USE_MODULE ==> This now only populates FEATURES_PROVIDED, nothing more - Added makefiles/features_check.inc.mk: - This performs the population of FEATURES_USED and FEATURES_MISSING now - Added makefiles/features_modules.inc.mk: - This performs now the addition of modules implementing used features - Added makefiles/dependency_resolution.inc.mk: - This now performs the recursion required to catch transient dependencies - Also the feature check is performed recursively to handle also required and optional features of the transient dependencies - DEFAULT_MODULES are added repeatedly to allow it to be extended based on used features and modules ==> This allows modules to have optional dependencies, as these dependencies can be blacklisted - Use simply expanded variables instead of recursively expended variables (`foo := $(bar)` instead `foo = $(bar)`) for internal variables during feature resolution. This improves performance significantly for `make info-boards-supported`. - Reduce dependency resolution steps in `make info-boards-supported` - Globally resolve dependencies without any features (including arch) provided ==> This results in the common subset of feature requirements and modules used - But for individual boards additional modules might be used on top due to architecture specific dependencies or optional features - Boards not supporting this subset of commonly required features are not supported, so no additional dependency resolution is needed for them - For each board supporting the common set of requirements a complete dependency resolution is still needed to also catch architecture specific hacks - But this resolution is seeded with the common set of dependencies to speed this up
2020-03-19 14:06:47 +01:00
# features supported and listed in item will be picked
# ==> At the end of the list, feature alternatives in item itself are added.
# If no feature in item is already used or usable, the first alternative is
# just added, triggering a warning about a feature being missing or
# conflicting later on.
build system: Restructure dependency resolution Goals: - Untangle dependency resolution and feature checking for better maintainability - Improve performance of "make info-boards-supported" Changes: - Makefile.dep - Dropped handling of default modules and recursion - Now only dependencies of the current set of used modules and pkgs are added ==> External recursion is needed to catch transient dependencies - Changed Makefile.features: - Dropped checking of provided features - Dropped populating FEATURES_USED with provided features that are required or optional - Dropped populating FEATURES_MISSING with required but not provided features - Dropped adding modules implementing used features to USE_MODULE ==> This now only populates FEATURES_PROVIDED, nothing more - Added makefiles/features_check.inc.mk: - This performs the population of FEATURES_USED and FEATURES_MISSING now - Added makefiles/features_modules.inc.mk: - This performs now the addition of modules implementing used features - Added makefiles/dependency_resolution.inc.mk: - This now performs the recursion required to catch transient dependencies - Also the feature check is performed recursively to handle also required and optional features of the transient dependencies - DEFAULT_MODULES are added repeatedly to allow it to be extended based on used features and modules ==> This allows modules to have optional dependencies, as these dependencies can be blacklisted - Use simply expanded variables instead of recursively expended variables (`foo := $(bar)` instead `foo = $(bar)`) for internal variables during feature resolution. This improves performance significantly for `make info-boards-supported`. - Reduce dependency resolution steps in `make info-boards-supported` - Globally resolve dependencies without any features (including arch) provided ==> This results in the common subset of feature requirements and modules used - But for individual boards additional modules might be used on top due to architecture specific dependencies or optional features - Boards not supporting this subset of commonly required features are not supported, so no additional dependency resolution is needed for them - For each board supporting the common set of requirements a complete dependency resolution is still needed to also catch architecture specific hacks - But this resolution is seeded with the common set of dependencies to speed this up
2020-03-19 14:06:47 +01:00
FEATURES_REQUIRED_ONE_OUT_OF := $(foreach item,\
$(FEATURES_REQUIRED_ANY),\
$(word 1,\
$(filter $(FEATURES_USED_SO_FAR),$(subst |, ,$(item)))\
$(filter $(FEATURES_USABLE),$(subst |, ,$(item)))\
$(subst |, ,$(item))))
build system: Restructure dependency resolution Goals: - Untangle dependency resolution and feature checking for better maintainability - Improve performance of "make info-boards-supported" Changes: - Makefile.dep - Dropped handling of default modules and recursion - Now only dependencies of the current set of used modules and pkgs are added ==> External recursion is needed to catch transient dependencies - Changed Makefile.features: - Dropped checking of provided features - Dropped populating FEATURES_USED with provided features that are required or optional - Dropped populating FEATURES_MISSING with required but not provided features - Dropped adding modules implementing used features to USE_MODULE ==> This now only populates FEATURES_PROVIDED, nothing more - Added makefiles/features_check.inc.mk: - This performs the population of FEATURES_USED and FEATURES_MISSING now - Added makefiles/features_modules.inc.mk: - This performs now the addition of modules implementing used features - Added makefiles/dependency_resolution.inc.mk: - This now performs the recursion required to catch transient dependencies - Also the feature check is performed recursively to handle also required and optional features of the transient dependencies - DEFAULT_MODULES are added repeatedly to allow it to be extended based on used features and modules ==> This allows modules to have optional dependencies, as these dependencies can be blacklisted - Use simply expanded variables instead of recursively expended variables (`foo := $(bar)` instead `foo = $(bar)`) for internal variables during feature resolution. This improves performance significantly for `make info-boards-supported`. - Reduce dependency resolution steps in `make info-boards-supported` - Globally resolve dependencies without any features (including arch) provided ==> This results in the common subset of feature requirements and modules used - But for individual boards additional modules might be used on top due to architecture specific dependencies or optional features - Boards not supporting this subset of commonly required features are not supported, so no additional dependency resolution is needed for them - For each board supporting the common set of requirements a complete dependency resolution is still needed to also catch architecture specific hacks - But this resolution is seeded with the common set of dependencies to speed this up
2020-03-19 14:06:47 +01:00
# 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_REQUIRED_ONE_OUT_OF)))
build system: Restructure dependency resolution Goals: - Untangle dependency resolution and feature checking for better maintainability - Improve performance of "make info-boards-supported" Changes: - Makefile.dep - Dropped handling of default modules and recursion - Now only dependencies of the current set of used modules and pkgs are added ==> External recursion is needed to catch transient dependencies - Changed Makefile.features: - Dropped checking of provided features - Dropped populating FEATURES_USED with provided features that are required or optional - Dropped populating FEATURES_MISSING with required but not provided features - Dropped adding modules implementing used features to USE_MODULE ==> This now only populates FEATURES_PROVIDED, nothing more - Added makefiles/features_check.inc.mk: - This performs the population of FEATURES_USED and FEATURES_MISSING now - Added makefiles/features_modules.inc.mk: - This performs now the addition of modules implementing used features - Added makefiles/dependency_resolution.inc.mk: - This now performs the recursion required to catch transient dependencies - Also the feature check is performed recursively to handle also required and optional features of the transient dependencies - DEFAULT_MODULES are added repeatedly to allow it to be extended based on used features and modules ==> This allows modules to have optional dependencies, as these dependencies can be blacklisted - Use simply expanded variables instead of recursively expended variables (`foo := $(bar)` instead `foo = $(bar)`) for internal variables during feature resolution. This improves performance significantly for `make info-boards-supported`. - Reduce dependency resolution steps in `make info-boards-supported` - Globally resolve dependencies without any features (including arch) provided ==> This results in the common subset of feature requirements and modules used - But for individual boards additional modules might be used on top due to architecture specific dependencies or optional features - Boards not supporting this subset of commonly required features are not supported, so no additional dependency resolution is needed for them - For each board supporting the common set of requirements a complete dependency resolution is still needed to also catch architecture specific hacks - But this resolution is seeded with the common set of dependencies to speed this up
2020-03-19 14:06:47 +01:00
# Features that are used for an application
FEATURES_USED := $(sort $(FEATURES_REQUIRED) \
$(FEATURES_REQUIRED_ONE_OUT_OF) \
$(FEATURES_OPTIONAL_USED))
build system: Restructure dependency resolution Goals: - Untangle dependency resolution and feature checking for better maintainability - Improve performance of "make info-boards-supported" Changes: - Makefile.dep - Dropped handling of default modules and recursion - Now only dependencies of the current set of used modules and pkgs are added ==> External recursion is needed to catch transient dependencies - Changed Makefile.features: - Dropped checking of provided features - Dropped populating FEATURES_USED with provided features that are required or optional - Dropped populating FEATURES_MISSING with required but not provided features - Dropped adding modules implementing used features to USE_MODULE ==> This now only populates FEATURES_PROVIDED, nothing more - Added makefiles/features_check.inc.mk: - This performs the population of FEATURES_USED and FEATURES_MISSING now - Added makefiles/features_modules.inc.mk: - This performs now the addition of modules implementing used features - Added makefiles/dependency_resolution.inc.mk: - This now performs the recursion required to catch transient dependencies - Also the feature check is performed recursively to handle also required and optional features of the transient dependencies - DEFAULT_MODULES are added repeatedly to allow it to be extended based on used features and modules ==> This allows modules to have optional dependencies, as these dependencies can be blacklisted - Use simply expanded variables instead of recursively expended variables (`foo := $(bar)` instead `foo = $(bar)`) for internal variables during feature resolution. This improves performance significantly for `make info-boards-supported`. - Reduce dependency resolution steps in `make info-boards-supported` - Globally resolve dependencies without any features (including arch) provided ==> This results in the common subset of feature requirements and modules used - But for individual boards additional modules might be used on top due to architecture specific dependencies or optional features - Boards not supporting this subset of commonly required features are not supported, so no additional dependency resolution is needed for them - For each board supporting the common set of requirements a complete dependency resolution is still needed to also catch architecture specific hacks - But this resolution is seeded with the common set of dependencies to speed this up
2020-03-19 14:06:47 +01:00
# 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)))
# Used features that conflict when used together
FEATURES_CONFLICTING := $(sort $(foreach conflict,\
$(FEATURES_CONFLICT),\
$(call _features_conflicting,$(conflict))))
build system: Restructure dependency resolution Goals: - Untangle dependency resolution and feature checking for better maintainability - Improve performance of "make info-boards-supported" Changes: - Makefile.dep - Dropped handling of default modules and recursion - Now only dependencies of the current set of used modules and pkgs are added ==> External recursion is needed to catch transient dependencies - Changed Makefile.features: - Dropped checking of provided features - Dropped populating FEATURES_USED with provided features that are required or optional - Dropped populating FEATURES_MISSING with required but not provided features - Dropped adding modules implementing used features to USE_MODULE ==> This now only populates FEATURES_PROVIDED, nothing more - Added makefiles/features_check.inc.mk: - This performs the population of FEATURES_USED and FEATURES_MISSING now - Added makefiles/features_modules.inc.mk: - This performs now the addition of modules implementing used features - Added makefiles/dependency_resolution.inc.mk: - This now performs the recursion required to catch transient dependencies - Also the feature check is performed recursively to handle also required and optional features of the transient dependencies - DEFAULT_MODULES are added repeatedly to allow it to be extended based on used features and modules ==> This allows modules to have optional dependencies, as these dependencies can be blacklisted - Use simply expanded variables instead of recursively expended variables (`foo := $(bar)` instead `foo = $(bar)`) for internal variables during feature resolution. This improves performance significantly for `make info-boards-supported`. - Reduce dependency resolution steps in `make info-boards-supported` - Globally resolve dependencies without any features (including arch) provided ==> This results in the common subset of feature requirements and modules used - But for individual boards additional modules might be used on top due to architecture specific dependencies or optional features - Boards not supporting this subset of commonly required features are not supported, so no additional dependency resolution is needed for them - For each board supporting the common set of requirements a complete dependency resolution is still needed to also catch architecture specific hacks - But this resolution is seeded with the common set of dependencies to speed this up
2020-03-19 14:06:47 +01:00
# Features that are used by the application but blacklisted by the BSP.
# Having blacklisted features may cause the build to fail.
FEATURES_USED_BLACKLISTED := $(sort $(filter $(FEATURES_USED), $(FEATURES_BLACKLIST)))