[Top][All Lists]

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

Re: $(@F) as dependecy

From: Paul D. Smith
Subject: Re: $(@F) as dependecy
Date: Tue, 12 Feb 2002 12:00:58 -0500

%% Maciej Walezak <address@hidden> writes:

  mw> $(TARGETS): $(@F)

You can't use automatic variables within rules like this.  Automatic
variables are defined only within command scripts.  See the section "How
make Reads a Makefile" in the GNU make manual.

  mw> The rule works i.e. copies given file from source to destination
  mw> directory if the file doesn't exist in destination directory but
  mw> fails if the destination file exists and local file is newer that
  mw> destination.  Why?

Since $(@F) expands to nothing in the context you're using it, the above
rule is identical to just:


with no prerequisites.  So, if the target doesn't exist then it will be
copied; if it does exist it's _always_ considered up-to-date (since it
has no prerequisites to make it out-of-date).

  mw> Is there another way to achive the behavior I need?

Static pattern rules.  But, you'll have to write one for each

 Paul D. Smith <address@hidden>          Find some GNU make tips at:            
 "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]