make : rule call rule

后端 未结 5 795
一生所求
一生所求 2020-12-23 16:10

In a makefile, can I call a rule from another rule?

Similar to:

rule1:
        echo \"bye\"
rule2:
        date
rule3:
        @echo \"hello\"
               


        
5条回答
  •  青春惊慌失措
    2020-12-23 16:27

    There are two advanced functions in GNU Make which can do this, although it should only be used in extenuating circumstances. This SO is top rated in google.

    Rule prerequisites are more recommended, but sometimes you need a post-requisite.

    GNU Make Call function

    GNU Make Eval function

    Essentially, Eval lets you build targets on the fly, and Call allows function like "defines" to be created.

提交回复
热议问题