[Cook] Building tool support environments

Henderson, Michael D michael.d.henderson at lmco.com
Tue Jun 7 02:57:59 EST 2005


For a project I'm working on, I've split the code into two subdirectories. The src directory holds code I'm developing. The tools directory holds software that is developed externally.

  bin/
  include/
  lib/
  src/
  tools/foo/
  tools/bar/
  tools/hoe/
  tools/rake/

I apply updates to the tools area as the vendor releases them. In the past, I'd build it, then install into a local library path. I'm better than that now, and I've put the tools under cook so that I can just issue one cook command and get everything built. I'm wondering if I'm doing this as best as can be done.

My cook file has something like these two statements to build the tools with a different set of includes than my source code.

 tools/%0%.o: tools/%0%.cpp { [cpp] [tools_cpp_include] ... }
 %0%.o: %0%.cpp { [cpp] [cpp_include] ... }

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

  tools_hoe_cpp_include = ;
  tools_rake_cpp_include = ;

so it wouldn't seem to matter in the long run. And, I'm using a loop to dynamically build the source and object lists for each tool, so I could put this in

  tools_[loop_value]_cpp_include = ;

just to initialize all of the tools. I explicitly set the values for foo and bar later.

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.

Thanks,
Mike



More information about the Cook-users mailing list