help-make
[Top][All Lists]
Advanced

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

Re: suppressing $ resolution in variable value


From: Mike Haboustak
Subject: Re: suppressing $ resolution in variable value
Date: Thu, 2 Sep 2021 10:16:32 -0400

On Thu, Sep 2, 2021 at 9:51 AM Brian J. Murrell <brian@interlinx.bc.ca> wrote:
> How can I get make to not try to resolve the $ in the value as it seems
> to be doing for all of the echos in the debug target:

The value built-in function will provide the value of a variable without
expanding it. See Section 8.8 of the Gnu Make manual.
http://www.gnu.org/software/make/manual/make.html#Value-Function

In your example, be wary of the shell expanding $ in addition to Make. Use
single quotes to ensure the shell doesn't also expand $ during echo.

fooreal := $(value foo)
debug:
        echo 'foo = $(foo)'
        echo 'value(for) = $(value foo)'
        echo 'fooreal = $(fooreal)'
        echo 'value(fooreal) = $(value fooreal)'

Mike



reply via email to

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