This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[toplevel] Overhaul detection of target compilers


This patch makes the search for target tools simpler, more orthogonal
and less brittle.  It is necessary to enable parallel processing of
multiple directories in toplevel bootstrap: I agreed with Alexandre
Oliva that it is better to fix this issue, so that --enable-bootstrap
need not disable parallel processing of the toplevel Makefile.  Then we
can fix PR/22340 (the remaining severe bug in toplevel bootstrap) in the
proper way.

I cannot actually reconstruct why the target compilers, unlike the rest
of the toolchain, are searched for in the configure script, rather than
at `make' time.  My supposition is that:

1) the reason for RECURSE_FLAGS_TO_PASS ("shell code that varies from
one target library to another") became obsolete with the patch at
http://gcc.gnu.org/ml/gcc-patches/2002-11/msg01353.html, that replaced
an embedded case statement inside a make macro with the raw_cxx Autogen
macro.  The relevant hunk, wrapped for readability, is this:

-libstdcxx_flags='`case $$dir in libstdc++-v3 | libjava) ;; *)
  test ! -f $$r/$(TARGET_SUBDIR)/libstdc++-v3/testsuite_flags ||
  $(SHELL) $$r/$(TARGET_SUBDIR)/libstdc++-v3/testsuite_flags
  --build-includes;; esac` -L$$r/$(TARGET_SUBDIR)/libstdc++-v3/src
  -L$$r/$(TARGET_SUBDIR)/libstdc++-v3/src/.libs'
+libstdcxx_flags='`
  test ! -f $$r/$(TARGET_SUBDIR)/libstdc++-v3/testsuite_flags ||
  $(SHELL) $$r/$(TARGET_SUBDIR)/libstdc++-v3/testsuite_flags
  --build-includes` -L$$r/$(TARGET_SUBDIR)/libstdc++-v3/src
  -L$$r/$(TARGET_SUBDIR)/libstdc++-v3/src/.libs'
+raw_libstdcxx_flags=' -L$$r/$(TARGET_SUBDIR)/libstdc++-v3/src
  -L$$r/$(TARGET_SUBDIR)/libstdc++-v3/src/.libs'

... snippety snip ...

-  CXX_FOR_TARGET='$$r/gcc/`case $$dir in libstdc++-v3 | libjava)
  echo xgcc -shared-libgcc ;; *) echo g++ ;; esac` -B$$r/gcc/
  -nostdinc++ '$libstdcxx_flags
+  CXX_FOR_TARGET='$$r/gcc/g++ -B$$r/gcc/ -nostdinc++ '$libstdcxx_flags
+  RAW_CXX_FOR_TARGET='$$r/gcc/xgcc -shared-libgcc -B$$r/gcc/
  -nostdinc++ '$raw_libstdcxx_flags

This was in November 2002.

2) maybe there were problems with nesting command substitutions, so this
was not done yet; I say this because it is the only problem I
encountered while working on this patch.

However, now we can easily avoid nested substitutions.  To substitute
the output of libstdc++-v3/script/testsuite_flags, we put it on a
separate line and use 'tr '\n' " "'.

In November 2002 it was definitely harder to avoid using
$(CC_FOR_TARGET) into the backticked expressions USUAL_AS_FOR_TARGET,
USUAL_LD_FOR_TARGET, USUAL_NM_FOR_TARGET.  Now however can rely on the
presence of `as', `collect-ld' and `nm' in the GCC build directory:
after the recent patch (with Kazu's already committed fixes) to always
create them, we know that

 gcc/xgcc -Bgcc --print-prog-name=as
 gcc/xgcc -Bgcc --print-prog-name=ld
 gcc/xgcc -Bgcc --print-prog-name=nm

will always be gcc/as, gcc/ld, gcc/nm respectively.  So we can just use
these expressions in $(USUAL_AS_FOR_TARGET) and friends.

This patch also allows one to specify AR_FOR_TARGET, AS_FOR_TARGET, etc.
in the environment where configure is run.  The name to use, previously,
was CONFIGURED_AR_FOR_TARGET, CONFIGURED_AS_FOR_TARGET, etc., but this
was unorthogonal with compilers (where things like CC_FOR_TARGET or
CXX_FOR_TARGET worked).

---

An important point.  This patch removes "MAKEOVERRIDES=" and,
consequently, empties RECURSE_FLAGS_TO_PASS.  This prevents subtle bugs
in recursive invocations, when the backtick substitutions are evaluated
too early; it also subsumes
http://gcc.gnu.org/ml/gcc-patches/2005-07/msg00571.html.  I did not try
doing this as a separate patch, because I was not sure of the
consequences of emptying "MAKEOVERRIDES=" with the old CXX_FOR_TARGET
scheme.

So, I have to digress and explain why this is not a problem with the new
scheme.  To test this, I created two Makefiles that recursively invoke
themselves: one uses an empty MAKEOVERRIDES and the FLAGS_TO_PASS
mechanism, the other lets "make" do the job.  After four recursive
invocations, they dump some interesting environment variables (with 'env
| grep').

In the common case, nobody sets anything on the command-line, and nobody
sets anything in the recursive invocations.  Case a) is without
"MAKEOVERRIDES=", case b) is with it

a) make -f Makefile.def no-var-pass
   make -f Makefile.def no-var-pass2
   make -f Makefile.def no-var-pass3
   make -f Makefile.def out-env
     MY_VAR_XXX=xxx MY_VAR_ZZZ=zzz
     Environment contents:
     MAKEFLAGS=
     MAKELEVEL=4

b) make -f Makefile.empty no-var-pass
   make -f Makefile.empty no-var-pass2 'MY_VAR_XXX=xxx' 'MY_VAR_ZZZ=zzz'
   make -f Makefile.empty no-var-pass3 'MY_VAR_XXX=xxx' 'MY_VAR_ZZZ=zzz'
   make -f Makefile.empty out-env 'MY_VAR_XXX=xxx' 'MY_VAR_ZZZ=zzz'
     MY_VAR_XXX=xxx MY_VAR_ZZZ=zzz
     Environment contents:
     MAKEFLAGS=
     MAKELEVEL=4
     MY_VAR_XXX=xxx
     MY_VAR_ZZZ=zzz

In case b), all the variables in FLAGS_TO_PASS are in the environment.
So, more variables are set in the environment with 1b (the current
setup), and the command line is longer.  This is the most common case
for the toplevel makefile: we'd save in environment size and command
line length.

---

The second important case, is when we pass a few variables in the
command-line, but the toplevel makefile does not change anything upon
the recursive invocations:

a) make -f Makefile.def MY_VAR_XXX=set
   make -f Makefile.def no-var-pass2
   make -f Makefile.def no-var-pass3
   make -f Makefile.def out-env
     MY_VAR_XXX=set MY_VAR_ZZZ=zzz
     Environment contents:
     MAKEFLAGS=MY_VAR_XXX=set
     MAKELEVEL=4
     MAKEOVERRIDES=${-*-command-variables-*-}
     MY_VAR_XXX=set
b) make -f Makefile.empty MY_VAR_XXX=set
   make -f Makefile.empty no-var-pass2 'MY_VAR_XXX=set' 'MY_VAR_ZZZ=zzz'
   make -f Makefile.empty no-var-pass3 'MY_VAR_XXX=set' 'MY_VAR_ZZZ=zzz'
   make -f Makefile.empty out-env 'MY_VAR_XXX=set' 'MY_VAR_ZZZ=zzz'
     MY_VAR_XXX=set MY_VAR_ZZZ=zzz
     Environment contents:
     MAKEFLAGS=
     MAKELEVEL=4
     MY_VAR_XXX=set
     MY_VAR_ZZZ=zzz

The number of variables in the environment, in case a), cannot be higher
than in case b).  But, a) stores each variable twice (once in MAKEFLAGS,
once out of it).  Given that FLAGS_TO_PASS is very big in the toplevel
Makefile, one really has to have a big command line, for this to be a
problem.

---

The problematic case is when you have many levels of invocations, and
each sets the same variables to a different value.  In this case
duplicates are not removed in MAKEFLAGS and they sum up.  This case
never happens in the toplevel, because it is already rare to change a
variable's value in a recursive invocation of the toplevel, but I added
a comment about it in the patch.  The invocations of my example are:

a) make -f Makefile.def var-pass
make -f Makefile.def var-pass2 MY_VAR_XXX=set
make -f Makefile.def var-pass3 MY_VAR_XXX=set
make -f Makefile.def out-env MY_VAR_XXX=set
MY_VAR_XXX=set MY_VAR_ZZZ=zzz
Environment contents:
>> MAKEFLAGS=MY_VAR_XXX=set MY_VAR_XXX=set MY_VAR_XXX=set
MAKELEVEL=4
MAKEOVERRIDES=${-*-command-variables-*-}
MY_VAR_XXX=set
b) make -f Makefile.empty var-pass
make -f Makefile.empty var-pass2 'MY_VAR_XXX=xxx' 'MY_VAR_ZZZ=zzz' MY_VAR_XXX=set
make -f Makefile.empty var-pass3 'MY_VAR_XXX=set' 'MY_VAR_ZZZ=zzz' MY_VAR_XXX=set
make -f Makefile.empty out-env 'MY_VAR_XXX=set' 'MY_VAR_ZZZ=zzz' MY_VAR_XXX=set
MY_VAR_XXX=set MY_VAR_ZZZ=zzz
Environment contents:
MAKEFLAGS=
MAKELEVEL=4
MY_VAR_XXX=set
MY_VAR_ZZZ=zzz


End of the digression.

---

I tested this on i686-pc-linux-gnu together with the other patch I am
submitting, with three different build types:

1) "make -j2"
2) "make bootstrap -j2"
3) "make -j2" and --enable-bootstrap.

The last one was also regtested.  I also checked manually the config.log
files for the target libraries, to see if they were the same before and
after the patch.

Ok for gcc and src?

Paolo


2005-07-14  Paolo Bonzini  <bonzini@gnu.org>

	* configure.in (CC_FOR_TARGET, CXX_FOR_TARGET, GCJ_FOR_TARGET,
	GCC_FOR_TARGET, RAW_CXX_FOR_TARGET, GFORTRAN_FOR_TARGET): Find
	them with NCN_STRICT_CHECK_TARGET_TOOL, like the other target
	tools; remove code to manually set them.
	(Target tools): Look in the environment for them.
	* Makefile.tpl (CC_FOR_TARGET, CXX_FOR_TARGET, GCJ_FOR_TARGET,
	GCC_FOR_TARGET, RAW_CXX_FOR_TARGET, GFORTRAN_FOR_TARGET): Redefine.
	(AS_FOR_TARGET, LD_FOR_TARGET, NM_FOR_TARGET): Look into gcc
	build directory.
	(CONFIGURED_CC_FOR_TARGET, CONFIGURED_CXX_FOR_TARGET,
	CONFIGURED_GCJ_FOR_TARGET, CONFIGURED_GCC_FOR_TARGET,
	CONFIGURED_GFORTRAN_FOR_TARGET, USUAL_CC_FOR_TARGET,
	USUAL_CXX_FOR_TARGET, USUAL_GCJ_FOR_TARGET, USUAL_GCC_FOR_TARGET,
	USUAL_RAW_CXX_FOR_TARGET, USUAL_GFORTRAN_FOR_TARGET): New.
	(CXX_FOR_TARGET_FOR_RECURSIVE_MAKE,
	RAW_CXX_FOR_TARGET_FOR_RECURSIVE_MAKE, RECURSE_FLAGS): Delete.
 	* configure: Regenerate.
 	* Makefile.in: Regenerate.

Index: configure.in
===================================================================
RCS file: /cvs/gcc/gcc/configure.in,v
retrieving revision 1.357
diff -p -u -u -r1.357 configure.in
--- configure.in	7 Jul 2005 01:12:59 -0000	1.357
+++ configure.in	15 Jul 2005 11:42:04 -0000
@@ -993,10 +993,6 @@ if test "${build}" != "${host}" ; then
   CXX=${CXX-${host_alias}-c++}
   CXXFLAGS=${CXXFLAGS-"-g -O2"}
   CC_FOR_BUILD=${CC_FOR_BUILD-gcc}
-  CC_FOR_TARGET=${CC_FOR_TARGET-${target_alias}-gcc}
-  CXX_FOR_TARGET=${CXX_FOR_TARGET-${target_alias}-c++}
-  GCJ_FOR_TARGET=${GCJ_FOR_TARGET-${target_alias}-gcj}
-  GCC_FOR_TARGET=${GCC_FOR_TARGET-${CC_FOR_TARGET-${target_alias}-gcc}}
   BUILD_PREFIX=${build_alias}-
   BUILD_PREFIX_1=${build_alias}-
 
@@ -1010,7 +1006,6 @@ else
   # This is all going to change when we autoconfiscate...
 
   CC_FOR_BUILD="\$(CC)"
-  GCC_FOR_TARGET="\$(USUAL_GCC_FOR_TARGET)"
   BUILD_PREFIX=
   BUILD_PREFIX_1=loser-
 
@@ -2032,89 +2027,6 @@ if test "x${use_gnu_ld}" = x &&
   FLAGS_FOR_TARGET=$FLAGS_FOR_TARGET' -L$$r/$(HOST_SUBDIR)/ld'
 fi
 
-if test "x${CC_FOR_TARGET+set}" = xset; then
-  :
-elif test -d ${srcdir}/gcc; then
-  CC_FOR_TARGET='$$r/$(HOST_SUBDIR)/gcc/xgcc -B$$r/$(HOST_SUBDIR)/gcc/'
-elif test "$host" = "$target"; then
-  CC_FOR_TARGET='$(CC)'
-else
-  CC_FOR_TARGET=`echo gcc | sed "${program_transform_name}"`
-fi
-CC_FOR_TARGET=$CC_FOR_TARGET' $(FLAGS_FOR_TARGET)'
-
-if test "x${GCJ_FOR_TARGET+set}" = xset; then
-  :
-elif test -d ${srcdir}/gcc; then
-  GCJ_FOR_TARGET='$$r/$(HOST_SUBDIR)/gcc/gcj -B$$r/$(HOST_SUBDIR)/gcc/'
-elif test "$host" = "$target"; then
-  GCJ_FOR_TARGET='gcj'
-else
-  GCJ_FOR_TARGET=`echo gcj | sed "${program_transform_name}"`
-fi
-GCJ_FOR_TARGET=$GCJ_FOR_TARGET' $(FLAGS_FOR_TARGET)'
-
-if test "x${GFORTRAN_FOR_TARGET+set}" = xset; then
-  :
-elif test -d ${srcdir}/gcc; then
-  GFORTRAN_FOR_TARGET='$$r/$(HOST_SUBDIR)/gcc/gfortran -B$$r/$(HOST_SUBDIR)/gcc/'
-elif test "$host" = "$target"; then
-  GFORTRAN_FOR_TARGET='gfortran'
-else
-  GFORTRAN_FOR_TARGET=`echo gfortran | sed "${program_transform_name}"`
-fi
-case $GFORTRAN_FOR_TARGET in
-*' $(FLAGS_FOR_TARGET)') ;;
-*) GFORTRAN_FOR_TARGET=$GFORTRAN_FOR_TARGET' $(FLAGS_FOR_TARGET)' ;;
-esac
-
-# Don't use libstdc++-v3's flags to configure/build itself.
-libstdcxx_flags='`test ! -f $$r/$(TARGET_SUBDIR)/libstdc++-v3/scripts/testsuite_flags || $(SHELL) $$r/$(TARGET_SUBDIR)/libstdc++-v3/scripts/testsuite_flags --build-includes` -L$$r/$(TARGET_SUBDIR)/libstdc++-v3/src -L$$r/$(TARGET_SUBDIR)/libstdc++-v3/src/.libs'
-raw_libstdcxx_flags='-L$$r/$(TARGET_SUBDIR)/libstdc++-v3/src -L$$r/$(TARGET_SUBDIR)/libstdc++-v3/src/.libs'
-
-if test "x${CXX_FOR_TARGET+set}" = xset; then
-  if test "x${RAW_CXX_FOR_TARGET+set}" != xset; then
-    RAW_CXX_FOR_TARGET=${CXX_FOR_TARGET}
-  fi
-elif test -d ${srcdir}/gcc; then
-  # We add -shared-libgcc to CXX_FOR_TARGET whenever we use xgcc instead
-  # of g++ for linking C++ or Java, because g++ has -shared-libgcc by
-  # default whereas gcc does not.
-  # RAW_CXX_FOR_TARGET is for linking C++ or java; CXX_FOR_TARGET is for
-  # all other cases.
-  CXX_FOR_TARGET='$$r/$(HOST_SUBDIR)/gcc/g++ -B$$r/$(HOST_SUBDIR)/gcc/ -nostdinc++ '$libstdcxx_flags
-  RAW_CXX_FOR_TARGET='$$r/$(HOST_SUBDIR)/gcc/xgcc -shared-libgcc -B$$r/$(HOST_SUBDIR)/gcc/ -nostdinc++ '$raw_libstdcxx_flags
-elif test "$host" = "$target"; then
-  CXX_FOR_TARGET='$(CXX)'
-  RAW_CXX_FOR_TARGET=${CXX_FOR_TARGET}
-else
-  CXX_FOR_TARGET=`echo c++ | sed "${program_transform_name}"`
-  RAW_CXX_FOR_TARGET=${CXX_FOR_TARGET}
-fi
-CXX_FOR_TARGET=$CXX_FOR_TARGET' $(FLAGS_FOR_TARGET)'
-RAW_CXX_FOR_TARGET=$RAW_CXX_FOR_TARGET' $(FLAGS_FOR_TARGET)'
-
-qCXX_FOR_TARGET=`echo "$CXX_FOR_TARGET" | sed 's,[[&%]],\\\&,g'`
-qRAW_CXX_FOR_TARGET=`echo "$RAW_CXX_FOR_TARGET" | sed 's,[[&%]],\\\&,g'`
-
-# We want to defer the evaluation of `cmd`s and shell variables in
-# CXX_FOR_TARGET when recursing in the top-level Makefile, such as for
-# bootstrap.  We'll enclose CXX_FOR_TARGET_FOR_RECURSIVE_MAKE in single
-# quotes, but we still have to duplicate `$'s so that shell variables
-# can be expanded by the nested make as shell variables, not as make
-# macros.
-qqCXX_FOR_TARGET=`echo "$qCXX_FOR_TARGET" | sed -e 's,[[$]][[$]],$$$$,g'`
-qqRAW_CXX_FOR_TARGET=`echo "$qRAW_CXX_FOR_TARGET" | sed -e 's,[[$]][[$]],$$$$,g'`
-
-# Wrap CC_FOR_TARGET and friends, for certain types of builds.
-CC_FOR_TARGET="\$(STAGE_CC_WRAPPER) ${CC_FOR_TARGET}"
-GCJ_FOR_TARGET="\$(STAGE_CC_WRAPPER) ${GCJ_FOR_TARGET}"
-GFORTRAN_FOR_TARGET="\$(STAGE_CC_WRAPPER) ${GFORTRAN_FOR_TARGET}"
-CXX_FOR_TARGET="\$(STAGE_CC_WRAPPER) ${qCXX_FOR_TARGET}"
-RAW_CXX_FOR_TARGET="\$(STAGE_CC_WRAPPER) ${qRAW_CXX_FOR_TARGET}"
-CXX_FOR_TARGET_FOR_RECURSIVE_MAKE="\$(STAGE_CC_WRAPPER) ${qqCXX_FOR_TARGET}"
-RAW_CXX_FOR_TARGET_FOR_RECURSIVE_MAKE="\$(STAGE_CC_WRAPPER) ${qqRAW_CXX_FOR_TARGET}"
-
 # Makefile fragments.
 for frag in host_makefile_frag target_makefile_frag alphaieee_frag ospace_frag;
 do
