I'm trying to use a multiline variable definition in my Makefile, and it doesn't seem to be working for me:
$ 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
What am I doing wrong?
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
The =
following the name of the variable being defined doesn't seem to work in define
statements in 3.81, and if you echo a multiline variable, the shell will interpret the lines after the first one as commands.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments