Skip to content

Commit

Permalink
Eliminate boot/ocamlruns
Browse files Browse the repository at this point in the history
Previously, the build maintained boot/ocamlruns and boot/ocamlrun, but
this is both unnecessary and slightly more complicated. boot/ocamlrun is
never installed and should not be used with dynamic loading regardless,
as that should always be done with runtime/ocamlrun.
  • Loading branch information
dra27 committed Jun 7, 2023
1 parent 2054372 commit 5273bfd
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 19 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ META
/asmcomp/CSE.ml

/boot/ocamlrun
/boot/ocamlruns
/boot/camlheader
/boot/ocamlc.opt

Expand Down
28 changes: 12 additions & 16 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -177,16 +177,13 @@ FLEXLINK_BUILD_ENV = \
FLEXDLL_SOURCES = \
$(FLEXDLL_C_SOURCES) $(wildcard $(FLEXDLL_SOURCE_DIR)/*.ml*)

boot/ocamlruns$(EXE): runtime/ocamlruns$(EXE)
cp $< $@

$(BYTE_BINDIR) $(OPT_BINDIR):
$(MKDIR) $@

flexlink.byte$(EXE): $(FLEXDLL_SOURCES)
rm -f $(FLEXDLL_SOURCE_DIR)/flexlink.exe
$(MAKE) -C $(FLEXDLL_SOURCE_DIR) $(FLEXLINK_BUILD_ENV) \
OCAMLRUN='$$(ROOTDIR)/boot/ocamlruns$(EXE)' NATDYNLINK=false \
OCAMLRUN='$$(ROOTDIR)/boot/ocamlrun$(EXE)' NATDYNLINK=false \
OCAMLOPT='$(value BOOT_OCAMLC) $(USE_RUNTIME_PRIMS) $(USE_STDLIB)' \
flexlink.exe support
cp $(FLEXDLL_SOURCE_DIR)/flexlink.exe $@
Expand All @@ -197,34 +194,34 @@ partialclean::
$(BYTE_BINDIR)/flexlink$(EXE): flexlink.byte$(EXE) | $(BYTE_BINDIR)
rm -f $@
# Start with a copy to ensure that the result is always executable
cp boot/ocamlruns$(EXE) $@
cp boot/ocamlrun$(EXE) $@
cat flexlink.byte$(EXE) >> $@
cp $(addprefix $(FLEXDLL_SOURCE_DIR)/, $(FLEXDLL_OBJECTS)) $(BYTE_BINDIR)

partialclean::
rm -f $(BYTE_BINDIR)/flexlink $(BYTE_BINDIR)/flexlink.exe

ifeq "$(BOOTSTRAPPING_FLEXDLL)" "false"
COLDSTART_STDLIB_RUNTIME = runtime/ocamlrun$(EXE) runtime/primitives
boot/ocamlrun$(EXE): runtime/ocamlrun$(EXE) runtime/primitives
else
# The recipe for boot/ocamlruns$(EXE) directly produces runtime/primitives
COLDSTART_STDLIB_RUNTIME = boot/ocamlruns$(EXE)
# The recipe for runtime/ocamlruns$(EXE) directly produces runtime/primitives
boot/ocamlrun$(EXE): runtime/ocamlruns$(EXE)

$(foreach runtime, ocamlrun ocamlrund ocamlruni, \
$(eval runtime/$(runtime)$(EXE): | $(BYTE_BINDIR)/flexlink$(EXE)))
endif

# $< refers to runtime/ocamlruns when bootstrapping flexlink and
# runtime/ocamlrun otherwise (see above).
boot/ocamlrun$(EXE):
cp $< $@

# Start up the system from the distribution compiler
.PHONY: coldstart
coldstart: $(COLDSTART_STDLIB_RUNTIME)
coldstart: boot/ocamlrun$(EXE) runtime/libcamlrun.$(A)
$(MAKE) -C stdlib OCAMLRUN='$$(ROOTDIR)/$<' \
CAMLC='$$(BOOT_OCAMLC) $(USE_RUNTIME_PRIMS)' all
$(MAKE) setup-boot

.PHONY: setup-boot
setup-boot: runtime/ocamlrun$(EXE)
rm -f $(addprefix boot/, ocamlrun$(EXE) libcamlrun.$(A) $(LIBFILES))
cp $< boot/ocamlrun$(EXE)
rm -f $(addprefix boot/, libcamlrun.$(A) $(LIBFILES))
cp $(addprefix stdlib/, $(LIBFILES)) boot
cd boot; $(LN) ../runtime/libcamlrun.$(A) .

Expand Down Expand Up @@ -1654,7 +1651,6 @@ distclean: clean
rm -f utils/config.generated.ml
rm -f compilerlibs/META
rm -f boot/ocamlrun boot/ocamlrun.exe boot/camlheader \
boot/ocamlruns boot/ocamlruns.exe \
boot/flexdll_*.o boot/flexdll_*.obj \
boot/*.cm* boot/libcamlrun.a boot/libcamlrun.lib boot/ocamlc.opt
rm -f Makefile.config Makefile.build_config
Expand Down
4 changes: 2 additions & 2 deletions ocamldoc/Makefile.best_ocamldoc
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ OCAMLDOC_OPT = $(ROOTDIR)/ocamldoc/ocamldoc.opt$(EXE)

ifeq "$(TARGET)" "$(HOST)"
ifeq "$(SUPPORTS_SHARED_LIBRARIES)" "true"
OCAMLDOC_RUN_BYTE = $(OCAMLRUN) -I $(ROOTDIR)/otherlibs/unix \
OCAMLDOC_RUN_BYTE = $(NEW_OCAMLRUN) -I $(ROOTDIR)/otherlibs/unix \
-I $(ROOTDIR)/otherlibs/str ./$(OCAMLDOC)
else
# if shared-libraries are not supported, unix.cma and str.cma
Expand All @@ -27,7 +27,7 @@ ifeq "$(TARGET)" "$(HOST)"
OCAMLDOC_RUN_BYTE = ./$(OCAMLDOC)
endif
else
OCAMLDOC_RUN_BYTE = $(OCAMLRUN) ./$(OCAMLDOC)
OCAMLDOC_RUN_BYTE = $(NEW_OCAMLRUN) ./$(OCAMLDOC)
endif

OCAMLDOC_RUN_OPT = ./$(OCAMLDOC_OPT)
Expand Down

0 comments on commit 5273bfd

Please sign in to comment.