make-alpha
[Top][All Lists]
Advanced

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

Re: newline escape problem.


From: David Boyce
Subject: Re: newline escape problem.
Date: Wed, 30 Oct 2002 11:50:02 -0500

At 06:19 PM 10/29/2002 -0500, Paul D. Smith wrote:
We already allow SHELL to contain whitespace, as in:

  SHELL = /bin/sh -e

(not portable but does work in some shells) so there is _SOME_ amount of
parsing we have to do ...

What's the argument for allowing whitespace at all (aside from backward compatibility of course)? Most makes require SHELL to be a single word suitable for use as "arg0" in execl[p]() and in fact I've always assumed GNU make did the same thing. I don't think there will ever be a way to correctly parse SHELL into an array. What if it was

        SHELL := env FOO=BAR myscript -comment "this is what I propose to do"

If only there was a way for make to represent arrays; then we could contemplate an enhancement "MAKEARGV" (or whatever) which holds not a string requiring difficult parsing but a true array, e.g. in perl pseudo-syntax:

        MAKEARGV        :=      qw(my_program -flag1 -flag2 %)

where the command string gets plugged in in place of the '%' (adjust syntax to taste). This would solve a lot of the SHELL-customization issues in one fell swoop, but I'm not aware of a way to represent an array other than as a whitespace-separated string.

Next, a different but I hope sufficiently related topic: has the subject of implementing .ONESHELL for GNU make ever come up here? I see no RFE's for it in the bug database and google shows nothing (of course, in an apparent new "feature" google insists on telling me "ONESHELL" is a typo and separating it into "ONE SHELL"). Here's what SUS says:

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

I'd think it would be not so hard to implement, mostly a matter of joining lines with && between them, and a nice enhancement with a clear go-ahead from the relevant standards. So have I missed a deprecation of .ONESHELL or is it something that just hasn't come up?

-David





reply via email to

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