[Cook] recursive descent cook problem
Mike Mayers
mmayers at jaleco.com
Sat Aug 16 02:34:36 EST 2003
patterns like %1 , %2 and %3 contain knowledge of the directory structure
(like the number of levels deep the source tree go). I was trying to avoid
that (I dont know or care how deep the source tree will go, thats why i use
collect and find to find my sources).
unless of course I misread the documentation of %1 %2 and %3. ;>
oh wait, maybe I spoke too soon,
how does a pattern like %%0%2.c or %%0%3.c expand (will these work with a
directory tree of arbitrary depth)?
mtm
-----Original Message-----
From: Jerry Pendergraft [mailto:jerry at endocardial.com]
Sent: Friday, August 15, 2003 9:43 AM
To: Mike Mayers
Cc: 'cook-users at auug.org.au'
Subject: Re: [Cook] recursive descent cook problem
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