2007-02-07 00:59:16 -08:00
|
|
|
(***********************************************************************)
|
2012-08-01 07:47:00 -07:00
|
|
|
(* *)
|
2007-02-07 00:59:16 -08:00
|
|
|
(* ocamlbuild *)
|
|
|
|
(* *)
|
|
|
|
(* Nicolas Pouillard, Berke Durak, projet Gallium, INRIA Rocquencourt *)
|
|
|
|
(* *)
|
|
|
|
(* Copyright 2007 Institut National de Recherche en Informatique et *)
|
|
|
|
(* en Automatique. All rights reserved. This file is distributed *)
|
2015-07-28 06:18:34 -07:00
|
|
|
(* under the terms of the GNU Library General Public License, with *)
|
|
|
|
(* the special exception on linking described in file ../LICENSE. *)
|
2007-02-07 00:59:16 -08:00
|
|
|
(* *)
|
|
|
|
(***********************************************************************)
|
|
|
|
|
2009-03-03 08:54:58 -08:00
|
|
|
|
2007-02-07 00:59:16 -08:00
|
|
|
(* Original author: Nicolas Pouillard *)
|
|
|
|
(* Tools *)
|
|
|
|
|
|
|
|
open My_std
|
|
|
|
open Format
|
|
|
|
open Log
|
|
|
|
open Pathname.Operators
|
|
|
|
open Tags.Operators
|
|
|
|
open Rule
|
|
|
|
|
|
|
|
let pp_l = List.print String.print
|
|
|
|
|
|
|
|
let tags_of_pathname p =
|
2007-11-28 08:06:13 -08:00
|
|
|
Configuration.tags_of_filename (Pathname.to_string p)
|
2007-02-08 08:53:39 -08:00
|
|
|
++("file:"^p)
|
2010-01-22 04:48:24 -08:00
|
|
|
++("extension:"^Pathname.get_extension p)
|
2007-02-07 00:59:16 -08:00
|
|
|
|
|
|
|
let opt_print elt ppf =
|
|
|
|
function
|
|
|
|
| Some x -> fprintf ppf "@[<2>Some@ %a@]" elt x
|
|
|
|
| None -> pp_print_string ppf "None"
|
|
|
|
|
|
|
|
let path_and_context_of_string s =
|
|
|
|
if Pathname.is_implicit s then
|
|
|
|
let b = Pathname.basename s in
|
|
|
|
let d = Pathname.dirname s in
|
|
|
|
if d <> Pathname.current_dir_name then
|
|
|
|
let () = Pathname.define_context d [d] in
|
|
|
|
[s]
|
|
|
|
else
|
|
|
|
let include_dirs = Pathname.include_dirs_of d in
|
|
|
|
List.map (fun include_dir -> include_dir/b) include_dirs
|
|
|
|
else [s]
|