OSDN Git Service

2004-10-12 Frank Ch. Eigler <fche@redhat.com>
[pf3gnuchains/gcc-fork.git] / Makefile.tpl
index fed6824..3fb09f7 100644 (file)
@@ -104,10 +104,11 @@ SET_LIB_PATH = @SET_LIB_PATH@
 # Some platforms don't like blank entries, so we remove duplicate,
 # leading and trailing colons.
 REALLY_SET_LIB_PATH = \
+  @SET_GCC_LIB_PATH@ \
   $(RPATH_ENVVAR)=`echo "$(HOST_LIB_PATH):$(TARGET_LIB_PATH):$$$(RPATH_ENVVAR)" | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'`; export $(RPATH_ENVVAR);
 
 # This is the list of directories to be built for the build system.
-BUILD_CONFIGDIRS = libiberty libbanshee
+BUILD_CONFIGDIRS = libiberty
 # 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
@@ -173,7 +174,9 @@ HOST_EXPORTS = \
        OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \
        TOPLEVEL_CONFIGURE_ARGUMENTS="$(TOPLEVEL_CONFIGURE_ARGUMENTS)"; export TOPLEVEL_CONFIGURE_ARGUMENTS; \
        GMPLIBS="$(HOST_GMPLIBS)"; export GMPLIBS; \
-       GMPINC="$(HOST_GMPINC)"; export GMPINC;
+       GMPINC="$(HOST_GMPINC)"; export GMPINC; \
+       SET_GCC_LIB_PATH_CMD="@SET_GCC_LIB_PATH@"; export SET_GCC_LIB_PATH_CMD; \
+       @SET_GCC_LIB_PATH@
 
 # Similar, for later GCC stages.
 STAGE_HOST_EXPORTS = \
@@ -207,7 +210,9 @@ BASE_TARGET_EXPORTS = \
        LDFLAGS="$(LDFLAGS_FOR_TARGET)"; export LDFLAGS; \
        NM="$(NM_FOR_TARGET)"; export NM; \
        RANLIB="$(RANLIB_FOR_TARGET)"; export RANLIB; \
-       WINDRES="$(WINDRES_FOR_TARGET)"; export WINDRES;
+       WINDRES="$(WINDRES_FOR_TARGET)"; export WINDRES; \
+       SET_GCC_LIB_PATH_CMD="@SET_GCC_LIB_PATH@"; export SET_GCC_LIB_PATH_CMD; \
+       @SET_GCC_LIB_PATH@
 
 RAW_CXX_TARGET_EXPORTS = \
        $(BASE_TARGET_EXPORTS) \
@@ -248,6 +253,10 @@ CXX_FOR_BUILD = $(CXX)
 BUILD_PREFIX = @BUILD_PREFIX@
 BUILD_PREFIX_1 = @BUILD_PREFIX_1@
 
+# Flags to pass to stage2 and later makes.  They are defined
+# here so that they can be overridden by Makefile fragments.
+BOOT_CFLAGS= -g -O2
+
 CONFIGURED_BISON = @CONFIGURED_BISON@
 BISON = `if [ -f $$r/$(BUILD_SUBDIR)/bison/tests/bison ] ; then \
            echo $$r/$(BUILD_SUBDIR)/bison/tests/bison ; \
@@ -481,14 +490,6 @@ PICFLAG_FOR_TARGET =
 # Miscellaneous targets and flag lists
 # ------------------------------------
 
-@if gcc-bootstrap
-# Let's leave this as the first rule in the file until toplevel
-# bootstrap is fleshed out completely.
-sorry:
-       @echo Toplevel bootstrap temporarily out of commission.
-       @echo Please reconfigure without --enable-bootstrap
-@endif gcc-bootstrap
-
 # The first rule in the file had better be this one.  Don't put any above it.
 # This lives here to allow makefile fragments to contain dependencies.
 @default_target@:
@@ -908,6 +909,7 @@ configure-[+module+]:
 .PHONY: all-[+module+] maybe-all-[+module+]
 maybe-all-[+module+]:
 @if [+module+]
+TARGET-[+module+]=[+ IF target +][+target+][+ ELSE +]all[+ ENDIF target +]
 maybe-all-[+module+]: all-[+module+]
 all-[+module+]: configure-[+module+]
        @[+ IF bootstrap +]test -f stage_last && exit 0; \
@@ -915,13 +917,8 @@ all-[+module+]: configure-[+module+]
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd [+module+] && $(MAKE) $(FLAGS_TO_PASS)[+ 
-         IF with_x 
-           +] $(X11_FLAGS_TO_PASS)[+ 
-         ENDIF with_x +] [+extra_make_flags+] [+
-         IF (== (get "module") "gcc") +] \
-           `if [ -f gcc/stage_last ]; then echo quickstrap ; else echo all; fi` [+
-         ELSE +]all[+ ENDIF +])
+       (cd [+module+] && $(MAKE) $(FLAGS_TO_PASS) [+extra_make_flags+] \
+         $(TARGET-[+module+]))
 @endif [+module+]
 
 .PHONY: check-[+module+] maybe-check-[+module+]
@@ -1338,7 +1335,9 @@ stage:
 # (both in a combined tree, or separately).  This however requires some
 # change to the gcc driver, again in order to avoid comparison failures.
 
-# Bugs: This is almost certainly not parallel-make safe.
+# Bugs: This is crippled when doing parallel make, the `make all-host'
+# and `make all-target' phases can be parallelized.
+
 
 # 'touch' doesn't work right on some platforms.
 STAMP = echo timestamp > 
