Certain modules that ship with OCaml like Unix
and Bigarray
have their own .cmx
and .cmxa
files in ocamlopt -where
(which is ~/.opam/4.03.0/lib/ocaml
on my system in my current opam switch).
Is there a way to determine without compiling which source files depend on which of these "special" libraries in the standard distribution? I'm intending to consume this output later in a Makefile.
The following program example.ml
open Unix;;
Unix.system "echo hi";;
Can be compiled using ocamlfind ocamlopt -package unix -linkpkg example.ml
. I'm not sure how to compile it without going through the ocamlfind
wrapper.
I'm wondering if there's a way to statically detect that the unbound-in-this-file module Unix
corresponds to "something" in the standard distribution and report unix.cmxa
as a dependency. ocamldep
does not seem to report it as a dependency by default.
ocamldep -all example.ml
just reports that the various object and interfaces files that can be produced using example.ml
depend on example.ml
. I was hoping for either an error message complaining that ocamldep doesn't understand the Unix
module or some indication that it's required to build the objects.
$ ocamldep -all example.ml
example.cmo example.cmi : example.ml
example.cmx example.o example.cmi : example.ml