[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Circular build dependencies



On Tue, Feb 28, 2012 at 3:12 PM, Sebastian Probst Eide
<sebastian.probst.eide@xxxxxxxxx> wrote:
> Dear OCamlers and miragers.
>
> I seem to be spending more time fighting circular build dependencies than 
> writing code.

That could be because ocaml lets you spend very little time writing
powerful codeâ </trollish ad>

> Is there a way to have the compiler work around these?

You should check out ocamldep which let's you create a Makefile
friendly summary of all your dependencies. (using something like
ocamldep *.ml > .depend && echo "-include .depend" >> Makefile)

If you prefer ocamlbuild to make this is not necessary, but learning
Makefile syntax is much faster (and applies to more languages) than
learning to write myocamlbuild.ml scripts.

You can also have a look at ocamldsort (less standard then ocamldep though).

> It might be a sign of bad design, but it regardless, it is just bloody 
> annoying!

ocamldep will point out real dependency cycles regardless of the order
of its argument.

As pointed out by Anil, it is possible to have recursive modules. But
it makes it necessary to put them in the same file (or to use
"include" tricks).


-- 
_______
Raphael



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.