GNU Makefiles are written in a Turing-complete interpreted language, making their parsing quite complex. Handling macros, substitutions, pattern rules with multiple expansion phases, and conditional recursive inclusions directly from Makefiles can be highly challenging. Therefore, parsing Makefile directly is not recommended. A more efficient approach is to parse the debug output generated by make.
You can invoke the script in two ways:
-
Redirecting
makeoutput to a log file:make -Bnd > make.loggraph.py make.log -
Piping
makeoutput directly to the script:make -Bnd | graph.py
Example graph for this Makefile.
