caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* Ocamlbuild + unexpected dependency
@ 2009-10-23 16:04 Dario Teixeira
  2009-10-23 16:13 ` [Caml-list] " Hezekiah M. Carty
  0 siblings, 1 reply; 3+ messages in thread
From: Dario Teixeira @ 2009-10-23 16:04 UTC (permalink / raw)
  To: caml-list

Hi,

I'm using the Xstrp4 syntax extension to include an external
file "data.txt" inside a "foobar.ml" file.  I'm also using
ocamlbuild to build the project.  How do I tell ocamlbuild
that data.txt should be also be copied to the _build directory
for building?  Ocamlbuild by default has no way of knowing that
foobar.ml depends on data.txt.  (I am presently using an absolute
path to get around this, which is not very portable).

Thanks in advance!
Best regards,
Dario Teixeira







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

* Re: [Caml-list] Ocamlbuild + unexpected dependency
  2009-10-23 16:04 Ocamlbuild + unexpected dependency Dario Teixeira
@ 2009-10-23 16:13 ` Hezekiah M. Carty
  2009-10-23 16:49   ` Dario Teixeira
  0 siblings, 1 reply; 3+ messages in thread
From: Hezekiah M. Carty @ 2009-10-23 16:13 UTC (permalink / raw)
  To: Dario Teixeira; +Cc: caml-list

On Fri, Oct 23, 2009 at 11:04 AM, Dario Teixeira
<darioteixeira@yahoo.com> wrote:
>
> I'm using the Xstrp4 syntax extension to include an external
> file "data.txt" inside a "foobar.ml" file.  I'm also using
> ocamlbuild to build the project.  How do I tell ocamlbuild
> that data.txt should be also be copied to the _build directory
> for building?  Ocamlbuild by default has no way of knowing that
> foobar.ml depends on data.txt.  (I am presently using an absolute
> path to get around this, which is not very portable).
>

I'm not sure if there is a better way to do this, but you can add the
dependency in your myocamlbuild.ml file.  Add something along the
lines of this:

---
let xstrp4_includes = "data.txt"

...
| After_rules ->
...

dep ["compile"; "the_xstrp4_tag"] xstrp4_includes;
---

I use this to support external includes with camlidl + ocamlbuild.

Hope this helps,

Hez

-- 
Hezekiah M. Carty
Graduate Research Assistant
University of Maryland
Department of Atmospheric and Oceanic Science


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

* Re: [Caml-list] Ocamlbuild + unexpected dependency
  2009-10-23 16:13 ` [Caml-list] " Hezekiah M. Carty
@ 2009-10-23 16:49   ` Dario Teixeira
  0 siblings, 0 replies; 3+ messages in thread
From: Dario Teixeira @ 2009-10-23 16:49 UTC (permalink / raw)
  To: Hezekiah M. Carty; +Cc: caml-list

Hi,

Thanks for the hint -- it was sufficient to get me on the right
track.  Note however that instead of using the "compile" tag,
I had to use "ocamldep".  Also, the creation of the single-purpose
tag can be avoided by using "file:", as follows:

| After_rules ->
  dep ["ocamldep"; "file:foobar.ml"] ["data.txt"]

Best regards,
Dario Teixeira






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

end of thread, other threads:[~2009-10-23 16:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-10-23 16:04 Ocamlbuild + unexpected dependency Dario Teixeira
2009-10-23 16:13 ` [Caml-list] " Hezekiah M. Carty
2009-10-23 16:49   ` Dario Teixeira

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