Browse thread
Conditional compilation
-
Edgar Friendly
-
Andre Nathan
- Edgar Friendly
- Pietro Abate
- Richard Jones
-
Andre Nathan
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | Edgar Friendly <thelema314@g...> |
| Subject: | Re: [Caml-list] Conditional compilation |
Andre Nathan wrote: > On Mon, 2009-08-17 at 22:00 -0400, Edgar Friendly wrote: >> Is there a better way to do this? The path I'm following is looking >> very byzantine compared to C's [-DFOO] + [#ifdef FOO]. > > In ospec I use > > -pp "camlp4o Camlp4MacroParser.cmo -D FOO" > > which can then be tested in the code with > > IFDEF FOO THEN > ... > END > > > HTH, > Andre > It does help - I'd not considered Camlp4MacroParser for the job, thinking that optcomp would have a good way to do exactly what its name says - optional compilation. I'm starting to think that optcomp is just a mismatch for what I'm trying to do, and I'm trying to use the wrong tool for the job. That said, I don't think it's the best solution (especially with already long compile times for the project) to use both optcomp and Camlp4MacroParser, so I guess I should figure out how to do #if ocaml_version < (3, 11) in Camlp4MacroParser. I guess autoconf might be of some help here, although I don't see an easy way to to pass text from an autoconf-created Makefile through ocamlbuild into only some files' [-pp] commands. I think myocamlbuild.ml might be the key, maybe autoconf can produce it as well as Makefile. E.