docs/master
annotate scripts/makedeps2dot @ 235:e58400695ae2
Added tag final version for changeset 348b92755bef
author | markus schnalke <meillo@marmaro.de> |
---|---|
date | Mon, 16 Jul 2012 11:25:04 +0200 |
parents | |
children |
rev | line source |
---|---|
meillo@234 | 1 #!/usr/bin/env awk |
meillo@234 | 2 # |
meillo@234 | 3 # List dependencies in Makefile input, |
meillo@234 | 4 # ignore a set of default targets and 1:1 dependencies |
meillo@234 | 5 # and generate dot graph output |
meillo@234 | 6 |
meillo@234 | 7 BEGIN { |
meillo@234 | 8 FS = " *: *" |
meillo@234 | 9 |
meillo@234 | 10 ignore["all"] = 1 |
meillo@234 | 11 ignore["configure"] = 1 |
meillo@234 | 12 ignore["Makefile"] = 1 |
meillo@234 | 13 ignore["install"] = 1 |
meillo@234 | 14 ignore["uninstall"] = 1 |
meillo@234 | 15 ignore["clean"] = 1 |
meillo@234 | 16 ignore["distclean"] = 1 |
meillo@234 | 17 ignore["realclean"] = 1 |
meillo@234 | 18 ignore["mostlyclean"] = 1 |
meillo@234 | 19 ignore["superclean"] = 1 |
meillo@234 | 20 ignore["mmhdist"] = 1 |
meillo@234 | 21 ignore["lint"] = 1 |
meillo@234 | 22 |
meillo@234 | 23 print "digraph foo {" |
meillo@234 | 24 } |
meillo@234 | 25 |
meillo@234 | 26 /^\t/ { |
meillo@234 | 27 next |
meillo@234 | 28 } |
meillo@234 | 29 |
meillo@234 | 30 $1 ~ /^[a-zA-Z_]+$/ { |
meillo@234 | 31 if ($1 in ignore) { |
meillo@234 | 32 next |
meillo@234 | 33 } |
meillo@234 | 34 split($2, dep, /[ \t]+/) |
meillo@234 | 35 for (i in dep) { |
meillo@234 | 36 if (dep[i] ~ /^\$/) { |
meillo@234 | 37 continue |
meillo@234 | 38 } |
meillo@234 | 39 if (dep[i] ~ "^"$1"\\.(o|sh)$") { |
meillo@234 | 40 continue |
meillo@234 | 41 } |
meillo@234 | 42 sub(/\.o$/, ".c", dep[i]); |
meillo@234 | 43 print "\t\"" dep[i] "\" [shape=box];" |
meillo@234 | 44 print "\t\"" dep[i] "\" -> \"" $1 "\";" |
meillo@234 | 45 } |
meillo@234 | 46 print "" |
meillo@234 | 47 } |
meillo@234 | 48 |
meillo@234 | 49 END { |
meillo@234 | 50 print "}" |
meillo@234 | 51 } |