@@ -2168,24 +2080,47 @@ AC_SUBST(CFLAGS)
 AC_SUBST(CFLAGS_FOR_BUILD)
 AC_SUBST(CXXFLAGS)
 
-# Target tools.
-NCN_STRICT_CHECK_TARGET_TOOL(CONFIGURED_AR_FOR_TARGET, ar)
-NCN_STRICT_CHECK_TARGET_TOOL(CONFIGURED_AS_FOR_TARGET, as)
-NCN_STRICT_CHECK_TARGET_TOOL(CONFIGURED_DLLTOOL_FOR_TARGET, dlltool)
-NCN_STRICT_CHECK_TARGET_TOOL(CONFIGURED_LD_FOR_TARGET, ld)
-NCN_STRICT_CHECK_TARGET_TOOL(CONFIGURED_NM_FOR_TARGET, nm)
-NCN_STRICT_CHECK_TARGET_TOOL(CONFIGURED_RANLIB_FOR_TARGET, ranlib, :)
-NCN_STRICT_CHECK_TARGET_TOOL(CONFIGURED_WINDRES_FOR_TARGET, windres)
-
-AC_SUBST(GCC_FOR_TARGET)
+# Target tools.  Do the tests using the names they may have passed in
+# the environment, then move it to CONFIGURED_*_FOR_TARGET.
+NCN_STRICT_CHECK_TARGET_TOOL(AR_FOR_TARGET, ar)
+NCN_STRICT_CHECK_TARGET_TOOL(AS_FOR_TARGET, as)
+NCN_STRICT_CHECK_TARGET_TOOL(CC_FOR_TARGET, cc)
+NCN_STRICT_CHECK_TARGET_TOOL(CXX_FOR_TARGET, c++)
+NCN_STRICT_CHECK_TARGET_TOOL(DLLTOOL_FOR_TARGET, dlltool)
+NCN_STRICT_CHECK_TARGET_TOOL(GCC_FOR_TARGET, gcc, ${CC_FOR_TARGET})
+NCN_STRICT_CHECK_TARGET_TOOL(GCJ_FOR_TARGET, gcj)
+NCN_STRICT_CHECK_TARGET_TOOL(GFORTRAN_FOR_TARGET, gfortran)
+NCN_STRICT_CHECK_TARGET_TOOL(LD_FOR_TARGET, ld)
+NCN_STRICT_CHECK_TARGET_TOOL(NM_FOR_TARGET, nm)
+NCN_STRICT_CHECK_TARGET_TOOL(RANLIB_FOR_TARGET, ranlib, :)
+NCN_STRICT_CHECK_TARGET_TOOL(WINDRES_FOR_TARGET, windres)
+
+CONFIGURED_AR_FOR_TARGET="$AR_FOR_TARGET"
+CONFIGURED_AS_FOR_TARGET="$AS_FOR_TARGET"
+CONFIGURED_CC_FOR_TARGET="$CC_FOR_TARGET"
+CONFIGURED_CXX_FOR_TARGET="$CXX_FOR_TARGET"
+CONFIGURED_DLLTOOL_FOR_TARGET="$DLLTOOL_FOR_TARGET"
+CONFIGURED_GCC_FOR_TARGET="$GCC_FOR_TARGET"
+CONFIGURED_GCJ_FOR_TARGET="$GCJ_FOR_TARGET"
+CONFIGURED_GFORTRAN_FOR_TARGET="$GFORTRAN_FOR_TARGET"
+CONFIGURED_LD_FOR_TARGET="$LD_FOR_TARGET"
+CONFIGURED_NM_FOR_TARGET="$NM_FOR_TARGET"
+CONFIGURED_RANLIB_FOR_TARGET="$RANLIB_FOR_TARGET"
+CONFIGURED_WINDRES_FOR_TARGET="$WINDRES_FOR_TARGET"
+
+AC_SUBST(CONFIGURED_AR_FOR_TARGET)dnl
+AC_SUBST(CONFIGURED_AS_FOR_TARGET)dnl
+AC_SUBST(CONFIGURED_CC_FOR_TARGET)dnl
+AC_SUBST(CONFIGURED_CXX_FOR_TARGET)dnl
+AC_SUBST(CONFIGURED_DLLTOOL_FOR_TARGET)dnl
+AC_SUBST(CONFIGURED_GCC_FOR_TARGET)dnl
+AC_SUBST(CONFIGURED_GCJ_FOR_TARGET)dnl
+AC_SUBST(CONFIGURED_GFORTRAN_FOR_TARGET)dnl
+AC_SUBST(CONFIGURED_LD_FOR_TARGET)dnl
+AC_SUBST(CONFIGURED_NM_FOR_TARGET)dnl
+AC_SUBST(CONFIGURED_RANLIB_FOR_TARGET)dnl
+AC_SUBST(CONFIGURED_WINDRES_FOR_TARGET)dnl
 AC_SUBST(FLAGS_FOR_TARGET)
