help-make
[Top][All Lists]
Advanced

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

Re: Help needed writing a rules.


From: Paul Smith
Subject: Re: Help needed writing a rules.
Date: Tue, 09 Jan 2007 08:46:23 -0500

On Mon, 2007-01-08 at 14:37 +0100, Pelle Svensson wrote:

> src-files := A/foo.c A/bar.c
> dst-files := B/foo.c B/bar.c
> 
> all: $(dst-files)
> 
> $(dst-files) : $(src-files)
>       mkdir -p $(dir $@)
>       cp -l $< $@

Yeah, that won't do what you want.

A rule like this:

  a b c d : e f g h

is shorthand for this:

  a : e f g h
  b : e f g h
  c : e f g h
  d : e f g h

You can write a pattern rule to do what you want:

B/%.c : A/%.c
        mkdir -p $(@D)
        cp -l $< $@

all: $(dst-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]