On Tue, 2007-08-14 at 22:59 -0500, David A. Greene wrote:
> define some_func
> 
> target: $$($(1))
>         echo '$$' > $$@
> endef
> 
> my_func = $(eval $(call some_func,$(1)))

You have to deal with escaping "$".  First, the call will evaluate
some_func, so that will remove one "level" of escaping, leaving you
with:

        target: $(xxxx)
                echo '$' > $@

Then when the command script itself is evaluated it will treat $' as a
variable reference and expand it, which causes the problem you've seen.
You need to escape the "$" here both for the call AND for the command
script eval, which means you need a double-escape, which means you need
four "$"'s:

        define some_func
        
        target: $$($(1))
                echo '$$$$' > $$@
        endef
        
        my_func = $(eval $(call some_func,$(1)))

Now after the call you have:

        target: $(xxxx)
                echo '$$' > $@

which is what you want.

-- 
-------------------------------------------------------------------------------
 Paul D. Smith <[EMAIL PROTECTED]>          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


_______________________________________________
Help-make mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-make

Reply via email to