-AC_SUBST(CC_FOR_TARGET)
-AC_SUBST(GCJ_FOR_TARGET)
-AC_SUBST(GFORTRAN_FOR_TARGET)
-AC_SUBST(CXX_FOR_TARGET)
-AC_SUBST(RAW_CXX_FOR_TARGET)
-AC_SUBST(CXX_FOR_TARGET_FOR_RECURSIVE_MAKE)
-AC_SUBST(RAW_CXX_FOR_TARGET_FOR_RECURSIVE_MAKE)
 
 # Fix up target tools.
 if test "x${build}" = "x${host}" ; then
@@ -2197,7 +2132,13 @@ if test "x${build}" = "x${host}" ; then
   # should also eliminate all of this cleanly.
   AR_FOR_TARGET="\$(USUAL_AR_FOR_TARGET)"
   AS_FOR_TARGET="\$(USUAL_AS_FOR_TARGET)"
+  CC_FOR_TARGET="\$(USUAL_CC_FOR_TARGET)"
+  CXX_FOR_TARGET="\$(USUAL_CXX_FOR_TARGET)"
+  RAW_CXX_FOR_TARGET="\$(USUAL_RAW_CXX_FOR_TARGET)"
   DLLTOOL_FOR_TARGET="\$(USUAL_DLLTOOL_FOR_TARGET)"
