From f80498e19a670040dce0795a8ea1cc83ca490ecc Mon Sep 17 00:00:00 2001 From: Bernhard Schommer Date: Thu, 8 Feb 2018 16:44:06 +0100 Subject: Extend the modorder tool to handle Coq files as well (#54) This is useful to e.g. identify the .vo files from CompCert that a clightgen-generated .v file needs. Also: the "result" field of the record type is now initialized with the LHS of the dependency, not the RHS. It doesn't matter because the result field is unused, but it makes more sense now. --- tools/modorder.ml | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'tools') diff --git a/tools/modorder.ml b/tools/modorder.ml index 34e157d0..d1203568 100644 --- a/tools/modorder.ml +++ b/tools/modorder.ml @@ -29,7 +29,7 @@ type node = { let re_continuation_line = Str.regexp "\\(.*\\)\\\\[ \t]*$" -let re_depend_line = Str.regexp "\\([^ ]+\\) *:\\(.*\\)$" +let re_depend_line = Str.regexp "\\([^:]*\\):\\(.*\\)$" let re_whitespace = Str.regexp "[ \t\n]+" @@ -51,12 +51,14 @@ let parse_dependencies depfile = end else begin let lhs = Str.matched_group 1 l and rhs = Str.matched_group 2 l in - let node = { - deps = Str.split re_whitespace rhs; - result = rhs; - status = Todo - } in - Hashtbl.add deps lhs node + let lhs = Str.split re_whitespace lhs + and rhs = Str.split re_whitespace rhs in + List.iter (fun lhs -> let node = { + deps = rhs; + result = lhs; + status = Todo + } in + Hashtbl.add deps lhs node) lhs end in begin try -- cgit