[jamming] unexplained $(LOCATE) behavior

Vladimir Prus ghost at cs.msu.su
Mon May 17 22:57:32 PDT 2004


Paul Forgey wrote:

> So when the Foo actions fire, $(2) is shown to be temp/b.  Why isn't it
> b?
>
> LOCATE_TARGET = temp ;
>
> rule Foo
> {
>      MakeLocate $(1) : $(LOCATE_TARGET) ;
>      Depends exe : $(1) ;
>      Depends $(1) : $(2:G=dir) ;
>      MkDir $(2:G=dir) ;
>      Clean clean : $(1) ;
> }
>
> actions Foo
> {
>      echo $(2)
>      touch $(1)
> }

I believe it's a bug in jam. What happens is:

1. 'b' is not in dependency graph, so during initial binding stage jam does 
not assign any location to it.
2. When action is run, jam sees that 'b' target has no location yet, and calls 
'make1bind' function (in make1.c). The body of the function contains:

       pushsettings( t->settings );
        t->boundname = search( t->name, &t->time );
        t->binding = t->time ? T_BIND_EXISTS : T_BIND_MISSING;
        popsettings( t->settings );

where "t" is TARGET*. You don't have any specific setting of LOCALE on "b", so 
you'd guess that LOCALE will be empty and bound path of "b" will be empty 
too? But, make1bind is called from make1list, which is called from make1cmds, 
which is called in the following context:

                pushsettings( t->settings );
                t->cmds = (char *)make1cmds( t->actions );
                popsettings( t->settings )

where 't' refers to 'a'. 

The net result: "b" will be bound using the same value of "LOCATE" as for "a".

I think that's a bug in jam, but, on the other hand, maybe you should add 
dependency from "a" to "b"?

HTH,
Volodya



More information about the jamming mailing list