-# Only build the C compiler for stage1, because that is the only one that
-# we can guarantee will build with the native compiler, and also it is the
-# only thing useful for building stage2. STAGE1_CFLAGS (via CFLAGS),
-# MAKEINFO and MAKEINFOFLAGS are explicitly passed here to make them
-# overrideable (for a bootstrap build stage1 also builds gcc.info).
-
-STAGE1_CFLAGS=@stage1_cflags@
-STAGE1_LANGUAGES=@stage1_languages@
-
-# For stage 1:
-# * We force-disable intermodule optimizations, even if
-# --enable-intermodule was passed, since the installed compiler probably
-# can't handle them. Luckily, autoconf always respects
-# the last argument when conflicting --enable arguments are passed.
-# * Likewise, we force-disable coverage flags, since the installed compiler
-# probably has never heard of them.
-# * We build only C (and possibly Ada).
-configure-stage1-gcc:
- echo configure-stage1-gcc > stage_last ; \
- if [ -f stage1-gcc/Makefile ] ; then \
- $(STAMP) configure-stage1-gcc ; \
- exit 0; \
- else \
- true ; \
- fi ; \
- [ -d stage1-gcc ] || mkdir stage1-gcc; \
- mv stage1-gcc gcc ; \
- r=`${PWD_COMMAND}`; export r; \
- s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
- CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \
- TOPLEVEL_CONFIGURE_ARGUMENTS="$(TOPLEVEL_CONFIGURE_ARGUMENTS)"; export TOPLEVEL_CONFIGURE_ARGUMENTS; \
- CC="$(CC)"; export CC; \
- CFLAGS="$(CFLAGS)"; export CFLAGS; \
- CXX="$(CXX)"; export CXX; \
- CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \
- AR="$(AR)"; export AR; \
- AS="$(AS)"; export AS; \
- CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \
- DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \
- LD="$(LD)"; export LD; \
- NM="$(NM)"; export NM; \
- RANLIB="$(RANLIB)"; export RANLIB; \
- WINDRES="$(WINDRES)"; export WINDRES; \
- OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \
- OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \
- echo Configuring stage 1 in gcc; \
- cd gcc || exit 1; \
- case $(srcdir) in \
- \.) \
- srcdiroption="--srcdir=."; \
- libsrcdir=".";; \
- /* | [A-Za-z]:[\\/]*) \
- srcdiroption="--srcdir=$(srcdir)/gcc"; \
- libsrcdir="$$s/gcc";; \
- *) \
- srcdiroption="--srcdir=../$(srcdir)/gcc"; \
- libsrcdir="$$s/gcc";; \
- esac; \
- $(SHELL) $${libsrcdir}/configure \
- $(HOST_CONFIGARGS) $${srcdiroption} \
- --disable-intermodule --disable-coverage \
- --enable-languages="$(STAGE1_LANGUAGES)"; \
- cd .. ; \
- mv gcc stage1-gcc ; \
- $(STAMP) configure-stage1-gcc
-
-# Real targets act phony if they depend on phony targets; this hack
-# prevents gratuitous rebuilding of stage 1.
-prebootstrap:
- $(MAKE) all-bootstrap
- $(STAMP) prebootstrap
-
-all-stage1-gcc: configure-stage1-gcc prebootstrap
- echo all-stage1-gcc > stage_last ; \
- r=`${PWD_COMMAND}`; export r; \
- s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
- mv stage1-gcc gcc ; \
- cd gcc && \
- $(MAKE) $(GCC_FLAGS_TO_PASS) \
- CFLAGS="$(STAGE1_CFLAGS)" \
- || exit 1 ; \
- cd .. ; \
- mv gcc stage1-gcc ; \
- $(STAMP) all-stage1-gcc
-
-# TODO: Deal with STAGE_PREFIX (which is only for ada, incidentally)
-# Possibly pass --enable-werror-always (depending on --enable-werror);
-# that's what @stage2_werror_flag@ is for
-configure-stage2-gcc: all-stage1-gcc
- echo configure-stage2-gcc > stage_last ; \
- if [ -f stage2-gcc/Makefile ] ; then \
- $(STAMP) configure-stage2-gcc ; \
- exit 0; \
- else \
- true ; \
- fi ; \
- [ -d stage2-gcc ] || mkdir stage2-gcc; \
- mv stage2-gcc gcc ; \
- mv stage1-gcc prev-gcc ; \
- r=`${PWD_COMMAND}`; export r; \
- s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
- CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \
- TOPLEVEL_CONFIGURE_ARGUMENTS="$(TOPLEVEL_CONFIGURE_ARGUMENTS)"; export TOPLEVEL_CONFIGURE_ARGUMENTS; \
- CFLAGS="$(CFLAGS)"; export CFLAGS; \
- CXX="$(CXX)"; export CXX; \
- CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \
- AR="$(AR)"; export AR; \
- AS="$(AS)"; export AS; \
- DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \
- LD="$(LD)"; export LD; \
- NM="$(NM)"; export NM; \
- RANLIB="$(RANLIB)"; export RANLIB; \
- WINDRES="$(WINDRES)"; export WINDRES; \
- OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \
- OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \
- CC="$(STAGE_CC_WRAPPER) $$r/prev-gcc/xgcc$(exeext) -B$$r/prev-gcc/ -B$(build_tooldir)/bin/"; export CC; \
- CC_FOR_BUILD="$(STAGE_CC_WRAPPER) $$r/prev-gcc/xgcc$(exeext) -B$$r/prev-gcc/ -B$(build_tooldir)/bin/"; export CC_FOR_BUILD; \
- echo Configuring stage 2 in gcc; \
- cd gcc || exit 1; \
- case $(srcdir) in \
- \.) \
- srcdiroption="--srcdir=."; \
- libsrcdir=".";; \
- /* | [A-Za-z]:[\\/]*) \
- srcdiroption="--srcdir=$(srcdir)/gcc"; \
- libsrcdir="$$s/gcc";; \
- *) \
- srcdiroption="--srcdir=../$(srcdir)/gcc"; \
- libsrcdir="$$s/gcc";; \
- esac; \
- $(SHELL) $${libsrcdir}/configure \
- $(HOST_CONFIGARGS) $${srcdiroption} @stage2_werror_flag@ ; \
- cd .. ; \
- mv gcc stage2-gcc ; \
- mv prev-gcc stage1-gcc ; \
- $(STAMP) configure-stage2-gcc