makefiles/riotboot.mk: enforce rule precedence (first signed.bin over .bin) for gnu make#10
Conversation
|
@fedepell I agree with the changes. But before merging, do you by chance have any reference on why it could not work with your version and why this makes it work in your case ? I know what this does, I just lack the exact justification why it is required, is it because of definition order and that maybe Because that would be a good reason for me to finally move these "default" rules definition at the end of the main Makefile.include. |
|
@cladmi: yes make is a bit strange sometimes and considers various factors: definition order is one (and this rule is after, and would be also if we put it at the end of Makefile.include), but also if a rule is implicit is then preferred no matter the order. I found a quite complete and coincise overview of the topic here: Given the inclusion mechanism used in RIOT it would be safer to explicitly state things, although may seem ugly sometimes. Just for completeness my version of make is 3.81 running on a Mint 17.2 (package is version 3.81-8.2ubuntu3). |
|
It would be perfect if you can put your comment in the commit message, this way we will have enough information for later if we try removing it. Other than that ACK. |
3791134 to
887948a
Compare
make is a bit strange sometimes and considers various factors to decide the precedence of the rule to be applied: definition order is one (and the %.signed.bin is after %.bin, and would be also if we put it at the end of Makefile.include), but also if a rule is implicit is then preferred no matter the order. A quite complete and coincise overview of the topic can be found here: https://stackoverflow.com/questions/28842851/force-make-to-use-a-more-specific-rule Given the inclusion mechanism used in RIOT it should be safer to explicitly state things, although may seem ugly sometimes.
887948a to
116dc23
Compare
|
@cladmi : ok! I added the comment, slightly rewritten so it is clearer also without the other comments context, to the commit! Hope looks fine now! |
|
Thanks for testing and fixing this! |
Contribution description
Make sure the rule .signed.bin has precedence over .bin. GNU Make rule precedence is a bit tricky and version dependent. With my GNU Make 3.81 indeed the %.signed.bin rule in riotboot.mk is never called as the %.bin in Makefile.include is called and I end up always with non signed .bin that then do not work.
By explicitly making it a static rule (by prepending the files that will use it) we make sure it is called and the whole image is now correctly built.
Testing procedure
Build and flash some firmware updates :)