Search code examples
ocamlocamlbuildocamlfind

Build native executable with profile information using Ocamlbuild


How to build with enabled profile information using Ocamlbuild? It seems -p doesn't work there.

Now, I use ocamlopt for this. For example,

$ ocamlfind ocamlopt -c -p -thread -package core test.ml
$ ocamlfind ocamlopt -p -o test -thread -package core -linkpkg test.cmx

How to do the same with

ocamlbuild -user-ocamlfind test.native

Solution

  • You can pass the argument explicitly,

    ocamlbuild -cflags -p
    

    or in your _tags file,

    true : profile
    

    There is also a rule for the file-name,

    ocamlbuild test.p.native