Version française
Home     About     Download     Resources     Contact us    
Browse thread
Ocamlbuild with findlib + camlp4
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Pietro Abate <Pietro.Abate@p...>
Subject: Re: [Caml-list] Ocamlbuild with findlib + camlp4
On Thu, Mar 06, 2008 at 03:31:53PM +0000, Dario Teixeira wrote:
> Any thoughts on how this could be achieved?  (I'm not even sure if
> Ocamlbuild's tags can be parameterised).  This would go a long way
> towards simplifying the use of syntax extensions that we've been
> discussing in the OSR thread.

not tested, but I've a piece of code that has a similar mix...

what's about:

_tags:
<database.ml>: camlp4o, pgocaml.statements

and 

(almost verbatim from camlp4 docs) myocamlbuild.ml:

-----------------
open Ocamlbuild_plugin;;
open Command;;

let packages = "extlib,lwt,ocsigen,pgocaml";;

let ocamlfind x = S[A"ocamlfind"; x; A"-package"; A packages];;

dispatch begin function
| Before_options ->
    Options.ocamlc := ocamlfind& A"ocamlc";
    Options.ocamlopt := ocamlfind& A"ocamlopt";
| After_rules ->
    flag ["ocaml"; "link"] (A"-linkpkg")
    flag ["ocaml"; "pp"; "pgocaml.statements"] (A"pgocaml.statements.cmo");
    dep  ["ocaml"; "ocamldep"; "pgocaml.statements"] ["pgocaml.statements.cmo"];
 | _ -> ()

| _ -> ()
end;;
---------------------

not an expert ...

:)
p