Why GNU Make canned recipe doesn't work?

后端 未结 1 1140
遇见更好的自我
遇见更好的自我 2020-12-31 03:57

I\'m expecting to see files foo1 and foo3 created by the makefile below. However only a file foo3 is created. To me it seems that the canned recip

相关标签:
1条回答
  • 2020-12-31 04:34

    I think you don't want the = at the end of the define line. This makefile works here for me:

    define make-foo
    echo making $@
    touch $@
    endef
    
    .PHONY: foo1
    foo1:
        $(make-foo)
    

    Example:

    $ make
    echo making foo1
    making foo1
    touch foo1
    $ ls
    Makefile  foo1
    

    The GNU make manual seems to indicate that the = should be just fine, but like you, I get different behaviour if I have it there.

    Edit: I just asked:

    GNU make differences in multiline variable declarations

    To get some clarification on what's happening here...

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