多行变量定义在Makefile中不起作用
我正在尝试使用一个,但它似乎对我不起作用:多行变量定义在Makefile中不起作用,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, In
$ 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
我做错了什么?试试这个:
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
在3.81的define
语句中,被定义变量名称后面的=
似乎不起作用,如果您回显一个多行变量,shell会将第一行后面的行解释为命令