[Cook] parallel confusion

Jody Hagins jody at atdesk.com
Sun Jun 22 03:42:42 EST 2003


On Sat, 21 Jun 2003 10:15:15 -0500 (CDT)
Jerry Pendergraft <jerry at endocardial.com> wrote:

> If you have any patterns in the target side you must double all % in
> dependency and in recipe body
> %1/%2.o : %2.c
> {
> some_var = [patsubst %%2/%3 ....


I am sorry, I am still missing something.  Try this simple cookfile.  I
end up getting:
c1=/tmp/shipper/cooked/sh/19650107/19650107sl.gz
/tmp/shipper/cooked/sh/19650107/19650107s0.gz
/tmp/shipper/cooked/sh/19650107/19650107s10.gz
/tmp/shipper/cooked/sh/19631008/19631008sl.gz
/tmp/shipper/cooked/sh/19631008/19631008s2.gz
/tmp/shipper/cooked/sh/19631008/19631008s07.gz
/tmp/shipper/cooked/sh/19631008/19631008s17.gz

and I *want* to get:
c1=/tmp/shipper/cooked/sh/196501/19650107sl.gz
/tmp/shipper/cooked/sh/196501/19650107s0.gz
/tmp/shipper/cooked/sh/196501/19650107s10.gz
/tmp/shipper/cooked/sh/196310/19631008sl.gz
/tmp/shipper/cooked/sh/196310/19631008s2.gz
/tmp/shipper/cooked/sh/196310/19631008s07.gz
/tmp/shipper/cooked/sh/196310/19631008s17.gz

The string "%2" is being passed as the argument to substr, so it is
returning the string "%2".  It is not expanding the "%2" before making
the function call.
---------------------------------------------------------
rawdir=/tmp/shipper/raw;
cookdir=/tmp/shipper/cooked;
rawfiles = [addprefix /tmp/shipper/raw/sh/ 19650107sl.gz 19650107s0.gz
19650107s10.gz 196310/19631008sl.gz 196310/19631008s2.gz
196310/19631008s07.gz 196310/19631008s17.gz]; 
echo "rawfiles="[rawfiles] set silent; 
c1 =
    [patsubst
        [rawdir]/%1/%0%2s%4.gz
        [cookdir]/%1/[substr 1 6 %2]/%2s%4.gz
        [rawfiles]];
echo "c1="[c1] set silent; 

all: ;
---------------------------------------------------------



>   
> 
> -- 
> 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 Sat, 21 Jun 2003, Jody Hagins wrote:
> 
> > On Fri, 20 Jun 2003 23:07:54 -0500 (CDT)
> > Jerry Pendergraft <jerry at endocardial.com> wrote:
> > > 
> > >    local cmd = [unsplit " " [catenate "PATH=" [getenv PATH]]
> > >       \[ -d [ts_C_dir] \] || mkdir [ts_C_dir] &&
> > >       /usr/local/bin/build_test_script --debug [ts_src] [C_file]
> > >       &&[compile-cmd %1 %2] [target_flags]
> > >         -D[catenate ARCH [arch-to-identifier %1]]
> > >         '-DRCS_ID\="'%3_ID'"' -c [C_file]
> > >         -o [target]                        &&
> > >       [post_proc] [C_file]] ;
> > > 
> > 
> > 
> > 
> > This is interesting, mainly because I can not seem to use the "%"
> > matches in functions as part of a patsubst.  For example...
> > 
> > some_var =
> >     [patsubst
> >         %0%1/%2/%3
> >         %0%1/[subst 1 6 %2]/%2/[myfunc %3]
> >         [some_list]];
> > 
> > does not work.  I get the entire value for %2 insead of the "subst"
> > part.  Also, I get an absolute "%3" passed into "myfunc" so I do not
> > get the last part of the file name.
> > 
> > 
> > Any ideas?
> > 
> > 
> > 


-- 
Jody Hagins

A debugged program is one for which you have not yet found the
conditions
that make it fail.
		-- Jerry Ogdin



More information about the Cook-users mailing list