make-alpha
[Top][All Lists]
Advanced

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

Re: .ONESHELL enhancement?


From: Matt McCutchen
Subject: Re: .ONESHELL enhancement?
Date: Tue, 22 Sep 2009 20:16:56 -0400

On Tue, 2009-09-22 at 18:43 -0400, David Boyce wrote:
> On Tue, Sep 22, 2009 at 3:34 PM, Paul Smith <address@hidden> wrote:
> > I can't speak to the Windows implementation, but why do you need to do
> > any translation of the script on POSIX systems?  You can pass a string
> > containing a newline to the shell and it will work; you don't have to
> > add in "&&" or ";" or anything.

> Because the semantics are different. Newline behaves more like ; than
> &&, and for .ONESHELL too work we need && semantics.

Joining with && would be a simple, sane approach.  (Note, curly braces
may be needed around each line to protect any && or || operators
inside.)  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

That's a major change, and it doesn't fit well with the prefixes that
can currently be attached to individual lines.  For instance, what would
this mean?

foo: bar
        if test -s $<
        +then
        -       echo 'nonempty' >$@
        @else
                echo 'empty' >$@
        fi

We could either try to figure out some sane semantics for this or ignore
that remark in the standard and just implement the && joining.

-- 
Matt





reply via email to

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