1. HongboZhang
  2. ocaml


xleroy  committed 5c5917d

Nettoyage du bootstrap.

git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@39f963ae5c-01c2-4b8c-9fe0-0dff7051ff02

  • Participants
  • Parent commits f10a437
  • Branches master

Comments (0)

Files changed (1)

File Makefile

View file
  • Ignore whitespace
   typing/typedecl.cmo typing/typemod.cmo
 BYTECOMP=bytecomp/lambda.cmo bytecomp/printlambda.cmo \
-  bytecomp/matching.cmo bytecomp/translcore.cmo bytecomp/translmod.cmo \
-  bytecomp/instruct.cmo bytecomp/dectree.cmo bytecomp/codegen.cmo \
+  bytecomp/dectree.cmo bytecomp/matching.cmo \
+  bytecomp/translcore.cmo bytecomp/translmod.cmo \
+  bytecomp/instruct.cmo bytecomp/codegen.cmo \
   bytecomp/printinstr.cmo bytecomp/opcodes.cmo bytecomp/emitcode.cmo \
   bytecomp/runtimedef.cmo bytecomp/symtable.cmo \
   bytecomp/librarian.cmo bytecomp/linker.cmo
   obj parsing pervasives printexc printf queue set sort stack string sys
 # Recompile the system using the bootstrap compiler
-all: runtime camlc camltop lex/camllex yacc/camlyacc library
+all: runtime camlc camllex camlyacc library camltop
+# The compilation of camltop will fail if the runtime has changed.
+# Never mind, just do make bootstrap to reach fixpoint again.
 # Compile everything the first time
 world: coldstart all
+# Complete bootstrapping cycle
+bootstrap: backup promote-cross clean camlc camllex library-cross \
+           promote clean all compare
+# backup        save the bootstrap compiler
+# promote-cross promote the new compiler but keep the old runtime
+#               (runs on boot/camlrun, produces code for byterun/camlrun)
+# clean camlc camllex
+#               rebuild the compiler (runs on byterun/camlrun)
+# library-cross rebuild the library (using byterun/camlrun camlc)
+# promote       promote the new compiler and the new runtime
+# clean all     rebuild everything
+# compare       check fixpoint
 # Start up the system from the distribution compiler
 	cd byterun; $(MAKE) all
 	cd stdlib; $(MAKE) COMPILER=../boot/camlc all
 	cp stdlib/stdlib.cma stdlib/*.cmi stdlib/cslheader boot
-# Promote the newly compiled system to the rank of bootstrap compiler
+# Save the current bootstrap compiler
 	test -d boot/Saved || mkdir boot/Saved
 	mv boot/Saved boot/Saved.prev
 	mkdir boot/Saved
 	mv boot/Saved.prev boot/Saved/Saved.prev
-	mv boot/camlrun boot/camlc boot/camllex boot/camlyacc boot/Saved
+	cp boot/camlrun boot/Saved
+	mv boot/camlc boot/camllex boot/camlyacc boot/Saved
 	mv boot/*.cmi boot/stdlib.cma boot/cslheader boot/Saved
-	cp byterun/camlrun boot/camlrun
+# Promote the newly compiled system to the rank of cross compiler
+# (Runs on the old runtime, produces code for the new runtime)
 	cp camlc boot/camlc
 	cp lex/camllex boot/camllex
 	cp yacc/camlyacc boot/camlyacc
 	cp stdlib/stdlib.cma stdlib/*.cmi stdlib/cslheader boot
+# Promote the newly compiled system to the rank of bootstrap compiler
+# (Runs on the new runtime, produces code for the new runtime)
+promote: promote-cross
+	cp byterun/camlrun boot/camlrun
 # Restore the saved bootstrap compiler if a problem arises
 	mv boot/Saved/* boot
         else echo "Fixpoint not reached, try one more bootstrapping cycle."; \
-# Complete bootstrapping cycle
-bootstrap: promote clean all compare
 # Remove old bootstrap compilers
 	rm -rf boot/Saved/Saved.prev/*
 camltop: $(TOPOBJS) expunge
 	$(CAMLC) $(LINKFLAGS) -linkall -o camltop.tmp $(TOPOBJS)
-	$(CAMLRUN) ./expunge camltop.tmp camltop $(PERVASIVES)
+	- $(CAMLRUN) ./expunge camltop.tmp camltop $(PERVASIVES)
 	rm -f camltop.tmp
 	cd stdlib; $(MAKE) all
+	cd stdlib; $(MAKE) RUNTIME=../byterun/camlrun all
 	cd stdlib; $(MAKE) clean
 # The lexer and parser generators
 	cd lex; $(MAKE)
 	cd lex; $(MAKE) clean
 	cd lex; $(MAKE) depend
 	cd yacc; $(MAKE)
 	cd yacc; $(MAKE) clean