help-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: variable with newlines


From: Ken Smith
Subject: Re: variable with newlines
Date: Mon, 22 Oct 2007 17:57:03 -0700

On 10/22/07, Venkatraman Krishnan <address@hidden> wrote:
>
[snip]
> override define EXCLUDE_DIRS
> dir_a
> dir_b
> endef
>
> all:
>     @/bin/echo $(EXCLUDE_DIRS)
>
> When I try to make, I am guessing, the echo fails because of the multiline
> variable. How do I fix this?

When it comes to moving special characters between make and the shell,
things get ticklish as you've discovered.  How about something like
this:

override define EXCLUDE_DIRS
dir_a
dir_b
endef

empty :=#

define newline
$(empty)

endef

escaped-EXCLUDE_DIRS := \
   $(subst $(newline),\n,$(EXCLUDE_DIRS))

all: ; @echo -e "$(escaped-EXCLUDE_DIRS)"

# EOF

   Ken Smith




reply via email to

[Prev in Thread] Current Thread [Next in Thread]