How can I make a pattern rule dependency optional in a Makefile?

后端 未结 1 1437
孤独总比滥情好
孤独总比滥情好 2021-01-17 22:46

I would like make to reference the timestamp of a dependency if and only if the file already exists. I have a pattern rule like this:

%.pdf: %.sil
          


        
相关标签:
1条回答
  • 2021-01-17 23:32

    With a sufficiently new version of GNU make you can use:

    .SECONDEXPANSION:
    %.pdf: %.sil $$(wildcard $$*.lua)
            sile $< -o $@
    

    See the manual section for SECONDEXPANSION targets and the wildcard function.

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