Previous: Debugging Make Variables, Up: Sample Sessions [Contents][Index]
Now consider the following sample Makefile:
$ cat -n test2.mk 1 PACKAGE=make 2 3 all: $(PACKAGE).txt 4 5 $(PACKAGE).txt: ../doc/remake.texi 6 makeinfo --no-headers $< > $
$ remake -X -f test2.mk ... Reading makefiles... updating makefiles.... Updating goal targets.... /tmp/remake/src/test2.mk:3 File `all' does not exist. -> (/tmp/test2.mk:5) make.txt: ../doc/remake.texi
We could use the target
command to show information about
the current target, but that returns lots if information. So let us instead
narrow the information to just the automatic variables that get set. The
following commands do this are all mean the same thing: target make.txt
variables
, target variables
, and info locals
.
remake<1> info locals @ := all % := * := + := make.txt | := < := all ^ := make.txt ? :=
There is a target
option to list just the shell commands of the
target:
remake<2> target make.txt commands make.txt: # commands to execute (from `test2.mk', line 6): makeinfo --no-headers $< > $@
We can see a full expansion of the command that is about to be run:
remake<5> target @ expand # commands to execute (from `test2.mk', line 6): makeinfo --no-headers $< > $ # commands to execute (from `test2.mk', line 6): -makeinfo --no-headers ../doc/remake.texi > make.txt
Now if we want to write out commands as a shell script which
we might want to execute, we can use the write
(Write)
command:
(/tmp/remake/src/test2.mk:6): make.txt remake<6> write File "/tmp/make.txt.sh" written.
We can issue a shell command cat -n /tmp/make.txt.sh
to see what
was written.
remake<7> shell cat -n /tmp/make.txt.sh 1 #!/bin/sh 2 # cd /tmp/remake/src/ 3 #/tmp/remake/src/test2.mk:5 4 makeinfo --no-headers ../doc/remake.texi > make.txt 5
If you issue step commands, the debugger runs the each command and stops. In this way, you can inspect the result of running that particular shell command and decide to continue or not.
remake<8> step Must remake target `make.txt'. Invoking recipe from test2.mk:6 to update target `make.txt'. ##>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> makeinfo --no-headers ../doc/remake.texi > make.txt ##<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< ++ (/tmp/test2.mk:5)
Notice that we’ve shown the expansion automatically. One subtle difference in the above output, is that we only show the single shell command that is about to be run when there are several commands. In our example though, there is only one command; so there is no a difference.
The ++
icon means that we are about to run that code.
make.txt remake<9> step Successfully remade target file `make.txt'. <- (/tmp/test2.mk:5) make.txt remake<10>
We ran the code, and are still at target make.txt
. The <-
icon means that have finished with this target and are about to return.
If you are at a target and want to continue to the end of the target you
can use the command finish
which is the same as finish
0
. See Finish.
Previous: Debugging Make Variables, Up: Sample Sessions [Contents][Index]