[Cook] relative include
Aaron Denney
wnoise at ofb.net
Thu Oct 10 11:55:24 EST 2002
This is a feature request:
It would be nice if there were some way to include a cook file, and
automatically adjust the paths in the dependencies of any rules, so
that they match up to where the files are from the point of view of
the cookfile including the other file.
So, #include-relative "a/cook-fragment"
where a/cook-fragment has
b : c
{
rule
}
would be treated as
a/b : a/c
{
rule
}
This would help in the following situation:
You have two projects that depend on a common library.
Each can just then plop the library source down and include
the cook fragment without having to modify it.
Some have aesthetic preferences for this way of including things for
full-project builds, even when one knows the full path, so it isn't
necessary. I hear that jam and cons have this feature.
This can, of course, be done by transforming fragments outside
of cook and using the #include-cooked mechanism, but this requires
writing a parser for cook, which is not an entirely trivial project.
Alternatively, one can use:
dir = a
#include "a/cook-fragment"
/* unset dir */
with cook-fragment having
if [not [defined dir]] then
dir = .
[dir]/b : [dir]/c
{
rule
}
But it is also a bit ugly.
--
Aaron Denney
-><-
More information about the Cook-users
mailing list