help-make
[Top][All Lists]
Advanced

[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:

  $(TARGETS):

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
subdirectory.

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

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