when multiple pattern rules match a target

后端 未结 1 685
梦如初夏
梦如初夏 2020-12-07 00:42

The GNU make manual says

It is possible that more than one pattern rule will meet these criteria. In that case, make will choose the rule with the sho

相关标签:
1条回答
  • 2020-12-07 01:28

    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.
    
    0 讨论(0)
提交回复
热议问题