Version française
Home     About     Download     Resources     Contact us    
Browse thread
How to tell ocamlbuild to pass options to ocamldoc?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Andrej Bauer <Andrej.Bauer@f...>
Subject: Re: [Caml-list] How to tell ocamlbuild to pass options to ocamldoc?
>> open Ocamlbuild_plugin;;
>>
>> dispatch begin function
>>    | After_rules ->
>>        flag ["ocaml"; "doc"] "-keep-code"
>> end

This gives me an error.

> You can also be less global by adding a new tag "keep_code":

In my case I am happy to be "global". I ended up with:

open Ocamlbuild_plugin ;;

dispatch begin function
  | After_options ->
      Options.ocamldoc :=
        S[
          A"ocamldoc";
          A"-keep-code";
          A"-colorize-code"
        ]
  | _ -> ()
end

This feels "too global" though.

Maybe I should explain the background. I am composing a library of small
examples from programming language theory. A typical example consists of
about 300 lines of code (including ocamllex and ocamlyacc). I want it to be:

(1) as easy to compile as possible: I decided to use ocamlbuild but I
also provide a Makefile which runs ocamlbuild and a README.txt
explaining how to compile. The only drawback is that this requires a
fairly new version of ocaml.

(2) I want to publish the code on the web in browsable format. I think I
will do it two ways: as generated by ocamldoc (which is why I wanted
"-keep-code"). and as raw code converted to HTML with caml2html (because
ocamldoc doesn't do .mly and .mll).

Since I am already talking about ocamlbuild, I should point out that I
used it for teaching last semester. The main challenge was coping with
Windows environment which cannot handle symbolic links. (And we used
OcaIDE, too. The "development environment" kind of worked, and was much
much less hassle than xemacs+make).

Thank you again.

Andrej