[Cook] recursive descent cook problem
Jerry Pendergraft
jerry at endocardial.com
Sat Aug 16 01:43:14 EST 2003
I use patterns like:
%1/obj/%2.o : [match_mask %%0%2.c [project_files]]
or even (to have multiple compilers)
%1/obj/%2/%3.o : [match_mask %%0%3.c [project_files]]
And for binaries
%1/bin/%2/%3 : [addprefix %1/obj/%2/ [%3_objs]]
You define you architectures (platforms), compiler, and products:
architecture_list = a1 a2 a3;
products = p1 p2 p3;
compiler = gcc;
Then your targets are:
programs = ;
loop local thisarch = [architecture_list]
{
programs += [addprefix [thisarch]/bin/[compiler]/ [products]];
}
And cook will automatically figure out which objects it needs to build and
will do so using the .o recipe.
--
Jerry Pendergraft jerry.pendergraft at endocardial.com
Endocardial Solutions voice: 651-523-6935
1350 Energy Lane, Suite 110 fax: 651-644-7897
St Paul, MN 55108-5254 mobile: 651-491-0163
On Thu, 14 Aug 2003, Mike Mayers wrote:
> Im having trouble getting my recursive descent cookfile working
> I also need per platform configurable output paths
>
> I currently get this error (on linux or cygwin)
> cook: src/util/math_expression.obj dont know how
> cook: cookfile: 29 "magnum" not derived due to errors deriving
> "src/util/math_expression.obj"
>
> i guess the problem is this rule:
> [ObjDir]/%0%.obj: [SrcDir]/%0%.cpp
>
> I also tried these rules
> %.obj: %.cpp
> and
> [ObjDir]/%.obj: [SrcDir]/%0%.cpp
>
> begin cook file
> ///////////////////////////////////////////////////////////////////
> Platform = ;
> SrcDir = src;
> ObjDir = obj;
>
> SourceTree = [stripdot [collect find [SrcDir] -print] ];
> CPPSources = [match_mask %0%.cpp [SourceTree]];
> CPPSources = [fromto %0%.cpp %0%.obj [CPPSources]];
> CPPObjects = [patsubst [SrcDir]/%.obj [ObjDir]/%.obj [CPPSources]];
> MagnumDir = /projects/magnum;
>
> Includes = -I [MagnumDir] -I [MagnumDir]/src -I ExtInc/STLPort-4.5.3/stlport
> -I ExtInc;
> Options = -g -O0 -fpermissive -fno-rtti -fno-common -w -D
> BUILDING_GRANNY_STATIC;
>
> CPPFlags = [Includes] [Options];
>
> function compile_cpp =
> {
> src = [@1];
> obj = [@2];
> gcc [CPPFlags] -c [src] -o [obj];
> }
>
> [ObjDir]/%0%.obj: [SrcDir]/%0%.cpp
> /*%.obj: %.cpp*/
> {
> [compile_cpp [SrcDir]/%0%.cpp [target]];
> }
>
> magnum: [CPPObjects]
> {
> gcc [CPPObjects] -o magnum;
> }
>
> all:
> magnum;
> ///////////////////////////////////////////////////////////////////
> End cookfile
>
> thanks,
>
> mtm
>
> Michael T. Mayers
> Senior Engineer
> Jaleco Entertainment
> mmayers at jaleco.com
> michael at tweakoz.com
> _______________________________________________
> Cook-users mailing list
> Cook-users at auug.org.au
> http://www.auug.org.au/mailman/listinfo/cook-users
>
More information about the Cook-users
mailing list