[Cook] Unexpected Feature with "forced dependencies"

Meikel Brandmeyer mb-cook at kotka.de
Thu Nov 22 08:38:50 EST 2007


Hello,

I'm currently working on a set of recipes for building modular
projects. The main idea is to put as much intelligence as possible into
the build system, removing as much maintenance as possible. Ie. put a
self-contained directory into the project tree and that's it. No more
editing necessary.

These recipes more or less pushed the limits of make, although make is
quite powerful. Eg. one can use .include and .for to emulate
functions in the FreeBSD make. But for now it only works with cook
satisfactory.

Long introduction, short problem. Exploring the more exotic usages of
cook I noticed the following unexpected feature.

One can give so-called forced dependencies. I used the following recipe.
%0%/lib%.a: [%0%_dot_o] : [%0%_deps]
{
	...
}

Here %0%_dot_o contains a list of the object files corresponding to
this library and %0%_deps is a variable containing possibly additional
dependencies. Through some functions eg. the _deps variable for some
program is filled with a reference to the library. The _deps variable
for the library is empty.

Problem: Building the library from command line works. Building the
library as a dependency of the programs does not work..... cook
complains about not knowing how to build the library.

Removing the reference to the _deps variable in the library recipe
solves the problem as well as putting some dummy into the variable does.

Even more confusing: this does not happen for a similar structured
%.o -> %.c recipe.

Did anyone encounter similar behaviour? Is it even intended?

Sincerely
Meikel Brandmeyer

-- 
http://kotka.de



More information about the Cook-users mailing list