Version française
Home     About     Download     Resources     Contact us    
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: -- (:)
From: Henri Dubois-Ferriere <henridf@l...>
Subject: [Caml-list] ocamldep problem with .cmo vs .cmx
Hi,

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

Say my file main.ml 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.

thanks
henri

-------------------
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