caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* ocamlbuild vs INCLUDE: how to copy snippets into _build/ ?
@ 2008-11-08 15:09 Stefano Zacchiroli
  2008-11-08 15:22 ` [Caml-list] " Stéphane Glondu
  2008-11-08 15:49 ` Nicolas Pouillard
  0 siblings, 2 replies; 3+ messages in thread
From: Stefano Zacchiroli @ 2008-11-08 15:09 UTC (permalink / raw)
  To: Inria Ocaml Mailing List

I'm using ocamlbuild and camlp4oof to exploit the INCLUDE syntax
extension, that is have camlp4 expand in the obvious way stuff like:

  INCLUDE "some/relative/path/snippet.mli"

The path passed to INCLUDE is relative to the including file, but with
ocamlbuild I've a problem. Namely, the snippet is not copied inside
the appropriate subdir of _build, and camlp4 correctly fails with
something like:

  File "some/relative/path/snippet.mli", line 52, characters 0-3:
  I/O error: "some/relative/path/snippet.mli: No such file or directory"
  Preprocessing error on file src/foo/bar/including.mli
  Command exited with code 2.

The snippet is not otherwise processed by the OCaml toolchain, it is
just meant to be INCLUDEd.

How can I tell ocamlbuild to copy into the _build/ directory my
snippets?

My reading of the manual doesn't hint me to any useful tag ...

TIA,
Cheers.

-- 
Stefano Zacchiroli -*- PhD in Computer Science \ PostDoc @ Univ. Paris 7
zack@{upsilon.cc,pps.jussieu.fr,debian.org} -<>- http://upsilon.cc/zack/
Dietro un grande uomo c'è sempre /oo\ All one has to do is hit the right
uno zaino        -- A.Bergonzoni \__/ keys at the right time -- J.S.Bach


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

* Re: [Caml-list] ocamlbuild vs INCLUDE: how to copy snippets into _build/ ?
  2008-11-08 15:09 ocamlbuild vs INCLUDE: how to copy snippets into _build/ ? Stefano Zacchiroli
@ 2008-11-08 15:22 ` Stéphane Glondu
  2008-11-08 15:49 ` Nicolas Pouillard
  1 sibling, 0 replies; 3+ messages in thread
From: Stéphane Glondu @ 2008-11-08 15:22 UTC (permalink / raw)
  To: Inria Ocaml Mailing List

Stefano Zacchiroli wrote:
> How can I tell ocamlbuild to copy into the _build/ directory my
> snippets?

You can use copy_rule in a plugin.


Cheers,

-- 
Stéphane


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

* Re: [Caml-list] ocamlbuild vs INCLUDE: how to copy snippets into _build/ ?
  2008-11-08 15:09 ocamlbuild vs INCLUDE: how to copy snippets into _build/ ? Stefano Zacchiroli
  2008-11-08 15:22 ` [Caml-list] " Stéphane Glondu
@ 2008-11-08 15:49 ` Nicolas Pouillard
  1 sibling, 0 replies; 3+ messages in thread
From: Nicolas Pouillard @ 2008-11-08 15:49 UTC (permalink / raw)
  To: Stefano Zacchiroli; +Cc: caml-list

Excerpts from Stefano Zacchiroli's message of Sat Nov 08 16:09:40 +0100 2008:
> I'm using ocamlbuild and camlp4oof to exploit the INCLUDE syntax
> extension, that is have camlp4 expand in the obvious way stuff like:
> 
>   INCLUDE "some/relative/path/snippet.mli"
> 
> The path passed to INCLUDE is relative to the including file, but with
> ocamlbuild I've a problem. Namely, the snippet is not copied inside
> the appropriate subdir of _build, and camlp4 correctly fails with
> something like:
> 
>   File "some/relative/path/snippet.mli", line 52, characters 0-3:
>   I/O error: "some/relative/path/snippet.mli: No such file or directory"
>   Preprocessing error on file src/foo/bar/including.mli
>   Command exited with code 2.
> 
> The snippet is not otherwise processed by the OCaml toolchain, it is
> just meant to be INCLUDEd.
> 
> How can I tell ocamlbuild to copy into the _build/ directory my
> snippets?
> 
> My reading of the manual doesn't hint me to any useful tag ...

Try to have something like

  open Ocamlbuild_plugin
  dispatch begin function
  | After_rules ->
      dep ["file:src/foo/bar/including.mli"] ["some/relative/path/snippet.mli"]
  end

to your myocamlbuild.ml

-- 
Nicolas Pouillard aka Ertai


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

end of thread, other threads:[~2008-11-08 15:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-11-08 15:09 ocamlbuild vs INCLUDE: how to copy snippets into _build/ ? Stefano Zacchiroli
2008-11-08 15:22 ` [Caml-list] " Stéphane Glondu
2008-11-08 15:49 ` Nicolas Pouillard

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