···381381 let local_meta_path = Fpath.(v "lib" // meta_rel / "META" |> to_string) in
382382 (pkg_path, local_meta_path, pkg_deps)
383383384384-let opam_all verbose output_dir_str switch libraries no_worker =
384384+let opam_all verbose output_dir_str switch libraries no_worker all_pkgs =
385385 Opam.switch := switch;
386386387387 (* Get all packages and their dependencies *)
388388- let all_packages = match Ocamlfind.deps libraries with
389389- | Ok l -> "stdlib" :: l
390390- | Error (`Msg m) -> failwith ("Failed to find libs: " ^ m)
388388+ let all_packages =
389389+ if all_pkgs then
390390+ (* Build all installed packages *)
391391+ Ocamlfind.all ()
392392+ else if libraries = [] then
393393+ (* No packages specified, just stdlib *)
394394+ ["stdlib"]
395395+ else
396396+ match Ocamlfind.deps libraries with
397397+ | Ok l -> "stdlib" :: l
398398+ | Error (`Msg m) -> failwith ("Failed to find libs: " ^ m)
391399 in
392400393401 (* Remove duplicates and sort *)
···523531 let doc = "Opam switch to use" in
524532 Arg.(value & opt (some string) None & info [ "switch" ] ~doc)
525533 in
534534+ let all_pkgs =
535535+ let doc = "Build all installed packages (from ocamlfind list)" in
536536+ Arg.(value & flag & info [ "all" ] ~doc)
537537+ in
526538 let info = Cmd.info "opam-all" ~doc:"Generate universes for all packages and their dependencies" in
527539 Cmd.v info
528528- Term.(ret (const opam_all $ verbose $ output_dir $ switch $ libraries $ no_worker))
540540+ Term.(ret (const opam_all $ verbose $ output_dir $ switch $ libraries $ no_worker $ all_pkgs))
529541530542let main_cmd =
531543 let doc = "An odoc notebook tool" in