From 81182272629617d0b8b9b1e2034ff8cd39e41ade Mon Sep 17 00:00:00 2001 From: Enrico Tassi Date: Fri, 6 Oct 2006 15:30:37 +0000 Subject: [PATCH] now the makefile for developments requires the depend file that now has correct dependencies. --- helm/software/matita/matitadep.ml | 27 +++++++++++++++++++++-- helm/software/matita/matitamakeLib.ml | 2 +- helm/software/matita/template_makefile.in | 7 +++--- 3 files changed, 30 insertions(+), 6 deletions(-) diff --git a/helm/software/matita/matitadep.ml b/helm/software/matita/matitadep.ml index 65743db58..1ae74eafe 100644 --- a/helm/software/matita/matitadep.ml +++ b/helm/software/matita/matitadep.ml @@ -112,6 +112,29 @@ let main () = let oc = open_out !dot_file in let fmt = Format.formatter_of_out_channel oc in GraphvizPp.Dot.header (* ~graph_attrs:["rankdir","LR"] *) fmt; + let gcp x y = + (* explode and implode from the OCaml Expert FAQ. *) + let explode s = + let rec exp i l = + if i < 0 then l else exp (i - 1) (s.[i] :: l) in + exp (String.length s - 1) [] + in + let implode l = + let res = String.create (List.length l) in + let rec imp i = function + | [] -> res + | c :: l -> res.[i] <- c; imp (i + 1) l in + imp 0 l + in + let rec aux = function + | x::tl1,y::tl2 when x = y -> x::(aux (tl1,tl2)) + | _ -> [] + in + implode (aux (explode x,explode y)) + in + let max_path = List.hd ma_files in + let max_path = List.fold_left gcp max_path ma_files in + let short x = Pcre.replace ~pat:("^"^max_path) x in List.iter (fun ma_file -> let deps = Hashtbl.find_all include_deps_dot ma_file in @@ -124,8 +147,8 @@ let main () = in let deps = List.fast_sort Pervasives.compare deps in let deps = HExtlib.list_uniq deps in - GraphvizPp.Dot.node ma_file fmt; - List.iter (fun dep -> GraphvizPp.Dot.edge ma_file dep fmt) deps) + GraphvizPp.Dot.node (short ma_file) fmt; + List.iter (fun dep -> GraphvizPp.Dot.edge (short ma_file) (short dep) fmt) deps) ma_files; GraphvizPp.Dot.trailer fmt; close_out oc diff --git a/helm/software/matita/matitamakeLib.ml b/helm/software/matita/matitamakeLib.ml index 47dbdb22b..013d45b7a 100644 --- a/helm/software/matita/matitamakeLib.ml +++ b/helm/software/matita/matitamakeLib.ml @@ -202,7 +202,7 @@ let call_make ?matita_flags development target make = let args = ["--no-print-directory"; "-s"; "-k"; "-f"; makefile; target] @ flags in -(* prerr_endline (String.concat " " args); *) + (* prerr_endline (String.concat " " args); *) make development.root args let build_development ?matita_flags ?(target="all") development = diff --git a/helm/software/matita/template_makefile.in b/helm/software/matita/template_makefile.in index 7c5a40b31..630a14180 100644 --- a/helm/software/matita/template_makefile.in +++ b/helm/software/matita/template_makefile.in @@ -1,5 +1,6 @@ -SRC=$(shell find @ROOT@ -name "*.ma" -a -type f | sed 's?^@ROOT@/??') -TODO=$(SRC:%.ma=%.mo) +SRC=$(shell find @ROOT@ -name "*.ma" -a -type f) +SHORTSRC=$(echo $(SRC) | sed 's?^@ROOT@/??g') +TODO=$(SHORTSRC:%.ma=%.mo) MATITA_FLAGS= MATITA_FLAGS+=-noprofile @@ -32,4 +33,4 @@ clean: # this is the depend for full targets like: # dir/dir/name.moo: dir/dir/name.ma dir/dep.moo --include @DEPFILE@ +include @DEPFILE@ -- 2.39.2