YaM is a build system for Objective Caml projects, written in Objective Caml. Comments / bug reports / patches are welcome : Damien.Pous@ens-lyon.fr 1) Advertising... Highlight points are : * fine dependency analysis : - modification time, - file digest, - command digest, - dependency checking against .cmi files instead of .cmo files, * mixed bytecode/native mode support (distinct status informations). * support for "Packages" (ocamlc -pack) * does not require 'GNU make' : the standard OCaml tools are sufficient. a file `out = cmd(in_1, in_2, ...)' is re-compiled iff - one of the in_i has been modified (digest test) or - the command `cmd' differs from the last command used. 2) Contras... There is not yet support for : * CamlIDL * OcamlReport * Zoggy (but this should be quite easy to add :-) (See 5) 3) Using YaM An example can be found in `examples'. Basically, you just have to : - copy (or link) the files YaM.ml, YaM.mli, build.ml into the root directory of your project, - write a file "Makefile.ml" using the module `YaM' which provide tools to define a project builder. (See 4) - call `ocaml build.ml', which will compile and link the modules YaM and Makefile into an executable `YaM', before running it. (With a non-standard OCaml installation, you may have to edit the first lines of `build.ml') - then you can use `./YaM' as your make system : `./YaM' builds default targets `./YaM targets' builds the given targets `./YaM -clean' cleans the project `./YaM -help' prints the other available options. YaM will re-compile itself each time Makefile.ml is modified. - to clean all the project, including the YaM executable, call `ocaml build.ml -cleanall' You're done ! 4) Writing Makefile.ml The module `YaM' provides tools to define a project builder. You can generate its documentation using `doc.sh' or ocamldoc A dummy example can be found in `examples/' - Compilation Units The main point is the concept of "compilation unit" : mainly a set of targets, a set of source files, and functions to express dependencies and compile commands. YaM provides functions to define * standard compilation units : ocaml modules, interfaced modules, parsers, packages, programs... * alias (phony targets) - Flags The previous functions use flags, given trough : * the global value `YaM.options: options_t ref' * local parameter `?o: options_t' * local parameters `?flags: string' `?pp: string' ... - Main `YaM.main units' defines a standard entry point : it parses the command line, and build the given targets using the compilation units list `units' - Lower level functions You can also use lower level functions : - `generic_unit' to create a generic compilation unit - `project' `build' to define a project and build targets with it (See documentation (doc.sh)) 5) Adding new kinds of compilation units Just define them with `Yam.generic_unit', then add them into YaM ! You can look at YaM.ocaml_{Parser,Package,...} source code for examples.