docs/master

view scripts/makedeps2dot @ 234:eba3744fb238

Added my set of helper scripts. Removes the spell makefile target as it was not use{d,ful} anyway. Btw: I should have ran script/doubles before I printed the document. :-/
author markus schnalke <meillo@marmaro.de>
date Mon, 16 Jul 2012 11:23:30 +0200
parents
children
line source
1 #!/usr/bin/env awk
2 #
3 # List dependencies in Makefile input,
4 # ignore a set of default targets and 1:1 dependencies
5 # and generate dot graph output
7 BEGIN {
8 FS = " *: *"
10 ignore["all"] = 1
11 ignore["configure"] = 1
12 ignore["Makefile"] = 1
13 ignore["install"] = 1
14 ignore["uninstall"] = 1
15 ignore["clean"] = 1
16 ignore["distclean"] = 1
17 ignore["realclean"] = 1
18 ignore["mostlyclean"] = 1
19 ignore["superclean"] = 1
20 ignore["mmhdist"] = 1
21 ignore["lint"] = 1
23 print "digraph foo {"
24 }
26 /^\t/ {
27 next
28 }
30 $1 ~ /^[a-zA-Z_]+$/ {
31 if ($1 in ignore) {
32 next
33 }
34 split($2, dep, /[ \t]+/)
35 for (i in dep) {
36 if (dep[i] ~ /^\$/) {
37 continue
38 }
39 if (dep[i] ~ "^"$1"\\.(o|sh)$") {
40 continue
41 }
42 sub(/\.o$/, ".c", dep[i]);
43 print "\t\"" dep[i] "\" [shape=box];"
44 print "\t\"" dep[i] "\" -> \"" $1 "\";"
45 }
46 print ""
47 }
49 END {
50 print "}"
51 }