[Cook] dependency files and cook time

Ryan Thompson ryan at flamtap.org
Mon Apr 11 23:34:38 EST 2011


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.

Please look at my cook code and let me know if I have made any mistakes.
Thanks for any help,

-Ryan Thompson


DEPENDENCY_FILES = [fromto %.cpp [SRCDIR]%.cpp.d [CPP_FILES]];
#include-cooked [DEPENDENCY_FILES]

[SRCDIR]%.cpp.d:
[match_mask [SRCDIR]%.cpp [MANIFEST][RD_MANIFEST]]
{
    c_incl --no-cache [SRCDIR]%.cpp
    "--prefix='"[OBJDIR]"%.o " [target] ": " [match_mask [SRCDIR]%.cpp
[MANIFEST][RD_MANIFEST]] "' "
    "--suffix='set nodefault;'"
    -I [INCDIR]
    -o [target];
}

/* DEFAULT */
[OBJDIR]%.o:
[match_mask [SRCDIR]%.cpp [MANIFEST]]
{
    CPPFILE = [match_mask [SRCDIR]%.cpp [MANIFEST]];
    [CC] -o [target] -c [CPPFILE] [FLAGS] [OPT2FLAG] [INCLUDES] ;
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.auug.org.au/pipermail/cook-users/attachments/20110411/29b1b88d/attachment.html>


More information about the Cook-users mailing list