1

For debugging purposes, when there are many make file inclusions, it's useful to print the full path of the makefile where a particular variable in the current makefile was first defined. Is there a way to do that?

Seeker
  • 39
  • 6

2 Answers2

4

Just run make -p. Make will print its internal database including all targets and variables that were seen along with the filename and linenumber where they were set.

MadScientist
  • 92,819
  • 9
  • 109
  • 136
1

This might be tedious but you could go to each makefile and echo the makefile's location and filename. Then you can go on to print when a variable was defined as the makefile runs. Here is another post that goes more into detail with printing variables.

How to print out a variable in makefile

D. Joe
  • 23
  • 1
  • 6