buildsystem: Fix boards/Makefile.features
Inclusion
#21334
Merged
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.features
I 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.dep
is 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.features
after the dependency resolution, this won't work because the feature check already failed at that point. I added a$(warning $(USEMODULE))
to theboards/Makefile.features
and as you can see, theboards_common_adafruit-nrf52-bootloader
USEMODULE is not set yet.That obviously makes a
ifdef
that 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.features
during 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-bootloader
is 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.features
yet, 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/shell
and thefeather-nrf52840
board.You can test it with every board that uses the
adafruit-nrf52-bootloader
and you don't even have to have the actual board for testing this change.Issues/PRs references
Fixes a bug introduced by #21327.