Gnu make¶
Two blog posts by John Graham-Cumming, author of the GNU Make Book.
One weird trick that will give you makefile X-ray vision
This article advocates adding the lines:
_SHELL := $(SHELL) SHELL = $(warning [$@])$(_SHELL) -x
A commenter also added a link to stack overflow with a few other options (here).
Debugging Makefiles by John Graham-Cumming. Feb 2007. An even older article in Dr Dobbs, now linked through the web-archive. [1]
The GNU Make Debugger http://gmd.sourceforge.net/
Footnotes
This is a note of a command I used to find the targets from a make:
make -qp | awk -F':' '/^[a-zA-Z0-9][^$#\/\t=]*:([^=]|$)/ {split($1,A,/ /);for(i in A)print A[i]}' | sort -u
(copied from Marc 2377’s answer in stack overflow on 26 March 2023)