[Cook] dependency files and cook time

Peter Miller peter.miller.aus at gmail.com
Fri May 6 08:17:49 EST 2011


On Mon, 2011-04-11 at 09:34 -0400, Ryan Thompson wrote:
> We have been using cook for a few years in a c++ project. One thing
> that has always been a problem is that when we made certain changes to
> header (.h) files, not all of the needed source files would be
> recompiled. This was particularly noticeable with header files which
> include code, necessary because of something to do with the use of
> templates.
> 
> We have been using the "Small Method" for include file dependencies
> from the Users Guide. I have been trying to implement the "Large
> Method" instead, where dependency files (.cpp.d) are created and
> included in the build process. I find that this method increased our
> cook time by quite a bit, even when the .d files are not re-generated.
> It is also re-generating *all*the .d files any time I make a change to
> one .h file. 

For an example of C++ and Cook, you could look at how the build works in
SRecord http://srecord.sourceforge.net/ (or Tardy, or Uncia).

Have you checked that the .d files contain what you would expect to see?
One common problem is when c_incl doesn't find an include file... there
are c_incl options to govern what happens, but often c_incl simply omits
them.  This can be the result of incorrect -I options.

also, you must design the recipes so that the .d file gets rebuilt when
the corresponding .cpp file, or any relevant .h files, change.  If only
the .o file is named on the left hand side, the .d files can rapidly
become out of date.  Although this does not appear to be the case in the
example cookbook you supplied.

-- 
Peter Miller <peter.miller.aus at gmail.com>


More information about the Cook-users mailing list