2004-08-26 Paolo Bonzini <bonzini@gnu.org>
[gcc/gcc.git] / Makefile.tpl
index 27ab1fb..fed6824 100644 (file)
@@ -1376,19 +1376,19 @@ POSTSTAGE1_FLAGS_TO_PASS = \
 .PHONY: stage[+id+]-start stage[+id+]-end
 
 stage[+id+]-start::
-       [ -f stage_current ] && $(MAKE) `cat stage_current`-end || :
+       @[ -f stage_current ] && $(MAKE) `cat stage_current`-end || : ; \
        echo stage[+id+] > stage_current ; \
        echo stage[+id+] > stage_last[+ FOR host_modules +][+ IF bootstrap +]
 @if [+ module +]
-       [ -d stage[+id+]-[+module+] ] || mkdir stage[+id+]-[+module+]; \
+       @[ -d stage[+id+]-[+module+] ] || mkdir stage[+id+]-[+module+]; \
        set stage[+id+]-[+module+] [+module+] ; @CREATE_LINK_TO_DIR@ [+ IF prev +] ; \
        set stage[+prev+]-[+module+] prev-[+module+] ; @CREATE_LINK_TO_DIR@ [+ ENDIF prev +]
 @endif [+ module +][+ ENDIF bootstrap +][+ ENDFOR host_modules +]
 
 stage[+id+]-end::
-       rm -f stage_current[+ FOR host_modules +][+ IF bootstrap +]
+       @rm -f stage_current[+ FOR host_modules +][+ IF bootstrap +]
 @if [+ module +]
-       set [+module+] stage[+id+]-[+module+] ; @UNDO_LINK_TO_DIR@ [+ IF prev +] ; \
+       @set [+module+] stage[+id+]-[+module+] ; @UNDO_LINK_TO_DIR@ [+ IF prev +] ; \
        set prev-[+module+] stage[+prev+]-[+module+] ; @UNDO_LINK_TO_DIR@ [+ ENDIF prev +]
 @endif [+ module +][+ ENDIF bootstrap +][+ ENDFOR host_modules +]
 
@@ -1396,12 +1396,14 @@ stage[+id+]-end::
 # are remade, but not reconfigured.  The next stage (if any) will not
 # be reconfigured as well.
 .PHONY: stage[+id+]-bubble
-stage[+id+]-bubble:: [+ IF prev +]stage[+prev+]-bubble[+ ENDIF +]
-       @case `echo all-stage[+id+]-*` in \
-         'all-stage[+id+]-*') ;; \
-         *) echo Remaking stage [+id+] ; rm -f all-stage[+id+]-* ;; \
-       esac ; \
-       $(MAKE) $(RECURSE_FLAGS_TO_PASS) all-stage[+id+]
+stage[+id+]-bubble:: [+ IF prev +]stage[+prev+]-bubble[+ ENDIF +][+IF lean +]
+       @bootstrap_lean@-rm -rf stage[+lean+]-* ; $(STAMP) stage[+lean+]-lean[+ ENDIF lean +]
+       @if test -f stage[+id+]-lean [+
+         IF prev +]|| test -f stage[+prev+]-lean [+ ENDIF prev +] ; then \
+         echo Skipping rebuild of stage[+id+] ; \
+       else \
+         $(MAKE) $(RECURSE_FLAGS_TO_PASS) all-stage[+id+]; \
+       fi
 
 .PHONY: all-stage[+id+]
 all-stage[+id+]: [+ FOR host_modules +][+ IF bootstrap +]\
@@ -1409,19 +1411,17 @@ all-stage[+id+]: [+ FOR host_modules +][+ IF bootstrap +]\
 ENDIF bootstrap+] [+ ENDFOR host_modules +]
 
 [+ FOR host_modules +][+ IF bootstrap +]
+.PHONY: configure-stage[+id+]-[+module+] maybe-configure-stage[+id+]-[+module+]
+.PHONY: all-stage[+id+]-[+module+] maybe-all-stage[+id+]-[+module+]
+
 maybe-configure-stage[+id+]-[+module+]:
 maybe-all-stage[+id+]-[+module+]:
 
 @if [+module+]-bootstrap
 maybe-configure-stage[+id+]-[+module+]: configure-stage[+id+]-[+module+]
-configure-stage[+id+]-[+module+]: [+ IF prev +] maybe-all-stage[+prev+]-[+module+] [+ ENDIF prev +]
-       $(MAKE) stage[+id+]-start
-       @if [ -f stage[+id+]-[+module+]/Makefile ] ; then \
-         $(STAMP) configure-stage[+id+]-[+module+] ; \
-         exit 0; \
-       else \
-         true ; \
-       fi ; \
+configure-stage[+id+]-[+module+]:
+       @$(MAKE) stage[+id+]-start
+       @[ -f [+module+]/Makefile ] && exit 0 || : ; \
        r=`${PWD_COMMAND}`; export r; \
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; [+ IF prev +] \
        $(STAGE_HOST_EXPORTS) [+ ELSE prev +] \