+  GCC_FOR_TARGET="\$(USUAL_GCC_FOR_TARGET)"
+  GCJ_FOR_TARGET="\$(USUAL_GCJ_FOR_TARGET)"
+  GFORTRAN_FOR_TARGET="\$(USUAL_GFORTRAN_FOR_TARGET)"
   LD_FOR_TARGET="\$(USUAL_LD_FOR_TARGET)"
   NM_FOR_TARGET="\$(USUAL_NM_FOR_TARGET)"
   RANLIB_FOR_TARGET="\$(USUAL_RANLIB_FOR_TARGET)"
@@ -2206,19 +2147,20 @@ else
   # Just use the ones we found.
   AR_FOR_TARGET="\$(CONFIGURED_AR_FOR_TARGET)"
   AS_FOR_TARGET="\$(CONFIGURED_AS_FOR_TARGET)"
+  CC_FOR_TARGET="\$(CONFIGURED_CC_FOR_TARGET)"
+  CXX_FOR_TARGET="\$(CONFIGURED_CXX_FOR_TARGET)"
+  RAW_CXX_FOR_TARGET="\$(CONFIGURED_CXX_FOR_TARGET)"
   DLLTOOL_FOR_TARGET="\$(CONFIGURED_DLLTOOL_FOR_TARGET)"
