[PATCH] Makefile: Correctly propagate failure when removing target

Simon Glass sjg at chromium.org
Fri Oct 30 19:15:44 CET 2020


Hi Paul,

On Tue, 27 Oct 2020 at 20:25, Pali Rohár <pali at kernel.org> wrote:
>
> On Tuesday 27 October 2020 20:10:37 Simon Glass wrote:
> > Hi Paul,
> >
> > On Mon, 26 Oct 2020 at 07:11, Pali Rohár <pali at kernel.org> wrote:
> > >
> > > On more places is used pattern 'command > $@ || rm -f $@'. But it does not
> > > propagate failure from 'command' as 'rm -f' returns success.
> > >
> > > Fix it by calling 'false' to correctly propagate failure after 'rm -f'.
> > >
> > > Signed-off-by: Pali Rohár <pali at kernel.org>
> > > ---
> > >  Makefile | 12 ++++++------
> > >  1 file changed, 6 insertions(+), 6 deletions(-)
> >
> > Reviewed-by: Simon Glass <sjg at chromium.org>
> >
> > But I'm not sure about the use of {}. I would normally use ()
>
> ( ... ) spawns new shell and run commands in that new shell
> { ... ; } groups command together and runs them in the current shell
>
> So { ... ; } should be more efficient as it spawns less processes. But
> result should be same, return value from 'false', which returns 1.
>
> I'm using { ... ; } when it is not needed to spawns new processes and
> running commands in current shell is fine. I think that writing ( ... )
> should be equivalent to sh -c '...' (with correctly exported variables).

OK thank you.

Regards,
Simon


More information about the U-Boot mailing list