@@ -23,10 +23,26 @@ include $(ROOTDIR)/Makefile.common
2323
2424TARGET_BINDIR ?= $(BINDIR )
2525
26- COMPILER =$(ROOTDIR ) /ocamlc$(EXE )
27- CAMLC =$(OCAMLRUN ) $(COMPILER )
28- COMPFLAGS =-strict-sequence -absname -w +a-4-9-41-42-44-45-48 \
29- -g -warn-error +A -bin-annot -nostdlib -principal
26+ # There are three ways the Standard Library is compiled in bytecode:
27+ # 1. During coldstart
28+ # - using ../boot/ocamlc which runs on ../boot/ocamlrun
29+ # 2. During coreall (via library),
30+ # - using ../ocamlc which runs on ../boot/ocamlrun
31+ # 3. During coreboot (via library-cross),
32+ # - using ../ocamlc which at that point runs on ../runtime/ocamlrun
33+ # If $(USE_BOOT_OCAMLC) is non-empty, we select case 1 and use $(BOOT_OCAMLC).
34+ # Otherwise, we use $(OCAMLRUN) ../ocamlc, with $(OCAMLRUN) being
35+ # ../boot/ocamlrun by default, but able to overridden by library-cross to
36+ # ../runtime/ocamlrun.
37+ USE_BOOT_OCAMLC ?=
38+
39+ ifeq "$(USE_BOOT_OCAMLC ) " ""
40+ CAMLC = $(OCAMLRUN ) $(ROOTDIR ) /ocamlc$(EXE )
41+ else
42+ CAMLC = $(BOOT_OCAMLC )
43+ endif
44+ COMPFLAGS = -strict-sequence -absname -w +a-4-9-41-42-44-45-48 \
45+ -g -warn-error +A -bin-annot -nostdlib -principal
3046ifeq "$(FLAMBDA ) " "true"
3147OPTCOMPFLAGS += -O3
3248endif
@@ -220,7 +236,7 @@ stdlib__%.cmx:
220236 -o $@ -c $(filter % .ml, $^ )
221237
222238# Dependencies on the compiler
223- COMPILER_DEPS =$(filter-out -use-prims $(OCAMLRUN ) , $(CAMLC ) )
239+ COMPILER_DEPS =$(filter-out $(OCAMLRUN ) , $(CAMLC ) )
224240$(OBJS ) std_exit.cmo : $(COMPILER_DEPS )
225241$(OBJS:.cmo =.cmi) std_exit.cmi: $(COMPILER_DEPS )
226242$(OBJS:.cmo =.cmx) std_exit.cmx: $(OPTCOMPILER )
0 commit comments