+  GCC_FOR_TARGET="\$(CONFIGURED_GCC_FOR_TARGET)"
+  GCJ_FOR_TARGET="\$(CONFIGURED_GCJ_FOR_TARGET)"
+  GFORTRAN_FOR_TARGET="\$(CONFIGURED_GFORTRAN_FOR_TARGET)"
   LD_FOR_TARGET="\$(CONFIGURED_LD_FOR_TARGET)"
   NM_FOR_TARGET="\$(CONFIGURED_NM_FOR_TARGET)"
   RANLIB_FOR_TARGET="\$(CONFIGURED_RANLIB_FOR_TARGET)"
   WINDRES_FOR_TARGET="\$(CONFIGURED_WINDRES_FOR_TARGET)"  
 fi
-AC_SUBST(AR_FOR_TARGET)
-AC_SUBST(AS_FOR_TARGET)
-AC_SUBST(DLLTOOL_FOR_TARGET)
-AC_SUBST(LD_FOR_TARGET)
-AC_SUBST(NM_FOR_TARGET)
-AC_SUBST(RANLIB_FOR_TARGET)
-AC_SUBST(WINDRES_FOR_TARGET)
+
+AC_SUBST(RAW_CXX_FOR_TARGET)
 
 # Certain tools may need extra flags.
 AR_FOR_TARGET=${AR_FOR_TARGET}${extra_arflags_for_target}
