help-make
[Top][All Lists]
Advanced

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

Re: macros in macro substitution


From: Philip Guenther
Subject: Re: macros in macro substitution
Date: Fri, 17 Nov 2006 13:01:09 -0700

On 11/17/06, Aleksandar Uzelac <address@hidden> wrote:

   this will work alright: OBJECTS=$(SOURCES:.c=.o)
   but i would need something like this:
       OBJECTS=$(TARGETPATH)/$(SOURCES:.c=.o $(TARGETPATH)/)

So, you want to replace
  %.c
with
  $(TARGETPATH)/%.o

right?  As described in the GNU make info pages (you _have_ read
through them, right?), you can do that using the patsubst function:

  OBJECTS = $(patsubst $(SOURCES),%.c,$(TARGETPATH)/%.o)

That can also be written as:
  OBJECTS=$(SOURCES:%.c=$(TARGETPATH)/%.o)


Philip Guenther




reply via email to

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