List Info

Thread: problems with $$




problems with $$
user name
2006-05-23 14:03:52
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
jgcjgc.org

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-cl
oud.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/


_______________________________________________
Help-make mailing list
Help-makegnu.org
http:
//lists.gnu.org/mailman/listinfo/help-make
problems with $$
user name
2006-05-23 14:05:39
This was a very shortened version. the defines are necessary
as well as
the evals.
But I got it to work with the subst instead of the patsubst
  Thanks for your response.

> -----Original Message-----
> From: John Graham-Cumming [mailto:jgrahamcgmail.com] On 
> Behalf Of John Graham-Cumming
> Sent: Tuesday, May 23, 2006 9:04 AM
> To: PATTON, BILLY (SBCSI)
> Cc: help-makegnu.org
> Subject: Re: problems with $$
> 
> 
> 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
> jgcjgc.org
> 
> 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-cl
oud.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/
> 


_______________________________________________
Help-make mailing list
Help-makegnu.org
http:
//lists.gnu.org/mailman/listinfo/help-make
[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )