From: Stefano Zacchiroli Date: Wed, 27 Sep 2006 09:20:29 +0000 (+0000) Subject: Added generation of dependency graph for the ocaml modules in matita/ X-Git-Tag: 0.4.95@7852~991 X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=commitdiff_plain;h=92a345e67066fc5a039a87b0fb07caa838103780;p=helm.git Added generation of dependency graph for the ocaml modules in matita/ WARNING (and happyness ...): first Ruby script added to our repository --- diff --git a/matita/Makefile b/matita/Makefile index c51e7b7b6..896529cf4 100644 --- a/matita/Makefile +++ b/matita/Makefile @@ -405,6 +405,11 @@ endif $(CMOS): $(LIB_DEPS) $(CMOS:%.cmo=%.cmx): $(LIBX_DEPS) +deps.ps: deps.dot + dot -Tps -o $@ $< +deps.dot: .depend + ./dep2dot.rb < $< | tred > $@ + ifeq ($(MAKECMDGOALS),all) $(CMOS:%.cmo=%.cmi): $(LIB_DEPS) endif diff --git a/matita/dep2dot.rb b/matita/dep2dot.rb new file mode 100755 index 000000000..813b2afeb --- /dev/null +++ b/matita/dep2dot.rb @@ -0,0 +1,30 @@ +#!/usr/bin/ruby -w +# filter converting from .depend to .dot +# tested on .depend generated by ocamldep +# $Id$ + +require 'set' + +edges = Set.new +$stdin.each {|line| + target, deps = line.split(/\s*:\s*/) + while deps =~ /\\\s*$/ # deal with lines continued with trailing \ + deps.sub!(/\s*\\\s*$/, '') + line = $stdin.readline + deps += ' ' + line.lstrip + end + sources, targets = target.split, deps.split + for src in sources + for tgt in targets # ignore file extensions + src.sub!(/\.[^.]+/, '') + tgt.sub!(/\.[^.]+/, '') + edges << [src, tgt] unless src == tgt # ignore self deps + end + end +} +puts 'digraph G {' +for src, tgt in edges + print "\"#{src}\" -> \"#{tgt}\";\n" +end +puts '}' +