summaryrefslogtreecommitdiff
path: root/tools/ocamldep.ml
diff options
context:
space:
mode:
authorXavier Leroy <xavier.leroy@inria.fr>2002-06-07 13:30:00 +0000
committerXavier Leroy <xavier.leroy@inria.fr>2002-06-07 13:30:00 +0000
commit0d8157b09d09332cd728977993f8c1ae83b37930 (patch)
treeda73a33774f6d36ed8882a16f6c4980a07e99e26 /tools/ocamldep.ml
parenta970ebdb7ee49af7b46fcf77c660cb567b801e72 (diff)
downloadocaml-0d8157b09d09332cd728977993f8c1ae83b37930.tar.gz
Ajout flag -slash pour Windows
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@4902 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Diffstat (limited to 'tools/ocamldep.ml')
-rw-r--r--tools/ocamldep.ml18
1 files changed, 16 insertions, 2 deletions
diff --git a/tools/ocamldep.ml b/tools/ocamldep.ml
index 8e62e79b9b..485b682ad8 100644
--- a/tools/ocamldep.ml
+++ b/tools/ocamldep.ml
@@ -23,10 +23,22 @@ open Parsetree
let load_path = ref [""]
let native_only = ref false
+let force_slash = ref false
+
+let find_file name =
+ let filename = Misc.find_in_path_uncap !load_path name in
+ if !force_slash then begin
+ let filename = String.copy filename in
+ for i = 0 to String.length filename - 1 do
+ if filename.[i] = '\\' then filename.[i] <- '/'
+ done;
+ filename
+ end else
+ filename
let find_dependency modname (byt_deps, opt_deps) =
try
- let filename = Misc.find_in_path_uncap !load_path (modname ^ ".mli") in
+ let filename = find_file (modname ^ ".mli") in
let basename = Filename.chop_suffix filename ".mli" in
((basename ^ ".cmi") :: byt_deps,
(if Sys.file_exists (basename ^ ".ml")
@@ -34,7 +46,7 @@ let find_dependency modname (byt_deps, opt_deps) =
else basename ^ ".cmi") :: opt_deps)
with Not_found ->
try
- let filename = Misc.find_in_path_uncap !load_path (modname ^ ".ml") in
+ let filename = find_file (modname ^ ".ml") in
let basename = Filename.chop_suffix filename ".ml" in
((basename ^ (if !native_only then ".cmx" else ".cmo")) :: byt_deps,
(basename ^ ".cmx") :: opt_deps)
@@ -190,6 +202,8 @@ let _ =
"-native", Arg.Set native_only,
" Generate dependencies for a pure native-code project \
(no .cmo files)";
+ "-slash", Arg.Set force_slash,
+ " (for Windows) Use forward slash / instead of backslash \\ in file paths";
"-pp", Arg.String(fun s -> preprocessor := Some s),
"<command> Pipe sources through preprocessor <command>"
] file_dependencies usage;