multiline variable definitions not working in Makefile

rampion

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?

Beta

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.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Variable assignment issue in multiline macro in GNU Makefile

From Dev

Makefile: call multiline variable inside for loop

From Dev

Multiple definitions of main with Makefile

From Dev

AIX make/makefile : variable assignment is not working

From Dev

Rule to set a variable in Makefile not working as expected

From Dev

Working with Logs (with multiline) and Regex

From Dev

Golang multiline regex not working

From Dev

CCLabelTTF multiline label not working

From Dev

Programatically Multiline not working in iOS

From Dev

Multiple definitions of a global variable

From Dev

Print a multiline variable in a column

From Dev

Multiline filter with logstash not working as expected

From Dev

Matching a regular expression on multiline not working

From Dev

regex multiline not working on repeated patterns

From Dev

html multiline comment not working in chrome

From Dev

using arraylist spinner multiline not working

From Dev

Spaces / align of variable definitions in IntelliJ

From Dev

Proper External Variable Declarations and Definitions

From Dev

Proper External Variable Declarations and Definitions

From Dev

Spaces / align of variable definitions in IntelliJ

From Dev

if statement in ONESHELL Makefile not working

From Dev

Current working directory of makefile

From Dev

pushd not working in makefile

From Dev

Generic Makefile not working on FreeBSD

From Dev

Makefile opencv stopped working

From Dev

Makefile generic rule not working

From Dev

Makefile is working really weird

From Dev

`read` command not working in a Makefile

From Dev

Why this makefile is not working?