[Cook] Building tool support environments

Jerry Pendergraft jerry at endocardial.com
Wed Jun 8 00:22:43 EST 2005


On Mon, 6 Jun 2005, Henderson, Michael D wrote:

> [snip]
> That works pretty well, but I'd like to have foo and bar use different include paths than the other tools directories. I can do that (and am, ick) by putting this in the cook file, above the generic tools.
> 
>  tools/foo/%0%.o: tools/foo/%0%.cpp { [cpp] [tools_foo_cpp_include] ... }
>  tools/bar/%0%.o: tools/bar/%0%.cpp { [cpp] [tools_bar_cpp_include] ... }
> 
> Could something like this work?
> 
>  tools/%1/%0%.o: tools/foo/%1%.cpp { [cpp] [tools_%1_cpp_include] ... }
> 
> If I tried to do that, how could I prevent tools/hoe and tools/rake from matching? I thought that I could just add something like
> 
Set the values for foo and bar explicitly then have the recipe something like:
tools/%1/%0%.o: tools/foo/%1%.cpp
{
    local incl = [cpp_include];  /* your default */
    if [defined tools_%1_cpp_include] then
        incl = [tools_%1_cpp_include];

    [cpp] [incl] [resolve tools/foo/%1%.cpp] > [target];
}

Assuming you have unique file names, you can also combine recipes a bit:

%1/%2/%0%.o: [match_mask %0%2.cpp [project_files]]
{
    local incl = [cpp_include];  /* your default */
    if [defined %1_%2_cpp_include] then
        incl = [%1_%2_cpp_include];

    [cpp] [incl] [resolve [match_mask %0%2.cpp [project_files]]] > [target];

}

> 
> BTW, if I'm just approaching this insanely, let me know. I'm not above rearranging my directory tree to make things easier to work with.
Using cook allows you to support whatever organization makes sense ;^)
> 
> Thanks,
> Mike
> _______________________________________________
> Cook-users mailing list
> Cook-users at auug.org.au
> http://www.auug.org.au/mailman/listinfo/cook-users
> 
-- 
Jerry Pendergraft                        jerry.pendergraft at endocardial.com
St. Jude Medical                         voice: 651-523-6935
1350 Energy Lane, Suite 110                fax: 651-644-7897
St Paul, MN 55108-5254                  mobile: 651-491-0163






More information about the Cook-users mailing list