caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* ocamlbuild: add source files on the fly
@ 2008-12-11 18:43 Anastasia Gornostaeva
  2008-12-12 21:38 ` [Caml-list] " Mikkel Fahnøe Jørgensen
  0 siblings, 1 reply; 2+ messages in thread
From: Anastasia Gornostaeva @ 2008-12-11 18:43 UTC (permalink / raw)
  To: caml-list

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

All files including a list of user selected files are described in _tags, so
there remains the small stuff -- how to somewhat interesting in myocamlbuild.ml.
As always, there is important the order of files.
And I hope that it does not need to describe long rules to produce %.cm(o|x)s...

Thanks.
ermine


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [Caml-list] ocamlbuild: add source files on the fly
  2008-12-11 18:43 ocamlbuild: add source files on the fly Anastasia Gornostaeva
@ 2008-12-12 21:38 ` Mikkel Fahnøe Jørgensen
  0 siblings, 0 replies; 2+ messages in thread
From: Mikkel Fahnøe Jørgensen @ 2008-12-12 21:38 UTC (permalink / raw)
  To: Anastasia Gornostaeva; +Cc: caml-list

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-12-12 21:38 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-12-11 18:43 ocamlbuild: add source files on the fly Anastasia Gornostaeva
2008-12-12 21:38 ` [Caml-list] " Mikkel Fahnøe Jørgensen

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