This script finds dependencies between source code modules, treating the .cpp and .h file as one unit (so it will detect A.cpp depending on B.h where B.cpp depends on A.h). This can be used to find out which modules cannot be used independently from each other. It is very simplistic at this point, and assumes that a .cpp file's corresponding header has the exact same name, with .cpp replaced by .h. Furthermore, it assumes all #includes are relative to the src/ directory.
Backport of core PR13228
https://github.com/bitcoin/bitcoin/pull/13228/files