Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
Re: Behavior of csldep
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 1996-03-20 (16:31)
From: Xavier Leroy <xleroy@p...>
Subject: Re: Behavior of csldep

> When I use csldep to automatically generate dependencies for both 
> bytecode and native code versions, the .cmo files are listed as 
> depending on .cmi files whereas the .cmx files are listed as depending 
> on the .cmx files.  Is this the correct behavior and is there a 
> workaround?

I'll put this in the FAQ, because it seems to puzzle many users.

.cmx files depend also on .cmx files because these files contain
information for cross-module optimizations. If a compilation unit A
calls a function in unit B, generating code from looks up
information on the called function in B.cmx.

Hence, if B.cmx changes (e.g. if is recompiled), must also
be recompiled, which is obtained by saying that A.cmx depends on

Not recompiling A may cause its code to become inconsistent with
that of B. This is detected at link-time and causes an error. So, it
would not be safe to remove the dependencies between .cmx files.

On the other hand, it often happens that recompiling a .ml file does
not actually change its .cmx file (if the changes to the .ml file are
small enough), in which case no further recompilation is
needed. Unfortunately, "make" is too dumb to understand that. I have
been unable to express this kind of dependencies in a standard
Makefile. A special-purpose compilation manager is needed to minimize
the amount of recompilation necessary.

- Xavier Leroy