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

后端 未结 19 2068
借酒劲吻你
借酒劲吻你 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:31

    As an alternative you can use the printf command. This is helpful on OSX or other platforms with less features.

    To simply output a multiline message:

    all:
            @printf '%s\n' \
                'Version $(VERSION) has been released' \
                '' \
                'You can download from URL $(URL)'
    

    If you are trying to pass the string as an arg to another program, you can do so like this:

    all:
            /some/command "`printf '%s\n' 'Version $(VERSION) has been released' '' 'You can download from URL $(URL)'`"
    

提交回复
热议问题