help-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Dynamic rules : $< and $@ empty?


From: Paul D. Smith
Subject: Re: Dynamic rules : $< and $@ empty?
Date: Fri, 5 Aug 2005 14:34:51 -0400

%% Jon Chatten <address@hidden> writes:

  jc> Hi,
  jc> I'm using GNU make 3.80 on Windows, but am having some
  jc> issues with Dynamic Rules.  This is probably down to
  jc> my own misunderstanding, but consider the following
  jc> (contrived!  I do have a reason for trying this :-))
  jc> example:


  jc> ALL : TEST

  jc> define test-rule
  jc> $(1)/%.o : %.c
  jc>   @echo test-rule
  jc>   @echo Arg 1 : $(1)
  jc>   @echo Target : $@
  jc>   @echo Dependent : $<
  jc> endef

  jc> TEST : bin/File.o
  jc> bin/File.o : File.c

  jc> $(eval $(call test-rule,bin))

  jc> Which leads me to believe the rule is created
  jc> correctly and invoked as you'd expect, but why are $<
  jc> and $@ empty?

Because call is evaluating them, and at that time they have no value.

You have to escape them ($$@ etc.) if you want the references to the
variable to survive into the eval step.

-- 
-------------------------------------------------------------------------------
 Paul D. Smith <address@hidden>          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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]