|
|
Here is a resubmit of the patch to make toplevel bootstrap parallel,
this time without using MAKEOVERRIDES.
:ADDPATCH toplevel:
Paolo
2005-07-15 Paolo Bonzini <bonzini@xxxxxxx>
PR target/22340
* configure.in (default_target): Remove.
* Makefile.tpl (all): Do not use prerequisites as subroutines
(all) [gcc-bootstrap]: Bootstrap gcc first if it was not done yet.
(do-[+make_target+], check, install, [+bootstrap_target+]): Do not
use prerequisites as subroutines.
(check-host, check-target): New.
(bootstrap configure & all targets): Do not use stage*-start
if the directory layout is already ok.
(non-bootstrap configure & all targets): Prepend a $(unstage).
(stage[+id+]-bubble): Do that here. Do not use NOTPARALLEL.
(NOTPARALLEL): Remove.
(unstage, stage variables): New variables.
(unstage, stage targets): Simply expand to those variables.
Index: configure.in
===================================================================
RCS file: /cvs/gcc/gcc/configure.in,v
retrieving revision 1.362
diff -p -u -u -p -r1.362 configure.in
--- configure.in 8 Aug 2005 09:19:07 -0000 1.362
+++ configure.in 8 Aug 2005 13:00:31 -0000
@@ -1765,18 +1765,14 @@ esac
case "$enable_bootstrap" in
yes)
bootstrap_lean='#'
- default_target=bootstrap
bootstrap_suffix=bootstrap ;;
lean)
bootstrap_lean=''
- default_target=bootstrap
bootstrap_suffix=bootstrap ;;
no)
- default_target=all
bootstrap_suffix=no-bootstrap ;;
esac
AC_SUBST(bootstrap_lean)
-AC_SUBST(default_target)
for module in ${build_configdirs} ; do
if test -z "${no_recursion}" \
Index: Makefile.tpl
===================================================================
RCS file: /cvs/gcc/gcc/Makefile.tpl,v
retrieving revision 1.140
diff -p -u -u -p -r1.140 Makefile.tpl
--- Makefile.tpl 8 Aug 2005 09:19:17 -0000 1.140
+++ Makefile.tpl 8 Aug 2005 13:00:31 -0000
@@ -534,7 +534,7 @@ PICFLAG_FOR_TARGET =
# 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@:
+all:
#### host and target specific makefile fragments come in here.
@target_makefile_frag@
@@ -666,7 +666,26 @@ configure-target: [+
# The target built for a native non-bootstrap build.
.PHONY: all
-all: unstage all-host all-target stage
+all:
+@if gcc-bootstrap
+ @r=`${PWD_COMMAND}`; export r; \
+ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+ if [ ! -f stage_last ]; then \
+ $(MAKE) $(RECURSE_FLAGS_TO_PASS) bootstrap; \
+ fi
+@endif gcc-bootstrap
+ @$(unstage); \
+ r=`${PWD_COMMAND}`; export r; \
+ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+ if [ -f stage_last ]; then \
+ $(MAKE) $(TARGET_FLAGS_TO_PASS) all-host; \
+ else \
+ $(MAKE) $(RECURSE_FLAGS_TO_PASS) all-host; \
+ fi
+ @r=`${PWD_COMMAND}`; export r; \
+ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+ $(MAKE) $(RECURSE_FLAGS_TO_PASS) all-target
+ @$(stage)
.PHONY: all-build
all-build: [+
@@ -690,7 +709,12 @@ all-target: [+
# but it may do additional work as well).
[+ FOR recursive_targets +]
.PHONY: do-[+make_target+]
-do-[+make_target+]: unstage [+make_target+]-host [+make_target+]-target stage
+do-[+make_target+]:
+ @$(unstage)
+ @$(MAKE) $(RECURSE_FLAGS_TO_PASS) [+make_target+]-host \
+ [+make_target+]-target
+ @$(stage)
+
.PHONY: [+make_target+]-host
[+make_target+]-host: [+
@@ -770,13 +794,22 @@ clean-target-libgcc:
check: do-check
# Only include modules actually being configured and built.
-do-check: unstage [+
+.PHONY: check-host
+check-host: [+
FOR host_modules +] \
maybe-check-[+module+][+
- ENDFOR host_modules +][+
+ ENDFOR host_modules +]
+
+.PHONY: check-target
+check-target: [+
FOR target_modules +] \
maybe-check-target-[+module+][+
- ENDFOR target_modules +] stage
+ ENDFOR target_modules +]
+
+do-check:
+ @$(unstage)
+ @$(MAKE) $(RECURSE_FLAGS_TO_PASS) check-host check-target
+ @$(stage)
# Automated reporting of test results.
@@ -802,7 +835,10 @@ mail-report-with-warnings.log: warning.l
# Installation targets.
.PHONY: install uninstall
-install: installdirs install-host install-target
+install:
+ @$(unstage)
+ @$(MAKE) $(RECURSE_FLAGS_TO_PASS) installdirs install-host
install-target
+ @$(stage)
.PHONY: install-host-nogcc
install-host-nogcc: [+
@@ -883,7 +919,8 @@ maybe-configure-[+prefix+][+module+]:
maybe-configure-[+prefix+][+module+]: configure-[+prefix+][+module+]
configure-[+prefix+][+module+]: [+deps+]
@[+ IF bootstrap +]test -f stage_last && exit 0; \
- [+ ENDIF bootstrap +]test ! -f [+subdir+]/[+module+]/Makefile || exit
0; \
+ [+ ELSE bootstrap +]$(unstage)
+ @[+ ENDIF bootstrap +]test ! -f [+subdir+]/[+module+]/Makefile || exit
0; \
$(SHELL) $(srcdir)/mkinstalldirs [+subdir+]/[+module+] ; \
r=`${PWD_COMMAND}`; export r; \
s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
@@ -910,7 +947,7 @@ maybe-configure-stage[+id+]-[+prefix+][+
@if [+module+]-bootstrap
maybe-configure-stage[+id+]-[+prefix+][+module+]:
configure-stage[+id+]-[+prefix+][+module+]
configure-stage[+id+]-[+prefix+][+module+]: [+deps+]
- @$(MAKE) stage[+id+]-start
+ @[ `cat stage_current` = stage[+id+] ] || $(MAKE) stage[+id+]-start
@[ -f [+subdir+]/[+module+]/Makefile ] && exit 0 || : ; \
r=`${PWD_COMMAND}`; export r; \
s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
@@ -942,7 +979,8 @@ TARGET-[+prefix+][+module+]=[+
maybe-all-[+prefix+][+module+]: all-[+prefix+][+module+]
all-[+prefix+][+module+]: configure-[+prefix+][+module+]
@[+ IF bootstrap +]test -f stage_last && exit 0; \
- [+ ENDIF bootstrap +]r=`${PWD_COMMAND}`; export r; \
+ [+ ELSE bootstrap +]$(unstage)
+ @[+ ENDIF bootstrap +]r=`${PWD_COMMAND}`; export r; \
s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
[+exports+] \
(cd [+subdir+]/[+module+] && \
@@ -959,7 +997,7 @@ maybe-clean-stage[+id+]-[+prefix+][+modu
maybe-all-stage[+id+]-[+prefix+][+module+]:
all-stage[+id+]-[+prefix+][+module+]
all-stage[+id+]: all-stage[+id+]-[+prefix+][+module+]
all-stage[+id+]-[+prefix+][+module+]:
configure-stage[+id+]-[+prefix+][+module+]
- @$(MAKE) stage[+id+]-start
+ @[ `cat stage_current` = stage[+id+] ] || $(MAKE) stage[+id+]-start
@r=`${PWD_COMMAND}`; export r; \
s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
[+exports+][+ IF prev +] \
@@ -974,7 +1012,7 @@ clean-stage[+id+]: clean-stage[+id+]-[+p
clean-stage[+id+]-[+prefix+][+module+]:
@[ -f [+subdir+]/[+module+]/Makefile ] || [ -f
[+subdir+]/stage[+id+]-[+module+]/Makefile ] \
|| exit 0 ; \
- [ -f [+subdir+]/[+module+]/Makefile ] || $(MAKE) stage[+id+]-start ; \
+ @[ `cat stage_current` = stage[+id+] ] || $(MAKE) stage[+id+]-start
cd [+subdir+]/[+module+] && \
$(MAKE) [+args+] [+ IF prev +] \
[+poststage1_args+] [+ ENDIF prev +] \
@@ -1019,6 +1057,7 @@ check-[+module+]:
[+ ELIF no_check_cross +]
# This module is only tested in a native toolchain.
check-[+module+]:
+ @$(unstage)
@if [ '$(host)' = '$(target)' ] ; then \
r=`${PWD_COMMAND}`; export r; \
s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
@@ -1028,6 +1067,7 @@ check-[+module+]:
fi
[+ ELSE check +]
check-[+module+]:
+ @$(unstage)
@r=`${PWD_COMMAND}`; export r; \
s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
$(HOST_EXPORTS) \
@@ -1044,6 +1084,7 @@ maybe-install-[+module+]: install-[+modu
install-[+module+]:
[+ ELSE install +]
install-[+module+]: installdirs
+ @$(unstage)
@r=`${PWD_COMMAND}`; export r; \
s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
$(HOST_EXPORTS) \
@@ -1066,7 +1107,8 @@ maybe-[+make_target+]-[+module+]: [+make
FOR depend +]\
[+depend+]-[+module+] [+
ENDFOR depend +]
- @[ -f ./[+module+]/Makefile ] || exit 0; \
+ @[+ IF bootstrap +][+ ELSE +]$(unstage)
+ @[+ ENDIF bootstrap +][ -f ./[+module+]/Makefile ] || exit 0; \
r=`${PWD_COMMAND}`; export r; \
s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
$(HOST_EXPORTS) \
@@ -1128,6 +1170,7 @@ maybe-check-target-[+module+]: check-tar
check-target-[+module+]:
[+ ELSE check +]
check-target-[+module+]:
+ @$(unstage)
@r=`${PWD_COMMAND}`; export r; \
s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \[+
IF raw_cxx +]
@@ -1153,6 +1196,7 @@ maybe-install-target-[+module+]: install
install-target-[+module+]:
[+ ELSE install +]
install-target-[+module+]: installdirs
+ @$(unstage)
@r=`${PWD_COMMAND}`; export r; \
s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \[+
IF raw_cxx +]
@@ -1179,7 +1223,8 @@ maybe-[+make_target+]-target-[+module+]:
FOR depend +]\
[+depend+]-target-[+module+] [+
ENDFOR depend +]
- @[ -f $(TARGET_SUBDIR)/[+module+]/Makefile ] || exit 0 ; \
+ @$(MAKE) unstage; \
+ [ -f $(TARGET_SUBDIR)/[+module+]/Makefile ] || exit 0 ; \
r=`${PWD_COMMAND}`; export r; \
s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \[+
IF raw_cxx +]
@@ -1320,17 +1365,23 @@ gcc-no-fixedincludes:
# stage_last instead tracks the stage that was built last. These targets
# are dummy when toplevel bootstrap is not active.
-.PHONY: unstage
-unstage:
+# While making host and target tools, symlinks to the final stage must be
+# there, so $(MAKE) $(unstage) should be run at various points. To avoid
+# excessive recursive invocations of make, we "inline" them using a variable.
+
+unstage = :
+stage = :
+
@if gcc-bootstrap
- @[ -f stage_current ] || $(MAKE) `cat stage_last`-start
+unstage = [ -f stage_current ] || $(MAKE) `cat stage_last`-start
+stage = $(MAKE) `cat stage_current`-end
@endif gcc-bootstrap
-.PHONY: stage
+.PHONY: unstage stage
+unstage:
+ @$(unstage)
stage:
-@if gcc-bootstrap
- @$(MAKE) `cat stage_current`-end
-@endif gcc-bootstrap
+ @$(stage)
# We name the build directories for the various stages "stage1-gcc",
# "stage2-gcc","stage3-gcc", etc.
@@ -1343,19 +1394,6 @@ stage:
# mv on platforms where symlinks to directories do not work or are not
# reliable.
-# At the end of the bootstrap, a symlink to 'stage3-gcc' named 'gcc' must
-# be kept, so that libraries can find it. Ick!
-
-# It would be best to preinstall gcc into a staging area (and in the
-# future, gather there all prebootstrap packages). This would allow
-# assemblers and linkers can be bootstrapped as well as the compiler
-# (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 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 >
@@ -1440,7 +1478,8 @@ stage[+id+]-bubble:: [+ IF prev +]stage[
IF prev +]|| test -f stage[+prev+]-lean [+ ENDIF prev +] ; then \
echo Skipping rebuild of stage[+id+] ; \
else \
- $(MAKE) $(RECURSE_FLAGS_TO_PASS) NOTPARALLEL= all-stage[+id+]; \
+ $(MAKE) stage[+id+]-start; \
+ $(MAKE) $(RECURSE_FLAGS_TO_PASS) all-stage[+id+]; \
fi
.PHONY: all-stage[+id+] clean-stage[+id+]
@@ -1480,7 +1519,9 @@ do-clean: clean-stage[+id+]
[+ IF bootstrap-target +]
.PHONY: [+bootstrap-target+]
-[+bootstrap-target+]: stage[+id+]-bubble [+compare-target+] all
+[+bootstrap-target+]: stage[+id+]-bubble
+ [+ IF compare-target +]$(MAKE) [+compare-target+]
+ [+ ENDIF compare-target +]$(MAKE) $(RECURSE_FLAGS_TO_PASS) all
[+ ENDIF bootstrap-target +]
# Rules to wipe a stage and all the following ones, also used for cleanstrap
@@ -1513,8 +1554,6 @@ stagefeedback-start::
done
@if gcc-bootstrap
-NOTPARALLEL = .NOTPARALLEL
-$(NOTPARALLEL):
do-distclean: distclean-stage1
@endif gcc-bootstrap
|
|