caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: "Nicolas Pouillard" <nicolas.pouillard@inria.fr>
To: Alan Falloon <alan.falloon@marseda.com>
Cc: caml-list <caml-list@inria.fr>
Subject: Re: [Caml-list] Re: ocamlbuild and c libs
Date: Wed, 10 Oct 2007 16:38:48 +0200	[thread overview]
Message-ID: <1192026948-sup-1108@port-ext2.ensta.fr> (raw)
In-Reply-To: <470B8BF5.2060105@marseda.com>

Excerpts from Alan Falloon's message of Tue Oct 09 16:11:01 +0200 2007:
> Nicolas Pouillard wrote:
> > Excerpts from Alan Falloon's message of Thu Oct 04 16:49:54 +0200 2007:
> >> Another useful addition would be to pass the include flags when 
> >> compiling c stubs. Right now, you need to write a plugin even if you 
> >> only want to include the other project directories.
> > 
> > You can also specify include directories using tags.
> > 
> > "libfoo": include
> 
> That works for compiling ocaml ".ml -> .cmo" code, but not for c code 
> ".c -> .o".
> 
> I had to add this to my After_rules section:
>     flag ["c"; "compile"] (
>       S( List.map
>           (fun p -> S[A"-ccopt"; A("-I../"^p)])
>           !Ocamlbuild_pack.Options.include_dirs)
>     );

Hum, that's make sense.

[...]

> It is a big hack because what I really want to do is scan the C file and 
> determine which header files is actually depends on and have them copied 
> into the _build directory before compiling (notice the include flag has 
> .. in it). However, I am having a really hard time figuring our how to 
> reproduce the dependency magic implemented for the ocaml stuff, and at 
> least this sort of works (as long as I don't expect the .o to rebuild 
> when I touch the headers).

Have  you  tried  to  use  `gcc -MM' it's some kind of ocamldep for C code. It
returns  dependencies  in  a  makefile  syntax. But you can do almost the same
thing as for OCaml.

> Maybe this would make another good example for the Wiki.

Indeed! A volunteer... :)
-- 
Nicolas Pouillard aka Ertai


      reply	other threads:[~2007-10-10 14:39 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-09-30 21:52 Daniel Bünzli
2007-10-04 14:49 ` Alan Falloon
2007-10-08 13:25   ` [Caml-list] " Nicolas Pouillard
2007-10-09 14:11     ` Alan Falloon
2007-10-10 14:38       ` Nicolas Pouillard [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1192026948-sup-1108@port-ext2.ensta.fr \
    --to=nicolas.pouillard@inria.fr \
    --cc=alan.falloon@marseda.com \
    --cc=caml-list@inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).