--- /dev/null
+BEGIN {
+ FS = " *: *"
+
+ ignore["all"] = 1
+ ignore["configure"] = 1
+ ignore["Makefile"] = 1
+ ignore["install"] = 1
+ ignore["uninstall"] = 1
+ ignore["clean"] = 1
+ ignore["distclean"] = 1
+ ignore["realclean"] = 1
+ ignore["mostlyclean"] = 1
+ ignore["superclean"] = 1
+ ignore["mmhdist"] = 1
+ ignore["lint"] = 1
+
+ print "digraph foo {"
+}
+
+/^\t/ {
+ next
+}
+
+$1 ~ /^[a-zA-Z_]+$/ {
+ if ($1 in ignore) {
+ next
+ }
+ split($2, dep, /[ \t]+/)
+ for (i in dep) {
+ if (dep[i] ~ /^\$/) {
+ continue
+ }
+ if (dep[i] ~ "^"$1"\\.(o|sh)$") {
+ continue
+ }
+ print "\t\"" dep[i] "\" [shape=box];"
+ print "\t\"" dep[i] "\" -> \"" $1 "\";"
+ }
+ print ""
+}
+
+END {
+ print "}"
+}