OSDN Git Service

2009-05-06 Tobias Burnus <burnus@net-b.de>
[pf3gnuchains/gcc-fork.git] / Makefile.tpl
index 6164a41..dd2e1c1 100644 (file)
@@ -6,11 +6,12 @@ in
 #
 # Makefile for directory with subdirs to build.
 #   Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
-#   1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation
+#   1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009
+#   Free Software Foundation
 #
 # This file is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
+# the Free Software Foundation; either version 3 of the License, or
 # (at your option) any later version.
 # 
 # This program is distributed in the hope that it will be useful,
@@ -19,10 +20,18 @@ in
 # GNU General Public License for more details.
 # 
 # You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+# along with this program; see the file COPYING3.  If not see
+# <http://www.gnu.org/licenses/>.
 #
 
+# First, test for a proper version of make, but only where one is required.
+
+@if gcc
+ifeq (,$(.VARIABLES)) # The variable .VARIABLES, new with 3.80, is never empty.
+$(error GNU make version 3.80 or newer is required.)
+endif
+@endif gcc
+
 # -------------------------------
 # Standard Autoconf-set variables
 # -------------------------------
@@ -100,6 +109,11 @@ GDB_NLM_DEPS =
 # the libraries.
 RPATH_ENVVAR = @RPATH_ENVVAR@
 
+# On targets where RPATH_ENVVAR is PATH, a subdirectory of the GCC build path
+# is used instead of the directory itself to avoid including built
+# executables in PATH.
+GCC_SHLIB_SUBDIR = @GCC_SHLIB_SUBDIR@
+
 # Build programs are put under this directory.
 BUILD_SUBDIR = @build_subdir@
 # This is set by the configure script to the arguments to use when configuring
@@ -136,7 +150,14 @@ BUILD_EXPORTS = \
        LDFLAGS="$(LDFLAGS_FOR_BUILD)"; export LDFLAGS; \
        NM="$(NM_FOR_BUILD)"; export NM; \
        RANLIB="$(RANLIB_FOR_BUILD)"; export RANLIB; \
-       WINDRES="$(WINDRES_FOR_BUILD)"; export WINDRES;
+       WINDRES="$(WINDRES_FOR_BUILD)"; export WINDRES; \
+       WINDMC="$(WINDMC_FOR_BUILD)"; export WINDMC;
+
+# These variables must be set on the make command line for directories
+# built for the build system to override those in BASE_FLAGS_TO_PASSS.
+EXTRA_BUILD_FLAGS = \
+       CFLAGS="$(CFLAGS_FOR_BUILD)" \
+       LDFLAGS="$(LDFLAGS_FOR_BUILD)"
 
 # This is the list of directories to built for the host system.
 SUBDIRS = @configdirs@
@@ -152,6 +173,7 @@ HOST_SUBDIR = @host_subdir@
 HOST_EXPORTS = \
        $(BASE_EXPORTS) \
        CC="$(CC)"; export CC; \
+       ADA_CFLAGS="$(ADA_CFLAGS)"; export ADA_CFLAGS; \
        CFLAGS="$(CFLAGS)"; export CFLAGS; \
        CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \
        CXX="$(CXX)"; export CXX; \
@@ -165,6 +187,7 @@ HOST_EXPORTS = \
        NM="$(NM)"; export NM; \
        RANLIB="$(RANLIB)"; export RANLIB; \
        WINDRES="$(WINDRES)"; export WINDRES; \
+       WINDMC="$(WINDMC)"; export WINDMC; \
        OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \
        OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \
        AR_FOR_TARGET="$(AR_FOR_TARGET)"; export AR_FOR_TARGET; \
@@ -177,6 +200,10 @@ HOST_EXPORTS = \
        TOPLEVEL_CONFIGURE_ARGUMENTS="$(TOPLEVEL_CONFIGURE_ARGUMENTS)"; export TOPLEVEL_CONFIGURE_ARGUMENTS; \
        GMPLIBS="$(HOST_GMPLIBS)"; export GMPLIBS; \
        GMPINC="$(HOST_GMPINC)"; export GMPINC; \
+       PPLLIBS="$(HOST_PPLLIBS)"; export PPLLIBS; \
+       PPLINC="$(HOST_PPLINC)"; export PPLINC; \
+       CLOOGLIBS="$(HOST_CLOOGLIBS)"; export CLOOGLIBS; \
+       CLOOGINC="$(HOST_CLOOGINC)"; export CLOOGINC; \
 @if gcc-bootstrap
        $(RPATH_ENVVAR)=`echo "$(TARGET_LIB_PATH)$$$(RPATH_ENVVAR)" | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'`; export $(RPATH_ENVVAR); \
 @endif gcc-bootstrap
@@ -191,6 +218,7 @@ POSTSTAGE1_HOST_EXPORTS = \
          $$r/$(HOST_SUBDIR)/prev-gcc/xgcc$(exeext) \
          -B$$r/$(HOST_SUBDIR)/prev-gcc/ \
          -B$(build_tooldir)/bin/"; export CC_FOR_BUILD; \
+       GNATBIND="$$r/$(HOST_SUBDIR)/prev-gcc/gnatbind"; export GNATBIND \
        LDFLAGS="$(BOOT_LDFLAGS)"; export LDFLAGS;
 
 # Target libraries are put under this directory:
@@ -205,10 +233,10 @@ BASE_TARGET_EXPORTS = \
        AR="$(AR_FOR_TARGET)"; export AR; \
        AS="$(COMPILER_AS_FOR_TARGET)"; export AS; \
        CC="$(CC_FOR_TARGET)"; export CC; \
-       CFLAGS="$(CFLAGS_FOR_TARGET)"; export CFLAGS; \
+       CFLAGS="$(CFLAGS_FOR_TARGET) $(SYSROOT_CFLAGS_FOR_TARGET) $(DEBUG_PREFIX_CFLAGS_FOR_TARGET)"; export CFLAGS; \
        CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \
        CPPFLAGS="$(CPPFLAGS_FOR_TARGET)"; export CPPFLAGS; \
-       CXXFLAGS="$(CXXFLAGS_FOR_TARGET)"; export CXXFLAGS; \
+       CXXFLAGS="$(CXXFLAGS_FOR_TARGET) $(SYSROOT_CFLAGS_FOR_TARGET) $(DEBUG_PREFIX_CFLAGS_FOR_TARGET)"; export CXXFLAGS; \
        GCJ="$(GCJ_FOR_TARGET)"; export GCJ; \
        GFORTRAN="$(GFORTRAN_FOR_TARGET)"; export GFORTRAN; \
        DLLTOOL="$(DLLTOOL_FOR_TARGET)"; export DLLTOOL; \
@@ -220,6 +248,7 @@ BASE_TARGET_EXPORTS = \
        RANLIB="$(RANLIB_FOR_TARGET)"; export RANLIB; \
        STRIP="$(STRIP_FOR_TARGET)"; export STRIP; \
        WINDRES="$(WINDRES_FOR_TARGET)"; export WINDRES; \
+       WINDMC="$(WINDMC_FOR_TARGET)"; export WINDMC; \
        $(RPATH_ENVVAR)=`echo "$(HOST_LIB_PATH)$(TARGET_LIB_PATH)$$$(RPATH_ENVVAR)" | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'`; export $(RPATH_ENVVAR);
 
 RAW_CXX_TARGET_EXPORTS = \
@@ -235,6 +264,14 @@ NORMAL_TARGET_EXPORTS = \
 HOST_GMPLIBS = @gmplibs@
 HOST_GMPINC = @gmpinc@
 
+# Where to find PPL
+HOST_PPLLIBS = @ppllibs@
+HOST_PPLINC = @pplinc@
+
+# Where to find CLOOG
+HOST_CLOOGLIBS = @clooglibs@
+HOST_CLOOGINC = @clooginc@
+
 # ----------------------------------------------
 # Programs producing files for the BUILD machine
 # ----------------------------------------------
@@ -251,10 +288,21 @@ PWD_COMMAND = $${PWDCMD-pwd}
 
 # compilers to use to create programs which must be run in the build
 # environment.
+AR_FOR_BUILD = @AR_FOR_BUILD@
+AS_FOR_BUILD = @AS_FOR_BUILD@
 CC_FOR_BUILD = @CC_FOR_BUILD@
 CFLAGS_FOR_BUILD = @CFLAGS_FOR_BUILD@
-
-CXX_FOR_BUILD = $(CXX)
+CXXFLAGS_FOR_BUILD = @CXXFLAGS_FOR_BUILD@
+CXX_FOR_BUILD = @CXX_FOR_BUILD@
+DLLTOOL_FOR_BUILD = @DLLTOOL_FOR_BUILD@
+GCJ_FOR_BUILD = @GCJ_FOR_BUILD@
+GFORTRAN_FOR_BUILD = @GFORTRAN_FOR_BUILD@
+LDFLAGS_FOR_BUILD = @LDFLAGS_FOR_BUILD@
+LD_FOR_BUILD = @LD_FOR_BUILD@
+NM_FOR_BUILD = @NM_FOR_BUILD@
+RANLIB_FOR_BUILD = @RANLIB_FOR_BUILD@
+WINDMC_FOR_BUILD = @WINDMC_FOR_BUILD@
+WINDRES_FOR_BUILD = @WINDRES_FOR_BUILD@
 
 # Special variables passed down in EXTRA_GCC_FLAGS.  They are defined
 # here so that they can be overridden by Makefile fragments.
@@ -265,6 +313,7 @@ BUILD_PREFIX_1 = @BUILD_PREFIX_1@
 # here so that they can be overridden by Makefile fragments.
 BOOT_CFLAGS= -g -O2
 BOOT_LDFLAGS=
+BOOT_ADAFLAGS=-gnatpg -gnata
 
 BISON = @BISON@
 YACC = @YACC@
@@ -298,6 +347,7 @@ OBJDUMP = @OBJDUMP@
 RANLIB = @RANLIB@
 STRIP = @STRIP@
 WINDRES = @WINDRES@
+WINDMC = @WINDMC@
 
 GNATBIND = @GNATBIND@
 GNATMAKE = @GNATMAKE@
@@ -307,7 +357,6 @@ LDFLAGS = @LDFLAGS@
 LIBCFLAGS = $(CFLAGS)
 CXXFLAGS = @CXXFLAGS@
 LIBCXXFLAGS = $(CXXFLAGS) -fno-implicit-templates
-PICFLAG = 
 
 # 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
@@ -315,10 +364,23 @@ PICFLAG =
 # 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_CHECKING=@stage1_checking@
 STAGE1_LANGUAGES=@stage1_languages@
 
+STAGE1_CFLAGS=@stage1_cflags@
+STAGE2_CFLAGS=$(BOOT_CFLAGS)
+STAGE3_CFLAGS=$(BOOT_CFLAGS)
+STAGE4_CFLAGS=$(BOOT_CFLAGS)
+
+STAGE1_LIBCFLAGS=$(CFLAGS_FOR_TARGET)
+STAGE2_LIBCFLAGS=$(CFLAGS_FOR_TARGET)
+STAGE3_LIBCFLAGS=$(CFLAGS_FOR_TARGET)
+STAGE4_LIBCFLAGS=$(CFLAGS_FOR_TARGET)
+
+do-compare = @do_compare@
+do-compare3 = $(do-compare)
+do-compare-debug = $(SHELL) $(srcdir)/contrib/compare-debug $$f1 $$f2
+
 # -----------------------------------------------
 # Programs producing files for the TARGET machine
 # -----------------------------------------------
@@ -347,22 +409,20 @@ OBJDUMP_FOR_TARGET=@OBJDUMP_FOR_TARGET@
 RANLIB_FOR_TARGET=@RANLIB_FOR_TARGET@
 STRIP_FOR_TARGET=@STRIP_FOR_TARGET@
 WINDRES_FOR_TARGET=@WINDRES_FOR_TARGET@
+WINDMC_FOR_TARGET=@WINDMC_FOR_TARGET@
 
 COMPILER_AS_FOR_TARGET=@COMPILER_AS_FOR_TARGET@
 COMPILER_LD_FOR_TARGET=@COMPILER_LD_FOR_TARGET@
 COMPILER_NM_FOR_TARGET=@COMPILER_NM_FOR_TARGET@
 
-# During gcc bootstrap, if we use some random cc for stage1 then
-# CFLAGS will be just -g.  We want to ensure that TARGET libraries
-# (which we know are built with gcc) are built with optimizations so
-# prepend -O2 when setting CFLAGS_FOR_TARGET.
-CFLAGS_FOR_TARGET = -O2 $(CFLAGS) $(SYSROOT_CFLAGS_FOR_TARGET)
+CFLAGS_FOR_TARGET = @CFLAGS_FOR_TARGET@
+CXXFLAGS_FOR_TARGET = @CXXFLAGS_FOR_TARGET@
 SYSROOT_CFLAGS_FOR_TARGET = @SYSROOT_CFLAGS_FOR_TARGET@
-CXXFLAGS_FOR_TARGET = $(CXXFLAGS) $(SYSROOT_CFLAGS_FOR_TARGET)
+DEBUG_PREFIX_CFLAGS_FOR_TARGET = @DEBUG_PREFIX_CFLAGS_FOR_TARGET@
+
 LIBCFLAGS_FOR_TARGET = $(CFLAGS_FOR_TARGET)
 LIBCXXFLAGS_FOR_TARGET = $(CXXFLAGS_FOR_TARGET) -fno-implicit-templates
 LDFLAGS_FOR_TARGET = 
-PICFLAG_FOR_TARGET = 
 
 # ------------------------------------
 # Miscellaneous targets and flag lists
@@ -399,7 +459,7 @@ HOST_LIB_PATH = [+ FOR host_modules +][+
 
 # Define HOST_LIB_PATH_gcc here, for the sake of TARGET_LIB_PATH, ouch
 @if gcc
-HOST_LIB_PATH_gcc = $$r/$(HOST_SUBDIR)/gcc:$$r/$(HOST_SUBDIR)/prev-gcc:
+HOST_LIB_PATH_gcc = $$r/$(HOST_SUBDIR)/gcc$(GCC_SHLIB_SUBDIR):$$r/$(HOST_SUBDIR)/prev-gcc$(GCC_SHLIB_SUBDIR):
 @endif gcc
 
 [+ FOR host_modules +][+ IF lib_path +]
@@ -434,7 +494,8 @@ EXTRA_HOST_FLAGS = \
        'OBJDUMP=$(OBJDUMP)' \
        'RANLIB=$(RANLIB)' \
        'STRIP=$(STRIP)' \
-       'WINDRES=$(WINDRES)'
+       'WINDRES=$(WINDRES)' \
+       'WINDMC=$(WINDMC)'
 
 FLAGS_TO_PASS = $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS)
 
@@ -453,31 +514,32 @@ X11_FLAGS_TO_PASS = \
 # Flags to pass to stage2 and later makes.
 
 POSTSTAGE1_FLAGS_TO_PASS = \
-       CC="$${CC}" CC_FOR_BUILD="$${CC_FOR_BUILD}" \
-       GNATBIND="$$r/$(HOST_SUBDIR)/prev-gcc/gnatbind" \
+       CC="$${CC}" CC_FOR_BUILD="$${CC_FOR_BUILD}" GNATBIND="$${GNATBIND}" \
        LDFLAGS="$(BOOT_LDFLAGS)" \
        "`echo 'ADAFLAGS=$(BOOT_ADAFLAGS)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`"
 
 # Flags to pass down to makes which are built with the target environment.
 # The double $ decreases the length of the command line; those variables
 # are set in BASE_FLAGS_TO_PASS, and the sub-make will expand them.  The
-# COMPILER_ prefixed variables are not passed down so we expand them here.
+# *_CFLAGS_FOR_TARGET variables are not passed down and most often empty,
+# so we expand them here.
 EXTRA_TARGET_FLAGS = \
        'AR=$$(AR_FOR_TARGET)' \
        'AS=$(COMPILER_AS_FOR_TARGET)' \
        'CC=$$(CC_FOR_TARGET)' \
-       'CFLAGS=$$(CFLAGS_FOR_TARGET)' \
+       'CFLAGS=$$(CFLAGS_FOR_TARGET) $(SYSROOT_CFLAGS_FOR_TARGET) $(DEBUG_PREFIX_CFLAGS_FOR_TARGET)' \
        'CXX=$$(CXX_FOR_TARGET)' \
