diff options
-rw-r--r-- | tools/ocamldep.ml | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/tools/ocamldep.ml b/tools/ocamldep.ml index 120ca7029..02af076d4 100644 --- a/tools/ocamldep.ml +++ b/tools/ocamldep.ml @@ -258,6 +258,8 @@ and add_class_declaration bv decl = let load_path = ref [""] +let native_only = ref false + let find_dependency modname (byt_deps, opt_deps) = let name = String.uncapitalize modname in try @@ -271,7 +273,7 @@ let find_dependency modname (byt_deps, opt_deps) = try let filename = Misc.find_in_path !load_path (name ^ ".ml") in let basename = Filename.chop_suffix filename ".ml" in - ((basename ^ ".cmo") :: byt_deps, + ((basename ^ (if !native_only then ".cmx" else ".cmo")) :: byt_deps, (basename ^ ".cmx") :: opt_deps) with Not_found -> (byt_deps, opt_deps) @@ -355,12 +357,14 @@ let file_dependencies source_file = (* Entry point *) -let usage = "Usage: ocamldep [-I <dir>] <files>" +let usage = "Usage: ocamldep [-I <dir>] [-native] <files>" let _ = Clflags.classic := false; Arg.parse [ "-I", Arg.String(fun dir -> load_path := !load_path @ [dir]), - "<dir> Add <dir> to the list of include directories" + "<dir> Add <dir> to the list of include directories"; + "-native", Arg.Set native_only, + " Generate dependencies for a pure native-code project (no .cmo files)" ] file_dependencies usage; exit (if !error_occurred then 2 else 0) |