help-make
[Top][All Lists]
Advanced

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

Re: problems with $$


From: John Graham-Cumming
Subject: Re: problems with $$
Date: Tue, 23 May 2006 16:03:52 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6) Gecko/20040208 Thunderbird/0.5 Mnenhy/0.6.0.104

PATTON, BILLY (SBCSI) wrote:
I have the following example :
INCLUDE := -Idogs -Ipigs -Isheep -Irats

PC_TO_O = @echo $$(INCLUDE:-I=include\=)

.PHONY : x

define x
x : ; $(PC_TO_O)
endef
$(eval $(call x))

It need to print out
include=dogs include=pigs include=sheep include=rats

1. A substitution reference $(X:A=B) change A to B for each A _at the end_ of a word in $(X). Hence your substitution reference doesn't work. If you fix that your example will work.

    PC_TO_O = @echo $$(patsubst -I%,include=%,$(INCLUDE))

2. I don't think you need $(eval $(call x)) at all.  Try doing

    INCLUDE := -Idogs -Ipigs -Isheep -Irats

    PC_TO_O = @echo $(patsubst -I%,include=%,$(INCLUDE))

    .PHONY : x

    define x
    x : ; $(PC_TO_O)
    endef

    $(x)

3. Since you only have one line in your rule for x you don't need define

    INCLUDE := -Idogs -Ipigs -Isheep -Irats

    PC_TO_O = @echo $(patsubst -I%,include=%,$(INCLUDE))

    .PHONY : x
    x = x : ; $(PC_TO_O)
    $(x)

John.
--
John Graham-Cumming
address@hidden

Home: http://www.jgc.org/
Blog: http://www.jgc.org/blog/

POPFile: http://getpopfile.org/
GNU Make Standard Library: http://gmsl.sf.net/
GNU Make Debugger: http://gmd.sf.net/
Fast, Parallel Builds: http://www.electric-cloud.com/

Sign up for my Spam and Anti-spam Newsletter
at http://www.jgc.org/

Help out in the fight against spam
http://www.spamorham.org/




reply via email to

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