improve install-no-fixedincludes Makefile target

Ralf Wildenhues Ralf.Wildenhues@gmx.de
Fri Oct 8 17:39:00 GMT 2010


Hello Olivier,

* Olivier Hainque wrote on Fri, Oct 08, 2010 at 12:10:55PM CEST:
> The install-no-fixedincludes Makefile target eventually resorts to
> gcc-no-fixedincludes, which removes stmp-int-hdrs and triggers make
> install arranging for fixincludes not to run.
> 
> The mere stmp-int-hdrs removal triggers a rebuild of the internal
> headers, and then of everything that depends on them.
> 
> The latter sometimes is annoying. We have witnessed in the past libgcc
> rebuilds on some targets for instance. This takes time, rebuilds with
> a different set of headers and possibly fails.
> 
>   http://gcc.gnu.org/ml/gcc/2003-04/msg00420.html
> 
> While we haven't been able to expose the libgcc particular issue on
> mainline recently, the general underlying issue remains.
> 
> The attached patch is a proposal to improve things a bit by rebuilding
> the headers explicitely first, then restore the original stamps before
> invoking install:. It also removes the stmp-headers removal, as this
> stamp file is apparently unused now.

Isn't the fact that such breakage is encountered a sign that this:

>   # [...] This rule is very
>   # dependent on the workings of the gcc Makefile.in.

simply isn't such a good idea?  IOW, why is the toplevel rule
gcc-no-fixedincludes not merely a forwarder for an
install-no-fixedincludes in gcc/Makefile.in, where that at least allows
to keep the logic closer to the stmp-int-hdrs and similar rules?

Otherwise, I guess things are bound to break again in the future.

Also, would it be possible to build the right set of headers right away,
or, rather, the headers in the right way right away (sorry for the pun)?
Maybe with some --disable-fixed-headers or so?
(I may be missing something here, so thanks for any hints.)

Thanks,
Ralf

> + # The idea is to
> + #  - Get to "install" with a bare set of internal headers, not the
> + #    fixed system ones,
> + #  - Prevent rebuilds of what normally depends on the headers, which
> + #    is useless for installation purposes and would rely on improper headers.
> + #  - Restore as much of the original state as possible.
> + #
> + # We stash the current set of headers away, save stamps we're going to alter
> + # explictitely, re-trigger the header making target arranging for fixincludes
> + # not to run, install after restoring the original stamps (so that
> + # intermediate targets don't rebuild), and restore the original set of
> + # headers.
> + 
>   .PHONY: gcc-no-fixedincludes
>   gcc-no-fixedincludes:
>   	@if [ -f ./gcc/Makefile ]; then \
>   	  rm -rf gcc/tmp-include; \
>   	  mv gcc/include gcc/tmp-include 2>/dev/null; \
> + 	  mv gcc/stmp-int-hdrs gcc/tmp-stmp-int-hdrs 2>/dev/null; \
> + 	  mv gcc/stmp-fixinc gcc/tmp-stmp-fixinc 2>/dev/null; \
>   	  mkdir gcc/include; \
>   	  cp $(srcdir)/gcc/gsyslimits.h gcc/include/syslimits.h; \
>   	  touch gcc/stmp-fixinc gcc/include/fixed; \
>   	  r=`${PWD_COMMAND}`; export r; \
>   	  s=`cd $(srcdir); ${PWD_COMMAND}` ; export s; \
>   	  $(HOST_EXPORTS) \
>   	  (cd ./gcc && \
> ! 	   $(MAKE) $(GCC_FLAGS_TO_PASS) stmp-int-hdrs); \
> ! 	  mv gcc/tmp-stmp-int-hdrs gcc/stmp-int-hdrs 2>/dev/null; \
> ! 	  mv gcc/tmp-stmp-fixinc gcc/stmp-fixinc 2>/dev/null; \
> ! 	  (cd ./gcc && \
> !            $(MAKE) $(GCC_FLAGS_TO_PASS) install); \
>   	  rm -rf gcc/include; \
>   	  mv gcc/tmp-include gcc/include 2>/dev/null; \
>   	else true; fi



More information about the Gcc-patches mailing list