Re: Evaluation and expansion

Paul Smith <[email protected]>
Newsgroups gmane.comp.gnu.make.general
Organization Please remain calm--I may be mad but I am a professional!
Message-ID <[email protected]>
On Wed, 2023-06-07 at 00:14 +0200, Bartłomiej Wójcik wrote:
> I also found that in the *immediate* context the expansion is done
> before evaluation, and for the *deferred* context, it is the
> opposite. But it is also stated that in the *immediate *context, the
> expansion is done while parsing, which would be contradictory,
> because as I understand the evaluation is the process of parsing and
> internalizating.

Evaluating a variable assignment just means that the variable is
assigned to some value inside make's memory: that's the
"internalizing".

So:

    FOO = bar

evaluates to setting the make variable FOO to the value bar.  And this:

    bar = baz
    FOO = $(bar)

evaluates to setting the make variable FOO to the value $(bar): no
expansion is performed here, but the variable assignment is still
evaluated.  And this:

    bar = baz
    FOO := $(bar)

evaluates to setting the make variable FOO to the value baz: here
$(bar) is expanded immediately.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.