-       'CXXFLAGS=$$(CXXFLAGS_FOR_TARGET)' \
+       'CXXFLAGS=$$(CXXFLAGS_FOR_TARGET) $(SYSROOT_CFLAGS_FOR_TARGET) $(DEBUG_PREFIX_CFLAGS_FOR_TARGET)' \
        'DLLTOOL=$$(DLLTOOL_FOR_TARGET)' \
        'LD=$(COMPILER_LD_FOR_TARGET)' \
        'LDFLAGS=$$(LDFLAGS_FOR_TARGET)' \
-       'LIBCFLAGS=$$(LIBCFLAGS_FOR_TARGET)' \
-       'LIBCXXFLAGS=$$(LIBCXXFLAGS_FOR_TARGET)' \
+       'LIBCFLAGS=$$(LIBCFLAGS_FOR_TARGET) $(SYSROOT_CFLAGS_FOR_TARGET) $(DEBUG_PREFIX_CFLAGS_FOR_TARGET)' \
+       'LIBCXXFLAGS=$$(LIBCXXFLAGS_FOR_TARGET) $(SYSROOT_CFLAGS_FOR_TARGET) $(DEBUG_PREFIX_CFLAGS_FOR_TARGET)' \
        'NM=$(COMPILER_NM_FOR_TARGET)' \
        'OBJDUMP=$$(OBJDUMP_FOR_TARGET)' \
        'RANLIB=$$(RANLIB_FOR_TARGET)' \
-       'WINDRES=$$(WINDRES_FOR_TARGET)'
+       'WINDRES=$$(WINDRES_FOR_TARGET)' \
+       'WINDMC=$$(WINDMC_FOR_TARGET)'
 
 TARGET_FLAGS_TO_PASS = $(BASE_FLAGS_TO_PASS) $(EXTRA_TARGET_FLAGS)
 
@@ -820,9 +882,11 @@ configure-stage[+id+]-[+prefix+][+module+]:
        fi; \
        [+ ENDIF check_multilibs +]test ! -f [+subdir+]/[+module+]/Makefile || exit 0; \
        [+exports+][+ IF prev +] \
-       [+poststage1_exports+][+ ENDIF prev +] \
+       [+poststage1_exports+][+ ENDIF prev +] [+ IF prefix +] \
+       CFLAGS="[+stage_libcflags+] $(SYSROOT_CFLAGS_FOR_TARGET) $(DEBUG_PREFIX_CFLAGS_FOR_TARGET)"; export CFLAGS; \
+       CXXFLAGS="[+stage_libcflags+] $(SYSROOT_CFLAGS_FOR_TARGET) $(DEBUG_PREFIX_CFLAGS_FOR_TARGET)"; export CXXFLAGS; [+ ELSE +] \
        CFLAGS="[+stage_cflags+]"; export CFLAGS; \
-       LIBCFLAGS="[+stage_cflags+]"; export LIBCFLAGS; \
+       CXXFLAGS="[+stage_cflags+]"; export CXXFLAGS; [+ ENDIF +] \
        echo Configuring stage [+id+] in [+subdir+]/[+module+] ; \
        $(SHELL) $(srcdir)/mkinstalldirs [+subdir+]/[+module+] ; \
        cd [+subdir+]/[+module+] || exit 1; \
@@ -859,7 +923,8 @@ all-[+prefix+][+module+]: configure-[+prefix+][+module+][+ IF bootstrap +][+ ELS
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        [+exports+] \
        (cd [+subdir+]/[+module+] && \
-         $(MAKE) [+args+] [+extra_make_flags+] $(TARGET-[+prefix+][+module+]))
+         $(MAKE) $(BASE_FLAGS_TO_PASS) [+args+] [+extra_make_flags+] \
+               $(TARGET-[+prefix+][+module+]))
 @endif [+prefix+][+module+]
 
 [+ IF bootstrap +]
@@ -879,8 +944,11 @@ all-stage[+id+]-[+prefix+][+module+]: configure-stage[+id+]-[+prefix+][+module+]
        [+exports+][+ IF prev +] \
        [+poststage1_exports+][+ ENDIF prev +] \
        cd [+subdir+]/[+module+] && \
