Wiki source for CDependencyGraph
=====C-Module dependency graph=====
I wrote a script to create a module dependency graph from a set of files using [[graphviz]]. This script works only for [[C]].
==a==Result==a==
The graph shows how the modules are dependent.
{{image url="images/rat2src_s.png" alt=""}}
==a==Script==a==
You need to change the project path to run the script.
%%(bash)
#!/bin/bash
# Author: Andreas Tobola
# http://www.tnotes.de/CDependencyGraph
FILE_OUT="rat2src.dot"
echo "digraph G {" > $FILE_OUT
echo "rankdir=LR;" >> $FILE_OUT
echo "fontsize=24;" >> $FILE_OUT
for mfile in `ls ./rat2src`
do
module=`echo $mfile | sed 's/[.]/ /' | awk '{print $1}'`
echo $module" ("$mfile")"
modlist=`cat ./rat2src/$mfile | grep -v '<' | grep '#include'| awk '{print $2}' | sed 's/<//g' | sed 's/>//g' | sed 's/[.]/ /g' | sed 's/"//g' | awk '{print $1}' | grep -v $module`
for link in $modlist
do
echo " "$link
echo "\""$module"\" -> \""$link"\"" >> $FILE_OUT
done
done
echo "}" >> $FILE_OUT
echo "graphviz..."
dot -Tpng $FILE_OUT -o rat2moddep.png
%%
----
Siehe auch {{backlinks}}
I wrote a script to create a module dependency graph from a set of files using [[graphviz]]. This script works only for [[C]].
==a==Result==a==
The graph shows how the modules are dependent.
{{image url="images/rat2src_s.png" alt=""}}
==a==Script==a==
You need to change the project path to run the script.
%%(bash)
#!/bin/bash
# Author: Andreas Tobola
# http://www.tnotes.de/CDependencyGraph
FILE_OUT="rat2src.dot"
echo "digraph G {" > $FILE_OUT
echo "rankdir=LR;" >> $FILE_OUT
echo "fontsize=24;" >> $FILE_OUT
for mfile in `ls ./rat2src`
do
module=`echo $mfile | sed 's/[.]/ /' | awk '{print $1}'`
echo $module" ("$mfile")"
modlist=`cat ./rat2src/$mfile | grep -v '<' | grep '#include'| awk '{print $2}' | sed 's/<//g' | sed 's/>//g' | sed 's/[.]/ /g' | sed 's/"//g' | awk '{print $1}' | grep -v $module`
for link in $modlist
do
echo " "$link
echo "\""$module"\" -> \""$link"\"" >> $FILE_OUT
done
done
echo "}" >> $FILE_OUT
echo "graphviz..."
dot -Tpng $FILE_OUT -o rat2moddep.png
%%
----
Siehe auch {{backlinks}}