help-make
[Top][All Lists]
Advanced

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

Re: Evaluation and expansion


From: Kaz Kylheku
Subject: Re: Evaluation and expansion
Date: Wed, 07 Jun 2023 09:45:52 -0700
User-agent: Roundcube Webmail/1.4.13

On 2023-06-07 00:37, Bartłomiej Wójcik wrote:
> Hi, 
> Thank you for the response. I think that I understand that,
> but still not catching the part with other things.
> What is the term _evaluation_, when does it happen (in which phase)
> and how is it related to parsing, expanding?

We can think of Make as a language which has a run-time (rules
are matched against the state of the system environment, and build
recipes are executed) and a compile-time (Makefiles are read, and
manipulated, in order to instantiate all the rules.)

All variable manipulations and expansions happen in this compile
time. Once make rules are executing, variables (mostly) do not
change, except for special variables like $@ (dynamically taking
on the value of the target of an executing recipe) and
variables set up by the target-specific assignment feature.

GNU Make's manual uses the word "evaluate" for all compile-time
calculations: assignments and expansions of $(...) syntax.
For instance $(shell command ...) is said to evaluate to the
output of the command. If VAR contains "a" (or nothing) and
VAR := b is processed, then VAR contains b. That is evaluation also.
In computer science, evaluation primarily refers to the reduction of
a term to its value; however in some imperative languages (C,
most Lisp dialects and also Make) side effects like assignment
or I/O are understood to be part of evaluation.

What is not called evaluation in Make is the processing of the
rules against the state of the filesystem to determine what
targets need updating, and the execution of the recipes.
The term "execution" is used throughout the manual to refer
to that processing, as well as the dispatch of
external commands (including in $(shell ...)).

In a two places, the manual uses the wording "execution of foreach",
and "execution of let", which may be accidental slips; those
uses could be replaced with "evaluation".

The processing of an entire Makefile is referred to as execution
in Appendix C, in reference to making a Makefile executable using
the #! (hash bang) mechanism.



reply via email to

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