buildsystem: Fix boards/Makefile.features Inclusion#21334
Merged
crasbe merged 1 commit intoRIOT-OS:masterfrom Mar 31, 2025
Merged
buildsystem: Fix boards/Makefile.features Inclusion#21334crasbe merged 1 commit intoRIOT-OS:masterfrom
boards/Makefile.features Inclusion#21334crasbe merged 1 commit intoRIOT-OS:masterfrom
Conversation
mguetschow
approved these changes
Mar 29, 2025
Contributor
mguetschow
left a comment
There was a problem hiding this comment.
Hum, not great, but I don't have a better idea either. Thanks for fixing!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Contribution description
During the development of #21332 I noticed that the
boards/Makefile.featuresI introduced in #21327 does not work and unfortunately it is unlikely to ever work, because it suffers from the classic hen-and-egg problem.The
$(RIOTBASE)/Makefile.features(which includes $(RIOTBASE)/boards/Makefile.features) is included before the$(RIOTBASE)/Makefile.depis included in the dependency check and before the dependencies are resolved, the Make system will check that there are not feature conflicts or errors.RIOT/Makefile.include
Lines 407 to 408 in e85269a
RIOT/Makefile.include
Lines 428 to 429 in e85269a
RIOT/Makefile.include
Lines 437 to 438 in e85269a
While it would be tempting to move the include of
$(RIOTBASE)/boards/Makefile.featuresafter the dependency resolution, this won't work because the feature check already failed at that point. I added a$(warning $(USEMODULE))to theboards/Makefile.featuresand as you can see, theboards_common_adafruit-nrf52-bootloaderUSEMODULE is not set yet.That obviously makes a
ifdefthat depends on the USEMODULES kind of pointless.The other tempting solution would be to move the dependency resolution before the feature check, however the dependency resolution depends on the features being set.
Therefore the not-super-elegant solution is to include the
boards/Makefile.featuresduring the dependency resolution.Since the dependency resolution runs in a loop until all features are stable, this works as expected and the
boards_common_adafruit-nrf52-bootloaderis part of the USEMODULES after the second run of the dependency resolution:Testing procedure
Testing this is a bit abstract as no board uses the global
boards/Makefile.featuresyet, but I added this line to theboards/Makefile.features, which prints the$(USEMODULE)variable.You can test it with every application you like, I used the
tests/sys/shelland thefeather-nrf52840board.You can test it with every board that uses the
adafruit-nrf52-bootloaderand you don't even have to have the actual board for testing this change.Issues/PRs references
Fixes a bug introduced by #21327.