The following line is from a makefile accepted by gmake:
onefile: $(AVAR)
I'm wondering what the ramification are of lexing what's on the right of the colon as a single string and then breaking it apart later, as opposed to returning a more detailed sequence of tokens, such as DOLLAR LPAREN NAME RPAREN.
The following line is from a makefile accepted by gmake:
onefile: $(AVAR)
On Wednesday, June 29, 2022 at 2:02:08 PM UTC-7, nob...@gmail.com wrote:
The following line is from a makefile accepted by gmake:
onefile: $(AVAR)
I'm wondering what the ramification are of lexing what's on the right of the >> colon as a single string and then breaking it apart later, as opposed to
returning a more detailed sequence of tokens, such as DOLLAR LPAREN NAME
RPAREN.
I suspect that the question is more complicated than it looks.
Well, first, you might look at the gmake manual, and especially here:
https://www.gnu.org/software/make/manual/html_node/Flavors.html#Flavors
Often in interpreted languages, and also in languages that use a preprocessor,
you have to consider that things might be parsed more than once.
As well as I know it, in processing that line gmake searches the line for $, without (mostly) looking at the rest of the line. (Even more, I am not sure about string constants.) So variables are replaced, and then the line
is executed. Except when it isn't.
It seems that in variable assignment:
bvar = $AVAR
the variable isn't expanded yet, but $AVAR is the value of bvar.
Then, later, when there is a $bvar, and $AVAR is substituted,
and then the value of AVAR is substituted.
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 300 |
Nodes: | 16 (2 / 14) |
Uptime: | 71:00:10 |
Calls: | 6,712 |
Files: | 12,244 |
Messages: | 5,356,851 |