2004-04-25 Paolo Bonzini * Makefile.tpl (RELOCATE_FLAGS_TO_PASS): New variable. (configure-stage1-gcc, configure-stage2-gcc): Pass it. (configure-stage2-gcc, configure-stage3-gcc, (all-stage2-gcc, all-stage3-gcc): Use staged gcc. Link a stageN directory to stage-previous instead of renaming a stageN-gcc to prev-gcc. (all-stage1-gcc, all-stage2-gcc): Install after making. diff -u gcc-save/Makefile.tpl gcc/Makefile.tpl --- gcc-save/Makefile.tpl 2004-04-24 07:56:08.000000000 +0200 +++ gcc/Makefile.tpl 2004-04-25 00:04:58.000000000 +0200 @@ -1281,17 +1281,31 @@ # GCC bootstrap support # --------------------- -# We name the directories for the various stages "stage1-gcc", -# "stage2-gcc","stage3-gcc", etc. -# Unfortunately, the 'compare' process will fail (on debugging information) -# if any directory names are different! -# So in the building rule for each stage, we relocate them before and after. -# The current one is 'gcc', while the previous one is 'prev-gcc'. (The -# current one must be 'gcc' for now because the scripts in that directory -# assume it.) +# We track the current stage (the one in 'gcc') in the stage_last file. +# We name the build directories for the various stages "stage1-gcc", +# "stage2-gcc","stage3-gcc", etc. stage1 and stage2 are compiled +# with the toplevel's 'stage-previous' directory as their prefix; +# at the end of stage1 and stage2 builds, gcc is installed into +# a stage1 or stage2 directory, which is then symlinked to +# 'stage-previous' before building the next stage. The idea is +# that in the future all prebootstrap packages will be gathered +# into the stage1 or stage2 directory. + +# Since the 'compare' process will fail (on debugging information) +# if any directory names are different, we need a constant name for +# the previous stage ('stage-previous') and for the build directories +# For the latter, we use naked names like 'gcc', because the scripts +# in that directory assume it. + # At the end of the bootstrap, 'stage3-gcc' must be moved to 'gcc' so that # libraries can find it. Ick! +RELOCATE_FLAGS_TO_PASS = \ + --prefix="$$r/stage-previous" --exec-prefix='$$(prefix)' \ + --bindir='$$(exec_prefix)/bin' --infodir='$$(prefix)/info' \ + --libdir='$$(exec_prefix)/lib' --libexecdir='$$(exec_prefix)/libexec' \ + --mandir='$$(prefix)/man' --program-transform-name=s,y,y, + # Bugs: This is almost certainly not parallel-make safe. # 'touch' doesn't work right on some platforms. @@ -1315,7 +1329,7 @@ # probably has never heard of them. # * We build only C (and possibly Ada). configure-stage1-gcc: - echo configure-stage1-gcc > stage_last ; \ + echo stage1 > stage_last ; \ if [ -f stage1-gcc/Makefile ] ; then \ $(STAMP) configure-stage1-gcc ; \ exit 0; \ @@ -1359,10 +1373,12 @@ $(SHELL) $${libsrcdir}/configure \ $(HOST_CONFIGARGS) $${srcdiroption} \ --disable-intermodule --disable-coverage \ - --enable-languages="$(STAGE1_LANGUAGES)"; \ + --enable-languages="$(STAGE1_LANGUAGES)" \ + $(RELOCATE_FLAGS_TO_PASS) && $(STAMP) ../configure-stage1-gcc ; \ + result=$$? ; \ cd .. ; \ mv gcc stage1-gcc ; \ - $(STAMP) configure-stage1-gcc + exit $$result # Real targets act phony if they depend on phony targets; this hack # prevents gratuitous rebuilding of stage 1. @@ -1371,13 +1387,14 @@ $(STAMP) prebootstrap all-stage1-gcc: configure-stage1-gcc prebootstrap - echo all-stage1-gcc > stage_last ; \ + echo stage1 > stage_last ; \ r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ mv stage1-gcc gcc ; \ cd gcc && \ $(MAKE) $(GCC_FLAGS_TO_PASS) \ - CFLAGS="$(STAGE1_CFLAGS)" && $(STAMP) ../all-stage1-gcc ; \ + CFLAGS="$(STAGE1_CFLAGS)" && $(STAMP) ../all-stage1-gcc && \ + $(MAKE) install $(GCC_FLAGS_TO_PASS) prefix=$$r/stage1 ; \ result=$$? ; \ cd .. ; \ mv gcc stage1-gcc ; \ @@ -1387,7 +1404,7 @@ # Possibly pass --enable-werror-always (depending on --enable-werror); # that's what @stage2_werror_flag@ is for configure-stage2-gcc: all-stage1-gcc - echo configure-stage2-gcc > stage_last ; \ + echo stage2 > stage_last ; \ if [ -f stage2-gcc/Makefile ] ; then \ $(STAMP) configure-stage2-gcc ; \ exit 0; \ @@ -1396,7 +1413,7 @@ fi ; \ [ -d stage2-gcc ] || mkdir stage2-gcc; \ mv stage2-gcc gcc ; \ - mv stage1-gcc prev-gcc ; \ + ln -sf stage1 stage-previous ; \ r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ @@ -1414,8 +1431,8 @@ WINDRES="$(WINDRES)"; export WINDRES; \ OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ - CC="$(STAGE_CC_WRAPPER) $$r/prev-gcc/xgcc$(exeext) -B$$r/prev-gcc/ -B$(build_tooldir)/bin/"; export CC; \ - CC_FOR_BUILD="$(STAGE_CC_WRAPPER) $$r/prev-gcc/xgcc$(exeext) -B$$r/prev-gcc/ -B$(build_tooldir)/bin/"; export CC_FOR_BUILD; \ + CC="$(STAGE_CC_WRAPPER) $$r/stage-previous/bin/gcc$(exeext)"; export CC; \ + CC_FOR_BUILD="$(STAGE_CC_WRAPPER) $$r/stage-previous/bin/gcc$(exeext)"; export CC_FOR_BUILD; \ echo Configuring stage 2 in gcc; \ cd gcc || exit 1; \ case $(srcdir) in \ @@ -1430,11 +1447,12 @@ libsrcdir="$$s/gcc";; \ esac; \ $(SHELL) $${libsrcdir}/configure \ - $(HOST_CONFIGARGS) $${srcdiroption} @stage2_werror_flag@ ; \ + $(HOST_CONFIGARGS) $${srcdiroption} @stage2_werror_flag@ \ + $(RELOCATE_FLAGS_TO_PASS) && $(STAMP) ../configure-stage2-gcc ; \ + result=$$? ; \ cd .. ; \ mv gcc stage2-gcc ; \ - mv prev-gcc stage1-gcc ; \ - $(STAMP) configure-stage2-gcc + exit $$result # Flags to pass to stage2 and later makes. BOOT_CFLAGS= -g -O2 @@ -1443,25 +1461,25 @@ ADAC="\$$(CC)" all-stage2-gcc: all-stage1-gcc configure-stage2-gcc - echo all-stage2-gcc > stage_last ; \ + echo stage2 > stage_last ; \ r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ mv stage2-gcc gcc ; \ - mv stage1-gcc prev-gcc ; \ + ln -sf stage1 stage-previous ; \ cd gcc && \ $(MAKE) $(GCC_FLAGS_TO_PASS) \ - 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/" \ + CC="$(STAGE_CC_WRAPPER) $$r/stage-previous/bin/gcc$(exeext)" \ + CC_FOR_BUILD="$(STAGE_CC_WRAPPER) $$r/stage-previous/bin/gcc$(exeext)" \ STAGE_PREFIX=$$r/prev-gcc/ \ - $(POSTSTAGE1_FLAGS_TO_PASS) && $(STAMP) ../all-stage2-gcc ; \ + $(POSTSTAGE1_FLAGS_TO_PASS) && $(STAMP) ../all-stage2-gcc && \ + $(MAKE) install $(GCC_FLAGS_TO_PASS) prefix=$$r/stage2 ; \ result=$$? ; \ cd .. ; \ - mv prev-gcc stage1-gcc ; \ mv gcc stage2-gcc ; \ exit $$result configure-stage3-gcc: all-stage2-gcc - echo configure-stage3-gcc > stage_last ; \ + echo stage3 > stage_last ; \ if [ -f stage3-gcc/Makefile ] ; then \ $(STAMP) configure-stage3-gcc ; \ exit 0; \ @@ -1470,7 +1488,7 @@ fi ; \ [ -d stage3-gcc ] || mkdir stage3-gcc; \ mv stage3-gcc gcc ; \ - mv stage2-gcc prev-gcc ; \ + ln -sf stage2 stage-previous ; \ r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ @@ -1488,8 +1506,8 @@ WINDRES="$(WINDRES)"; export WINDRES; \ OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ - CC="$(STAGE_CC_WRAPPER) $$r/prev-gcc/xgcc$(exeext) -B$$r/prev-gcc/ -B$(build_tooldir)/bin/"; export CC; \ - CC_FOR_BUILD="$(STAGE_CC_WRAPPER) $$r/prev-gcc/xgcc$(exeext) -B$$r/prev-gcc/ -B$(build_tooldir)/bin/"; export CC_FOR_BUILD; \ + CC="$(STAGE_CC_WRAPPER) $$r/stage-previous/bin/gcc$(exeext)"; export CC; \ + CC_FOR_BUILD="$(STAGE_CC_WRAPPER) $$r/stage-previous/bin/gcc$(exeext)"; export CC_FOR_BUILD; \ echo Configuring stage 3 in gcc; \ cd gcc || exit 1; \ case $(srcdir) in \ @@ -1504,27 +1522,27 @@ libsrcdir="$$s/gcc";; \ esac; \ $(SHELL) $${libsrcdir}/configure \ - $(HOST_CONFIGARGS) $${srcdiroption} @stage2_werror_flag@ ; \ + $(HOST_CONFIGARGS) $${srcdiroption} @stage2_werror_flag@ \ + && $(STAMP) ../configure-stage3-gcc ; \ + result=$$? ; \ cd .. ; \ mv gcc stage3-gcc ; \ - mv prev-gcc stage2-gcc ; \ - $(STAMP) configure-stage3-gcc + exit $$result all-stage3-gcc: all-stage2-gcc configure-stage3-gcc - echo all-stage3-gcc > stage_last ; \ + echo stage3 > stage_last ; \ r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - mv stage2-gcc prev-gcc ; \ mv stage3-gcc gcc ; \ + ln -sf stage2 stage-previous ; \ cd gcc && \ $(MAKE) $(GCC_FLAGS_TO_PASS) \ - 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/" \ + CC="$(STAGE_CC_WRAPPER) $$r/stage-previous/bin/gcc$(exeext)" \ + CC_FOR_BUILD="$(STAGE_CC_WRAPPER) $$r/stage-previous/bin/gcc$(exeext)" \ STAGE_PREFIX=$$r/prev-gcc/ \ $(POSTSTAGE1_FLAGS_TO_PASS) && $(STAMP) ../all-stage3-gcc \ result=$$? ; \ cd .. ; \ - mv prev-gcc stage2-gcc ; \ mv gcc stage3-gcc ; \ exit $$result