OSDN Git Service

Patch from Serge Belyshev.
[pf3gnuchains/gcc-fork.git] / Makefile.tpl
index cd7e06e..18d55f2 100644 (file)
@@ -249,6 +249,7 @@ TARGET_LIB_PATH = $$r/$(TARGET_SUBDIR)/libstdc++-v3/src/.libs:
 FLAGS_FOR_TARGET = @FLAGS_FOR_TARGET@
 
 AR_FOR_TARGET=@AR_FOR_TARGET@
+CONFIGURED_AR_FOR_TARGET=@CONFIGURED_AR_FOR_TARGET@
 USUAL_AR_FOR_TARGET = ` \
   if [ -f $$r/binutils/ar ] ; then \
     echo $$r/binutils/ar ; \
@@ -256,11 +257,12 @@ USUAL_AR_FOR_TARGET = ` \
     if [ '$(host)' = '$(target)' ] ; then \
       echo $(AR); \
     else \
-       echo ar | sed '$(program_transform_name)' ; \
+      echo $(CONFIGURED_AR_FOR_TARGET) ; \
     fi; \
   fi`
 
 AS_FOR_TARGET=@AS_FOR_TARGET@
+CONFIGURED_AS_FOR_TARGET=@CONFIGURED_AS_FOR_TARGET@
 USUAL_AS_FOR_TARGET = ` \
   if [ -f $$r/gas/as-new ] ; then \
     echo $$r/gas/as-new ; \
@@ -270,7 +272,7 @@ USUAL_AS_FOR_TARGET = ` \
     if [ '$(host)' = '$(target)' ] ; then \
       echo $(AS); \
     else \
-       echo as | sed '$(program_transform_name)' ; \
+      echo $(CONFIGURED_AS_FOR_TARGET) ; \
     fi; \
   fi`
 
@@ -296,6 +298,7 @@ CXXFLAGS_FOR_TARGET = $(CXXFLAGS)
 LIBCXXFLAGS_FOR_TARGET = $(CXXFLAGS_FOR_TARGET) -fno-implicit-templates
 
 DLLTOOL_FOR_TARGET=@DLLTOOL_FOR_TARGET@
+CONFIGURED_DLLTOOL_FOR_TARGET=@CONFIGURED_DLLTOOL_FOR_TARGET@
 USUAL_DLLTOOL_FOR_TARGET = ` \
   if [ -f $$r/binutils/dlltool ] ; then \
     echo $$r/binutils/dlltool ; \
@@ -303,13 +306,14 @@ USUAL_DLLTOOL_FOR_TARGET = ` \
     if [ '$(host)' = '$(target)' ] ; then \
       echo $(DLLTOOL); \
     else \
-       echo dlltool | sed '$(program_transform_name)' ; \
+      echo $(CONFIGURED_DLLTOOL_FOR_TARGET) ; \
     fi; \
   fi`
 
 GCJ_FOR_TARGET = @GCJ_FOR_TARGET@
 
 LD_FOR_TARGET=@LD_FOR_TARGET@
+CONFIGURED_LD_FOR_TARGET=@CONFIGURED_LD_FOR_TARGET@
 USUAL_LD_FOR_TARGET = ` \
   if [ -f $$r/ld/ld-new ] ; then \
     echo $$r/ld/ld-new ; \
@@ -319,13 +323,14 @@ USUAL_LD_FOR_TARGET = ` \
     if [ '$(host)' = '$(target)' ] ; then \
       echo $(LD); \
     else \
-       echo ld | sed '$(program_transform_name)' ; \
+      echo $(CONFIGURED_LD_FOR_TARGET) ; \
     fi; \
   fi`
 
 LDFLAGS_FOR_TARGET = 
 
 NM_FOR_TARGET=@NM_FOR_TARGET@
+CONFIGURED_NM_FOR_TARGET=@CONFIGURED_NM_FOR_TARGET@
 USUAL_NM_FOR_TARGET = ` \
   if [ -f $$r/binutils/nm-new ] ; then \
     echo $$r/binutils/nm-new ; \
@@ -335,11 +340,12 @@ USUAL_NM_FOR_TARGET = ` \
     if [ '$(host)' = '$(target)' ] ; then \
       echo $(NM); \
     else \
-       echo nm | sed '$(program_transform_name)' ; \
+      echo $(CONFIGURED_NM_FOR_TARGET) ; \
     fi; \
   fi`
 
 RANLIB_FOR_TARGET=@RANLIB_FOR_TARGET@
+CONFIGURED_RANLIB_FOR_TARGET=@CONFIGURED_RANLIB_FOR_TARGET@
 USUAL_RANLIB_FOR_TARGET = ` \
   if [ -f $$r/binutils/ranlib ] ; then \
     echo $$r/binutils/ranlib ; \
