2016-05-27 13 views
1

Ich versuche, eine multiline variable definition in my Makefile zu verwenden, und es scheint nicht für mich arbeiten zu werden:mehrzeilige Variablen-Definitionen arbeiten nicht in Makefile

$ cat Makefile 
define foo = 
I'm a little teapot 
short and stout 
here is my handle 
here is my spout 
endef 

all: 
    echo "$(foo)" 
$ make all 
echo "" 

$ make --version 
GNU Make 3.81 
Copyright (C) 2006 Free Software Foundation, Inc. 
This is free software; see the source for copying conditions. 
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A 
PARTICULAR PURPOSE. 

This program built for i386-apple-darwin11.3.0 

Was mache ich falsch?

Antwort

1

Try this:

define foo 
I'm a little teapot 
short and stout 
here is my handle 
here is my spout 
endef 

$(info $(foo)) 


all: 
    echo the shell dislikes multiline variables 

Die '=' scheint nicht in 3.81 in define Aussagen zu arbeiten, und wenn Sie Echo eine mehrzeilige Variable, die Shell die Zeilen nach dem ersten interpretieren als Befehle.