makefile: more fixes and improvements

This is more content from !1218 that I did not picked up initially for unclear reasons (probably got interrupted IRL).

I split the change into more changeset for clarity.

Edited by Pierre-Yves David

Merge request reports

Loading