Re: .ONESHELL enhancement?

Paul Smith <[email protected]>
Newsgroups gmane.comp.gnu.make.devel
Organization GNU's Not Unix!
Message-ID <[email protected]>
On Tue, 2009-09-22 at 12:29 -0400, David Boyce wrote:
> I have an interest in seeing the .ONESHELL special target enhancement
> implemented, as recommended by POSIX (see the RATIONALE section within
> http://www.opengroup.org/onlinepubs/009695399/). So I have a few
> questions for the GNU make gatekeepers:
> 
> - Would such an enhancement be welcomed, with a likelihood of eventual
> incorporation?

Sure, this is something I'd like to have.

> - If it could be shown reliably to not affect anyone not specifying
> .ONESHELL, would it have a chance of making the 3.82 release? That's
> assuming 3.82 isn't still on an Oct 1 schedule, of course.

3.82 was never going to be released on Oct 1.  I was going to start the
release candidate cycle on Oct 1.  In the past, RC cycles have lasted a
month or more.  Some have asked to delay to Oct 15; I'm going to see
what's what when Oct 1 rolls around.

As for 3.82 inclusion, it all depends on when it gets done :-).  I
probably wouldn't hold the release for a long time for it but if it was
"close" I would consider it.

> - This _feels_ like a pretty easy feature to add; though I don't know
> the sources well, it appears that the "recipe" is contained within
> file->cmds->commands in a newline-separated sequence of commands.
> AFAICT it seems like a simple matter of splitting this on newlines and
> replacing them with " && ", which is supported by both POSIX and
> Windows shells. Am I right, and if so can anyone suggest the best
> place to make the change? I'm looking at execute_file_commands() or
> new_job() but there may be a better place. Of course it would be most
> elegant to separate commands in the string with "&&" in the first
> place rather than replacing later, but I suspect that due to parse
> order we might not have seen .ONESHELL in time to do this.

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.

E.g., for a command like:

	all:
		echo hi
		echo there

why can't you just take this string as-is and invoke:

	/bin/sh -c "echo hi
	echo there"

??
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.