Next: Debugging Shell Commands, Previous: Simple Debugging, Up: Sample Sessions [Contents][Index]
We’ve seen we can get information about GNU Remake’s targets. We
can also get information about GNU Remake’s variables. That is done
with the print
command. (See Print.)
remake<4> print MAKE (origin default) MAKE = $(MAKE_COMMAND)
The (origin default)
means this is a built-in
definition. There is another print which does full expansion
of the variables. So if I run x
(expand
) instead I get:
remake<5> expand MAKE (origin default) MAKE := /tmp/remake/src/./make
Note that in printing expanded values we use :=
while non-expanded
values we use =
This output matches the semantics of these
assignment operators.
In fact, expand
doesn’t need a variable name, it will work
with a string. So I could type x This is $(MAKE)
or
x $(bin_PROGRAMS) $(noinst_PROGRAMS)
. For the latter, I
get:
remake<6> x $(bin_PROGRAMS) $(noinst_PROGRAMS) make remake
No location identification is given here since what I put in isn’t a variable.
But I can also change values too using either set
or
setq
. (See set variable and setq.) Let’s see the difference
between the two.
remake<7> set MAKE $(MAKE_COMMAND) Variable MAKE now has value '/tmp/remake/src/./make' remake<8> setq MAKE $(MAKE_COMMAND) Variable MAKE now has value '$(MAKE_COMMAND)'
So with set
, the value in the expression $(MAKE_COMMAND)
is expanded before the variable definition is assigned. With setq
the internal variables are kept unexpanded. Which you use or want is up
to you.
Note the irregular syntax of set
and setq
. Don’t put an
equal sign (=
) between the variable and the expression. That
is, set MAKE = $(MAKE_COMMAND)
gives:
Variable MAKE now has value '= /tmp/remake/src/./make'
which is probably not what you want. One may optionally put in the the
word "variable" when using set
, one must not supply it with
setq
. Down the line, someone (maybe you!) will probably
put in a command parser.
Next: Debugging Shell Commands, Previous: Simple Debugging, Up: Sample Sessions [Contents][Index]