[PATCH] fix make clean on already pretty clean builddir

Daniel Jacobowitz drow@false.org
Fri Nov 17 00:31:00 GMT 2006

On Thu, Nov 16, 2006 at 02:02:14PM -0800, Mike Stump wrote:
> > clean-target: clean-target-libgcc
> > clean-target-libgcc:
> >-	test ! -d gcc || (cd gcc && $(MAKE) $@)
> >+	if test -f gcc/Makefile; then cd gcc && $(MAKE) $@; else :; fi
> No, you cannot remove the ()s, instead, please:
>   if test -f gcc/Makefile; then (cd gcc && $(MAKE) $@) else :; fi
> as strange as that looks.  You can tell this is bad by doing a pwd  
> after the command.  If the directory is changed, it failed.  When I  
> do that, it fails, as I'm using a shell (bash) that doesn't run the  
> if in a subshell.  Original sysv I think did run the command in a  
> subshell.  With my version, the cwd remains unchanged.

This is a Makefile, not a shell script.  There's a new shell
for every command not joined by backslashes.  Paolo's change is fine.

Daniel Jacobowitz

More information about the Gcc-patches mailing list