Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: Radu Grigore <radugrigore@gmail.com>
To: caml-list <caml-list@inria.fr>
Subject: [Caml-list] make
Date: Tue, 19 Oct 2004 15:49:51 +0300	[thread overview]
Message-ID: <7f8e92aa041019054919917bef@mail.gmail.com> (raw)

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

---
$ocamldep main.ml parser.ml ast.ml lexer.ml
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)

depend:
  ocamldep *.ml > .depend

%.cmo: %.ml
   ocamlc -c $<
---

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

-- 
regards,
 radu
http://rgrig.idilis.ro/

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


             reply	other threads:[~2004-10-19 12:49 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-10-19 12:49 Radu Grigore [this message]
2004-10-19 13:02 ` Nicolas Cannasse
2004-10-20  0:28   ` skaller
2004-10-19 13:16 ` Julien Signoles
2004-10-19 13:35   ` Radu Grigore
2004-10-19 19:12     ` noweb/nuweb (was: Re: [Caml-list] make) David MENTRE
2004-10-20  5:08       ` Radu Grigore
2004-10-21 11:12   ` [Caml-list] ocamldsort and directories Richard Jones
2004-10-22 18:04     ` Dimitri Ara
2004-10-19 14:48 ` [Caml-list] make Eric C. Cooper
2004-10-19 23:23   ` skaller
2004-10-21  2:41 ` Aleksey Nogin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7f8e92aa041019054919917bef@mail.gmail.com \
    --to=radugrigore@gmail.com \
    --cc=caml-list@inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox