Splitting OCamllex specification into multiple files

Finally found the solution, after reading this post.

Here’s the rule to add to the dune file

(rule
 (target lexer.mll)
 (deps
   (:src lexer.cppo.mll)
   (glob_files ./inc/*.inc))
 (action (run cppo -I ./inc %{src} -o %{target})))

where inc is the subdir in the source directory where files to be included by cppo are put.