You are probably using a make version lower than 3.82
.
In version 3.81
and lower, the selection criterion was different; make
would choose the first rule that matched the pattern. The documentation you are referring to is for version 3.82
. That version does choose the rule with the most specific stem, which is according to your expectations.
From the file NEWS
in the make
source tree:
Version 3.82
...
* WARNING: Backward-incompatibility!
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.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…