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
[Caml-list] ocamldep problem with .cmo vs .cmx
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2002-08-07 (00:07)
From: Henri Dubois-Ferriere <henridf@l...>
Subject: [Caml-list] ocamldep problem with .cmo vs .cmx

I have noticed that ocamldep fills in dependencies differently for a .cmo
than for a .cmx

Say my file does a "open mylib"

then ocamldep will produce the following dependencies:

main.cmo: mylib.cmi
(depends on *interface* of included module)
main.cmx: mylib.cmx
(depends on compiled *object code* of included module)

mylib.cmo: mylib.cmi
mylib.cmx: mylib.cmi

So, in the cmx case, we have the full dependency file so that a makefile
target like

main_opt: main.cmx
	$(OCAMLOPT) $(OBJ_FILES) ... ..

will follow all the dependencies and compile mylib.cmi and mylib.cmx
(assuming the right implicit rules etc).

whereas if we have a target for the bytecode version like:

main_bcode: main.cmo
	$(OCAMLC) $(BC_OBJ_FILES) ... ..

make will only compile mylib.cmi and not mylib.cmo, so one would have to
explicitly add mylib.cmo as a dependency of main_bcode. This is painful in
itself, on top of forcing bytecode and native rules to be different.

So the question is:
In the example above, why doesn't ocamldep output
main.cmo: mylib.cmo
instead of
main.cmo: mylib.cmi

? This would make .cmx and .cmo treatment consistent, as well as simplify
makefile writing.


To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: