[Cook] Problem with dependencies

Pendergraft, Jerry JPendergraft at sjm.com
Tue Nov 15 02:11:17 EST 2005



> -----Original Message-----
> From: cook-users-bounces+jpendergraft=sjm.com at auug.org.au on behalf of Henderson, Michael D
> Sent: Sun 13-Nov-05 20:58
> To: cook-users at auug.org.au
> Subject: [Cook] Problem with dependencies
 
> I am having an issue with getting the build order straight for a couple
> of libraries I am using. It may not be the smartest approach in the
> world, but I have a couple of class libraries hanging under my source
> tree (eg, [prjRoot]/src/bar). As part of the build rule for my
> libraries, they install themselves to [prjRoot]/lib and their header
> files to [prjRoot]/include/[libName]/ (where libName would be bar in
> this case). I have a global cc flag option of -I[prjRoot]/include to
> point my other files there (they do something like #include
> <bar/bar.hpp>).

> The problem is that when I first do a cook on a clean source tree it
> builds the hpp_dep files. Since the libraries are built after that the
> hpp_dep files don't point to the right include file - in fact they
> ignore my [prjRoot]/include. That seems logical since that directory
> doesn't hold the includes until after the libraries are built. But it
> means that cook doesn't recognize that the files actually do depend on
> these new header files.
You have identified the problem in the hpp_dep files. You probably need to generate (as cascade dependencies if not already) you dep file such that they reference the includes in their installed location. You then need a recipe to install them separate from the library build rule. By having the cascade dependencies saying that
lib/lib%1.a  :  obj/%1/file1.o obj/%1/file2.o
obj/%1/%2.o : src/%1/%2.cpp
src/%1/%2.cpp : include/%1/xxx.hpp

The latter being what you generate in the dep files as the cascade form.

Once you have that then cook will generate the dep files first, then see that before compiling any objects it must install the hpp file over in include and invoke that recipe to do so. Only then will it compile anything, and since it needs all the objects before making a library it will do that in the right order too. The key is to *always* express products in terms of their components so cook knows it has to build the components before invoking the recipe for the product.

> Thanks,
> Mike

hope that helps

> .i le temci cu denpa no lo prenu
> 	- Jessica Shewell Brockway

Jerry Pendergraft                              voice:651-523-6935
St.Jude Medical                                mobil:651-491-0163
Atrial Fibrillation Division                email:jpendergraft at sjm.com
1350 Energy Lane
St.Paul, MN  55108





-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.auug.org.au/pipermail/cook-users/attachments/20051114/3722558c/attachment.htm>


More information about the Cook-users mailing list