Index: Makefile.tpl
===================================================================
RCS file: /cvs/gcc/gcc/Makefile.tpl,v
retrieving revision 1.135
diff -p -u -u -r1.135 Makefile.tpl
--- Makefile.tpl	11 Jul 2005 08:03:08 -0000	1.135
+++ Makefile.tpl	15 Jul 2005 11:42:04 -0000
@@ -354,8 +354,8 @@ CONFIGURED_AS_FOR_TARGET=@CONFIGURED_AS_
 USUAL_AS_FOR_TARGET = ` \
   if [ -f $$r/$(HOST_SUBDIR)/gas/as-new ] ; then \
     echo $$r/$(HOST_SUBDIR)/gas/as-new ; \
-  elif [ -f $$r/$(HOST_SUBDIR)/gcc/xgcc ]; then \
-    $(CC_FOR_TARGET) -print-prog-name=as ; \
+  elif [ -f $$r/$(HOST_SUBDIR)/gcc/as ]; then \
+    echo $$r/$(HOST_SUBDIR)/gcc/as ; \
   else \
     if [ '$(host)' = '$(target)' ] ; then \
       echo $(AS); \
@@ -364,7 +364,19 @@ USUAL_AS_FOR_TARGET = ` \
     fi; \
   fi`
 
-CC_FOR_TARGET = @CC_FOR_TARGET@
+CC_FOR_TARGET=$(STAGE_CC_WRAPPER) @CC_FOR_TARGET@ $(FLAGS_FOR_TARGET)
+CONFIGURED_CC_FOR_TARGET=@CONFIGURED_CC_FOR_TARGET@
+USUAL_CC_FOR_TARGET = ` \
+  if [ -f $$r/$(HOST_SUBDIR)/gcc/xgcc ] ; then \
+    echo $$r/$(HOST_SUBDIR)/gcc/xgcc -B$$r/$(HOST_SUBDIR)/gcc ; \
+  else \
+    if [ '$(host)' = '$(target)' ] ; then \
+      echo $(CC); \
+    else \
+      echo $(CONFIGURED_CC_FOR_TARGET) ; \
+    fi; \
+  fi`
+
 # 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
@@ -379,13 +391,63 @@ USUAL_GCC_FOR_TARGET = $(STAGE_CC_WRAPPE
   $$r/$(HOST_SUBDIR)/gcc/xgcc -B$$r/$(HOST_SUBDIR)/gcc/ $(FLAGS_FOR_TARGET)
 LIBCFLAGS_FOR_TARGET = $(CFLAGS_FOR_TARGET)
 
-CXX_FOR_TARGET = @CXX_FOR_TARGET@
-RAW_CXX_FOR_TARGET = @RAW_CXX_FOR_TARGET@
-CXX_FOR_TARGET_FOR_RECURSIVE_MAKE = @CXX_FOR_TARGET_FOR_RECURSIVE_MAKE@
-RAW_CXX_FOR_TARGET_FOR_RECURSIVE_MAKE = @RAW_CXX_FOR_TARGET_FOR_RECURSIVE_MAKE@
+CXX_FOR_TARGET=$(STAGE_CC_WRAPPER) @CXX_FOR_TARGET@ $(FLAGS_FOR_TARGET)
+CONFIGURED_CXX_FOR_TARGET=@CONFIGURED_CXX_FOR_TARGET@
+USUAL_CXX_FOR_TARGET = ` \
+  if [ -f $$r/$(HOST_SUBDIR)/gcc/g++ ] ; then \
+    (echo $$r/$(HOST_SUBDIR)/gcc/g++ -B$$r/$(HOST_SUBDIR)/gcc -nostdinc++; \
+    test ! -f $$r/$(TARGET_SUBDIR)/libstdc++-v3/scripts/testsuite_flags || $(SHELL) $$r/$(TARGET_SUBDIR)/libstdc++-v3/scripts/testsuite_flags --build-includes; \
+    echo -L$$r/$(TARGET_SUBDIR)/libstdc++-v3/src -L$$r/$(TARGET_SUBDIR)/libstdc++-v3/src/.libs) | tr '\015\012' '  '; \
+  else \
+    if [ '$(host)' = '$(target)' ] ; then \
+      echo $(CXX); \
+    else \
+      echo $(CONFIGURED_CXX_FOR_TARGET) ; \
+    fi; \
+  fi`
+
+RAW_CXX_FOR_TARGET=$(STAGE_CC_WRAPPER) @RAW_CXX_FOR_TARGET@ $(FLAGS_FOR_TARGET)
+USUAL_RAW_CXX_FOR_TARGET = ` \
+  if [ -f $$r/$(HOST_SUBDIR)/gcc/xgcc ] ; then \
+    echo $$r/$(HOST_SUBDIR)/gcc/xgcc -shared-libgcc -B$$r/$(HOST_SUBDIR)/gcc -nostdinc++ -L$$r/$(TARGET_SUBDIR)/libstdc++-v3/src -L$$r/$(TARGET_SUBDIR)/libstdc++-v3/src/.libs; \
+  else \
+    if [ '$(host)' = '$(target)' ] ; then \
+      echo $(CXX); \
+    else \
+      echo $(CONFIGURED_CXX_FOR_TARGET) ; \
+    fi; \
+  fi`
+
 CXXFLAGS_FOR_TARGET = $(CXXFLAGS)
 LIBCXXFLAGS_FOR_TARGET = $(CXXFLAGS_FOR_TARGET) -fno-implicit-templates
 
+GCJ_FOR_TARGET=$(STAGE_CC_WRAPPER) @GCJ_FOR_TARGET@ $(FLAGS_FOR_TARGET)
+CONFIGURED_GCJ_FOR_TARGET=@CONFIGURED_GCJ_FOR_TARGET@
+USUAL_GCJ_FOR_TARGET = ` \
+  if [ -f $$r/$(HOST_SUBDIR)/gcc/gcj ] ; then \
+    echo $$r/$(HOST_SUBDIR)/gcc/gcj -B$$r/$(HOST_SUBDIR)/gcc ; \
+  else \
+    if [ '$(host)' = '$(target)' ] ; then \
+      echo $(GCJ); \
+    else \
+      echo $(CONFIGURED_GCJ_FOR_TARGET) ; \
+    fi; \
+  fi`
+
+GFORTRAN_FOR_TARGET=$(STAGE_CC_WRAPPER) @GFORTRAN_FOR_TARGET@ $(FLAGS_FOR_TARGET)
+CONFIGURED_GFORTRAN_FOR_TARGET=@CONFIGURED_GFORTRAN_FOR_TARGET@
+USUAL_GFORTRAN_FOR_TARGET = ` \
+  if [ -f $$r/$(HOST_SUBDIR)/gcc/gfortran ] ; then \
+    echo $$r/$(HOST_SUBDIR)/gcc/gfortran -B$$r/$(HOST_SUBDIR)/gcc ; \
+  else \
+    if [ '$(host)' = '$(target)' ] ; then \
+      echo $(GFORTRAN); \
+    else \
+      echo $(CONFIGURED_GFORTRAN_FOR_TARGET) ; \
+    fi; \
+  fi`
+
+
 DLLTOOL_FOR_TARGET=@DLLTOOL_FOR_TARGET@
 CONFIGURED_DLLTOOL_FOR_TARGET=@CONFIGURED_DLLTOOL_FOR_TARGET@
 USUAL_DLLTOOL_FOR_TARGET = ` \
