summaryrefslogtreecommitdiff
path: root/Makefile.tpl
diff options
context:
space:
mode:
authorPaolo Bonzini <bonzini@gnu.org>2005-10-05 07:30:22 +0000
committerPaolo Bonzini <bonzini@gnu.org>2005-10-05 07:30:22 +0000
commita435e563af2616f340fc0b055acf740d0c57828a (patch)
tree32a833ad18ed21e91a42a692314e9195fc463b1e /Makefile.tpl
parente91253d22cf1eb07dfdb825008166b97939c921b (diff)
downloadgdb-a435e563af2616f340fc0b055acf740d0c57828a.tar.gz
2005-10-05 Paolo Bonzini <bonzini@gnu.org>
PR bootstrap/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. * configure: Regenerate. * Makefile.in: Regenerate.
Diffstat (limited to 'Makefile.tpl')
-rw-r--r--Makefile.tpl130
1 files changed, 90 insertions, 40 deletions
diff --git a/Makefile.tpl b/Makefile.tpl
index 2413c0fa300..889552d6e95 100644
--- a/Makefile.tpl
+++ b/Makefile.tpl
@@ -158,11 +158,13 @@ HOST_EXPORTS = \
TOPLEVEL_CONFIGURE_ARGUMENTS="$(TOPLEVEL_CONFIGURE_ARGUMENTS)"; export TOPLEVEL_CONFIGURE_ARGUMENTS; \
GMPLIBS="$(HOST_GMPLIBS)"; export GMPLIBS; \
GMPINC="$(HOST_GMPINC)"; export GMPINC; \
+@if gcc-bootstrap
+ $(RPATH_ENVVAR)=`echo "$(TARGET_LIB_PATH)$$$(RPATH_ENVVAR)" | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'`; export $(RPATH_ENVVAR); \
+@endif gcc-bootstrap
$(RPATH_ENVVAR)=`echo "$(HOST_LIB_PATH)$$$(RPATH_ENVVAR)" | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'`; export $(RPATH_ENVVAR);
# Similar, for later GCC stages.
POSTSTAGE1_HOST_EXPORTS = \
- $(RPATH_ENVVAR)=`echo "$(TARGET_LIB_PATH)$$$(RPATH_ENVVAR)" | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'`; export $(RPATH_ENVVAR); \
$(HOST_EXPORTS) \
CC="$(STAGE_CC_WRAPPER) $$r/$(HOST_SUBDIR)/prev-gcc/xgcc$(exeext) \
-B$$r/$(HOST_SUBDIR)/prev-gcc/ -B$(build_tooldir)/bin/"; export CC; \
@@ -566,7 +568,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@
@@ -698,7 +700,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: [+
@@ -722,7 +743,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: [+
@@ -802,13 +828,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.
@@ -834,7 +869,10 @@ mail-report-with-warnings.log: warning.log
# 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: [+
@@ -915,7 +953,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; \
@@ -942,7 +981,7 @@ maybe-configure-stage[+id+]-[+prefix+][+module+]:
@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; \
@@ -974,7 +1013,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+] && \
@@ -990,8 +1030,9 @@ maybe-clean-stage[+id+]-[+prefix+][+module+]:
@if [+module+]-bootstrap
maybe-all-stage[+id+]-[+prefix+][+module+]: all-stage[+id+]-[+prefix+][+module+]
all-stage[+id+]: all-stage[+id+]-[+prefix+][+module+]
+TARGET-stage[+id+]-[+prefix+][+module+] = $(TARGET-[+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 +] \
@@ -999,14 +1040,15 @@ all-stage[+id+]-[+prefix+][+module+]: configure-stage[+id+]-[+prefix+][+module+]
cd [+subdir+]/[+module+] && \
$(MAKE) [+args+] [+ IF prev
+][+poststage1_args+][+ ENDIF prev
- +] [+stage_make_flags+] [+extra_make_flags+]
+ +] [+stage_make_flags+] [+extra_make_flags+] \
+ $(TARGET-stage[+id+]-[+prefix+][+module+])
maybe-clean-stage[+id+]-[+prefix+][+module+]: clean-stage[+id+]-[+prefix+][+module+]
clean-stage[+id+]: clean-stage[+id+]-[+prefix+][+module+]
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 +] \
@@ -1051,6 +1093,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; \
@@ -1060,6 +1103,7 @@ check-[+module+]:
fi
[+ ELSE check +]
check-[+module+]:
+ @$(unstage)
@r=`${PWD_COMMAND}`; export r; \
s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
$(HOST_EXPORTS) \
@@ -1076,6 +1120,7 @@ maybe-install-[+module+]: install-[+module+]
install-[+module+]:
[+ ELSE install +]
install-[+module+]: installdirs
+ @$(unstage)
@r=`${PWD_COMMAND}`; export r; \
s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
$(HOST_EXPORTS) \
@@ -1098,7 +1143,8 @@ maybe-[+make_target+]-[+module+]: [+make_target+]-[+module+]
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) \
@@ -1160,6 +1206,7 @@ maybe-check-target-[+module+]: check-target-[+module+]
check-target-[+module+]:
[+ ELSE check +]
check-target-[+module+]:
+ @$(unstage)
@r=`${PWD_COMMAND}`; export r; \
s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \[+
IF raw_cxx +]
@@ -1185,6 +1232,7 @@ maybe-install-target-[+module+]: install-target-[+module+]
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 +]
@@ -1211,6 +1259,7 @@ maybe-[+make_target+]-target-[+module+]: [+make_target+]-target-[+module+]
FOR depend +]\
[+depend+]-target-[+module+] [+
ENDFOR depend +]
+ @$(unstage)
@[ -f $(TARGET_SUBDIR)/[+module+]/Makefile ] || exit 0 ; \
r=`${PWD_COMMAND}`; export r; \
s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \[+
@@ -1352,17 +1401,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.
@@ -1375,19 +1430,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 >
@@ -1472,7 +1514,8 @@ 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) NOTPARALLEL= all-stage[+id+]; \
+ $(MAKE) stage[+id+]-start; \
+ $(MAKE) $(RECURSE_FLAGS_TO_PASS) all-stage[+id+]; \
fi
.PHONY: all-stage[+id+] clean-stage[+id+]
@@ -1497,7 +1540,14 @@ do-clean: clean-stage[+id+]
for file in $${files} ; do \
f1=$$r/stage[+prev+]-gcc/$$file; f2=$$r/stage[+id+]-gcc/$$file; \
@do_compare@ > /dev/null 2>&1; \
- test $$? -eq 1 && echo $$file differs >> .bad_compare || true; \
+ if test $$? -eq 1; then \
+ case $$file in \
+ ./cc*-checksum$(objext) | ./libgcc/* ) \
+ echo warning: $$file differs ;; \
+ *) \
+ echo $$file differs >> .bad_compare ;; \
+ esac ; \
+ fi ; \
done ; \
if [ -f .bad_compare ]; then \
echo "Bootstrap comparison failure!"; \
@@ -1512,7 +1562,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
@@ -1545,8 +1597,6 @@ stagefeedback-start::
done
@if gcc-bootstrap
-NOTPARALLEL = .NOTPARALLEL
-$(NOTPARALLEL):
do-distclean: distclean-stage1
@endif gcc-bootstrap