makefile pattern rules without recipes

后端 未结 1 1963
猫巷女王i
猫巷女王i 2020-12-10 15:19

I\'m observing an interesting behavior of make and I wonder if there is a reasonable explanation to it besides a bug in gmake.

Let\'s say we have the following in ma

1条回答
  •  盖世英雄少女心
    2020-12-10 15:58

    Pattern rules with no recipes at all are documented as meaning something quite different from those providing a recipe, even an empty one. Instead they cancel any pre-existing implicit rule:

    You can cancel a built-in implicit rule by defining a pattern rule with the same target and prerequisites, but no recipe.

    Thus your "%-wolf" pattern actually serves to cancel any existing implicit rule for %-wolf-animal -> %-wolf. And there wasn't one anyway.

    0 讨论(0)
提交回复
热议问题