Skip to content

Makefile: Fix compatibility with GNU Make v3.81

Patrick Steinhardt requested to merge pks-makefile-fix-3.81-compatibility into master

With GNU Make v3.82, the behaviour of pattern rules was changed. Previously, pattern rules were applied in definition order, while with that new version they're instead applied in shortest stem first order. Quoting release notes:

The pattern-specific variables and pattern rules are now applied in the
shortest stem first order instead of the definition order (variables
and rules with the same stem length are still applied in the definition
order). This produces the usually-desired behavior where more specific
patterns are preferred. To detect this feature search for 'shortest-stem'
in the .FEATURES special variable.

With the introduction of the intermediate build directory we have started to depend on the newer behaviour with shortest stem first, which is breaking builds on macOS which installs GNU Make v3.81 by default.

Fix this issue by shifting around our build rules.

Merge request reports