Re: .ONESHELL enhancement?
Matt McCutchen <[email protected]>
| Newsgroups | gmane.comp.gnu.make.devel |
|---|---|
| Message-ID | <1253665016.2392.55.camel@localhost> |
On Tue, 2009-09-22 at 18:43 -0400, David Boyce wrote: > On Tue, Sep 22, 2009 at 3:34 PM, Paul Smith <[email protected]> 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