2016-05-27 59 views
1

工作,我試圖用一個multiline variable definition in my Makefile,它似乎並沒有爲我工作:多變量定義不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 

我在做什麼錯?

回答

1

試試這個:

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 

的「=」似乎並沒有在define報表工作在3.81,如果你回聲一個多變量,shell會後的第一個解釋線如命令