Re: .ONESHELL enhancement?

David Boyce <[email protected]>
Newsgroups gmane.comp.gnu.make.devel
Message-ID <[email protected]>
On Tue, Sep 22, 2009 at 8:16 PM, Matt McCutchen <[email protected]> wrote:
>  But note the following in the standard:
>
>> The single-shell method has the advantages in [...] the lack of a
>> requirement for many continued lines.
>
> So they are viewing the command recipe as a single shell script, and
> constructs like the following would be legal:
>
> foo: bar
>        if test -s $<
>        then
>                echo 'nonempty' >$@
>        else
>                echo 'empty' >$@
>        fi

I think you're reading too much into this language. In the normative
sections, standards writers are extra careful in their wording and we
have to take it literally, but this is just a suggestion thrown out in
the RATIONALE section and I think the language is much more
colloquial. I think the only common-sense reading here is that
consecutive lines should be implicitly joined with "&&".

The reference to the "advantage of performance" is a strong hint; you
can't compare two techniques for performance unless they do pretty
much the same thing. Similarly, it seems clear to me anyway that the
"lack of requirement for many continued lines" simply means that it's
nice to not have to type (and see) a literal &&\ at the end of each
line.

BTW, can you give an example of a whose semantics would be changed by
adding &&, such that {} or () is needed? Seems to me that the
precedence rules make this safe

DSB
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.