Browse thread
ocamlbuild: add source files on the fly
-
Anastasia Gornostaeva
- Mikkel_Fahnøe_Jørgensen
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | Mikkel_Fahnøe_Jørgensen <mikkel@d...> |
| Subject: | Re: [Caml-list] ocamlbuild: add source files on the fly |
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