[Omake] Dependencies on generated tools
Jonathan Roewen
jonathan.roewen at gmail.com
Sun Apr 8 22:18:44 PDT 2007
Thanks, I'll give it a go =) Anything to get rid of that evil phony target hack.
Jonathan
On 4/9/07, Nathaniel Gray <n8gray at caltech.edu> wrote:
> 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 -->
>
>
> _______________________________________________
> Omake mailing list
> Omake at metaprl.org
> https://lists.metaprl.org/mailman/listinfo/omake
>
More information about the Omake
mailing list