help-make
[Top][All Lists]
Advanced

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

Re: How to preserve $-containing terms in an expanded variable (with cal


From: Paul D. Smith
Subject: Re: How to preserve $-containing terms in an expanded variable (with call)?
Date: Tue, 14 Mar 2006 12:19:31 -0500

%% "Dimitry Golubovsky" <address@hidden> writes:

  dg> I am puzzled at the following problem I cannot solve.
  dg> I need to create a variable to use with "call", which after
  dg> substitution of all parameters must still contain something with
  dg> dollar-sign.

  dg> Namely, the $(call myvar,foo) must expand into:
  dg> awk '$0 != foo { ... }'
  dg> where $0 is in the awk sense (i. e. whole line read from the input).

  dg> I tried to define myvar like this:
  dg> myvar = awk '$$0 != $(0) { .... }'
  dg> this does not work: $$0 expands to /bin/sh i. e. shell's $0, not awk's

If $0 expands to /bin/sh, then that expansion is being done by the
shell, not by make.  Make will never expand $0 to /bin/sh, unless, I
suppose, you do something like:

    0 = /bin/sh

in your makefile.

So, your quoting to make is correct (make is sending $0 to the shell)
but you haven't properly quoted this to the shell so the shell is
expanding it.

-- 
-------------------------------------------------------------------------------
 Paul D. Smith <address@hidden>          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




reply via email to

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