[Omake] scanning of .mly files
Aleksey Nogin
nogin at cs.caltech.edu
Mon Jun 12 12:35:58 PDT 2006
On 12.06.2006 11:39, Benjamin Pierce wrote:
> I'd prefer something more eager/aggressive: I wish we could interpret
>
> .PREBUILD: %.ml: %.mly
>
> as "If foo.mly [n.b.] is in the project, then generate foo.ml before
> scanning other things."
>
> But I worry that both of these approaches may lead to difficulties,
> since it is not very clear exactly what "before scanning" means. E.g.,
> in the case of Harmony, the file parser.mly is itself generated from
> yet another file, parser.srcy, using a little OCaml program that must,
> in turn, get built before it can be used...
Right, and this setup is fairly common as well. I would argue that the
general solution would be to have ocamldep take a list of "interface
extensions" and another list of "implementation extensions". You would
then just use something like
OCAMLDEPFLAGS[] +=
-intf .srcy
-impl .srcy
and all will be well.
The OCamlGeneratedFiles function is definitely a big hack and is
equivalent to manually specifying the dependencies where a tool
(ocamldep, not OMake, I would argue) fails to discover them automatically.
BTW, in your situation, Benjamin, you should be able fine-tune the
OCamlGeneratedFiles approach, if necessary - just take a look at how
OCamlGeneratedFiles is implemented in OCaml.om
P.S. The only truly truly general solution would be to have some sort of
interface where ocamldep (or any other dependency scanner) would instead
of asking the filesystem the question "does foo.ml exist?" (which is
what it does now) would be capable of asking OMake "is foo.ml buildable?".
--
Aleksey Nogin
Home Page: http://nogin.org/
E-Mail: nogin at cs.caltech.edu (office), aleksey at nogin.org (personal)
Office: Moore 04, tel: (626) 395-2200
More information about the Omake
mailing list