-       $(MAKE) [+args+] \
-               CFLAGS="[+stage_cflags+]" LIBCFLAGS="[+stage_cflags+]" [+
+       $(MAKE) $(BASE_FLAGS_TO_PASS) \
+               CFLAGS="[+stage_cflags+]" CXXFLAGS="[+stage_cflags+]" \
+               LIBCFLAGS="[+stage_libcflags+]" \
+               CFLAGS_FOR_TARGET="[+stage_libcflags+]" \
+               CXXFLAGS_FOR_TARGET="[+stage_libcflags+]" [+args+] [+
                IF prev +][+poststage1_args+][+ ENDIF prev
                +] [+extra_make_flags+] \
                $(TARGET-stage[+id+]-[+prefix+][+module+])
@@ -913,7 +981,8 @@ clean-stage[+id+]-[+prefix+][+module+]:
             target_alias=(get "target" "${target_alias}")
             args="$(BUILD_CONFIGARGS)" no-config-site=true +]
 
-[+ all prefix="build-" subdir="$(BUILD_SUBDIR)" exports="$(BUILD_EXPORTS)" +]
+[+ all prefix="build-" subdir="$(BUILD_SUBDIR)" exports="$(BUILD_EXPORTS)"
+            args="$(EXTRA_BUILD_FLAGS)" +]
 [+ ENDFOR build_module +]
 
 # --------------------------------------
@@ -930,7 +999,7 @@ clean-stage[+id+]-[+prefix+][+module+]:
 [+ all prefix="" subdir="$(HOST_SUBDIR)"
        exports="$(HOST_EXPORTS)"
        poststage1_exports="$(POSTSTAGE1_HOST_EXPORTS)"
-       args="$(FLAGS_TO_PASS)"
+       args="$(EXTRA_HOST_FLAGS)"
        poststage1_args="$(POSTSTAGE1_FLAGS_TO_PASS)" +]
 
 .PHONY: check-[+module+] maybe-check-[+module+]
@@ -1005,7 +1074,7 @@ maybe-[+make_target+]-[+module+]: [+make_target+]-[+module+]
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
-                 "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \
+                 "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
                  [+make_target+]) \
          || exit 1
 [+ ENDIF +]
@@ -1028,7 +1097,7 @@ maybe-[+make_target+]-[+module+]: [+make_target+]-[+module+]
 
 [+ all prefix="target-" subdir="$(TARGET_SUBDIR)"
        exports="$(RAW_CXX_TARGET_EXPORTS)"
-       args="$(TARGET_FLAGS_TO_PASS) 'CXX=$$(RAW_CXX_FOR_TARGET)' 'CXX_FOR_TARGET=$$(RAW_CXX_FOR_TARGET)'" +]
+       args="$(EXTRA_TARGET_FLAGS) 'CXX=$$(RAW_CXX_FOR_TARGET)' 'CXX_FOR_TARGET=$$(RAW_CXX_FOR_TARGET)'" +]
 [+ ELSE +]
 [+ configure prefix="target-" subdir="$(TARGET_SUBDIR)"
             check_multilibs=true
@@ -1039,7 +1108,7 @@ maybe-[+make_target+]-[+module+]: [+make_target+]-[+module+]
 
 [+ all prefix="target-" subdir="$(TARGET_SUBDIR)"
        exports="$(NORMAL_TARGET_EXPORTS)"
-       args="$(TARGET_FLAGS_TO_PASS)" +]
+       args="$(EXTRA_TARGET_FLAGS)" +]
 [+ ENDIF +]
 
 .PHONY: check-target-[+module+] maybe-check-target-[+module+]
@@ -1121,7 +1190,7 @@ ENDIF raw_cxx +]
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
-                 "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \
+                 "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
                  [+extra_make_flags+] [+make_target+]) \
          || exit 1
 [+ ENDIF +]
@@ -1148,19 +1217,15 @@ cross: all-build all-gas all-ld
 @endif gcc-no-bootstrap
 
 @if gcc
