summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorSébastien Hinderer <Sebastien.Hinderer@inria.fr>2022-05-09 13:45:52 +0200
committerGitHub <noreply@github.com>2022-05-09 13:45:52 +0200
commit27454be9a119b400450c14f5c5b6a9c8270b2940 (patch)
tree82fa52337dfa9f0bd56bd61da92852bd7b3e057c /tools
parentb8ee69ab295d86310fa158a98f3b5ab2b4d33a27 (diff)
parenta805f1f140d08acfc72402ee1225d2d796fffdc5 (diff)
downloadocaml-27454be9a119b400450c14f5c5b6a9c8270b2940.tar.gz
Merge pull request #11200 from dra27/lib-layout-profiling
[3/3] Restructure LIBDIR: Move the Profiling module to a sub-directory
Diffstat (limited to 'tools')
-rw-r--r--tools/Makefile12
-rw-r--r--tools/ocamlcp.ml10
-rw-r--r--tools/ocamloptp.ml10
3 files changed, 19 insertions, 13 deletions
diff --git a/tools/Makefile b/tools/Makefile
index eff3f9d379..b4d805384f 100644
--- a/tools/Makefile
+++ b/tools/Makefile
@@ -109,20 +109,26 @@ ocamloptp.opt$(EXE): $(call byte2native, $(OCAMLCP) ocamloptp.cmo)
opt:: profiling.cmx
+INSTALL_LIBDIR_PROFILING = $(INSTALL_LIBDIR)/profiling
+
install::
+# If installing over a previous OCaml version, ensure the module is removed
+# from the previous installation.
+ rm -f "$(INSTALL_LIBDIR)"/profiling.cm* "$(INSTALL_LIBDIR)/profiling.$(O)"
+ $(MKDIR) "$(INSTALL_LIBDIR_PROFILING)"
$(INSTALL_DATA) \
profiling.cmi profiling.cmo \
- "$(INSTALL_LIBDIR)"
+ "$(INSTALL_LIBDIR_PROFILING)"
ifeq "$(INSTALL_SOURCE_ARTIFACTS)" "true"
$(INSTALL_DATA) \
profiling.cmt profiling.cmti \
- "$(INSTALL_LIBDIR)"
+ "$(INSTALL_LIBDIR_PROFILING)"
endif
installopt::
$(INSTALL_DATA) \
profiling.cmx profiling.$(O) \
- "$(INSTALL_LIBDIR)"
+ "$(INSTALL_LIBDIR_PROFILING)"
# To help building mixed-mode libraries (OCaml + C)
OCAMLMKLIB = config.cmo build_path_prefix_map.cmo misc.cmo ocamlmklib.cmo
diff --git a/tools/ocamlcp.ml b/tools/ocamlcp.ml
index 595a742328..2664a9d918 100644
--- a/tools/ocamlcp.ml
+++ b/tools/ocamlcp.ml
@@ -84,10 +84,10 @@ end;
if !with_impl then rev_profargs := "-impl" :: !rev_profargs;
if !with_intf then rev_profargs := "-intf" :: !rev_profargs;
let status =
- Sys.command
- (Printf.sprintf "ocamlc -pp \"ocamlprof -instrument %s\" %s %s"
- (String.concat " " (List.rev !rev_profargs))
- (if !make_archive then "" else "profiling.cmo")
- (String.concat " " (List.rev !rev_compargs)))
+ ksprintf Sys.command
+ "ocamlc -pp \"ocamlprof -instrument %s\" -I +profiling %s %s"
+ (String.concat " " (List.rev !rev_profargs))
+ (if !make_archive then "" else "profiling.cmo")
+ (String.concat " " (List.rev !rev_compargs))
in
exit status
diff --git a/tools/ocamloptp.ml b/tools/ocamloptp.ml
index 397c421b96..8ca381cdf1 100644
--- a/tools/ocamloptp.ml
+++ b/tools/ocamloptp.ml
@@ -85,10 +85,10 @@ end;
if !with_impl then rev_profargs := "-impl" :: !rev_profargs;
if !with_intf then rev_profargs := "-intf" :: !rev_profargs;
let status =
- Sys.command
- (Printf.sprintf "ocamlopt -pp \"ocamlprof -instrument %s\" %s %s"
- (String.concat " " (List.rev !rev_profargs))
- (if !make_archive then "" else "profiling.cmx")
- (String.concat " " (List.rev !rev_compargs)))
+ ksprintf Sys.command
+ "ocamlopt -pp \"ocamlprof -instrument %s\" -I +profiling %s %s"
+ (String.concat " " (List.rev !rev_profargs))
+ (if !make_archive then "" else "profiling.cmx")
+ (String.concat " " (List.rev !rev_compargs))
in
exit status