Browse thread
managing ocaml dependencies
-
Guillaume Rousse
-
skaller
- Jean-Christophe Filliatre
- Nicolas Pouillard
- Ralf Wildenhues
-
skaller
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | Nicolas Pouillard <nicolas.pouillard@i...> |
| Subject: | Re: [Caml-list] managing ocaml dependencies |
On 11/16/06, skaller <skaller@users.sourceforge.net> wrote: > On Thu, 2006-11-16 at 15:20 +0100, Guillaume Rousse wrote: > > I'm trying to use autoconf for ocaml project, and I have troubles with > > > They are two different strategies here, either generate them on > > maintainer host and ship them in the distribution, either generate them > > on user's host. > > There is no choice: it has to be done by the developer > because sometimes the dependency is semantic, in particular > when order of initialisation matters. When order of initialization matters, just enforce it. > > For example: > > (* file 1 *) > let a : int opt = ref None > ;; > > (* file 2 *) > let _ = a := Some 99 > ;; > > (* file 3 *) Just add something like: open File2;; (* because initialization order matters *) Or if really don't want use open: module File2 = File2;; (* because initialization order matters *) Or if really don't want re-export that module (if you don't have a .mli): let module File2 = File2 in ();; (* because initialization order matters *) > let _ = > match !a with > | None -> failwith "WRONG INIT ORDER" > | Some x -> print_endline (string_of_int x) > ;; > > You must link in the given order. Ocamldep can tell > 2 and 3 depend on 1, but not that 3 depends on 2. > > > The second strategy, however, heavily relies on make implementation. > > Whereas GNU make happily generate .depend file on the fly with previous > > snippet, some other implementations don't, such as Digital Unix's one > > (and potentially others). > > Make: Cannot open ../.depend. Stop. > > This is easy to fix: generate a new_makefile and then use > a rule something like: > > cat new_makefile_prefix .depend > new_makefile > make -f new_makefile > > Since this is a rule, the order of evaluation is strict. > -- Nicolas Pouillard