@@ -399,16 +461,13 @@ USUAL_DLLTOOL_FOR_TARGET = ` \
     fi; \
   fi`
 
-GCJ_FOR_TARGET = @GCJ_FOR_TARGET@
-GFORTRAN_FOR_TARGET = @GFORTRAN_FOR_TARGET@
-
 LD_FOR_TARGET=@LD_FOR_TARGET@
 CONFIGURED_LD_FOR_TARGET=@CONFIGURED_LD_FOR_TARGET@
 USUAL_LD_FOR_TARGET = ` \
   if [ -f $$r/$(HOST_SUBDIR)/ld/ld-new ] ; then \
     echo $$r/$(HOST_SUBDIR)/ld/ld-new ; \
-  elif [ -f $$r/$(HOST_SUBDIR)/gcc/xgcc ]; then \
-    $(CC_FOR_TARGET) -print-prog-name=ld ; \
+  elif [ -f $$r/$(HOST_SUBDIR)/gcc/collect-ld ]; then \
+    echo $$r/$(HOST_SUBDIR)/gcc/collect-ld ; \
   else \
     if [ '$(host)' = '$(target)' ] ; then \
       echo $(LD); \
@@ -424,8 +483,8 @@ CONFIGURED_NM_FOR_TARGET=@CONFIGURED_NM_
 USUAL_NM_FOR_TARGET = ` \
   if [ -f $$r/$(HOST_SUBDIR)/binutils/nm-new ] ; then \
     echo $$r/$(HOST_SUBDIR)/binutils/nm-new ; \
