Incomprehensible to newcomers to the ecosystem, is the canonically preferred way to structure and manage small and medium sized OCaml projects. I understand the basics of ocamlc , & c. - they mirror ordinary UNIX C compilers, sufficient for seemingly simple. But, above the one-time compilation level of individual files, it is unclear how best to manage compilation simply and cleanly. The problem is not the search for potential tools, but the search for one or several correct (sufficient) ways - as confirmed by community experience - for structuring and building standard OCaml projects.
My example of using the model is a modest but non-trivial project, pure OCaml or OCaml plus C dependency. Such a project:
- contains several source files
- links to several standard libraries
- links to one or more third-party libraries
- optionally includes the C library and the OCaml shell as a subproject (although this can also be managed separately and included as a third-party library, as in (3))
Several alternative tools stand out:
- Custom Makefiles appear to be the standard standard in most open source OCaml packages, but they look disappointing and complicated - even more so than for modest C / C ++ projects. Worse, many even seemingly simple OCaml libraries use autoconf / automake from above for even more complexity.
- ocamlbuild seems to offer a modern, optimized build automation engine with minimal configuration, but it is poorly documented for beginners, presented as an example in the introductory materials in the OCaml ecosystem, and is clearly not used by any of the various published OCaml projects that I looked for inspiration.
- OASIS seems like a convention and library code layer on other build systems to support building a package manager and library such as Cabal.
(I also saw OMake , which looks like the self-styled " make++ ", which also includes a set of standard rules for common languages, including OCaml, and ocaml-make née OCamlMakefile, which provides a standard rules template for GNU make .)
Are any of these the preferred, modern way to manage OCaml?
How are project files best structured?
How are third-party library dependencies included and managed? Is it advisable to install them at the system level, or is there a standard and easy way to manage them locally for a project? I would prefer a model in which projects remain as self-sufficient as possible.
build ocaml ocamlbuild makefile
jrk May 10 '11 at 20:50 2011-05-10 20:50
source share