English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
[Caml-list] ocamldep
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2004-05-08 (11:13)
From: Nicolas Cannasse <warplayer@f...>
Subject: Re: [Caml-list] ocamldep
> On Sat, 2004-05-08 at 19:05, Nicolas Cannasse wrote:
> > > Any chance of a -S option on ocamldep
> > > which generates a list topologically sorted
> > > files?
> > >
> > > Or a script (ocaml, perl, whatever) that takes
> > > ocamldep output and does so?
> > >
> > > I'm having trouble building a .cmxa library.
> > > I can't sort ocamldep output in my head.. :)
> >
> > OCamake will do it for you !
> Please clarify. I need this:
> make_order dirname >out
> where 'out' is a plain list of module names
> A
> B
> C
> D
> which allows me to compile
> A.mli
> B.mli
> C.mli
> D.mli
> A.ml
> B.ml
> C.ml
> D.ml
> and then put the *.cmx into an *.cmxa in that order.
> I'm not interested at the moment in using make
> to actually build anything, I just want
> an easy way to recompute a topological sort
> of the module dependencies.

There is such algorithm in OCamake, which is a basic topological sort with
additionnal tricks when cross dependencies are found (since ocamldep does
not report the difference between dependencies for using types and
dependencies for using functions, the later only need a linkage dependency).
>From the OCamake sources :

" In order to link, we need to order the CMO files.
We currently have a ML/MLI dependency graph (in fact, tree) generated
by ocamldep.
To build the CMO list, we are reducing the dep-tree into one graph merging
corresponding ML & MLI nodes. ML-ML edges are keeped, ML-MLI edges
become ML-ML edges only if they do not create a cycle in the reduced

The other - best - way would be to have a tool that does that directly from
the depencies expressed in the CMO / CMX, so we don't care anymore about
types-only imports. Ocamldep is only working at a syntax level and is good
in order to compile, but does not provide enough informations for linking :
such an algorithm would be very useful directly in the linker !

Nicolas Cannasse

To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners