Is it possible to create a multi-line string variable in a Makefile

后端 未结 19 2074
借酒劲吻你
借酒劲吻你 2020-11-28 20:27

I want to create a makefile variable that is a multi-line string (e.g. the body of an email release announcement). something like

ANNOUNCE_BODY=\"
Version $         


        
19条回答
  •  星月不相逢
    2020-11-28 20:39

    Yes. You escape the newlines with \:

    VARIABLE="\
    THIS IS A VERY LONG\
    TEXT STRING IN A MAKE VARIABLE"
    

    update

    Ah, you want the newlines? Then no, I don't think there's any way in vanilla Make. However, you can always use a here-document in the command part

    [This does not work, see comment from MadScientist]

    foo:
        echo <

提交回复
热议问题