-  elif [ -f $$r/$(HOST_SUBDIR)/gcc/xgcc ]; then \
-    $(CC_FOR_TARGET) -print-prog-name=nm ; \
+  elif [ -f $$r/$(HOST_SUBDIR)/gcc/nm ]; then \
+    echo $$r/$(HOST_SUBDIR)/gcc/nm ; \
   else \
     if [ '$(host)' = '$(target)' ] ; then \
       echo $(NM); \
@@ -518,16 +577,8 @@ BASE_FLAGS_TO_PASS = [+ FOR flags_to_pas
 	"CONFIG_SHELL=$(SHELL)" \
 	"MAKEINFO=$(MAKEINFO) $(MAKEINFOFLAGS)" 
 
-# For any flags above that may contain shell code that varies from one
-# target library to another.  When doing recursive invocations of the
-# top-level Makefile, we don't want the outer make to evaluate them,
-# so we pass these variables down unchanged.  They must not contain
-# single nor double quotes.
-RECURSE_FLAGS = \
-	CXX_FOR_TARGET='$(CXX_FOR_TARGET_FOR_RECURSIVE_MAKE)' \
-	RAW_CXX_FOR_TARGET='$(RAW_CXX_FOR_TARGET_FOR_RECURSIVE_MAKE)' \
-
-RECURSE_FLAGS_TO_PASS = $(BASE_FLAGS_TO_PASS) $(RECURSE_FLAGS)
+# We leave this in just in case, but it is not needed anymore.
+RECURSE_FLAGS_TO_PASS = 
 
 # Flags to pass down to most sub-makes, in which we're building with
 # the host environment.
@@ -1633,6 +1717,5 @@ $(srcdir)/configure: @MAINT@ $(srcdir)/c
 
 # Don't pass command-line variables to submakes.
 .NOEXPORT:
-MAKEOVERRIDES=
 
 # end of Makefile.in

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]