help-make
[Top][All Lists]
Advanced

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

Re: using $(@F) as a dependency


From: Paul D. Smith
Subject: Re: using $(@F) as a dependency
Date: Thu, 19 Sep 2002 16:22:03 -0400

%% troy <address@hidden> writes:

  t> I'm trying to create a makefile that will copy scripts to a bin
  t> directory.  With non-gmake make's I use something like:

  t> posix make:

  t> FILES = /usr/local/bin/file1 /usr/local/bin/file2
  t> ${FILES}: address@hidden
  t>    cp $? $@

This is not POSIX make.  In fact, I don't know of _any_ make that will
accept this.  SysV make will allow:

  $(FILES): $$(@F)

but this is not POSIX.  POSIX standard make does not provide any way to
do this except by writing out the rules individually.

See the GNU make manual, chapter "Incompatibilities and Missing
Features".

  t> What's the right way to do this using gmake?

In the currently released version of GNU make you could use an implicit
rule:

  /usr/local/bin/% : %
        cp $< $@

  all: $(FILES)

Or, if you wanted to be slightly more explicit, you could use static
pattern rules:

  $(FILES) : /usr/local/bin/% : %
        cp $< $@

  all: $(FILES)

-- 
-------------------------------------------------------------------------------
 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]