This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

proposed bootstrap changes



These do not change the semantics of "make bootstrap" as I don't think
that conversation is done yet.

I propose adding the following targets to gcc's Makefile (which I've
already prototyped and tested):

restage1: moves stage1/* back to . and remakes it (deletes stage[2-4]/*)
restage2: ditto, stage2/*, make with stage1 (deletes stage[3-4]/*)
restage3: ditto, stage3/*, make with stage2 (deletes stage4/*)

quickstrap: Whichever stage it just finished building, it deletes the
	stamp for and builds again (incremental, not from scratch)

cleanstrap: does a make clean; make bootstrap

Note that all five of these targets support LANGUAGES="..." but I
couldn't think of a safe generic way to pass arbitrary parameters to
them.

I've also cleaned up the "sequentializing" code (tested with -j4 on
dual cpu), and renamed all the stamps to be more obvious (like
stage2_build instead of stage_c, stage1_copy instead of stage_b, etc).

Also, something I'm thinking of but haven't done:  incrementally
rebuild all the stages by shuffling files around:
	for i in 1 2 3
	   mv stage$i/* .
	   make
	   mv * stage$i

This would be the "make depstrap".  Would this be useful enough to
warrant the work and support for it?

Also, at the end of a bootstrap or bootstrap-lean, a short message is
printed noting which of these targest are appropriate for further
builds.  Example for "bootstrap":

  Bootstrap complete - make "quickstrap" to redo last build,
  "restage1" through "restage3" to rebuild specific stages,
  or "cleanstrap" to redo the bootstrap from scratch.

bootstrap-lean is similar, but missing the middle line (because the
needed files are missing).

Patch [so far] attached, for the curious.

Index: Makefile.in
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Makefile.in,v
retrieving revision 1.541
diff -p -2 -r1.541 Makefile.in
*** Makefile.in	2000/11/14 09:58:39	1.541
--- Makefile.in	2000/11/16 20:58:40
*************** clean: mostlyclean $(INTL_CLEAN) lang.cl
*** 2234,2239 ****
  	-rm -fr stage1 stage2 stage3 stage4
  # Delete stamps of bootstrap stages
! 	-rm -f stage_*
! 	-rm -f clean_*
  
  # Delete all files that users would normally create
--- 2234,2240 ----
  	-rm -fr stage1 stage2 stage3 stage4
  # Delete stamps of bootstrap stages
! 	-rm -f stage?_*
! 	-rm -f clean?_*
! 	-rm -f stage_last
  
  # Delete all files that users would normally create
*************** STAGE2_FLAGS_TO_PASS = \
*** 2741,2751 ****
  # we can guarantee will build with the native compiler, and also it is the
  # only thing useful for building stage2.
! stage_a: 
  	+$(MAKE) CC="$(CC)" libdir=$(libdir) LANGUAGES="$(BOOT_LANGUAGES)"
! 	touch stage_a
  
! stage_b: stage_a
  	$(MAKE) stage1
! 	touch stage_b
  
  # This used to define ALLOCA as empty, but that would lead to bad results
--- 2742,2754 ----
  # we can guarantee will build with the native compiler, and also it is the
  # only thing useful for building stage2.
! stage1_build:
  	+$(MAKE) CC="$(CC)" libdir=$(libdir) LANGUAGES="$(BOOT_LANGUAGES)"
! 	touch stage1_build
! 	echo stage1_build > stage_last
  
! stage1_copy: stage1_build
  	$(MAKE) stage1
! 	touch stage1_copy
! 	echo stage2_build > stage_last
  
  # This used to define ALLOCA as empty, but that would lead to bad results
*************** stage_b: stage_a
*** 2754,2822 ****
  # because alloca.o is newer, we permit these recursive makes to compile
  # alloca.o.  Then cc1 is newer, so it won't have to be relinked.
! stage_c: stage_b
  	+$(MAKE) CC="stage1/xgcc$(exeext) -Bstage1/ -B$(build_tooldir)/bin/" \
  		 STAGE_PREFIX=stage1/ \
  		 $(STAGE2_FLAGS_TO_PASS)
! 	touch stage_c
  
! stage_d: stage_c
  	+$(MAKE) stage2
! 	touch stage_d
  
! stage_e: stage_d
  	+$(MAKE) CC="stage2/xgcc$(exeext) -Bstage2/ -B$(build_tooldir)/bin/" \
  		 STAGE_PREFIX=stage2/ \
  		 $(STAGE2_FLAGS_TO_PASS)
! 	touch stage_e
  
  # For bootstrap4:
! stage_f: stage_e
  	+$(MAKE) CC="stage3/xgcc$(exeext) -B$(build_tooldir)/bin/ -Bstage3/" \
  		 STAGE_PREFIX=stage3/ \
  		 $(STAGE2_FLAGS_TO_PASS)
! 	touch stage_f
  
  # Additional steps for *-lean targets:
! clean_s1: stage_b
  	-(cd stage1 && rm -f $(VOL_FILES))
  	touch clean_s1
  
! clean_s2: stage_d
  	-rm -rf stage1
  	touch clean_s2
  
! # This next little bit is the way it is for parallel builds.  It's simply
! # a chain of stages which DO have to be done sequentially.
  
! bootstrap_a:              stage_a
! bootstrap_b:  bootstrap_a stage_b
! bootstrap_c:  bootstrap_b stage_c
! bootstrap_d:  bootstrap_c stage_d
! bootstrap_e:  bootstrap_d stage_e
! bootstrap: force bootstrap_e
! 
! bootstrap-lean_a:                   stage_a
! bootstrap-lean_b:  bootstrap-lean_a stage_b
! bootstrap-lean_c:  bootstrap-lean_b clean_s1 
! bootstrap-lean_d:  bootstrap-lean_c stage_c
! bootstrap-lean_e:  bootstrap-lean_d stage_d
! bootstrap-lean_f:  bootstrap-lean_e clean_s2
! bootstrap-lean_g:  bootstrap-lean_f stage_e
! bootstrap-lean: force bootstrap-lean_g
! 
! bootstrap2_c:               stage_c
! bootstrap2_d:  bootstrap2_c stage_d
! bootstrap2_e:  bootstrap2_d stage_e
! bootstrap2: force bootstrap2_e
! 
! bootstrap2-lean_c:                    stage_c
! bootstrap2-lean_d:  bootstrap2-lean_c stage_d
! bootstrap2-lean_e:  bootstrap2-lean_d clean_s2
! bootstrap2-lean_f:  bootstrap2-lean_e stage_e
! bootstrap2-lean: force bootstrap2-lean_f
  
! bootstrap3 bootstrap3-lean: force stage_e
   
! bootstrap4 bootstrap4-lean: force stage_f
  
  # Compare the object files in the current directory with those in the
--- 2757,2847 ----
  # because alloca.o is newer, we permit these recursive makes to compile
  # alloca.o.  Then cc1 is newer, so it won't have to be relinked.
! stage2_build: stage1_copy
  	+$(MAKE) CC="stage1/xgcc$(exeext) -Bstage1/ -B$(build_tooldir)/bin/" \
  		 STAGE_PREFIX=stage1/ \
  		 $(STAGE2_FLAGS_TO_PASS)
! 	touch stage2_build
! 	echo stage2_build > stage_last
  
! stage2_copy: stage2_build
  	+$(MAKE) stage2
! 	touch stage2_copy
! 	echo stage3_build > stage_last
  
! stage3_build: stage2_copy
  	+$(MAKE) CC="stage2/xgcc$(exeext) -Bstage2/ -B$(build_tooldir)/bin/" \
  		 STAGE_PREFIX=stage2/ \
  		 $(STAGE2_FLAGS_TO_PASS)
! 	touch stage3_build
! 	echo stage3_build > stage_last
  
  # For bootstrap4:
! stage3_copy: stage3_build
! 	+$(MAKE) stage3
! 	touch stage3_copy
! 	echo stage4_build > stage_last
! 
! stage4_build: stage3_copy
  	+$(MAKE) CC="stage3/xgcc$(exeext) -B$(build_tooldir)/bin/ -Bstage3/" \
  		 STAGE_PREFIX=stage3/ \
  		 $(STAGE2_FLAGS_TO_PASS)
! 	touch stage4_build
! 	echo stage4_build > stage_last
  
  # Additional steps for *-lean targets:
! clean_s1: stage1_copy
  	-(cd stage1 && rm -f $(VOL_FILES))
  	touch clean_s1
  
! clean_s2: stage2_copy
  	-rm -rf stage1
  	touch clean_s2
+ 
+ # The various entry points for bootstrapping.
+ 
+ bootstrap: stage3_build
+ 	@echo
+ 	@echo Bootstrap complete - make \"quickstrap\" to redo last build,
+ 	@echo \"restage1\" through \"restage3\" to rebuild specific stages,
+ 	@echo or \"cleanstrap\" to redo the bootstrap from scratch.
+ 
+ bootstrap-lean : clean_s1 clean_s2 stage3_build
+ 	@echo
+ 	@echo Bootstrap complete - make \"quickstrap\" to redo last build,
+ 	@echo or \"cleanstrap\" to redo the bootstrap from scratch.
  
! bootstrap2: bootstrap
  
! bootstrap2-lean : bootstrap_lean
  
! bootstrap3 bootstrap3-lean: bootstrap
   
! bootstrap4 bootstrap4-lean: stage4_build
! 
! restage1:
! 	-mv stage1/* .
! 	-rm -rf stage1 stage2 stage3 stage4 stage1_build stage1_copy
! 	$(MAKE) stage1_build
! 
! restage2:
! 	-mv stage2/* .
! 	-rm -rf stage2 stage3 stage4 stage2_build stage2_copy
! 	$(MAKE) LANGUAGES="$(LANGUAGES)" stage2_build
! 
! restage3:
! 	-mv stage3/* .
! 	-rm -rf stage3 stage4 stage3_build stage3_copy
! 	$(MAKE) LANGUAGES="$(LANGUAGES)" stage3_build
! 
! quickstrap:
! 	if test -f stage_last ; then \
! 	  LAST=`cat stage_last`; rm $$LAST; $(MAKE) LANGUAGES="$(LANGUAGES)" $$LAST; \
! 	else \
! 	  $(MAKE) stage1_build; \
! 	fi
! 
! cleanstrap:
! 	-$(MAKE) clean
! 	$(MAKE) LANGUAGES="$(LANGUAGES)" bootstrap
  
  # Compare the object files in the current directory with those in the

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]