···350350351351### Build system:
352352353353-- #10289: Do not print option documentation in usage messages.
354354- (Pavlo Khrystenko, review by Gabriel Scherer)
353353+- #10289, #10406: Do not print option documentation in usage messages.
354354+ (Pavlo Khrystenko, review by Gabriel Scherer, fix by Kate Deplaix)
355355356356- #9191, #10091, #10182: take the LDFLAGS variable into account, except on
357357 flexlink-using systems.
+60-53
driver/makedepend.ml
···591591 let dep_args_rev : dep_arg list ref = ref [] in
592592 let add_dep_arg f s = dep_args_rev := (f s) :: !dep_args_rev in
593593 Clflags.classic := false;
594594- Compenv.readenv ppf Before_args;
595595- Clflags.reset_arguments (); (* reset arguments from ocamlc/ocamlopt *)
596596- Clflags.add_arguments __LOC__ [
597597- "-absname", Arg.Set Clflags.absname,
594594+ try
595595+ Compenv.readenv ppf Before_args;
596596+ Clflags.reset_arguments (); (* reset arguments from ocamlc/ocamlopt *)
597597+ Clflags.add_arguments __LOC__ [
598598+ "-absname", Arg.Set Clflags.absname,
598599 " Show absolute filenames in error messages";
599599- "-all", Arg.Set all_dependencies,
600600+ "-all", Arg.Set all_dependencies,
600601 " Generate dependencies on all files";
601601- "-allow-approx", Arg.Set allow_approximation,
602602+ "-allow-approx", Arg.Set allow_approximation,
602603 " Fallback to a lexer-based approximation on unparsable files";
603603- "-as-map", Arg.Set Clflags.transparent_modules,
604604- " Omit delayed dependencies for module aliases (-no-alias-deps -w -49)";
605605- (* "compiler uses -no-alias-deps, and no module is coerced"; *)
606606- "-debug-map", Arg.Set debug,
604604+ "-as-map", Arg.Set Clflags.transparent_modules,
605605+ " Omit delayed dependencies for module aliases (-no-alias-deps -w -49)";
606606+ (* "compiler uses -no-alias-deps, and no module is coerced"; *)
607607+ "-debug-map", Arg.Set debug,
607608 " Dump the delayed dependency map for each map file";
608608- "-I", Arg.String (add_to_list Clflags.include_dirs),
609609+ "-I", Arg.String (add_to_list Clflags.include_dirs),
609610 "<dir> Add <dir> to the list of include directories";
610610- "-nocwd", Arg.Set nocwd,
611611+ "-nocwd", Arg.Set nocwd,
611612 " Do not add current working directory to \
612613 the list of include directories";
613613- "-impl", Arg.String (add_dep_arg (fun f -> Src (f, Some ML))),
614614+ "-impl", Arg.String (add_dep_arg (fun f -> Src (f, Some ML))),
614615 "<f> Process <f> as a .ml file";
615615- "-intf", Arg.String (add_dep_arg (fun f -> Src (f, Some MLI))),
616616+ "-intf", Arg.String (add_dep_arg (fun f -> Src (f, Some MLI))),
616617 "<f> Process <f> as a .mli file";
617617- "-map", Arg.String (add_dep_arg (fun f -> Map f)),
618618+ "-map", Arg.String (add_dep_arg (fun f -> Map f)),
618619 "<f> Read <f> and propagate delayed dependencies to following files";
619619- "-ml-synonym", Arg.String(add_to_synonym_list ml_synonyms),
620620+ "-ml-synonym", Arg.String(add_to_synonym_list ml_synonyms),
620621 "<e> Consider <e> as a synonym of the .ml extension";
621621- "-mli-synonym", Arg.String(add_to_synonym_list mli_synonyms),
622622+ "-mli-synonym", Arg.String(add_to_synonym_list mli_synonyms),
622623 "<e> Consider <e> as a synonym of the .mli extension";
623623- "-modules", Arg.Set raw_dependencies,
624624+ "-modules", Arg.Set raw_dependencies,
624625 " Print module dependencies in raw form (not suitable for make)";
625625- "-native", Arg.Set native_only,
626626+ "-native", Arg.Set native_only,
626627 " Generate dependencies for native-code only (no .cmo files)";
627627- "-bytecode", Arg.Set bytecode_only,
628628+ "-bytecode", Arg.Set bytecode_only,
628629 " Generate dependencies for bytecode-code only (no .cmx files)";
629629- "-one-line", Arg.Set one_line,
630630+ "-one-line", Arg.Set one_line,
630631 " Output one line per file, regardless of the length";
631631- "-open", Arg.String (add_to_list Clflags.open_modules),
632632+ "-open", Arg.String (add_to_list Clflags.open_modules),
632633 "<module> Opens the module <module> before typing";
633633- "-plugin", Arg.String(fun _p -> Clflags.plugin := true),
634634- "<plugin> (no longer supported)";
635635- "-pp", Arg.String(fun s -> Clflags.preprocessor := Some s),
636636- "<cmd> Pipe sources through preprocessor <cmd>";
637637- "-ppx", Arg.String (add_to_list Compenv.first_ppx),
638638- "<cmd> Pipe abstract syntax trees through preprocessor <cmd>";
639639- "-shared", Arg.Set shared,
640640- " Generate dependencies for native plugin files (.cmxs targets)";
641641- "-slash", Arg.Set Clflags.force_slash,
642642- " (Windows) Use forward slash / instead of backslash \\ in file paths";
643643- "-sort", Arg.Set sort_files,
634634+ "-plugin", Arg.String(fun _p -> Clflags.plugin := true),
635635+ "<plugin> (no longer supported)";
636636+ "-pp", Arg.String(fun s -> Clflags.preprocessor := Some s),
637637+ "<cmd> Pipe sources through preprocessor <cmd>";
638638+ "-ppx", Arg.String (add_to_list Compenv.first_ppx),
639639+ "<cmd> Pipe abstract syntax trees through preprocessor <cmd>";
640640+ "-shared", Arg.Set shared,
641641+ " Generate dependencies for native plugin files (.cmxs targets)";
642642+ "-slash", Arg.Set Clflags.force_slash,
643643+ " (Windows) Use forward slash / instead of backslash \\ in file paths";
644644+ "-sort", Arg.Set sort_files,
644645 " Sort files according to their dependencies";
645645- "-version", Arg.Unit print_version,
646646- " Print version and exit";
647647- "-vnum", Arg.Unit print_version_num,
648648- " Print version number and exit";
649649- "-args", Arg.Expand Arg.read_arg,
650650- "<file> Read additional newline separated command line arguments \n\
651651- \ from <file>";
652652- "-args0", Arg.Expand Arg.read_arg0,
653653- "<file> Read additional NUL separated command line arguments from \n\
654654- \ <file>"
655655- ];
656656- let program = Filename.basename Sys.argv.(0) in
657657- Compenv.parse_arguments (ref argv)
646646+ "-version", Arg.Unit print_version,
647647+ " Print version and exit";
648648+ "-vnum", Arg.Unit print_version_num,
649649+ " Print version number and exit";
650650+ "-args", Arg.Expand Arg.read_arg,
651651+ "<file> Read additional newline separated command line arguments \n\
652652+ \ from <file>";
653653+ "-args0", Arg.Expand Arg.read_arg0,
654654+ "<file> Read additional NUL separated command line arguments from \n\
655655+ \ <file>"
656656+ ];
657657+ let program = Filename.basename Sys.argv.(0) in
658658+ Compenv.parse_arguments (ref argv)
658659 (add_dep_arg (fun f -> Src (f, None))) program;
659659- process_dep_args (List.rev !dep_args_rev);
660660- Compenv.readenv ppf Before_link;
661661- if !sort_files then sort_files_by_dependencies !files
662662- else List.iter print_file_dependencies (List.sort compare !files);
663663- exit (if Error_occurred.get () then 2 else 0)
660660+ process_dep_args (List.rev !dep_args_rev);
661661+ Compenv.readenv ppf Before_link;
662662+ if !sort_files then sort_files_by_dependencies !files
663663+ else List.iter print_file_dependencies (List.sort compare !files);
664664+ (if Error_occurred.get () then 2 else 0)
665665+ with
666666+ | Compenv.Exit_with_status n ->
667667+ n
668668+ | exn ->
669669+ Location.report_exception ppf exn;
670670+ 2
664671665672666673let main () =
667667- run_main Sys.argv
674674+ exit (run_main Sys.argv)
668675669676let main_from_option () =
670677 if Sys.argv.(1) <> "-depend" then begin
···676683 Array.concat [ [| Sys.argv.(0) ^ " -depend" |];
677684 Array.sub Sys.argv 2 (Array.length Sys.argv - 2) ] in
678685 Sys.argv.(0) <- args.(0);
679679- run_main args
686686+ exit (run_main args)