English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
Ocamlbuild plugins
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2007-11-07 (13:39)
From: Dario Teixeira <darioteixeira@y...>
Subject: Re: [Caml-list] Ocamlbuild plugins

> (...)
> Sadly you're right. As always any help/contribution will be appreciated :)

Well, I'll do my part: once I grok Ocamlbuild I'll profusely document
the myocamlbuild.ml for my project.

Anyway, thanks again for your help.  I have at the moment a myocamlbuild.ml
that can handle almost everything I need; the only bit that isn't working
is precisely the part that handles camlp4.  So, here's the myocamlbuild.ml:

open Ocamlbuild_plugin
open Command

let ocamlfind x =
        let packages = "calendar, ocsigen" in
        S[A "ocamlfind"; x; A "-package"; A packages];;

dispatch begin function
        | Before_options ->
             Options.ocamlc := ocamlfind & A"ocamlc";
             Options.ocamlopt := ocamlfind & A"ocamlopt";
             Options.ocamldep := ocamlfind & A"ocamldep"
        | After_rules ->
                let some_flags = S[A"-package"; A"pgocaml.statements";
A"-syntax"; A"camlp4o"] in
                flag ["ocaml"; "compile"; "use_pgocaml_statements"] 
                flag ["ocaml"; "ocamldep"; "use_pgocaml_statements"]
                flag ["ocaml"; "link"] (A"-linkpkg")
        | _ -> ()

I also have a _tags file with just one line:
"database.ml": use_pgocaml_statements, thread

And this is the error I get when I run "ocamlbuild database.cmo":

+ ocamlfind ocamldep -package 'calendar, ocsigen' -package pgocaml.statements
-syntax camlp4o -pp '-package pgocaml.statements -syntax camlp4o' -modules
database.ml > database.ml.depends
Warning: -pp overrides the effect of -syntax partly
sh: Illegal option -p
Preprocessing error on file database.ml
Command exited with code 2.

My guess is that some builtin rule is trying to invoke camlp4 with -pp,
which is altogether unnecessary because ocamlfind takes care of that
automatically with the -syntax option.  Any thoughts?

Thanks for your time,

Do not compromise. Get unlimited storage and first rate spam protection with Yahoo! Mail.