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] make
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2004-10-19 (12:49)
From: Radu Grigore <radugrigore@g...>
Subject: [Caml-list] make
I have a problem with writing makefiles for OCaml and with compilation
order. Probably a FAQ.

Searching the caml-list archives I've found info about a tool by
Nicolas Cannesse (ocamake) that can be used to compile a set of ml
files into an executable or to generate a makefile such that a
subsequent make command will construct the executable. However this is
not quite what I want.

Using a makefile has the advantage that only necessary recompilations
are performed. So I want to use a makefile. If I add a source (ml)
file in the project directory then the generated makefile becomes
obsolete and needs to be regenerated. But... a regeneration might
overwrite any subsequent changes I've done.

What I'd love is an enhanced ocamldep that in addition to the
dependencies prints also a topologically sorted list of files, like

main.cmo: lexer.cmo parser.cmo
main.cmx: lexer.cmx parser.cmx
parser.cmo: ast.cmo
parser.cmx: ast.cmx
lexer.cmo: parser.cmo
lexer.cmx: parser.cmx
CMO_FILES=ast.cmo parser.cmo lexer.cmo main.cmo
CMX_FILES=ast.cmx parser.cmx lexer.cmx main.cmx

This way I would be able to write a kind of 'standard' makefile:

include .depend
all: $(CMO_FILES)
   ocamlc -o my_app $(CMO_FILES)

  ocamldep *.ml > .depend

   ocamlc -c $<

Does such a tool exists? Does ocamldep already knows to do this and I
didn't found it in the docs? Thanks.


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