%% Sam Ravnborg <[EMAIL PROTECTED]> writes:

  sr> Is there any other way to get the name of the target
  sr> to be used in the prerequisite list?
  sr> Other make implementation expands $* to the name of
  sr> the target when listed in the prerequisites, but not gnu make.

No make expands $* in the prerequisites list to the name of the target.

Some makes support a feature where $$@ (note two $'s!) in the
prerequisites list will expand to the name of the target.  GNU make also
supports this syntax (see the GNU make manual).

However, this won't help you because again, the $$@ is not expanded
until _after_ all the other variables are expanded.  This is true even
for other versions of make which support this syntax.


The only way to do what you want is to use the $(eval ...) function to
declare extra dependencies.  Something like:

  OBJS = foo.o
  deps_foo.o := foo.h

  $(foreach target,$(OBJS),$(eval $(target): $$(deps_$(target))))

(note, this is untested).

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


_______________________________________________
Bug-make mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/bug-make

Reply via email to