Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Building an OCaml project in multiple directories

Tags:

ocaml

I have a medium-sized OCaml project (13K lines, 85 source files) which is built using OCamlMakefile, but it has slightly outgrown OCamlMakefile: instinctively, I would prefer to split it into three or four directories and build the files in these as libraries, not least as some parts of the overall project should be distinct projects in their own right.

What is the recommended way of doing this, in 2012? OCamlMakefile imposes a number of simplifications which get in the way of what would be considered conventional code organisation in most other programming environments.

like image 704
Martin Keegan Avatar asked Nov 04 '22 00:11

Martin Keegan


1 Answers

I had exactly the same problem in my project. I ended up using a combination of OCamlMakefile (make libinstall) and ocamlfind with OCAMLFIND_DESTDIR and OCAMLPATH variables pointing to a common local build directory.

It's a really flexible approach. For instance, I use an additional simple script to combine several libraries into one by merging their individual META files.

like image 68
alavrik Avatar answered Nov 12 '22 19:11

alavrik