Browse thread
ocamlbuild and packs
[
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: | Romain Bardou <Romain.Bardou@l...> |
| Subject: | ocamlbuild and packs |
Hello, I have this big project I work on, which could be summarized like this: module A module bla/A module bla/B module Main The module B in the bla directory depends on the module A of the bla directory. The module Main depends on both modules A and on module B. For some reasons I cannot rename either of the modules. So what I do is pack A and B in a Bla module, so I can write Bla.A and Bla.B, using the -pack command line option. It works with my Makefile. Now I try to use ocamlbuild, because I really like its approach (I come from the Pascal world where no makefile is needed). So I made this file bla.mlpack containing the lines: A B Now if I compile using: ocamlbuild Main.byte I get the following error: Unbound module Bla.A I can't compile using: ocamlbuild -I bla Main.byte Because now the module A is defined twice. So I tried to compile using two steps: first, compile bla.cmo, and then, compile Main.byte, but ocamlbuild doesn't seem to be good at that (and actually that's not a bad thing imo). Indeed, if I do: ocamlbuild bla.cmo I get the following error: Solver failed: Ocamlbuild cannot find or build bla.ml. (but the file bla.mlpack does exist). Actually at first I did that from a parent directory, so the command I used looked more like: ocamlbuild -I dir dir/bla.cmo And the error was different: Solver failed: Ocamlbuild knows of no rules that apply to a target named dir/bla.mly. There is no such file as dir/bla.mly anywhere on my drive, although the project does contain some other mly files. Now for the questions: 1) What is the best way to compile my project? By "best" I mean: with no plugin if possible, with a small _tags file, and as few command line options as possible, while still keeping the spirit of ocamlbuild (for instance, compiling everything in one single call to ocamlbuild if possible). 2) Why doesn't ocamlbuild compile my file bla.mlpack into bla.cmo? In the manual I can read that "%.mlpack" has target "%.cmo". 3) If ocamlbuild actually did compile bla.cmo, could it use it to compile main.byte or must I build a library bla.cma first? Thanks. I would be glad to contribute to the wiki, but I have to understand ocamlbuild first ;) -- Romain Bardou