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
[EMAIL PROTECTED]
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/
_______________________________________________
Help-make mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-make