[Omake] How to build camlp4 extension?

Dmitry Bely dmitry.bely at gmail.com
Mon Dec 11 05:45:11 PST 2006


On 12/7/06, Aleksey Nogin <nogin at metaprl.org> wrote:

> Sorry for the very slow response. By any chance, do you have pa_ba
> listed in the MLFILES (if so, this would probably explain the problem)?

No.

> Is it mentioned in some other places in your OMakefiles?

Nowhere except "section ..." and ".DEFAULT ...".

- Dmitry Bely

> On 28.11.2006 06:07, Dmitry Bely wrote:
>
> > I have an Ocaml project where both native and bytecode executables are
> > build:
> >
> > BYTE_ENABLED = true
> > NATIVE_ENABLED = true
> >
> > To compile .ml files I need some custom camlp4 syntax extension
> > pa_ba.cmo, so I have:
> >
> > OCAMLPPFLAGS = -pp "camlp4o -I . pa_ba.cmo"
> > OCAMLDEPFLAGS += $(OCAMLPPFLAGS)
> >
> > MLFILES = ...
> > LIB = ...
> > OCamlLibrary($(LIB), $(MLFILES))
> >
> > etc. But how to build the syntax extension itself? I tried the following:
> >
> > section
> >    BYTE_ENABLED = true
> >    NATIVE_ENABLED = false
> >    OCAMLFLAGS = -I +camlp4
> >    OCAMLPPFLAGS = -pp "camlp4o pa_extend.cmo q_MLast.cmo"
> >    OCAMLDEPFLAGS = $(OCAMLPPFLAGS)
> >    pa_ba.cmo: pa_ba.ml
> >
> > .DEFAULT: pa_ba.cmo
> >
> > This does not work:
> >
> > *** omake:
> >   These file are targeted separately, but appear as effects of a single
> > rule.
> >   This is likely to lead to unpredictable behavior.
> >   targets:
> >      debug\Core\pa_ba.obj
> >      debug\Core\pa_ba.cmo
> > [...]
> > - build debug\Core pa_ba.obj
> > + ocamlc.opt -warn-error A -g -pp "camlp4o -I . pa_ba.cmo" -I . -c pa_ba.ml
> > <W> Grammar extension: in [expr], some rule has been masked
> > File "pa_ba.ml", line 6, characters 8-15:
> > Unbound quotation: "expr"
> > Uncaught exception: Pcaml.Qerror("expr", 0, _)
> > Preprocessor error
> >
> > Do you know how to correctly write a rule to make pa_ba.cmo from pa_ba.ml?

- Dmitry Bely


More information about the Omake mailing list