[Top][All Lists]

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

Re: Canned command sequences

From: Ted Stern
Subject: Re: Canned command sequences
Date: Fri, 20 Jun 2003 13:08:09 -0700
User-agent: Gnus/5.1003 (Gnus v5.10.3) Emacs/21.2 (usg-unix-v)

On 20 Jun 2003, Sam Ravnborg wrote:
> Hi all.
> Posted the following a few weeks ago - wondered if anyone could explain it.
> I have stripped down the background info a bit - so the essense is kept.

>> The culprint is the extra line:
>> "echo hello again"
>> It should not be there.

Speaking only as another user ...

The essence of what you are asking is, "Why isn't the '@' indication of
no-echo respected by Make's $(call ) function and applied to the entire call?

IIUC, the answer is that you need to consider how "define/endef" differs from
a simple variable definition.

define/endef treats line endings differently -- it was specifically designed
so that you could create a function with each line written as it would be in a
target rule.  When a define-function is called, those line endings mean that
each line of $(rule_up) starts a new shell process.

In other words, what the "all" target sees after $(call) is evaluated is
something like

       <TAB> @set -e; <TAB> echo hello
       <TAB> echo hello again

Both '@' and the shell setting 'set -e' are applied only to the first shell,
so the second line of $(rule_up) is echoed.

Paul, did I get that right?

 Ted Stern                                 Applications Group
 Cray Inc.                               office: 206-701-2182
 411 First Avenue South, Suite 600         cell: 206-383-1049
 Seattle, WA 98104-2860                     FAX: 206-701-2500

 Frango ut patefaciam -- I break that I may reveal
 (The Paleontological Society motto, equally apropos for debugging)

reply via email to

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