[Omake] Dependencies on generated tools
Nathaniel Gray
n8gray at caltech.edu
Sun Apr 8 21:59:16 PDT 2007
On Apr 8, 2007, at 3:52 PM, Jonathan Roewen wrote:
> Hi Again,
>
> Yes, I have two problems to be tackled today =)
>
> Well, more a question of best practice/style, etc.
>
> I have a dir: toolchain/ocaml, which builds a custom ocamlc.
>
> Now, I need my entire tree except that subdir to be built using that
> ocamlc. So I set OCAMLC to $(file $(ROOT)/toolchain/ocaml/ocamlc), and
> OCAMLLINK to that as well in my OMakeroot.
>
> Then, in toolchain/ocaml/OMakefile I redefine those to ocamlc.
>
> The problem: when it comes to building my tree, it doesn't know to
> build my custom ocamlc first. So I'm wondering how do I generate this
> dependency properly?
>
> Currently, I just add it as a dependency on the main rules in the root
> OMakefile, but I'm pretty sure that if I were in a subdir, trying to
> rebuild part of the tree, this trick would fail.
>
> So, is there a nice way to do this more smartly?
We've got a similar problem in one of our projects and here's how we
tackled it. There may be better ways, but this works and it's
reasonably clean. You can use LocalOCamlGeneratedFiles($(OCAMLC)) in
every subdir *except* for the toolchain subdir. This is pretty easy
to do, since it's scoped -- you just declare it after you list the
toolchain subdir so it doesn't apply there.
There's some discussion of this function going away in the future
(some of its use-cases have been subsumed by OCAMLDEP_MODULES, but
that doesn't yet work on all platforms). I think there will be
something to replace it, but it's a simple function so you can define
it locally if necessary. In fact, I think this would work just as
well (though I haven't tested it and my omake-fu is not terribly
strong):
.SUBDIRS: toolchain
. . .
# After the toolchain subdir but before the others
%.cmi: $(OCAMLC)
%.cmx %.cmo: $(OCAMLC)
Cheers,
-n8
--
>>>-- Nathaniel Gray -- Caltech Computer Science ------>
>>>-- Mojave Project -- http://mojave.cs.caltech.edu -->
More information about the Omake
mailing list