make-alpha
[Top][All Lists]
Advanced

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

.ONESHELL (was: Re: newline escape problem.)


From: Paul D. Smith
Subject: .ONESHELL (was: Re: newline escape problem.)
Date: Wed, 30 Oct 2002 13:15:16 -0500

%% David Boyce <address@hidden> writes:

  db> Next, a different but I hope sufficiently related topic: has the
  db> subject of implementing .ONESHELL for GNU make ever come up here?

No.

  db> I see no RFE's for it in the bug database and google shows nothing
  db> (of course, in an apparent new "feature" google insists on telling
  db> me "ONESHELL" is a typo and separating it into "ONE
  db> SHELL"). Here's what SUS says:

Yes, I saw that as well.  I've actually never heard of this target
before I saw it in the SUS, in any make I've used, so I wonder where it
comes from?

  db>       The default in some advanced versions of make is to group
  db>       all the command lines for a target and execute them using a
  db>       single shell invocation; the System V method is to pass each
  db>       line individually to a separate shell. The single-shell
  db>       method has the advantages in performance and the lack of a
  db>       requirement for many continued lines.  However, converting
  db>       to this newer method has caused portability problems with
  db>       many historical makefiles, so the behavior with the POSIX
  db>       makefile is specified to be the same as that of System V. It
  db>       is suggested that the special target .ONESHELL be used as an
  db>       implementation extension to achieve the single-shell
  db>       grouping for a target or group of targets.

  db> I'd think it would be not so hard to implement, mostly a matter of
  db> joining lines with && between them, and a nice enhancement with a
  db> clear go-ahead from the relevant standards.

Hmm.  It's too bad they don't make clear what exactly "group all the
command lines" means.

The first thing off the top of my head when I read that was that we
would just pass the whole command script as a singlew string to the
interpreter with the newlines left intact, except for any initial TAB
characters would be removed.

I agree that && follows the original behavior more closely, especially
in light of GNU make's use of -c instead of -ec to the shell.

On the other hand, what does it mean to use both .ONESHELL and also to
choose a different interpreter for SHELL?  How would we use "&&" in that
situation?

As a gut feeling I still think the right answer is to not try to use
"&&" but just pass the script as a chunk of text with no special
escaping, etc.  This means that a .ONESHELL target would change the
actual behavior of the makefile, though, rather than being a "quiet
change".


I expect that this grouping decision is at the heart of the "portability
problems" discussed above.  It would be nice if they'd been a little
more precise about the description.

-- 
-------------------------------------------------------------------------------
 Paul D. Smith <address@hidden>          Find some GNU make tips at:
 http://www.gnu.org                      http://make.paulandlesley.org
 "Please remain calm...I may be mad, but I am a professional." --Mad Scientist




reply via email to

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