Skip to content

makefiles/riotboot.mk: enforce rule precedence (first signed.bin over .bin) for gnu make#10

Merged
cladmi merged 1 commit intokYc0o:wip/rebase/ota_work_branchfrom
fedepell:ota_contrib_4
Sep 24, 2018
Merged

makefiles/riotboot.mk: enforce rule precedence (first signed.bin over .bin) for gnu make#10
cladmi merged 1 commit intokYc0o:wip/rebase/ota_work_branchfrom
fedepell:ota_contrib_4

Conversation

@fedepell
Copy link
Copy Markdown

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 :)

@cladmi
Copy link
Copy Markdown
Collaborator

cladmi commented Sep 20, 2018

@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 riotboot.mk should be included before defining the %.bin rule ?

Because that would be a good reason for me to finally move these "default" rules definition at the end of the main Makefile.include.

@fedepell
Copy link
Copy Markdown
Author

@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:
https://stackoverflow.com/questions/28842851/force-make-to-use-a-more-specific-rule

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).

@cladmi
Copy link
Copy Markdown
Collaborator

cladmi commented Sep 24, 2018

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.

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.
@fedepell
Copy link
Copy Markdown
Author

@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!

@cladmi
Copy link
Copy Markdown
Collaborator

cladmi commented Sep 24, 2018

Thanks for testing and fixing this!

@cladmi cladmi merged commit 314a05f into kYc0o:wip/rebase/ota_work_branch Sep 24, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants