In this post Ill describe how to generate call graphs for Fortran programs using the doxygen source code documentation tool.
I used version 1.8.3 for this work - you will need a version >= 1.5.6. Note that a complete call graph for the main program is not produced as doxygen treats the program as a module.
$> doxygen -g
which creates a Doxyfile that tells doxygen what you want it to do.
Edit the Doxyfile. The important entries are:
OPTIMIZE_FOR_FORTRAN (set to YES)
EXTRACT_ALL (set to YES)
EXTRACT_PRIVATE (set to YES)
EXTRACT_STATIC (set to YES)
INPUT (in my case it is ./code)
FILE_PATTERNS (if extension is not .f90)
HAVE_DOT (set to YES)
CALL_GRAPH (set to YES)
CALLER_GRAPH (set to YES if you want)
DOT_PATH (if the dot program from graphviz is not in your $PATH)
$> doxygen Doxyfile
HTML and LaTeX files are created by default in html and latex subdirectories.
Open html/index.html in your browser. Click the Files tab and then click the file containing a procedure for which you want the call/caller graphs. Nodes in the graphs are clickable to take you to that function.
Here are a couple of example graphs - first a call graph and then a caller graph: