[Omake] Workaround to support OCaml cyclic dependencies?

Aleksey Nogin nogin at metaprl.org
Thu Apr 19 09:17:55 PDT 2007


On 18.04.2007 20:22, Tom Murray wrote:

> This type of case arises when, say, Foo uses some types in Bar, but Bar 
> uses some functions in Foo. The easy workaround is to move the shared 
> types to BarTypes, but I noticed that this sort of thing does compile 
> with ocamlc on the command line, but couldn't figure out a way to get 
> OMake to do it.
> 
> Mostly an academic question, but there are (at least debatable) cases 
> where this type of structure would make sense.

Tom,

The issue is that ocamldep does not distinguish the "dependency on the 
type" from the "dependency on implementation", so OMake has no way of 
knowing. Overriding this for native code would probably mean having to 
mess with scanner rules (tricky), but if you are only interested in byte 
code, you just need to override the OCamlLinkSort function so that OMake 
does not try to order the .cmo files and make sure you give the correct 
ordering manually.

E.g.

NATIVE_ENABLED = false
BYTE_ENABLED = true
OCamlLinkSort(nodes) =
     value $(nodes)

.DEFAULT: $(OCamlProgram xyz, foo bar)

Aleksey


More information about the Omake mailing list