summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorGabriel Scherer <gabriel.scherer@gmail.com>2022-07-06 20:24:51 +0200
committerGitHub <noreply@github.com>2022-07-06 20:24:51 +0200
commit3140fb4b2ede539cf22738b309c122d5150db284 (patch)
treeb981b95c979ace0e14bbe48db7fb866b1f8f4b47 /tools
parent8acd34e6c7c0b3204acbd126ae0a99d8aa0f8953 (diff)
parentc61bd58c214f2eb5e5516aeef56d3aed3f71a0b8 (diff)
downloadocaml-3140fb4b2ede539cf22738b309c122d5150db284.tar.gz
Merge pull request #11382 from Octachron/topdir_fix
compilerlibs: avoid unnecessary read to +compiler-libs/topdirs.cmi
Diffstat (limited to 'tools')
-rw-r--r--tools/.depend4
-rw-r--r--tools/Makefile8
-rw-r--r--tools/ocamlmktop.ml6
-rw-r--r--tools/ocamlmktop_init.ml17
4 files changed, 33 insertions, 2 deletions
diff --git a/tools/.depend b/tools/.depend
index 61105c5527..6d62f8dace 100644
--- a/tools/.depend
+++ b/tools/.depend
@@ -174,6 +174,10 @@ ocamlmktop.cmo : \
ocamlmktop.cmx : \
../utils/config.cmx \
../utils/ccomp.cmx
+ocamlmktop_init.cmo : \
+ ../toplevel/topcommon.cmi
+ocamlmktop_init.cmx : \
+ ../toplevel/topcommon.cmx
ocamloptp.cmo : \
ocamlcp_common.cmo \
../driver/main_args.cmi
diff --git a/tools/Makefile b/tools/Makefile
index afbae6fae3..73ed62a62b 100644
--- a/tools/Makefile
+++ b/tools/Makefile
@@ -144,6 +144,14 @@ OCAMLMKTOP=config.cmo build_path_prefix_map.cmo misc.cmo \
ocamlmktop$(EXE): $(OCAMLMKTOP)
ocamlmktop.opt$(EXE): $(call byte2native, $(OCAMLMKTOP))
+# opt.opt means "after the toplevel has been built" here
+opt.opt: ocamlmktop_init.cmo
+INSTALL_LIBDIR_OCAMLMKTOP = $(INSTALL_LIBDIR)/ocamlmktop
+install::
+ $(MKDIR) "$(INSTALL_LIBDIR_OCAMLMKTOP)"
+ $(INSTALL_DATA) \
+ ocamlmktop_init.cmi ocamlmktop_init.cmo \
+ "$(INSTALL_LIBDIR_OCAMLMKTOP)"
# Converter olabl/ocaml 2.99 to ocaml 3
diff --git a/tools/ocamlmktop.ml b/tools/ocamlmktop.ml
index 2b47ebb074..449b907812 100644
--- a/tools/ocamlmktop.ml
+++ b/tools/ocamlmktop.ml
@@ -24,8 +24,10 @@ let _ =
let extra_quote = if Sys.win32 then "\"" else "" in
let ocamlc = Filename.(quote (concat (dirname ocamlmktop) ocamlc)) in
let cmdline =
- extra_quote ^ ocamlc ^ " -I +compiler-libs -linkall ocamlcommon.cma " ^
- "ocamlbytecomp.cma ocamltoplevel.cma " ^ args ^ " topstart.cmo" ^
+ extra_quote ^ ocamlc ^
+ " -I +compiler-libs -I +ocamlmktop " ^
+ "-linkall ocamlcommon.cma ocamlbytecomp.cma ocamltoplevel.cma " ^
+ "ocamlmktop_init.cmo " ^ args ^ " topstart.cmo" ^
extra_quote
in
exit(Sys.command cmdline)
diff --git a/tools/ocamlmktop_init.ml b/tools/ocamlmktop_init.ml
new file mode 100644
index 0000000000..9f780a9b3b
--- /dev/null
+++ b/tools/ocamlmktop_init.ml
@@ -0,0 +1,17 @@
+(**************************************************************************)
+(* *)
+(* OCaml *)
+(* *)
+(* Florian Angeletti, projet Cambium, Inria Paris *)
+(* *)
+(* Copyright 2022 Institut National de Recherche en Informatique et *)
+(* en Automatique. *)
+(* *)
+(* All rights reserved. This file is distributed under the terms of *)
+(* the GNU Lesser General Public License version 2.1, with the *)
+(* special exception on linking described in the file LICENSE. *)
+(* *)
+(**************************************************************************)
+
+let () =
+ Topcommon.load_topdirs_signature ()