Here is one way to do this using myocamlbuild.ml and _tags.
In myocamlbuild.ml add the flag
statement so ocamlbuild recognizes the new tag - here keep_asm - which will include -S
for the selected files when compiling in native:
flag ["ocaml";"compile";"native";"keep_asm"] (S [A "-S"]);
Without the "native"
in the list passed to flag
, the flag will be enabled for any compilation step using ocaml (as indicated by the "ocaml"
and "compile"
lines), and will be run when ocamlc is called, which you donβt want.
So, for a complete standalone myocamlbuild.ml that does just the above, it will turn out like:
open Ocamlbuild_plugin;; open Command;; dispatch begin function | Before_rules -> begin end | After_rules -> begin flag ["ocaml";"compile";"native";"keep_asm"] (S [ A "-S"]); end | _ -> () end
Once you have this new tag installed, you can use it in your _tags file, like any other tag, for example:
<myfile.ml>: use_bigarray, keep_asm
source share