I am looking to add the ability to compile Ragel source files into Ocaml source files in the context of the LLVM Ocaml tutorial. Specifically, for source files with a ".rl" extension I would want it to execute:
ragel -O source.rl
The build system should of course then compile the resulting Ocaml file(s) as usual. What is a straightforward way to do this?
Here is the _tags file:
<{lexer,parser}.ml>: use_camlp4, pp(camlp4of)
<*.{byte,native}>: g++, use_llvm, use_llvm_analysis
<*.{byte,native}>: use_llvm_executionengine, use_llvm_target
<*.{byte,native}>: use_llvm_scalar_opts, use_bindings
And here is the myocamlbuild.ml file:
open Ocamlbuild_plugin;;
ocaml_lib ~extern:true "llvm";;
ocaml_lib ~extern:true "llvm_analysis";;
ocaml_lib ~extern:true "llvm_executionengine";;
ocaml_lib ~extern:true "llvm_target";;
ocaml_lib ~extern:true "llvm_scalar_opts";;
flag ["link"; "ocaml"; "g++"] (S[A"-cc"; A"g++ -rdynamic"]);;
dep ["link"; "ocaml"; "use_bindings"] ["bindings.o"];;