%% Laird Nelson <[EMAIL PROTECTED]> writes:

  ln> It appears that the pattern matching character ("%") is not
  ln> expanded in phony targets.

You're right.

This is a feature.

  ln> For example, given a GNUmakefile like this:

  ln>   TARGET_NAMES:=phony-a phony-b phony-c
  
  ln>   d : $(TARGET_NAMES)
  
  ln>   phony-% :
  ln>           @echo Phony target is $@
  
  ln>   .PHONY : $(TARGET_NAMES) d

  ln> ...making "d" results in nothing being echoed.

The GNU make manual sez (section "Phony Targets"):

     Since it knows that phony targets do not name actual files that
  could be remade from other files, `make' skips the implicit rule search
  for phony targets (*note Implicit Rules::.).  This is why declaring a
  target phony is good for performance, even if you are not worried about
  the actual file existing.

You are declaring an implicit rule "phony-%" but GNU make doesn't search
implicit rules for .PHONY targets.

You can make this work by using an explicit rule instead:

   TARGET_NAMES:=phony-a phony-b phony-c
  
   d : $(TARGET_NAMES)
  
   $(TARGET_NAMES) :
        @echo Phony target is $@
  
   .PHONY : $(TARGET_NAMES) d

-- 
-------------------------------------------------------------------------------
 Paul D. Smith <[EMAIL PROTECTED]>          Find some GNU make tips at:
 http://www.gnu.org                      http://www.paulandlesley.org/gmake/
 "Please remain calm...I may be mad, but I am a professional." --Mad Scientist

Reply via email to