1 # DP: Make bootstrap: restartable at any point
2 # DP: From: Donn Terry <donn@interix.com>
4 Make bootstrap: restartable at any point.
6 This is in response to a discussion on this topic. This is "take 2" |
7 which should work with parallel builds, though I haven't tested that. |
9 When doing a make bootstrap, it's hard to know (at least when
10 not throughly versed in the process details) how to restart
11 after making a fix. In general, retyping "make bootstrap"
12 will do the wrong thing (particularly if the host and target
13 compilers object files are incompatible!)
15 This change keeps track of the stages completed. The old
16 bootstrap2[234] (and *-lean) targets are rewritten, but work the
19 I've tested this by doing a make bootstrap (on CVS sources as of |
20 last night) and by typing 'make bootstrap' after it's done, |
21 in which case it thinks a moment and does nothing. (Which is exactly
24 I've also done a complete regression, with no surprises. |
26 I tested whether stopping/restarting at a few arbitrary points along the
27 way works with older sources, but haven't tested it real recently,
28 except to do a ^C halfway through a testbuild at one point. |
29 Again, if it works at all, it should work as well as it ever did.
30 I specficially did test it during the period where make bootstrap
31 wasn't succeeding for me, and it helped a LOT in being able to pick up
34 An interesting side-effect: make bootstrap-lean after a make bootstrap |
35 JUST cleans out stage1, with no unwanted consequences. |
38 Fri May 28 15:27:02 1999 Donn Terry (donn@interix.com)
39 * Makefile.in: restructure bootstrap stages to allow
40 clean restart after failure.
42 diff -urP egcs.source.old/gcc/Makefile.in egcs.source/gcc/Makefile.in
43 --- egcs.source.old/gcc/Makefile.in Sun May 23 13:39:21 1999
44 +++ egcs.source/gcc/Makefile.in Thu May 27 16:59:42 1999
45 @@ -2360,6 +2360,8 @@ clean: mostlyclean intl.clean lang.clean
46 rm -rf `echo $(MULTILIB_OPTIONS) | sed -e 's/\// /g'`; \
48 -rm -fr stage1 stage2 stage3 stage4
49 + -rm -f boot_stage_a boot_stage_b boot_stage_c boot_stage_d
50 + -rm -f boot_stage_e boot_stage_f
52 # Delete all files that users would normally create
53 # while building and installing GCC.
54 @@ -2924,33 +2926,83 @@ diff:
55 $(LANG_DIFF_EXCLUDES) \
56 gcc-$(oldversion) gcc-$(version) > gcc-$(oldversion)-$(version).diff
58 -bootstrap bootstrap-lean: force
60 # Only build the C compiler for stage1, because that is the only one that
61 # we can guarantee will build with the native compiler, and also it is the
62 # only thing useful for building stage2.
63 - $(MAKE) CC="$(CC)" libdir=$(libdir) LANGUAGES="$(BOOT_LANGUAGES)"
66 + +$(MAKE) CC="$(CC)" libdir=$(libdir) LANGUAGES="$(BOOT_LANGUAGES)"
68 + echo ---------------------- stage a complete ---------------------
73 + echo ---------------------- stage b complete ---------------------
75 # This used to define ALLOCA as empty, but that would lead to bad results
76 # for a subsequent `make install' since that would not have ALLOCA empty.
77 # To prevent `make install' from compiling alloca.o and then relinking cc1
78 # because alloca.o is newer, we permit these recursive makes to compile
79 # alloca.o. Then cc1 is newer, so it won't have to be relinked.
80 - $(MAKE) CC="stage1/xgcc$(exeext) -Bstage1/ -B$(build_tooldir)/bin/" CFLAGS="$(WARN_CFLAGS) $(BOOT_CFLAGS)" LDFLAGS="$(BOOT_LDFLAGS)" libdir=$(libdir) STAGE_PREFIX=stage1/ LANGUAGES="$(LANGUAGES)"
82 - -if test $@ = bootstrap-lean; then rm -rf stage1; else true; fi
83 - $(MAKE) CC="stage2/xgcc$(exeext) -Bstage2/ -B$(build_tooldir)/bin/" CFLAGS="$(WARN_CFLAGS) $(BOOT_CFLAGS)" LDFLAGS="$(BOOT_LDFLAGS)" libdir=$(libdir) STAGE_PREFIX=stage2/ LANGUAGES="$(LANGUAGES)"
85 + +$(MAKE) CC="stage1/xgcc$(exeext) -Bstage1/ -B$(build_tooldir)/bin/" CFLAGS="$(WARN_CFLAGS) $(BOOT_CFLAGS)" LDFLAGS="$(BOOT_LDFLAGS)" libdir=$(libdir) STAGE_PREFIX=stage1/ LANGUAGES="$(LANGUAGES)"
87 + echo ---------------------- stage c complete ---------------------
89 -bootstrap2 bootstrap2-lean: force
90 - $(MAKE) CC="stage1/xgcc$(exeext) -Bstage1/ -B$(build_tooldir)/bin/" CFLAGS="$(WARN_CFLAGS) $(BOOT_CFLAGS)" LDFLAGS="$(BOOT_LDFLAGS)" libdir=$(libdir) STAGE_PREFIX=stage1/ LANGUAGES="$(LANGUAGES)"
92 - -if test $@ = bootstrap2-lean; then rm -rf stage1; else true; fi
93 - $(MAKE) CC="stage2/xgcc$(exeext) -Bstage2/ -B$(build_tooldir)/bin/" CFLAGS="$(WARN_CFLAGS) $(BOOT_CFLAGS)" LDFLAGS="$(BOOT_LDFLAGS)" libdir=$(libdir) STAGE_PREFIX=stage2/ LANGUAGES="$(LANGUAGES)"
97 + echo ---------------------- stage d complete ---------------------
99 -bootstrap3 bootstrap3-lean: force
100 - $(MAKE) CC="stage2/xgcc$(exeext) -Bstage2/ -B$(build_tooldir)/bin/" CFLAGS="$(WARN_CFLAGS) $(BOOT_CFLAGS)" LDFLAGS="$(BOOT_LDFLAGS)" libdir=$(libdir) STAGE_PREFIX=stage2/ LANGUAGES="$(LANGUAGES)"
102 + +$(MAKE) CC="stage2/xgcc$(exeext) -Bstage2/ -B$(build_tooldir)/bin/" CFLAGS="$(WARN_CFLAGS) $(BOOT_CFLAGS)" LDFLAGS="$(BOOT_LDFLAGS)" libdir=$(libdir) STAGE_PREFIX=stage2/ LANGUAGES="$(LANGUAGES)"
104 + echo ---------------------- stage e complete ---------------------
106 +# Only bootstrap4 uses stage f.
108 + +$(MAKE) CC="stage3/xgcc$(exeext) -Bstage3/ -B$(build_tooldir)/bin/" CFLAGS="$(WARN_CFLAGS) $(BOOT_CFLAGS)" LDFLAGS="$(BOOT_LDFLAGS)" libdir=$(libdir) STAGE_PREFIX=stage3/ LANGUAGES="$(LANGUAGES)"
110 + echo ---------------------- stage f complete ---------------------
115 +# This next little bit is the way it is for parallel builds. It's simply
116 +# a chain of stages which DO have to be done sequentially.
118 +bootstrap_a: boot_stage_a
119 +bootstrap_b: bootstrap_a boot_stage_b
120 +bootstrap_c: bootstrap_b boot_stage_c
121 +bootstrap_d: bootstrap_c boot_stage_d
122 +bootstrap_e: bootstrap_d boot_stage_e
123 +bootstrap: force bootstrap_e
125 +bootstrap-lean_a: boot_stage_a
126 +bootstrap-lean_b: bootstrap-lean_a boot_stage_b
127 +bootstrap-lean_c: bootstrap-lean_b boot_stage_c
128 +bootstrap-lean_d: bootstrap-lean_c boot_stage_d
129 +bootstrap-lean_e: bootstrap-lean_d boot_clean_stage1
130 +bootstrap-lean_f: bootstrap-lean_e boot_stage_e
131 +bootstrap-lean: force bootstrap-lean_f
133 +bootstrap2_c: boot_stage_c
134 +bootstrap2_d: bootstrap2_c boot_stage_d
135 +bootstrap2_e: bootstrap2_d boot_stage_e
136 +bootstrap2: force bootstrap2_e
138 +bootstrap2-lean_c: boot_stage_c
139 +bootstrap2-lean_d: bootstrap2-lean_c boot_stage_d
140 +bootstrap2-lean_e: bootstrap2-lean_d boot_clean_stage1
141 +bootstrap2-lean_f: bootstrap2-lean_e boot_stage_e
142 +bootstrap2-lean: force bootstrap2-lean_f
144 +bootstrap3 bootstrap3-lean: force boot_stage_e
146 +# Only bootstrap4 uses stage f.
147 +bootstrap4 bootstrap4-lean: force boot_stage_f
149 -bootstrap4 bootstrap4-lean: force
150 - $(MAKE) CC="stage3/xgcc$(exeext) -Bstage3/ -B$(build_tooldir)/bin/" CFLAGS="$(WARN_CFLAGS) $(BOOT_CFLAGS)" LDFLAGS="$(BOOT_LDFLAGS)" libdir=$(libdir) STAGE_PREFIX=stage3/ LANGUAGES="$(LANGUAGES)"
152 # Compare the object files in the current directory with those in the