[jamming] Implicit action won't work

Russell rjshaw at iprimus.com.au
Tue Feb 11 00:33:37 PST 2003

Chris Antos wrote:
>>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.
> It's true, if you take into account that the whole point of Jam or Make
> or Nmake or etc is to define dependencies so that only the actions that
> *need* to happen are actually executed.  It seems you interpreted the
> section as saying "actions are always executed if a rule is executed",

yes, i thought *implicit* actions were always executed, but i know
that's wrong now;)

> but (a) I can't find where it says that [good, because it's not true
> :-)] and (b) the point that section is trying to make is that "when an
> action is executed, its arguments are the same as those used in the rule
> invocation".
> In your case, the problem is simple.  You never said that $(<) depends
> on $(_h).  So de facto it does not.  :-)
>    Depends all : $(_h) ;
> You did say that "all" depends on $(_h), so at some point during Jam it
> should in fact build the .hex file, but possibly not in time for it to
> serve as an input to whatever actions are using.

The .hex file was to be the end result anyway (for an eprom).

 > "all" is a
> pseudo-target; note that the statement above does not mean "make each
> individual target depend on $(_h)".  Did you add that line just to
> suppress the "independent target" warning that you'd otherwise get?
> Here's the line you should be using instead:
>    Depends $(<) : $(_h) ;

Thanks to all posters, i got it working:)

rule HEX
   local _h ;
   _h = $(<:S=.hex) ;
   MakeLocate $(_h) : $(LOCATE_TARGET) ;
   Depends $(_h) : $(>) ;
   Depends all : $(_h) ;
   HEX1 $(_h) : $(>) ;
   Clean clean : $(_h) ;
   NOTFILE $(<) ;
actions HEX1
   avr-objcopy -O ihex -R .eeprom -g $(>) $(<)

HEX $(PROJ) : $(PROJ).exe ;

Now all i need to do is figure out grist;)

More information about the jamming mailing list