make : rule call rule

后端 未结 5 793
一生所求
一生所求 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:34

    A simple way to do it is:

    ifeq (a, b)
        build_target:=one
    else
        build_target:=two
    endif
    
    mytarget: $(build_target)
    

提交回复
热议问题