+ @cd $(HOST_SUBDIR); [ -d stage1-zlib ] || \
+ mkdir stage1-zlib; \
+ mv stage1-zlib zlib
+@endif zlib
+@if lto-plugin
+ @cd $(HOST_SUBDIR); [ -d stage1-lto-plugin ] || \
+ mkdir stage1-lto-plugin; \
+ mv stage1-lto-plugin lto-plugin
+@endif lto-plugin
+@if libctf
+ @cd $(HOST_SUBDIR); [ -d stage1-libctf ] || \
+ mkdir stage1-libctf; \
+ mv stage1-libctf libctf
+@endif libctf
+ @[ -d stage1-$(TARGET_SUBDIR) ] || \
+ mkdir stage1-$(TARGET_SUBDIR); \
+ mv stage1-$(TARGET_SUBDIR) $(TARGET_SUBDIR)
+
+stage1-end::
+@if bfd
+ @if test -d $(HOST_SUBDIR)/bfd; then \
+ cd $(HOST_SUBDIR); mv bfd stage1-bfd; \
+ fi
+@endif bfd
+@if opcodes
+ @if test -d $(HOST_SUBDIR)/opcodes; then \
+ cd $(HOST_SUBDIR); mv opcodes stage1-opcodes; \
+ fi
+@endif opcodes
+@if binutils
+ @if test -d $(HOST_SUBDIR)/binutils; then \
+ cd $(HOST_SUBDIR); mv binutils stage1-binutils; \
+ fi
+@endif binutils
+@if fixincludes
+ @if test -d $(HOST_SUBDIR)/fixincludes; then \
+ cd $(HOST_SUBDIR); mv fixincludes stage1-fixincludes; \
+ fi
+@endif fixincludes
+@if gas
+ @if test -d $(HOST_SUBDIR)/gas; then \
+ cd $(HOST_SUBDIR); mv gas stage1-gas; \
+ fi
+@endif gas
+@if gcc
+ @if test -d $(HOST_SUBDIR)/gcc; then \
+ cd $(HOST_SUBDIR); mv gcc stage1-gcc; \
+ fi
+@endif gcc
+@if gmp
+ @if test -d $(HOST_SUBDIR)/gmp; then \
+ cd $(HOST_SUBDIR); mv gmp stage1-gmp; \
+ fi
+@endif gmp
+@if mpfr
+ @if test -d $(HOST_SUBDIR)/mpfr; then \
+ cd $(HOST_SUBDIR); mv mpfr stage1-mpfr; \
+ fi
+@endif mpfr
+@if mpc
+ @if test -d $(HOST_SUBDIR)/mpc; then \
+ cd $(HOST_SUBDIR); mv mpc stage1-mpc; \
+ fi
+@endif mpc
+@if isl
+ @if test -d $(HOST_SUBDIR)/isl; then \
+ cd $(HOST_SUBDIR); mv isl stage1-isl; \
+ fi
+@endif isl
+@if libelf
+ @if test -d $(HOST_SUBDIR)/libelf; then \
+ cd $(HOST_SUBDIR); mv libelf stage1-libelf; \
+ fi
+@endif libelf
+@if gold
+ @if test -d $(HOST_SUBDIR)/gold; then \
+ cd $(HOST_SUBDIR); mv gold stage1-gold; \
+ fi
+@endif gold
+@if intl
+ @if test -d $(HOST_SUBDIR)/intl; then \
+ cd $(HOST_SUBDIR); mv intl stage1-intl; \
+ fi
+@endif intl
+@if ld
+ @if test -d $(HOST_SUBDIR)/ld; then \
+ cd $(HOST_SUBDIR); mv ld stage1-ld; \
+ fi
+@endif ld
+@if libbacktrace
+ @if test -d $(HOST_SUBDIR)/libbacktrace; then \
+ cd $(HOST_SUBDIR); mv libbacktrace stage1-libbacktrace; \
+ fi
+@endif libbacktrace
+@if libcpp
+ @if test -d $(HOST_SUBDIR)/libcpp; then \
+ cd $(HOST_SUBDIR); mv libcpp stage1-libcpp; \
+ fi
+@endif libcpp
+@if libdecnumber
+ @if test -d $(HOST_SUBDIR)/libdecnumber; then \
+ cd $(HOST_SUBDIR); mv libdecnumber stage1-libdecnumber; \
+ fi
+@endif libdecnumber
+@if libiberty
+ @if test -d $(HOST_SUBDIR)/libiberty; then \
+ cd $(HOST_SUBDIR); mv libiberty stage1-libiberty; \
+ fi
+@endif libiberty
+@if libiberty-linker-plugin
+ @if test -d $(HOST_SUBDIR)/libiberty-linker-plugin; then \
+ cd $(HOST_SUBDIR); mv libiberty-linker-plugin stage1-libiberty-linker-plugin; \
+ fi
+@endif libiberty-linker-plugin
+@if libiconv
+ @if test -d $(HOST_SUBDIR)/libiconv; then \
+ cd $(HOST_SUBDIR); mv libiconv stage1-libiconv; \
+ fi
+@endif libiconv
+@if zlib
+ @if test -d $(HOST_SUBDIR)/zlib; then \
+ cd $(HOST_SUBDIR); mv zlib stage1-zlib; \
+ fi
+@endif zlib
+@if lto-plugin
+ @if test -d $(HOST_SUBDIR)/lto-plugin; then \
+ cd $(HOST_SUBDIR); mv lto-plugin stage1-lto-plugin; \
+ fi
+@endif lto-plugin
+@if libctf
+ @if test -d $(HOST_SUBDIR)/libctf; then \
+ cd $(HOST_SUBDIR); mv libctf stage1-libctf; \
+ fi
+@endif libctf
+ @if test -d $(TARGET_SUBDIR); then \
+ mv $(TARGET_SUBDIR) stage1-$(TARGET_SUBDIR); \
+ fi
+ rm -f stage_current
+
+# Bubble a bug fix through all the stages up to stage 1. They are
+# remade, but not reconfigured. The next stage (if any) will not be
+# reconfigured either.
+.PHONY: stage1-bubble
+stage1-bubble::
+ @r=`${PWD_COMMAND}`; export r; \
+ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+ if test -f stage1-lean ; then \
+ echo Skipping rebuild of stage1; \
+ else \
+ $(MAKE) stage1-start; \
+ $(MAKE) $(RECURSE_FLAGS_TO_PASS) all-stage1; \
+ fi
+
+.PHONY: all-stage1 clean-stage1
+do-clean: clean-stage1
+
+# FIXME: Will not need to be conditional when toplevel bootstrap is the
+# only possibility, but now it conflicts with no-bootstrap rules
+@if gcc-bootstrap
+
+
+
+
+# Rules to wipe a stage and all the following ones, also used for cleanstrap
+
+.PHONY: distclean-stage1
+distclean-stage1::
+ @: $(MAKE); $(stage)
+ @test "`cat stage_last`" != stage1 || rm -f stage_last
+ rm -rf stage1-*
+
+
+@endif gcc-bootstrap
+
+
+.PHONY: stage2-start stage2-end
+
+stage2-start::
+ @: $(MAKE); $(stage); \
+ echo stage2 > stage_current; \
+ echo stage2 > stage_last; \
+ $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)
+@if bfd
+ @cd $(HOST_SUBDIR); [ -d stage2-bfd ] || \
+ mkdir stage2-bfd; \
+ mv stage2-bfd bfd; \
+ mv stage1-bfd prev-bfd || test -f stage1-lean
+@endif bfd
+@if opcodes
+ @cd $(HOST_SUBDIR); [ -d stage2-opcodes ] || \
+ mkdir stage2-opcodes; \
+ mv stage2-opcodes opcodes; \
+ mv stage1-opcodes prev-opcodes || test -f stage1-lean
+@endif opcodes
+@if binutils
+ @cd $(HOST_SUBDIR); [ -d stage2-binutils ] || \
+ mkdir stage2-binutils; \
+ mv stage2-binutils binutils; \
+ mv stage1-binutils prev-binutils || test -f stage1-lean
+@endif binutils
+@if fixincludes
+ @cd $(HOST_SUBDIR); [ -d stage2-fixincludes ] || \
+ mkdir stage2-fixincludes; \
+ mv stage2-fixincludes fixincludes; \
+ mv stage1-fixincludes prev-fixincludes || test -f stage1-lean
+@endif fixincludes
+@if gas
+ @cd $(HOST_SUBDIR); [ -d stage2-gas ] || \
+ mkdir stage2-gas; \
+ mv stage2-gas gas; \
+ mv stage1-gas prev-gas || test -f stage1-lean
+@endif gas
+@if gcc
+ @cd $(HOST_SUBDIR); [ -d stage2-gcc ] || \
+ mkdir stage2-gcc; \
+ mv stage2-gcc gcc; \
+ mv stage1-gcc prev-gcc || test -f stage1-lean
+@endif gcc
+@if gmp
+ @cd $(HOST_SUBDIR); [ -d stage2-gmp ] || \
+ mkdir stage2-gmp; \
+ mv stage2-gmp gmp; \
+ mv stage1-gmp prev-gmp || test -f stage1-lean
+@endif gmp
+@if mpfr
+ @cd $(HOST_SUBDIR); [ -d stage2-mpfr ] || \
+ mkdir stage2-mpfr; \
+ mv stage2-mpfr mpfr; \
+ mv stage1-mpfr prev-mpfr || test -f stage1-lean
+@endif mpfr
+@if mpc
+ @cd $(HOST_SUBDIR); [ -d stage2-mpc ] || \
+ mkdir stage2-mpc; \
+ mv stage2-mpc mpc; \
+ mv stage1-mpc prev-mpc || test -f stage1-lean
+@endif mpc
+@if isl
+ @cd $(HOST_SUBDIR); [ -d stage2-isl ] || \
+ mkdir stage2-isl; \
+ mv stage2-isl isl; \
+ mv stage1-isl prev-isl || test -f stage1-lean
+@endif isl
+@if libelf
+ @cd $(HOST_SUBDIR); [ -d stage2-libelf ] || \
+ mkdir stage2-libelf; \
+ mv stage2-libelf libelf; \
+ mv stage1-libelf prev-libelf || test -f stage1-lean
+@endif libelf
+@if gold
+ @cd $(HOST_SUBDIR); [ -d stage2-gold ] || \
+ mkdir stage2-gold; \
+ mv stage2-gold gold; \
+ mv stage1-gold prev-gold || test -f stage1-lean
+@endif gold
+@if intl
+ @cd $(HOST_SUBDIR); [ -d stage2-intl ] || \
+ mkdir stage2-intl; \
+ mv stage2-intl intl; \
+ mv stage1-intl prev-intl || test -f stage1-lean
+@endif intl
+@if ld
+ @cd $(HOST_SUBDIR); [ -d stage2-ld ] || \
+ mkdir stage2-ld; \
+ mv stage2-ld ld; \
+ mv stage1-ld prev-ld || test -f stage1-lean
+@endif ld
+@if libbacktrace
+ @cd $(HOST_SUBDIR); [ -d stage2-libbacktrace ] || \
+ mkdir stage2-libbacktrace; \
+ mv stage2-libbacktrace libbacktrace; \
+ mv stage1-libbacktrace prev-libbacktrace || test -f stage1-lean
+@endif libbacktrace
+@if libcpp
+ @cd $(HOST_SUBDIR); [ -d stage2-libcpp ] || \
+ mkdir stage2-libcpp; \
+ mv stage2-libcpp libcpp; \
+ mv stage1-libcpp prev-libcpp || test -f stage1-lean
+@endif libcpp
+@if libdecnumber
+ @cd $(HOST_SUBDIR); [ -d stage2-libdecnumber ] || \
+ mkdir stage2-libdecnumber; \
+ mv stage2-libdecnumber libdecnumber; \
+ mv stage1-libdecnumber prev-libdecnumber || test -f stage1-lean
+@endif libdecnumber
+@if libiberty
+ @cd $(HOST_SUBDIR); [ -d stage2-libiberty ] || \
+ mkdir stage2-libiberty; \
+ mv stage2-libiberty libiberty; \
+ mv stage1-libiberty prev-libiberty || test -f stage1-lean
+@endif libiberty
+@if libiberty-linker-plugin
+ @cd $(HOST_SUBDIR); [ -d stage2-libiberty-linker-plugin ] || \
+ mkdir stage2-libiberty-linker-plugin; \
+ mv stage2-libiberty-linker-plugin libiberty-linker-plugin; \
+ mv stage1-libiberty-linker-plugin prev-libiberty-linker-plugin || test -f stage1-lean
+@endif libiberty-linker-plugin
+@if libiconv
+ @cd $(HOST_SUBDIR); [ -d stage2-libiconv ] || \
+ mkdir stage2-libiconv; \
+ mv stage2-libiconv libiconv; \
+ mv stage1-libiconv prev-libiconv || test -f stage1-lean
+@endif libiconv
+@if zlib
+ @cd $(HOST_SUBDIR); [ -d stage2-zlib ] || \
+ mkdir stage2-zlib; \
+ mv stage2-zlib zlib; \
+ mv stage1-zlib prev-zlib || test -f stage1-lean
+@endif zlib
+@if lto-plugin
+ @cd $(HOST_SUBDIR); [ -d stage2-lto-plugin ] || \
+ mkdir stage2-lto-plugin; \
+ mv stage2-lto-plugin lto-plugin; \
+ mv stage1-lto-plugin prev-lto-plugin || test -f stage1-lean
+@endif lto-plugin
+@if libctf
+ @cd $(HOST_SUBDIR); [ -d stage2-libctf ] || \
+ mkdir stage2-libctf; \
+ mv stage2-libctf libctf; \
+ mv stage1-libctf prev-libctf || test -f stage1-lean
+@endif libctf
+ @[ -d stage2-$(TARGET_SUBDIR) ] || \
+ mkdir stage2-$(TARGET_SUBDIR); \
+ mv stage2-$(TARGET_SUBDIR) $(TARGET_SUBDIR); \
+ mv stage1-$(TARGET_SUBDIR) prev-$(TARGET_SUBDIR) || test -f stage1-lean
+
+stage2-end::
+@if bfd
+ @if test -d $(HOST_SUBDIR)/bfd; then \
+ cd $(HOST_SUBDIR); mv bfd stage2-bfd; \
+ mv prev-bfd stage1-bfd; : ; \
+ fi
+@endif bfd
+@if opcodes
+ @if test -d $(HOST_SUBDIR)/opcodes; then \
+ cd $(HOST_SUBDIR); mv opcodes stage2-opcodes; \
+ mv prev-opcodes stage1-opcodes; : ; \
+ fi
+@endif opcodes
+@if binutils
+ @if test -d $(HOST_SUBDIR)/binutils; then \
+ cd $(HOST_SUBDIR); mv binutils stage2-binutils; \
+ mv prev-binutils stage1-binutils; : ; \
+ fi
+@endif binutils
+@if fixincludes
+ @if test -d $(HOST_SUBDIR)/fixincludes; then \
+ cd $(HOST_SUBDIR); mv fixincludes stage2-fixincludes; \
+ mv prev-fixincludes stage1-fixincludes; : ; \
+ fi
+@endif fixincludes
+@if gas
+ @if test -d $(HOST_SUBDIR)/gas; then \
+ cd $(HOST_SUBDIR); mv gas stage2-gas; \
+ mv prev-gas stage1-gas; : ; \
+ fi
+@endif gas
+@if gcc
+ @if test -d $(HOST_SUBDIR)/gcc; then \
+ cd $(HOST_SUBDIR); mv gcc stage2-gcc; \
+ mv prev-gcc stage1-gcc; : ; \
+ fi
+@endif gcc
+@if gmp
+ @if test -d $(HOST_SUBDIR)/gmp; then \
+ cd $(HOST_SUBDIR); mv gmp stage2-gmp; \
+ mv prev-gmp stage1-gmp; : ; \
+ fi
+@endif gmp
+@if mpfr
+ @if test -d $(HOST_SUBDIR)/mpfr; then \
+ cd $(HOST_SUBDIR); mv mpfr stage2-mpfr; \
+ mv prev-mpfr stage1-mpfr; : ; \
+ fi
+@endif mpfr
+@if mpc
+ @if test -d $(HOST_SUBDIR)/mpc; then \
+ cd $(HOST_SUBDIR); mv mpc stage2-mpc; \
+ mv prev-mpc stage1-mpc; : ; \
+ fi
+@endif mpc
+@if isl
+ @if test -d $(HOST_SUBDIR)/isl; then \
+ cd $(HOST_SUBDIR); mv isl stage2-isl; \
+ mv prev-isl stage1-isl; : ; \
+ fi
+@endif isl
+@if libelf
+ @if test -d $(HOST_SUBDIR)/libelf; then \
+ cd $(HOST_SUBDIR); mv libelf stage2-libelf; \
+ mv prev-libelf stage1-libelf; : ; \
+ fi
+@endif libelf
+@if gold
+ @if test -d $(HOST_SUBDIR)/gold; then \
+ cd $(HOST_SUBDIR); mv gold stage2-gold; \
+ mv prev-gold stage1-gold; : ; \
+ fi
+@endif gold
+@if intl
+ @if test -d $(HOST_SUBDIR)/intl; then \
+ cd $(HOST_SUBDIR); mv intl stage2-intl; \
+ mv prev-intl stage1-intl; : ; \
+ fi
+@endif intl
+@if ld
+ @if test -d $(HOST_SUBDIR)/ld; then \
+ cd $(HOST_SUBDIR); mv ld stage2-ld; \
+ mv prev-ld stage1-ld; : ; \
+ fi
+@endif ld
+@if libbacktrace
+ @if test -d $(HOST_SUBDIR)/libbacktrace; then \
+ cd $(HOST_SUBDIR); mv libbacktrace stage2-libbacktrace; \
+ mv prev-libbacktrace stage1-libbacktrace; : ; \
+ fi
+@endif libbacktrace
+@if libcpp
+ @if test -d $(HOST_SUBDIR)/libcpp; then \
+ cd $(HOST_SUBDIR); mv libcpp stage2-libcpp; \
+ mv prev-libcpp stage1-libcpp; : ; \
+ fi
+@endif libcpp
+@if libdecnumber
+ @if test -d $(HOST_SUBDIR)/libdecnumber; then \
+ cd $(HOST_SUBDIR); mv libdecnumber stage2-libdecnumber; \
+ mv prev-libdecnumber stage1-libdecnumber; : ; \
+ fi
+@endif libdecnumber
+@if libiberty
+ @if test -d $(HOST_SUBDIR)/libiberty; then \
+ cd $(HOST_SUBDIR); mv libiberty stage2-libiberty; \
+ mv prev-libiberty stage1-libiberty; : ; \
+ fi
+@endif libiberty
+@if libiberty-linker-plugin
+ @if test -d $(HOST_SUBDIR)/libiberty-linker-plugin; then \
+ cd $(HOST_SUBDIR); mv libiberty-linker-plugin stage2-libiberty-linker-plugin; \
+ mv prev-libiberty-linker-plugin stage1-libiberty-linker-plugin; : ; \
+ fi
+@endif libiberty-linker-plugin
+@if libiconv
+ @if test -d $(HOST_SUBDIR)/libiconv; then \
+ cd $(HOST_SUBDIR); mv libiconv stage2-libiconv; \
+ mv prev-libiconv stage1-libiconv; : ; \
+ fi
+@endif libiconv
+@if zlib
+ @if test -d $(HOST_SUBDIR)/zlib; then \
+ cd $(HOST_SUBDIR); mv zlib stage2-zlib; \
+ mv prev-zlib stage1-zlib; : ; \
+ fi
+@endif zlib
+@if lto-plugin
+ @if test -d $(HOST_SUBDIR)/lto-plugin; then \
+ cd $(HOST_SUBDIR); mv lto-plugin stage2-lto-plugin; \
+ mv prev-lto-plugin stage1-lto-plugin; : ; \
+ fi
+@endif lto-plugin
+@if libctf
+ @if test -d $(HOST_SUBDIR)/libctf; then \
+ cd $(HOST_SUBDIR); mv libctf stage2-libctf; \
+ mv prev-libctf stage1-libctf; : ; \
+ fi
+@endif libctf
+ @if test -d $(TARGET_SUBDIR); then \
+ mv $(TARGET_SUBDIR) stage2-$(TARGET_SUBDIR); \
+ mv prev-$(TARGET_SUBDIR) stage1-$(TARGET_SUBDIR); : ; \
+ fi
+ rm -f stage_current
+
+# Bubble a bug fix through all the stages up to stage 2. They are
+# remade, but not reconfigured. The next stage (if any) will not be
+# reconfigured either.
+.PHONY: stage2-bubble
+stage2-bubble:: stage1-bubble
+ @r=`${PWD_COMMAND}`; export r; \
+ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+ if test -f stage2-lean || test -f stage1-lean ; then \
+ echo Skipping rebuild of stage2; \
+ else \
+ $(MAKE) stage2-start; \
+ $(MAKE) $(RECURSE_FLAGS_TO_PASS) all-stage2; \
+ fi
+
+.PHONY: all-stage2 clean-stage2
+do-clean: clean-stage2
+
+# FIXME: Will not need to be conditional when toplevel bootstrap is the
+# only possibility, but now it conflicts with no-bootstrap rules
+@if gcc-bootstrap
+
+
+
+.PHONY: bootstrap2 bootstrap2-lean
+bootstrap2:
+ echo stage2 > stage_final
+ @r=`${PWD_COMMAND}`; export r; \
+ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+ $(MAKE) $(RECURSE_FLAGS_TO_PASS) stage2-bubble
+ @: $(MAKE); $(unstage)
+ @r=`${PWD_COMMAND}`; export r; \
+ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+ TFLAGS="$(STAGE2_TFLAGS)"; \
+ $(MAKE) $(TARGET_FLAGS_TO_PASS) all-host all-target
+
+bootstrap2-lean:
+ echo stage2 > stage_final
+ @r=`${PWD_COMMAND}`; export r; \
+ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+ $(MAKE) $(RECURSE_FLAGS_TO_PASS) LEAN=: stage2-bubble
+ @: $(MAKE); $(unstage)
+ @r=`${PWD_COMMAND}`; export r; \
+ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+ TFLAGS="$(STAGE2_TFLAGS)"; \
+ $(MAKE) $(TARGET_FLAGS_TO_PASS) all-host all-target
+
+
+# Rules to wipe a stage and all the following ones, also used for cleanstrap
+distclean-stage1:: distclean-stage2
+.PHONY: distclean-stage2
+distclean-stage2::
+ @: $(MAKE); $(stage)
+ @test "`cat stage_last`" != stage2 || rm -f stage_last
+ rm -rf stage2-*
+
+
+@endif gcc-bootstrap
+
+
+.PHONY: stage3-start stage3-end
+
+stage3-start::
+ @: $(MAKE); $(stage); \
+ echo stage3 > stage_current; \
+ echo stage3 > stage_last; \
+ $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)
+@if bfd
+ @cd $(HOST_SUBDIR); [ -d stage3-bfd ] || \
+ mkdir stage3-bfd; \
+ mv stage3-bfd bfd; \
+ mv stage2-bfd prev-bfd || test -f stage2-lean
+@endif bfd
+@if opcodes
+ @cd $(HOST_SUBDIR); [ -d stage3-opcodes ] || \
+ mkdir stage3-opcodes; \
+ mv stage3-opcodes opcodes; \
+ mv stage2-opcodes prev-opcodes || test -f stage2-lean
+@endif opcodes
+@if binutils
+ @cd $(HOST_SUBDIR); [ -d stage3-binutils ] || \
+ mkdir stage3-binutils; \
+ mv stage3-binutils binutils; \
+ mv stage2-binutils prev-binutils || test -f stage2-lean
+@endif binutils
+@if fixincludes
+ @cd $(HOST_SUBDIR); [ -d stage3-fixincludes ] || \
+ mkdir stage3-fixincludes; \
+ mv stage3-fixincludes fixincludes; \
+ mv stage2-fixincludes prev-fixincludes || test -f stage2-lean
+@endif fixincludes
+@if gas
+ @cd $(HOST_SUBDIR); [ -d stage3-gas ] || \
+ mkdir stage3-gas; \
+ mv stage3-gas gas; \
+ mv stage2-gas prev-gas || test -f stage2-lean
+@endif gas
+@if gcc
+ @cd $(HOST_SUBDIR); [ -d stage3-gcc ] || \
+ mkdir stage3-gcc; \
+ mv stage3-gcc gcc; \
+ mv stage2-gcc prev-gcc || test -f stage2-lean
+@endif gcc
+@if gmp
+ @cd $(HOST_SUBDIR); [ -d stage3-gmp ] || \
+ mkdir stage3-gmp; \
+ mv stage3-gmp gmp; \
+ mv stage2-gmp prev-gmp || test -f stage2-lean
+@endif gmp
+@if mpfr
+ @cd $(HOST_SUBDIR); [ -d stage3-mpfr ] || \
+ mkdir stage3-mpfr; \
+ mv stage3-mpfr mpfr; \
+ mv stage2-mpfr prev-mpfr || test -f stage2-lean
+@endif mpfr
+@if mpc
+ @cd $(HOST_SUBDIR); [ -d stage3-mpc ] || \
+ mkdir stage3-mpc; \
+ mv stage3-mpc mpc; \
+ mv stage2-mpc prev-mpc || test -f stage2-lean
+@endif mpc
+@if isl
+ @cd $(HOST_SUBDIR); [ -d stage3-isl ] || \
+ mkdir stage3-isl; \
+ mv stage3-isl isl; \
+ mv stage2-isl prev-isl || test -f stage2-lean
+@endif isl
+@if libelf
+ @cd $(HOST_SUBDIR); [ -d stage3-libelf ] || \
+ mkdir stage3-libelf; \
+ mv stage3-libelf libelf; \
+ mv stage2-libelf prev-libelf || test -f stage2-lean
+@endif libelf
+@if gold
+ @cd $(HOST_SUBDIR); [ -d stage3-gold ] || \
+ mkdir stage3-gold; \
+ mv stage3-gold gold; \
+ mv stage2-gold prev-gold || test -f stage2-lean
+@endif gold
+@if intl
+ @cd $(HOST_SUBDIR); [ -d stage3-intl ] || \
+ mkdir stage3-intl; \
+ mv stage3-intl intl; \
+ mv stage2-intl prev-intl || test -f stage2-lean
+@endif intl
+@if ld
+ @cd $(HOST_SUBDIR); [ -d stage3-ld ] || \
+ mkdir stage3-ld; \
+ mv stage3-ld ld; \
+ mv stage2-ld prev-ld || test -f stage2-lean
+@endif ld
+@if libbacktrace
+ @cd $(HOST_SUBDIR); [ -d stage3-libbacktrace ] || \
+ mkdir stage3-libbacktrace; \
+ mv stage3-libbacktrace libbacktrace; \
+ mv stage2-libbacktrace prev-libbacktrace || test -f stage2-lean
+@endif libbacktrace
+@if libcpp
+ @cd $(HOST_SUBDIR); [ -d stage3-libcpp ] || \
+ mkdir stage3-libcpp; \
+ mv stage3-libcpp libcpp; \
+ mv stage2-libcpp prev-libcpp || test -f stage2-lean
+@endif libcpp
+@if libdecnumber
+ @cd $(HOST_SUBDIR); [ -d stage3-libdecnumber ] || \
+ mkdir stage3-libdecnumber; \
+ mv stage3-libdecnumber libdecnumber; \
+ mv stage2-libdecnumber prev-libdecnumber || test -f stage2-lean
+@endif libdecnumber
+@if libiberty
+ @cd $(HOST_SUBDIR); [ -d stage3-libiberty ] || \
+ mkdir stage3-libiberty; \
+ mv stage3-libiberty libiberty; \
+ mv stage2-libiberty prev-libiberty || test -f stage2-lean
+@endif libiberty
+@if libiberty-linker-plugin
+ @cd $(HOST_SUBDIR); [ -d stage3-libiberty-linker-plugin ] || \
+ mkdir stage3-libiberty-linker-plugin; \
+ mv stage3-libiberty-linker-plugin libiberty-linker-plugin; \
+ mv stage2-libiberty-linker-plugin prev-libiberty-linker-plugin || test -f stage2-lean
+@endif libiberty-linker-plugin
+@if libiconv
+ @cd $(HOST_SUBDIR); [ -d stage3-libiconv ] || \
+ mkdir stage3-libiconv; \
+ mv stage3-libiconv libiconv; \
+ mv stage2-libiconv prev-libiconv || test -f stage2-lean
+@endif libiconv
+@if zlib
+ @cd $(HOST_SUBDIR); [ -d stage3-zlib ] || \
+ mkdir stage3-zlib; \
+ mv stage3-zlib zlib; \
+ mv stage2-zlib prev-zlib || test -f stage2-lean
+@endif zlib
+@if lto-plugin
+ @cd $(HOST_SUBDIR); [ -d stage3-lto-plugin ] || \
+ mkdir stage3-lto-plugin; \
+ mv stage3-lto-plugin lto-plugin; \
+ mv stage2-lto-plugin prev-lto-plugin || test -f stage2-lean
+@endif lto-plugin
+@if libctf
+ @cd $(HOST_SUBDIR); [ -d stage3-libctf ] || \
+ mkdir stage3-libctf; \
+ mv stage3-libctf libctf; \
+ mv stage2-libctf prev-libctf || test -f stage2-lean
+@endif libctf
+ @[ -d stage3-$(TARGET_SUBDIR) ] || \
+ mkdir stage3-$(TARGET_SUBDIR); \
+ mv stage3-$(TARGET_SUBDIR) $(TARGET_SUBDIR); \
+ mv stage2-$(TARGET_SUBDIR) prev-$(TARGET_SUBDIR) || test -f stage2-lean
+
+stage3-end::
+@if bfd
+ @if test -d $(HOST_SUBDIR)/bfd; then \
+ cd $(HOST_SUBDIR); mv bfd stage3-bfd; \
+ mv prev-bfd stage2-bfd; : ; \
+ fi
+@endif bfd
+@if opcodes
+ @if test -d $(HOST_SUBDIR)/opcodes; then \
+ cd $(HOST_SUBDIR); mv opcodes stage3-opcodes; \
+ mv prev-opcodes stage2-opcodes; : ; \
+ fi
+@endif opcodes
+@if binutils
+ @if test -d $(HOST_SUBDIR)/binutils; then \
+ cd $(HOST_SUBDIR); mv binutils stage3-binutils; \
+ mv prev-binutils stage2-binutils; : ; \
+ fi
+@endif binutils
+@if fixincludes
+ @if test -d $(HOST_SUBDIR)/fixincludes; then \
+ cd $(HOST_SUBDIR); mv fixincludes stage3-fixincludes; \
+ mv prev-fixincludes stage2-fixincludes; : ; \
+ fi
+@endif fixincludes
+@if gas
+ @if test -d $(HOST_SUBDIR)/gas; then \
+ cd $(HOST_SUBDIR); mv gas stage3-gas; \
+ mv prev-gas stage2-gas; : ; \
+ fi
+@endif gas
+@if gcc
+ @if test -d $(HOST_SUBDIR)/gcc; then \
+ cd $(HOST_SUBDIR); mv gcc stage3-gcc; \
+ mv prev-gcc stage2-gcc; : ; \
+ fi
+@endif gcc
+@if gmp
+ @if test -d $(HOST_SUBDIR)/gmp; then \
+ cd $(HOST_SUBDIR); mv gmp stage3-gmp; \
+ mv prev-gmp stage2-gmp; : ; \
+ fi
+@endif gmp
+@if mpfr
+ @if test -d $(HOST_SUBDIR)/mpfr; then \
+ cd $(HOST_SUBDIR); mv mpfr stage3-mpfr; \
+ mv prev-mpfr stage2-mpfr; : ; \
+ fi
+@endif mpfr
+@if mpc
+ @if test -d $(HOST_SUBDIR)/mpc; then \
+ cd $(HOST_SUBDIR); mv mpc stage3-mpc; \
+ mv prev-mpc stage2-mpc; : ; \
+ fi
+@endif mpc
+@if isl
+ @if test -d $(HOST_SUBDIR)/isl; then \
+ cd $(HOST_SUBDIR); mv isl stage3-isl; \
+ mv prev-isl stage2-isl; : ; \
+ fi
+@endif isl
+@if libelf
+ @if test -d $(HOST_SUBDIR)/libelf; then \
+ cd $(HOST_SUBDIR); mv libelf stage3-libelf; \
+ mv prev-libelf stage2-libelf; : ; \
+ fi
+@endif libelf
+@if gold
+ @if test -d $(HOST_SUBDIR)/gold; then \
+ cd $(HOST_SUBDIR); mv gold stage3-gold; \
+ mv prev-gold stage2-gold; : ; \
+ fi
+@endif gold
+@if intl
+ @if test -d $(HOST_SUBDIR)/intl; then \
+ cd $(HOST_SUBDIR); mv intl stage3-intl; \
+ mv prev-intl stage2-intl; : ; \
+ fi
+@endif intl
+@if ld
+ @if test -d $(HOST_SUBDIR)/ld; then \
+ cd $(HOST_SUBDIR); mv ld stage3-ld; \
+ mv prev-ld stage2-ld; : ; \
+ fi
+@endif ld
+@if libbacktrace
+ @if test -d $(HOST_SUBDIR)/libbacktrace; then \
+ cd $(HOST_SUBDIR); mv libbacktrace stage3-libbacktrace; \
+ mv prev-libbacktrace stage2-libbacktrace; : ; \
+ fi
+@endif libbacktrace
+@if libcpp
+ @if test -d $(HOST_SUBDIR)/libcpp; then \
+ cd $(HOST_SUBDIR); mv libcpp stage3-libcpp; \
+ mv prev-libcpp stage2-libcpp; : ; \
+ fi
+@endif libcpp
+@if libdecnumber
+ @if test -d $(HOST_SUBDIR)/libdecnumber; then \
+ cd $(HOST_SUBDIR); mv libdecnumber stage3-libdecnumber; \
+ mv prev-libdecnumber stage2-libdecnumber; : ; \
+ fi
+@endif libdecnumber
+@if libiberty
+ @if test -d $(HOST_SUBDIR)/libiberty; then \
+ cd $(HOST_SUBDIR); mv libiberty stage3-libiberty; \
+ mv prev-libiberty stage2-libiberty; : ; \
+ fi
+@endif libiberty
+@if libiberty-linker-plugin
+ @if test -d $(HOST_SUBDIR)/libiberty-linker-plugin; then \
+ cd $(HOST_SUBDIR); mv libiberty-linker-plugin stage3-libiberty-linker-plugin; \
+ mv prev-libiberty-linker-plugin stage2-libiberty-linker-plugin; : ; \
+ fi
+@endif libiberty-linker-plugin
+@if libiconv
+ @if test -d $(HOST_SUBDIR)/libiconv; then \
+ cd $(HOST_SUBDIR); mv libiconv stage3-libiconv; \
+ mv prev-libiconv stage2-libiconv; : ; \
+ fi
+@endif libiconv
+@if zlib
+ @if test -d $(HOST_SUBDIR)/zlib; then \
+ cd $(HOST_SUBDIR); mv zlib stage3-zlib; \
+ mv prev-zlib stage2-zlib; : ; \
+ fi
+@endif zlib
+@if lto-plugin
+ @if test -d $(HOST_SUBDIR)/lto-plugin; then \
+ cd $(HOST_SUBDIR); mv lto-plugin stage3-lto-plugin; \
+ mv prev-lto-plugin stage2-lto-plugin; : ; \
+ fi
+@endif lto-plugin
+@if libctf
+ @if test -d $(HOST_SUBDIR)/libctf; then \
+ cd $(HOST_SUBDIR); mv libctf stage3-libctf; \
+ mv prev-libctf stage2-libctf; : ; \
+ fi
+@endif libctf
+ @if test -d $(TARGET_SUBDIR); then \
+ mv $(TARGET_SUBDIR) stage3-$(TARGET_SUBDIR); \
+ mv prev-$(TARGET_SUBDIR) stage2-$(TARGET_SUBDIR); : ; \
+ fi
+ rm -f stage_current
+
+# Bubble a bug fix through all the stages up to stage 3. They are
+# remade, but not reconfigured. The next stage (if any) will not be
+# reconfigured either.
+.PHONY: stage3-bubble
+stage3-bubble:: stage2-bubble
+ @r=`${PWD_COMMAND}`; export r; \
+ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+ if test -f stage3-lean || test -f stage2-lean ; then \
+ echo Skipping rebuild of stage3; \
+ else \
+ $(MAKE) stage3-start; \
+ if $(LEAN); then \
+ rm -rf stage1-*; \
+ $(STAMP) stage1-lean; \
+ fi; \
+ $(MAKE) $(RECURSE_FLAGS_TO_PASS) all-stage3; \
+ fi
+ $(MAKE) $(RECURSE_FLAGS_TO_PASS) compare
+
+.PHONY: all-stage3 clean-stage3
+do-clean: clean-stage3
+
+# FIXME: Will not need to be conditional when toplevel bootstrap is the
+# only possibility, but now it conflicts with no-bootstrap rules
+@if gcc-bootstrap
+
+compare:
+ @r=`${PWD_COMMAND}`; export r; \
+ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+ if test -f stage2-lean; then \
+ echo Cannot compare object files as stage 2 was deleted.; \
+ exit 0; \
+ fi; \
+ : $(MAKE); $(stage); \
+ rm -f .bad_compare; \
+ echo Comparing stages 2 and 3; \
+ sed=`echo stage3 | sed 's,^stage,,;s,.,.,g'`; \
+ files=`find stage3-* -name "*$(objext)" -print | \
+ sed -n s,^stage$$sed-,,p`; \
+ for file in $${files} ${extra-compare}; do \
+ f1=$$r/stage2-$$file; f2=$$r/stage3-$$file; \
+ if test ! -f $$f1; then continue; fi; \
+ $(do-compare) > /dev/null 2>&1; \
+ if test $$? -eq 1; then \
+ case $$file in \
+ @compare_exclusions@) \
+ echo warning: $$file differs ;; \
+ *) \
+ echo $$file differs >> .bad_compare ;; \
+ esac; \
+ fi; \
+ done; \
+ if [ -f .bad_compare ]; then \
+ echo "Bootstrap comparison failure!"; \
+ cat .bad_compare; \
+ exit 1; \
+ else \
+ echo Comparison successful.; \
+ fi; \
+ $(STAMP) compare
+ if $(LEAN); then \
+ rm -rf stage2-*; \
+ $(STAMP) stage2-lean; \
+ fi
+
+
+
+.PHONY: bootstrap bootstrap-lean
+bootstrap:
+ echo stage3 > stage_final
+ @r=`${PWD_COMMAND}`; export r; \
+ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+ $(MAKE) $(RECURSE_FLAGS_TO_PASS) stage3-bubble
+ @: $(MAKE); $(unstage)
+ @r=`${PWD_COMMAND}`; export r; \
+ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+ TFLAGS="$(STAGE3_TFLAGS)"; \
+ $(MAKE) $(TARGET_FLAGS_TO_PASS) all-host all-target
+
+bootstrap-lean:
+ echo stage3 > stage_final
+ @r=`${PWD_COMMAND}`; export r; \
+ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+ $(MAKE) $(RECURSE_FLAGS_TO_PASS) LEAN=: stage3-bubble
+ @: $(MAKE); $(unstage)
+ @r=`${PWD_COMMAND}`; export r; \
+ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+ TFLAGS="$(STAGE3_TFLAGS)"; \
+ $(MAKE) $(TARGET_FLAGS_TO_PASS) all-host all-target
+
+
+# Rules to wipe a stage and all the following ones, also used for cleanstrap
+distclean-stage2:: distclean-stage3
+.PHONY: distclean-stage3
+distclean-stage3::
+ @: $(MAKE); $(stage)
+ @test "`cat stage_last`" != stage3 || rm -f stage_last
+ rm -rf stage3-* compare
+
+
+.PHONY: cleanstrap
+cleanstrap: do-distclean local-clean
+ echo stage3 > stage_final
+ @r=`${PWD_COMMAND}`; export r; \
+ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+ $(MAKE) $(RECURSE_FLAGS_TO_PASS) stage3-bubble
+ @: $(MAKE); $(unstage)
+ @r=`${PWD_COMMAND}`; export r; \
+ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+ TFLAGS="$(STAGE3_TFLAGS)"; \
+ $(MAKE) $(TARGET_FLAGS_TO_PASS) all-host all-target
+
+@endif gcc-bootstrap
+
+
+.PHONY: stage4-start stage4-end
+
+stage4-start::
+ @: $(MAKE); $(stage); \
+ echo stage4 > stage_current; \
+ echo stage4 > stage_last; \
+ $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)
+@if bfd
+ @cd $(HOST_SUBDIR); [ -d stage4-bfd ] || \
+ mkdir stage4-bfd; \
+ mv stage4-bfd bfd; \
+ mv stage3-bfd prev-bfd || test -f stage3-lean
+@endif bfd
+@if opcodes
+ @cd $(HOST_SUBDIR); [ -d stage4-opcodes ] || \
+ mkdir stage4-opcodes; \
+ mv stage4-opcodes opcodes; \
+ mv stage3-opcodes prev-opcodes || test -f stage3-lean
+@endif opcodes
+@if binutils
+ @cd $(HOST_SUBDIR); [ -d stage4-binutils ] || \
+ mkdir stage4-binutils; \
+ mv stage4-binutils binutils; \
+ mv stage3-binutils prev-binutils || test -f stage3-lean
+@endif binutils
+@if fixincludes
+ @cd $(HOST_SUBDIR); [ -d stage4-fixincludes ] || \
+ mkdir stage4-fixincludes; \
+ mv stage4-fixincludes fixincludes; \
+ mv stage3-fixincludes prev-fixincludes || test -f stage3-lean
+@endif fixincludes
+@if gas
+ @cd $(HOST_SUBDIR); [ -d stage4-gas ] || \
+ mkdir stage4-gas; \
+ mv stage4-gas gas; \
+ mv stage3-gas prev-gas || test -f stage3-lean
+@endif gas
+@if gcc
+ @cd $(HOST_SUBDIR); [ -d stage4-gcc ] || \
+ mkdir stage4-gcc; \
+ mv stage4-gcc gcc; \
+ mv stage3-gcc prev-gcc || test -f stage3-lean
+@endif gcc
+@if gmp
+ @cd $(HOST_SUBDIR); [ -d stage4-gmp ] || \
+ mkdir stage4-gmp; \
+ mv stage4-gmp gmp; \
+ mv stage3-gmp prev-gmp || test -f stage3-lean
+@endif gmp
+@if mpfr
+ @cd $(HOST_SUBDIR); [ -d stage4-mpfr ] || \
+ mkdir stage4-mpfr; \
+ mv stage4-mpfr mpfr; \
+ mv stage3-mpfr prev-mpfr || test -f stage3-lean
+@endif mpfr
+@if mpc
+ @cd $(HOST_SUBDIR); [ -d stage4-mpc ] || \
+ mkdir stage4-mpc; \
+ mv stage4-mpc mpc; \
+ mv stage3-mpc prev-mpc || test -f stage3-lean
+@endif mpc
+@if isl
+ @cd $(HOST_SUBDIR); [ -d stage4-isl ] || \
+ mkdir stage4-isl; \
+ mv stage4-isl isl; \
+ mv stage3-isl prev-isl || test -f stage3-lean
+@endif isl
+@if libelf
+ @cd $(HOST_SUBDIR); [ -d stage4-libelf ] || \
+ mkdir stage4-libelf; \
+ mv stage4-libelf libelf; \
+ mv stage3-libelf prev-libelf || test -f stage3-lean
+@endif libelf
+@if gold
+ @cd $(HOST_SUBDIR); [ -d stage4-gold ] || \
+ mkdir stage4-gold; \
+ mv stage4-gold gold; \
+ mv stage3-gold prev-gold || test -f stage3-lean
+@endif gold
+@if intl
+ @cd $(HOST_SUBDIR); [ -d stage4-intl ] || \
+ mkdir stage4-intl; \
+ mv stage4-intl intl; \
+ mv stage3-intl prev-intl || test -f stage3-lean
+@endif intl
+@if ld
+ @cd $(HOST_SUBDIR); [ -d stage4-ld ] || \
+ mkdir stage4-ld; \
+ mv stage4-ld ld; \
+ mv stage3-ld prev-ld || test -f stage3-lean
+@endif ld
+@if libbacktrace
+ @cd $(HOST_SUBDIR); [ -d stage4-libbacktrace ] || \
+ mkdir stage4-libbacktrace; \
+ mv stage4-libbacktrace libbacktrace; \
+ mv stage3-libbacktrace prev-libbacktrace || test -f stage3-lean
+@endif libbacktrace
+@if libcpp
+ @cd $(HOST_SUBDIR); [ -d stage4-libcpp ] || \
+ mkdir stage4-libcpp; \
+ mv stage4-libcpp libcpp; \
+ mv stage3-libcpp prev-libcpp || test -f stage3-lean
+@endif libcpp
+@if libdecnumber
+ @cd $(HOST_SUBDIR); [ -d stage4-libdecnumber ] || \
+ mkdir stage4-libdecnumber; \
+ mv stage4-libdecnumber libdecnumber; \
+ mv stage3-libdecnumber prev-libdecnumber || test -f stage3-lean
+@endif libdecnumber
+@if libiberty
+ @cd $(HOST_SUBDIR); [ -d stage4-libiberty ] || \
+ mkdir stage4-libiberty; \
+ mv stage4-libiberty libiberty; \
+ mv stage3-libiberty prev-libiberty || test -f stage3-lean
+@endif libiberty
+@if libiberty-linker-plugin
+ @cd $(HOST_SUBDIR); [ -d stage4-libiberty-linker-plugin ] || \
+ mkdir stage4-libiberty-linker-plugin; \
+ mv stage4-libiberty-linker-plugin libiberty-linker-plugin; \
+ mv stage3-libiberty-linker-plugin prev-libiberty-linker-plugin || test -f stage3-lean
+@endif libiberty-linker-plugin
+@if libiconv
+ @cd $(HOST_SUBDIR); [ -d stage4-libiconv ] || \
+ mkdir stage4-libiconv; \
+ mv stage4-libiconv libiconv; \
+ mv stage3-libiconv prev-libiconv || test -f stage3-lean
+@endif libiconv
+@if zlib
+ @cd $(HOST_SUBDIR); [ -d stage4-zlib ] || \
+ mkdir stage4-zlib; \
+ mv stage4-zlib zlib; \
+ mv stage3-zlib prev-zlib || test -f stage3-lean