Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 89 lines (65 sloc) 3.191 kb
fccc685 Initial open-source release
MLstate authored
1 (* ------------------------------------------------------------ *)
2 (* The build system *)
3 (* ------------------------------------------------------------ *)
4
5 Important files:
6 ---------------
7
8 * build_libs contains the external and internal mlstate libraries to be used
9
10 syntax:
11 internal libname [dir [installdir]]
12 defines library lib with source in directory dir (optional)
13 there must be an according .mllib file.
14 external libname [dir]
15 defines an external library
16
17 When dir is omitted, it's the name of the library. When installdir is omitted,
18 it's dir. This defines the use_libname tags and the installation of these libs
19 in MLSTATELIBS. Lines starting with # are comments
20
21
22 * build_tools contains the build-tools that we compile and use (eg. trx)
23
24 syntax:
25 internal toolname path
26 defines an internally-built compilation tool. path is as understood
27 by ocamlbuild (eg. trx_ocaml_main.native)
28 external toolname path
29 defines an external binary tool
30
31 Lines starting with # are comments
32
33
34 * build_rules.ml is included in our ocamlbuild plugin. It must contain one ocaml
35 expression of type unit. Several functions and macros can be used:
36
37 - shared_namespace_dir <dir>
38 - include_subdirs <dir>
39 - tool_deps <toolname>
40 - get_tool <toolname>
41 - def_stubs ~dir:<dir> <name>
42 - mlstatelibs
43 - and the usual ocamlbuild stuff
44
45
46 How it works:
47 ------------
48
49 Compilation is controlled by three things:
50
51 1) The _tags files in all directories. Local ones have higher priorities than
52 more general ones.
53
54 2) The build_* files that handle definitions of libraries for linking, define
55 specific tags and custom parameters.
56
57 3) Target files: these include .mllib, .clib, .itarget, .mlpack, which contain a
58 list of modules or targets to be built.
59 .mllib gives .cma, .cmxa
60 .clib gives .a
61 .itarget gives (the virtual file) .otarget
62 .mlpack gives .cmo, .cmx
63
64 Remarks on the build system:
65
66 * Usage of the tag "include" is forbidden, it pollutes the namespace. Instead,
67 build libraries and use the tag use_<libname>. If a directory *really* needs
68 access to the contents of another, use "Pathname.define_context" in
69 build_rules.ml (see the examples in libqmlcompil).
70
71 * Keep the top-level _tags minimal, and use manually the tag "traverse" on any
72 path that contains ocamlbuild-handled sources.
73
74 * Building libraries:
75 you need
76 - a toplevel .mllib file, supplying all the modules to be included
77 (with the syntax path/to/OcamlModule)
78 - a definition in build_libs
79
80 While all the modules in the mllib are compiled, only the .cmi included in the
81 main library directory are seen from the outside. This is *good*: it makes a
82 partition between public and private modules possible. You can add private
83 modules in subdirectories, and make them share the namespace of your library by
84 specifying "shared_namespace_dir" in build_rules.ml (see the examples).
85
86 This gives you three things: the rules for the creation of your .cma and .cmxa,
87 the definition of the tag use_<libname> that puts the right "-I" during
88 compilation and links to your lib, and the installation via bld.
Something went wrong with that request. Please try again.