From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by yquem.inria.fr (Postfix) with ESMTP id 724F1BC6B for ; Wed, 10 Oct 2007 16:39:21 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgAAAKeADEfAXQImh2dsb2JhbACOSAIBCAop X-IronPort-AV: E=Sophos;i="4.21,255,1188770400"; d="scan'208";a="4317928" Received: from discorde.inria.fr ([192.93.2.38]) by mail3-smtp-sop.national.inria.fr with ESMTP; 10 Oct 2007 16:39:21 +0200 Received: from mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id l9AEdH1O011693 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=OK) for ; Wed, 10 Oct 2007 16:39:20 +0200 X-IronPort-AV: E=Sophos;i="4.21,255,1188770400"; d="scan'208";a="17803172" Received: from peray.inria.fr (HELO ausone.inria.fr) ([128.93.8.98]) by mail4-relais-sop.national.inria.fr with SMTP; 10 Oct 2007 16:39:20 +0200 Received: by ausone.inria.fr (sSMTP sendmail emulation); Wed, _d Oct 2007 16:38:48 +0200 From: "Nicolas Pouillard" Cc: caml-list Subject: Re: [Caml-list] Re: ocamlbuild and c libs To: Alan Falloon References: <23D3A6CC-0AE4-40A6-8626-4600C0EEE7C0@epfl.ch> <1191849838-sup-8791@ausone.inria.fr> <470B8BF5.2060105@marseda.com> In-Reply-To: <470B8BF5.2060105@marseda.com> Date: Wed, 10 Oct 2007 16:38:48 +0200 Message-Id: <1192026948-sup-1108@port-ext2.ensta.fr> User-Agent: Sup/0.1 Content-Type: text/plain; charset=utf-8 X-j-chkmail-Score: MSGID : 470CE415.000 on discorde : j-chkmail score : X : 0/20 1 0.000 -> 1 X-Miltered: at discorde with ID 470CE415.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; libs:01 flags:01 stubs:01 libfoo:01 ocaml:01 cmo:01 dirs:01 ocaml:01 gcc:01 ocamldep:01 dependencies:01 makefile:01 syntax:01 wiki:01 wrote:01 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