caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* how can I use just a portion of another source directory with ocamlbuild?
@ 2008-02-11 21:23 Eric Cooper
  2008-02-11 22:59 ` [Caml-list] " Jake Donham
  0 siblings, 1 reply; 2+ messages in thread
From: Eric Cooper @ 2008-02-11 21:23 UTC (permalink / raw)
  To: caml-list

I would like to re-use a file dir/a.ml from another project. This file
depends on dir/b.ml.  Assume I can't modify the contents of dir/ in
any way.

I need to provide a new implementation of just b.ml for my
project. If I just use
    <dir>: include
then the compilation of a.ml uses dir/b.ml instead of my ./b.ml.

I can make it work by symlinking dir/a.ml, but in my real project
there are lots of these files and the project directory gets very
cluttered with symlinks.  I'm sure there must be a better way, but I
couldn't find much documentation on how to use the plugin APIs.

-- 
Eric Cooper             e c c @ c m u . e d u


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

* Re: [Caml-list] how can I use just a portion of another source directory with ocamlbuild?
  2008-02-11 21:23 how can I use just a portion of another source directory with ocamlbuild? Eric Cooper
@ 2008-02-11 22:59 ` Jake Donham
  0 siblings, 0 replies; 2+ messages in thread
From: Jake Donham @ 2008-02-11 22:59 UTC (permalink / raw)
  To: caml-list

[-- Attachment #1: Type: text/plain, Size: 837 bytes --]

On Feb 11, 2008 1:23 PM, Eric Cooper <ecc@cmu.edu> wrote:

> I need to provide a new implementation of just b.ml for my
> project. If I just use
>    <dir>: include
> then the compilation of a.ml uses dir/b.ml instead of my ./b.ml.


I have had success using Pathname.define_context in myocamlbuild.ml for this
kind of thing; if you put the directory containing your new implementation
first it will get picked up as desired, e.g.

  Pathname.define_context "ocaml/bytecomp" ["src/ocamljs"; "ocaml/parsing";
"ocaml/typing"; "ocaml/utils"];

in my ocamljs tree, where I need to replace bytecomp/translobj.ml.

I'm under the impression that the include tag is just a global way of doing
Pathname.define_context, so it seems like if you get things in the right
order you should be able to make that work too, but I have not tried it.

Jake

[-- Attachment #2: Type: text/html, Size: 1298 bytes --]

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

end of thread, other threads:[~2008-02-11 22:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-02-11 21:23 how can I use just a portion of another source directory with ocamlbuild? Eric Cooper
2008-02-11 22:59 ` [Caml-list] " Jake Donham

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