caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: "Mikkel Fahnøe Jørgensen" <mikkel@dvide.com>
To: "Anastasia Gornostaeva" <ermine@ermine.pp.ru>
Cc: caml-list@yquem.inria.fr
Subject: Re: [Caml-list] ocamlbuild: add source files on the fly
Date: Fri, 12 Dec 2008 22:38:07 +0100	[thread overview]
Message-ID: <caee5ad80812121338n246a4d0awca180edaaa5de6c1@mail.gmail.com> (raw)
In-Reply-To: <20081211184358.GA84210@ermine.home>

2008/12/11 Anastasia Gornostaeva <ermine@ermine.pp.ru>:
> Hello.
>
> How can I add additional source files for a program on fly? For instance, in
> usual Makefile I can do:
>
> SOURCES = file1.ml file2.ml file3.ml
> SOURCES += $(USER_SELECTED_PLUBINS)
> SOURCES += file4.ml

ocamlbuild scans dependencies automatically, so if the other files are
needed by the main program, you only have to build that single file.

For example,

  ocamlbuild file4.native

will depend of file4.ml and if the file has a statement like

  open File3
  open File2
etc.

then these are included in the build. This also works for ocamlyacc
and lex parser files.

If you build libraries, ocamlbuild has a .mllib file you can add files to.

If you also need C files, you need something more.
Here I developed ocamlbuild-ctools, where you can add c files to a
.cprog file and a .clib file. Ocamlbuild also has some C support, but
it is more limited and has no dependency scanning.

Regards,
Mikkel


      reply	other threads:[~2008-12-12 21:38 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-11 18:43 Anastasia Gornostaeva
2008-12-12 21:38 ` Mikkel Fahnøe Jørgensen [this message]

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=caee5ad80812121338n246a4d0awca180edaaa5de6c1@mail.gmail.com \
    --to=mikkel@dvide.com \
    --cc=caml-list@yquem.inria.fr \
    --cc=ermine@ermine.pp.ru \
    /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;
as well as URLs for NNTP newsgroup(s).