From 751851e34cd5ad06e6eac6ba7a5bfc9584602b7f Mon Sep 17 00:00:00 2001 From: Jacques Garrigue Date: Fri, 21 Dec 2001 06:54:52 +0000 Subject: [PATCH] simplify rpath git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@4181 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02 --- tools/ocamlmklib.mlp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/tools/ocamlmklib.mlp b/tools/ocamlmklib.mlp index 21904d92f..fc526e572 100644 --- a/tools/ocamlmklib.mlp +++ b/tools/ocamlmklib.mlp @@ -152,15 +152,22 @@ let scommand cmd = let safe_remove s = try Sys.remove s with Sys_error _ -> () +let make_set l = + let rec merge l = function + [] -> List.rev l + | p :: r -> if List.mem p l then merge l r else merge (p::l) r + in + merge [] l + let make_rpath flag = if !rpath = [] || flag = "" then "" - else flag ^ String.concat ":" !rpath + else flag ^ String.concat ":" (make_set !rpath) let make_rpath_ccopt flag = if !rpath = [] || flag = "" then "" - else "-ccopt " ^ flag ^ String.concat ":" !rpath + else "-ccopt " ^ flag ^ String.concat ":" (make_set !rpath) let prefix_list pref l = List.map (fun s -> pref ^ s) l