@@ -351,11 +357,12 @@ USUAL_RANLIB_FOR_TARGET = ` \
          echo ranlib; \
       fi; \
     else \
-       echo ranlib | sed '$(program_transform_name)' ; \
+      echo $(CONFIGURED_RANLIB_FOR_TARGET) ; \
     fi; \
   fi`
 
 WINDRES_FOR_TARGET=@WINDRES_FOR_TARGET@
+CONFIGURED_WINDRES_FOR_TARGET=@CONFIGURED_WINDRES_FOR_TARGET@
 USUAL_WINDRES_FOR_TARGET = ` \
   if [ -f $$r/binutils/windres ] ; then \
     echo $$r/binutils/windres ; \
@@ -363,7 +370,7 @@ USUAL_WINDRES_FOR_TARGET = ` \
     if [ '$(host)' = '$(target)' ] ; then \
       echo $(WINDRES); \
     else \
-       echo windres | sed '$(program_transform_name)' ; \
+      echo $(CONFIGURED_WINDRES_FOR_TARGET) ; \
     fi; \
   fi`
 
@@ -774,6 +781,7 @@ configure-[+module+]:
        CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \
        DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \
        LD="$(LD)"; export LD; \
+       LDFLAGS="$(LDFLAGS)"; export LDFLAGS; \
        NM="$(NM)"; export NM; \
        RANLIB="$(RANLIB)"; export RANLIB; \
        WINDRES="$(WINDRES)"; export WINDRES; \
@@ -1069,6 +1077,7 @@ configure-gcc:
        CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \
        DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \
        LD="$(LD)"; export LD; \
+       LDFLAGS="$(LDFLAGS)"; export LDFLAGS; \
        NM="$(NM)"; export NM; \
        RANLIB="$(RANLIB)"; export RANLIB; \
        WINDRES="$(WINDRES)"; export WINDRES; \
@@ -1328,6 +1337,7 @@ configure-stage1-gcc:
        CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \
        DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \
        LD="$(LD)"; export LD; \
+       LDFLAGS="$(LDFLAGS)"; export LDFLAGS; \
        NM="$(NM)"; export NM; \
        RANLIB="$(RANLIB)"; export RANLIB; \
        WINDRES="$(WINDRES)"; export WINDRES; \
@@ -1367,11 +1377,11 @@ all-stage1-gcc: configure-stage1-gcc prebootstrap
        mv stage1-gcc gcc ; \
        cd gcc && \
        $(MAKE) $(GCC_FLAGS_TO_PASS) \
-               CFLAGS="$(STAGE1_CFLAGS)" \
-               || exit 1 ; \
+               CFLAGS="$(STAGE1_CFLAGS)" && $(STAMP) ../all-stage1-gcc ; \
+       result=$$? ; \
        cd .. ; \
        mv gcc stage1-gcc ; \
-       $(STAMP) all-stage1-gcc
+       exit $$result
 
 # TODO: Deal with STAGE_PREFIX (which is only for ada, incidentally)
 # Possibly pass --enable-werror-always (depending on --enable-werror);
@@ -1398,6 +1408,7 @@ configure-stage2-gcc: all-stage1-gcc
        AS="$(AS)"; export AS; \
        DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \
        LD="$(LD)"; export LD; \
+       LDFLAGS="$(LDFLAGS)"; export LDFLAGS; \
        NM="$(NM)"; export NM; \
        RANLIB="$(RANLIB)"; export RANLIB; \
        WINDRES="$(WINDRES)"; export WINDRES; \
@@ -1442,11 +1453,12 @@ all-stage2-gcc: all-stage1-gcc configure-stage2-gcc
                CC="$(STAGE_CC_WRAPPER) $$r/prev-gcc/xgcc$(exeext) -B$$r/prev-gcc/ -B$(build_tooldir)/bin/" \
                CC_FOR_BUILD="$(STAGE_CC_WRAPPER) $$r/prev-gcc/xgcc$(exeext) -B$$r/prev-gcc/ -B$(build_tooldir)/bin/" \
                STAGE_PREFIX=$$r/prev-gcc/ \
-               $(POSTSTAGE1_FLAGS_TO_PASS) || exit 1 ; \
+               $(POSTSTAGE1_FLAGS_TO_PASS) && $(STAMP) ../all-stage2-gcc ; \
+       result=$$? ; \
        cd .. ; \
        mv prev-gcc stage1-gcc ; \
        mv gcc stage2-gcc ; \
-       $(STAMP) all-stage2-gcc
+       exit $$result
 
 configure-stage3-gcc: all-stage2-gcc
        echo configure-stage3-gcc > stage_last ; \
@@ -1470,6 +1482,7 @@ configure-stage3-gcc: all-stage2-gcc
        AS="$(AS)"; export AS; \
        DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \
        LD="$(LD)"; export LD; \
+       LDFLAGS="$(LDFLAGS)"; export LDFLAGS; \
        NM="$(NM)"; export NM; \
        RANLIB="$(RANLIB)"; export RANLIB; \
        WINDRES="$(WINDRES)"; export WINDRES; \
@@ -1508,11 +1521,12 @@ all-stage3-gcc: all-stage2-gcc configure-stage3-gcc
                CC="$(STAGE_CC_WRAPPER) $$r/prev-gcc/xgcc$(exeext) -B$$r/prev-gcc/ -B$(build_tooldir)/bin/" \
                CC_FOR_BUILD="$(STAGE_CC_WRAPPER) $$r/prev-gcc/xgcc$(exeext) -B$$r/prev-gcc/ -B$(build_tooldir)/bin/" \
                STAGE_PREFIX=$$r/prev-gcc/ \
-               $(POSTSTAGE1_FLAGS_TO_PASS) || exit 1 ; \
+               $(POSTSTAGE1_FLAGS_TO_PASS) && $(STAMP) ../all-stage3-gcc \
+       result=$$? ; \
        cd .. ; \
        mv prev-gcc stage2-gcc ; \
        mv gcc stage3-gcc ; \
-       $(STAMP) all-stage3-gcc
+       exit $$result
 
 # We only want to compare .o files, so set this!
 objext = .o
@@ -1525,8 +1539,8 @@ compare: all-stage3-gcc
        files=`find . -name "*$(objext)" -print` ; \
        cd .. ; \
        for file in $${files} ; do \
-         cmp --ignore-initial=16 $$r/stage2-gcc/$$file $$r/stage3-gcc/$$file \
-             > /dev/null 2>&1; \
+         f1=$$r/stage2-gcc/$$file; f2=$$r/stage3-gcc/$$file; \
+         @do_compare@ > /dev/null 2>&1; \
          test $$? -eq 1 && echo $$file differs >> .bad_compare || true; \
        done ; \
        if [ -f .bad_compare ]; then \
@@ -1547,6 +1561,30 @@ new-bootstrap: compare
        $(MAKE) all ; \
        mv gcc stage3-gcc
 
+new-cleanstrap:
+       rm -rf configure-stage1-gcc all-stage1-gcc stage1-gcc \
+         configure-stage2-gcc all-stage2-gcc stage2-gcc \
+         configure-stage3-gcc all-stage3-gcc stage3-gcc \
+         compare
+       $(MAKE) new-bootstrap
+
+new-restage1:
+       rm -rf all-stage1-gcc \
+         configure-stage2-gcc all-stage2-gcc stage2-gcc \
+         configure-stage3-gcc all-stage3-gcc stage3-gcc \
+         compare
+       $(MAKE) all-stage1-gcc
+
+new-restage2: all-stage1-gcc
+       rm -rf all-stage2-gcc \
+         configure-stage3-gcc all-stage3-gcc stage3-gcc \
+         compare
+       $(MAKE) all-stage2-gcc
+
+new-restage3: all-stage2-gcc
+       rm -rf all-stage3-gcc compare
+       $(MAKE) compare
+
 # --------------------------------------
 # Dependencies between different modules
 # --------------------------------------
@@ -1566,7 +1604,7 @@ all-gcc: maybe-all-libiberty maybe-all-intl maybe-all-bison maybe-all-byacc mayb
 # This is a slightly kludgy method of getting dependencies on 
 # all-build-libiberty correct; it would be better to build it every time.
 all-gcc: maybe-all-build-libiberty
-all-bootstrap: maybe-all-libiberty maybe-all-intl maybe-all-texinfo maybe-all-bison maybe-all-byacc maybe-all-binutils maybe-all-gas maybe-all-ld maybe-all-zlib
+all-bootstrap: [+ FOR host_modules +][+ IF bootstrap +]maybe-all-[+module+] [+ ENDIF bootstrap +][+ ENDFOR host_modules +]
 
 # Host modules specific to gdb.
 # GDB needs to know that the simulator is being built.