-.PHONY: check-gcc-c++
-check-gcc-c++:
-       @if [ -f ./gcc/Makefile ] ; then \
-         r=`${PWD_COMMAND}`; export r; \
-         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
-         $(HOST_EXPORTS) \
-         (cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) check-c++); \
-       else \
-         true; \
-       fi
-
-.PHONY: check-c++
-check-c++: check-target-libstdc++-v3 check-gcc-c++
+[+ FOR languages +]
+.PHONY: check-gcc-[+language+] check-[+language+]
+check-gcc-[+language+]:
+       r=`${PWD_COMMAND}`; export r; \
+       s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+       $(HOST_EXPORTS) \
+       (cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) [+gcc-check-target+]);
+check-[+language+]: check-gcc-[+language+][+ IF lib-check-target +] [+ lib-check-target +][+ ENDIF lib-check-target +]
+[+ ENDFOR languages +]
 
 # Install the gcc headers files, but not the fixed include files,
 # which Cygnus is not allowed to distribute.  This rule is very
@@ -1269,7 +1334,7 @@ stage[+id+]-end:: [+ FOR host_modules +][+ IF bootstrap +]
 
 # Bubble a bug fix through all the stages up to stage [+id+].  They are
 # remade, but not reconfigured.  The next stage (if any) will not be
-# reconfigured as well.
+# reconfigured either.
 .PHONY: stage[+id+]-bubble
 stage[+id+]-bubble:: [+ IF prev +]stage[+prev+]-bubble[+ ENDIF +]
        @r=`${PWD_COMMAND}`; export r; \
@@ -1309,7 +1374,7 @@ do-clean: clean-stage[+id+]
        cd .. ; \
        for file in $${files} ; do \
          f1=$$r/stage[+prev+]-gcc/$$file; f2=$$r/stage[+id+]-gcc/$$file; \
-         @do_compare@ > /dev/null 2>&1; \
+         $(do-[+compare-target+]) > /dev/null 2>&1; \
          if test $$? -eq 1; then \
            case $$file in \
              ./cc*-checksum$(objext) | ./libgcc/* ) \
@@ -1400,6 +1465,8 @@ do-distclean: distclean-stage1
 # Provide a GCC build when we're building target libraries.  This does
 # not work as a dependency, just as the minimum necessary to avoid errors.
 stage_last:
+       @r=`${PWD_COMMAND}`; export r; \
+       s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(MAKE) $(RECURSE_FLAGS_TO_PASS) stage1-bubble
 
 # Same as unstage, but not phony and defaulting to stage1-start.  We place
@@ -1408,11 +1475,11 @@ stage_current:
        @if test -f stage_last; then $(unstage); else $(MAKE) stage1-start; fi
 
 .PHONY: restrap
-restrap:
+restrap::
        @: $(MAKE); $(stage)
        rm -rf stage1-$(TARGET_SUBDIR) [+ FOR bootstrap-stage +][+ IF prev
          +]stage[+id+]-* [+ ENDIF prev +][+ ENDFOR bootstrap-stage +]
-       $(MAKE) $(RECURSE_FLAGS_TO_PASS) all
+restrap:: all
 @endif gcc-bootstrap
 
 # --------------------------------------
@@ -1443,7 +1510,7 @@ configure-target-[+module+]: maybe-all-gcc[+
 
 [+ ;; These Scheme functions build the bulk of the dependencies.
    ;; dep-target builds a string like "maybe-all-MODULE_KIND-gcc",
-   ;; where "maybe-" is only included if HARD is true, and all-gcc
+   ;; where "maybe-" is only included if HARD is not true, and all-gcc
    ;; is taken from VAR-NAME.
    (define dep-target (lambda (module-kind var-name hard)
       (string-append
@@ -1601,7 +1668,8 @@ config.status: configure
 
 # Rebuilding configure.
 AUTOCONF = autoconf
-$(srcdir)/configure: @MAINT@ $(srcdir)/configure.ac $(srcdir)/config/acx.m4
+$(srcdir)/configure: @MAINT@ $(srcdir)/configure.ac $(srcdir)/config/acx.m4 \
+       $(srcdir)/config/override.m4 $(srcdir)/config/proginstall.m4
        cd $(srcdir) && $(AUTOCONF)
 
 # ------------------------------