@@ -1356,7 +1355,6 @@ STAGE1_LANGUAGES=@stage1_languages@
 objext = .o
 
 # Flags to pass to stage2 and later makes.
-BOOT_CFLAGS= -g -O2
 POSTSTAGE1_FLAGS_TO_PASS = \
        CC="$${CC}" CC_FOR_BUILD="$${CC_FOR_BUILD}" \
        STAGE_PREFIX=$$r/stage[+prev+]-gcc/ \
@@ -1402,20 +1400,27 @@ stage[+id+]-bubble:: [+ IF prev +]stage[+prev+]-bubble[+ ENDIF +][+IF 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+]; \
+         $(MAKE) $(RECURSE_FLAGS_TO_PASS) NOTPARALLEL= all-stage[+id+]; \
        fi
 
-.PHONY: all-stage[+id+]
+.PHONY: all-stage[+id+] clean-stage[+id+]
 all-stage[+id+]: [+ FOR host_modules +][+ IF bootstrap +]\
   maybe-all-stage[+id+]-[+module+][+
 ENDIF bootstrap+] [+ ENDFOR host_modules +]
 
+do-clean: clean-stage[+id+]
+clean-stage[+id+]: [+ FOR host_modules +][+ IF bootstrap +]\
+  maybe-clean-stage[+id+]-[+module+][+
+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+]
+.PHONY: clean-stage[+id+]-[+module+] maybe-clean-stage[+id+]-[+module+]
 
 maybe-configure-stage[+id+]-[+module+]:
 maybe-all-stage[+id+]-[+module+]:
+maybe-clean-stage[+id+]-[+module+]:
 
 @if [+module+]-bootstrap
 maybe-configure-stage[+id+]-[+module+]: configure-stage[+id+]-[+module+]
@@ -1454,7 +1459,18 @@ all-stage[+id+]-[+module+]: configure-stage[+id+]-[+module+]
        $(MAKE) $(FLAGS_TO_PASS) [+ IF prev +] \
                $(POSTSTAGE1_FLAGS_TO_PASS) [+ ENDIF prev +] \
                [+stage_make_flags+] [+extra_make_flags+]
+
+maybe-clean-stage[+id+]-[+module+]: clean-stage[+id+]-[+module+]
+clean-stage[+id+]-[+module+]:
+       @[ -f [+module+]/Makefile ] || [ -f stage[+id+]-[+module+]/Makefile ] \
+         || exit 0 ; \
+       [ -f [+module+]/Makefile ] || $(MAKE) stage[+id+]-start ; \
+       cd [+module+] && \
+       $(MAKE) $(FLAGS_TO_PASS) [+ IF prev +] \
+               $(POSTSTAGE1_FLAGS_TO_PASS) [+ ENDIF prev +] \
+               [+stage_make_flags+] [+extra_make_flags+] clean
 @endif [+module+]-bootstrap
+
 [+ ENDIF bootstrap +][+ ENDFOR host_modules +]
 
 # FIXME: Will not need to be conditional when toplevel bootstrap is the
@@ -1494,10 +1510,9 @@ all-stage[+id+]-[+module+]: configure-stage[+id+]-[+module+]
 [+bootstrap-target+]: stage[+id+]-bubble [+compare-target+] all
 [+ ENDIF bootstrap-target +]
 
-.PHONY: distclean-stage[+id+]
-
-# Rules to wipe a stage and all the following ones, used for cleanstrap
+# Rules to wipe a stage and all the following ones, also used for cleanstrap
 [+ IF prev +]distclean-stage[+prev+]:: distclean-stage[+id+] [+ ENDIF prev +]
+.PHONY: distclean-stage[+id+]
 distclean-stage[+id+]::
        [ -f stage_current ] && $(MAKE) `cat stage_current`-end || :
        rm -rf stage[+id+]-* [+
@@ -1505,7 +1520,7 @@ distclean-stage[+id+]::
 
 [+ IF cleanstrap-target +]
 .PHONY: [+cleanstrap-target+]
-[+cleanstrap-target+]: distclean-stage1 [+bootstrap-target+]
+[+cleanstrap-target+]: distclean [+bootstrap-target+]
 [+ ENDIF cleanstrap-target +]
 @endif gcc-bootstrap
 
@@ -1541,6 +1556,12 @@ profiledbootstrap:
        $(MAKE) stagefeedback-bubble stagefeedback-end
 @endif gcc-bootstrap
 
+@if gcc-bootstrap
+NOTPARALLEL = .NOTPARALLEL
+$(NOTPARALLEL):
+do-distclean: distclean-stage1
+@endif gcc-bootstrap
+
 # --------------------------------------
 # Dependencies between different modules
 # --------------------------------------