[jamming] Implicit action won't work

Russell rjshaw at iprimus.com.au
Mon Feb 10 04:27:47 PST 2003


Ingo Weinhold wrote:
> On Mon, 10 Feb 2003, Russell wrote:
> 
> 
>>Ingo Weinhold wrote:
>>
>>>>Russell wrote:
>>
>>...
>>
>>>>Running jam gives:
>>>>  Rule HEX: myprog myprog.exe
>>>>  Action HEX: myprog objs/myprog.exe
>>>>
>>>>I don't understand why the second line doesn't say:
>>>>  Action HEX: objs/myprog objs/myprog.exe
>>>
>>>
>>>I don't know either. I threw your lines into a Jamfile and got:
>>>
>>>$ jam-2.4
>>>Rule HEX: myprog myprog.exe
>>>..found 9 target(s)...
>>>..updating 1 target(s)...
>>>HEX objs/myprog
>>>Action HEX: objs/myprog objs/myprog.exe
>>>..updated 1 target(s)...
>>>
>>>Tested with plain Jam 2.4.
>>
>>Hi, i managed to get that result too (working too late;)
>>
>>I think i don't fully understand the jam process, so i made
>>a small example that causes various problems.
>>In Jamrules, i have:
>>
>>TOP = /home/russell/test ;
>>SUFEXE = .exe ;
>>rule HEX
>>{
>>   local _h ;
>>   _h = $(<:S=.hex) ;
>>   Depends $(_h) : $(>) ;
>>   Depends all : $(_h) ;
>>   echo "Rule Hex:" $(<) $(_h) S(>) ;
>>}
>>actions HEX
>>{
>>   echo "Action hex:" $(<) $(>)
>>}
>>
>>In Jamfile, i have:
>>
>>SubDir TOP ;
>>HEX myprog : myprog.exe ;
>>
>>I created /home/russell/test/myprog.exe with "touch myprog.exe".
>>
>>When i run jam, i get:
>>
>>   Rule hex: myprog myprog.hex myprog.exe
>>   ...found 9 target(s)...
>>
>>which shows action HEX didn't execute. The last few lines of jam -d 3
>>shows:
>>   made  newer myprog.exe
>>   made+ missing myprog.hex
>>   made  update all
>>   ...found 9 target(s)...
>>
>>I don't know why "actions HEX" doesn't work. There's no jam options
>>to put out a simple dependency tree.
> 
> 
> Mmh, what is wrong with `-d3'?

I just saw that a space was used after -d at
http://public.perforce.com/public/jam/src/Jam.html

> Your problem here is that HEX is invoked on myprog.exe, not on myprog.hex.

This how i thought it worked: rule HEX is invoked with "HEX myprog : myprog.exe ;",
causing action HEX to be invoked with arguments "myprog : myprog.exe"

> Thus for jam no rule is invoked on myprog.hex and hence it can't execute
> any actions.
> 
> You can work around by renaming the actions to HEX1 and add
> `HEX1 $(_h) : $(>) ;' to your HEX rule. This way HEX1 is called for your
> target and the respective actions will be executed.

I thought if rule HEX was executed, then action HEX would *always* be
executed too. It says here:
   http://www.perforce.com/perforce/conf2001/wingerd/WPLaura.pdf
---------------------------------------------------------------
3.7 Implicity Invoked Actions
When an action and a rule have the same name, Jam implicitly invokes
the action with the same arguments that were used in the rule invocation.

Here's an example of an implicitly invoked action:
rule MyRule
{
   Depends all : $(1) ;
}
actions MyRule
{
   p4 info > $(1)
}

MyRule info.output ;

A single statement invokes "MyRule". The “MyRule” rule will be run
during the parsing phase, and the “MyRule” action will be run during
the updating phase. Both are passed the same argument, “info.output”.
---------------------------------------------------------------




More information about the jamming mailing list