caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Alan Falloon <alan.falloon@marseda.com>
To: Nicolas Pouillard <nicolas.pouillard@inria.fr>
Cc: caml-list <caml-list@inria.fr>
Subject: Re: [Caml-list] Re: ocamlbuild and c libs
Date: Tue, 09 Oct 2007 10:11:01 -0400	[thread overview]
Message-ID: <470B8BF5.2060105@marseda.com> (raw)
In-Reply-To: <1191849838-sup-8791@ausone.inria.fr>

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

To get the stubs to have the project include dirs.

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

Maybe this would make another good example for the Wiki.


  reply	other threads:[~2007-10-09 14:11 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 [this message]
2007-10-10 14:38       ` Nicolas Pouillard

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=470B8BF5.2060105@marseda.com \
    --to=alan.falloon@marseda.com \
    --cc=caml-list@inria.fr \
    --cc=nicolas.pouillard@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).