help-make
[Top][All Lists]
Advanced

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

Re: Can the exit status of the code block in @(...) be obtained from out


From: Paul Smith
Subject: Re: Can the exit status of the code block in @(...) be obtained from outside the @() structure?
Date: Tue, 18 Jan 2022 16:03:06 -0500
User-agent: Evolution 3.36.5-0ubuntu1

On Tue, 2022-01-18 at 12:38 -0800, Jon Forrest wrote:
> On 1/18/2022 10:55 AM, Paul Smith wrote:> 
> > All versions of make, including GNU make, invoke each logical line
> > of the recipe in a separate shell.
> 
> I'm curious what would happen if each logical line were executed in
> the same shell.

I guess what you really mean is if ALL logical lines (in a recipe) were
executed in the same shell.

You can achieve this if you want: that's what the .ONESHELL feature
does.

https://www.gnu.org/software/make/manual/html_node/One-Shell.html

However, blindly enabling this for makefiles which aren't written to
expect it WILL break them.  Many makefile recipes take advantage of
this "one line per shell" facility, by doing things like:

  foo:
          cd subdir && do command
          cd otherdir && do command

If these were run in the same shell this would work completely
differently.




reply via email to

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