@@ -1441,12 +1441,11 @@ configure-stage[+id+]-[+module+]: [+ IF prev +] maybe-all-stage[+prev+]-[+module
        esac; \
        $(SHELL) $${libsrcdir}/configure \
          $(HOST_CONFIGARGS) $${srcdiroption} \
-         [+stage_configure_flags+] [+extra_configure_flags+] && \
-         $(STAMP) ../configure-stage[+id+]-[+module+]
+         [+stage_configure_flags+] [+extra_configure_flags+]
 
 maybe-all-stage[+id+]-[+module+]: all-stage[+id+]-[+module+]
 all-stage[+id+]-[+module+]: configure-stage[+id+]-[+module+]
-       $(MAKE) stage[+id+]-start
+       @$(MAKE) stage[+id+]-start
        @r=`${PWD_COMMAND}`; export r; \
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; [+ IF prev +] \
        $(STAGE_HOST_EXPORTS) [+ ELSE prev +] \
@@ -1454,8 +1453,7 @@ all-stage[+id+]-[+module+]: configure-stage[+id+]-[+module+]
        cd [+module+] && \
        $(MAKE) $(FLAGS_TO_PASS) [+ IF prev +] \
                $(POSTSTAGE1_FLAGS_TO_PASS) [+ ENDIF prev +] \
-               [+stage_make_flags+] [+extra_make_flags+] && \
-       $(STAMP) ../all-stage[+id+]-[+module+]
+               [+stage_make_flags+] [+extra_make_flags+]
 @endif [+module+]-bootstrap
 [+ ENDIF bootstrap +][+ ENDFOR host_modules +]
 
@@ -1463,8 +1461,12 @@ all-stage[+id+]-[+module+]: configure-stage[+id+]-[+module+]
 # only possibility, but now it conflicts with no-bootstrap rules
 @if gcc-bootstrap
 [+ IF compare-target +]
-[+compare-target+]: all-stage[+id+]-gcc
-       [ -f stage_current ] && $(MAKE) `cat stage_current`-end || :
+[+compare-target+]:
+       @if test -f stage[+prev+]-lean; then \
+         echo Cannot compare object files as stage [+prev+] was deleted. ; \
+         exit 0 ; \
+       fi; \
+       [ -f stage_current ] && $(MAKE) `cat stage_current`-end || : ; \
        @r=`${PWD_COMMAND}`; export r; \
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        rm -f .bad_compare ; \
@@ -1483,49 +1485,23 @@ all-stage[+id+]-[+module+]: configure-stage[+id+]-[+module+]
        else \
          true; \
        fi ; \
-       $(STAMP) [+compare-target+]
+       $(STAMP) [+compare-target+][+ IF prev +]
+       @bootstrap_lean@-rm -rf stage[+prev+]-* ; $(STAMP) stage[+prev+]-lean[+ ENDIF prev +]
 [+ ENDIF compare-target +]
 
 [+ IF bootstrap-target +]
 .PHONY: [+bootstrap-target+]
-[+bootstrap-target+]: stage[+id+]-bubble [+
-         IF compare-target +] [+compare-target+] [+
-         ENDIF compare-target +] all
+[+bootstrap-target+]: stage[+id+]-bubble [+compare-target+] all
 [+ ENDIF bootstrap-target +]
 
-.PHONY: restage[+id+] touch-stage[+id+] distclean-stage[+id+]
+.PHONY: distclean-stage[+id+]
 
 # Rules to wipe a stage and all the following ones, used for cleanstrap
 [+ IF prev +]distclean-stage[+prev+]:: distclean-stage[+id+] [+ ENDIF prev +]
 distclean-stage[+id+]::
        [ -f stage_current ] && $(MAKE) `cat stage_current`-end || :
-       rm -rf configure-stage[+id+]-* all-stage[+id+]-* stage[+id+]-* [+
-         IF compare-target +][+compare-target+] [+ ENDIF compare-target +]
-
-# Rules to renew the timestamp on a stage and all the following ones
-[+ IF prev +]touch-stage[+prev+]:: touch-stage[+id+] [+ ENDIF prev +]
-touch-stage[+id+]::
-       @case `echo configure-stage[+id+]-*` in \
-         'configure-stage[+id+]-*') ;; \
-         *) \
-           echo '$(STAMP)' configure-stage[+id+]-* && \
-           $(STAMP) configure-stage[+id+]-* ;; \
-       esac ; \
-       case `echo all-stage[+id+]-*` in \
-         'all-stage[+id+]-*') ;; \
-         *) \
-           echo '$(STAMP)' all-stage[+id+]-* && \
-           $(STAMP) all-stage[+id+]-* ;; \
-       esac
-
-# After building a stage, touch the following ones
-[+ IF prev +]restage[+prev+]:: touch-stage[+id+] [+ ENDIF prev +]
-restage[+id+]::
-       rm -rf all-stage[+id+]-* [+
+       rm -rf stage[+id+]-* [+
          IF compare-target +][+compare-target+] [+ ENDIF compare-target +]
-       $(MAKE) $(RECURSE_FLAGS_TO_PASS) [+
-         IF compare-target +][+compare-target+] [+
-         ELSE +] all-stage[+id+] [+ ENDIF compare-target +]
 
 [+ IF cleanstrap-target +]
 .PHONY: [+cleanstrap-target+]