[PATCH] fix make clean on already pretty clean builddir

Mike Stump mrs@apple.com
Thu Nov 16 22:31:00 GMT 2006


On Nov 16, 2006, at 8:58 AM, Paolo Bonzini wrote:
> Two files (gcc/Makefile and stage_last, the latter obviously my  
> fault...) were assumed present.

Thanks.

> I couldn't reproduce the "make clean actually makes all first"  
> scenario.
>
> Ok for 4.3?

I think it looks pretty good, though, one serious error...

> What about 4.2?

I'd like cleaning to work in 4.2...  It is a regression.

> 2006-11-16  Paolo Bonzini  <bonzini@gnu.org>
>
> 	* Makefile.in (clean-target-libgcc): Test for gcc Makefile presence.
> 	(unstage): Test for stage_last presence.
>
> Index: Makefile.tpl
> ===================================================================
> --- Makefile.tpl	(revision 118810)
> +++ Makefile.tpl	(working copy)
> @@ -591,7 +591,7 @@ realclean: maintainer-clean
>  # Extra dependency for clean-target, owing to the mixed nature of  
> gcc.
>  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.

I think this part is obvious with that change.

> -unstage = [ -f stage_current ] || $(MAKE) `cat stage_last`-start
> +unstage = if [ -f stage_last ]; then [ -f stage_current ] || $ 
> (MAKE) `cat stage_last`-start || exit 1; else :; fi

I think this is obvious as well.



More information about the Gcc-patches mailing list