diff --git a/src/file_tree.ml b/src/file_tree.ml index 27c1079c..6bc5c021 100644 --- a/src/file_tree.ml +++ b/src/file_tree.ml @@ -24,15 +24,6 @@ type t = let root t = t.root -let always_ignore = - String_set.of_list - [ "" - ; "_build" - ; ".git" - ; ".hg" - ; "_darcs" - ] - let ignore_file = function | "" | "_build" diff --git a/src/gen_rules.ml b/src/gen_rules.ml index 76f2c7d5..62deffc5 100644 --- a/src/gen_rules.ml +++ b/src/gen_rules.ml @@ -785,7 +785,7 @@ module Gen(P : Params) = struct ~modules ~mode (String_map.keys modules))) - (expand_and_eval_set ~dir lib.c_libraries ~standard:[]) + (expand_and_eval_set ~dir lib.c_library_flags ~standard:[]) >>> Build.run (Dep compiler) ~extra_targets:( @@ -797,7 +797,7 @@ module Gen(P : Params) = struct ; As stubs_flags ; Dyn (fun (_, cclibs) -> S (List.map cclibs ~f:(fun flag -> - Arg_spec.S [A "-cclib"; A ("-l" ^ flag)]))) + Arg_spec.S [A "-cclib"; A flag]))) ; As (List.map lib.library_flags ~f:(expand_vars ~dir)) ; As (match lib.kind with | Normal -> [] @@ -979,7 +979,7 @@ module Gen(P : Params) = struct | None -> let targets = [ stubs_archive lib ~dir; dll lib ~dir ] in add_rule - (expand_and_eval_set ~dir lib.c_libraries ~standard:[] + (expand_and_eval_set ~dir lib.c_library_flags ~standard:[] >>> Build.run ~extra_targets:targets @@ -988,8 +988,7 @@ module Gen(P : Params) = struct ; A "-o" ; Path (Path.relative dir (sprintf "%s_stubs" lib.name)) ; Deps o_files - ; Dyn (fun cclibs -> - As (List.map cclibs ~f:((^) "-l"))) + ; Dyn (fun cclibs -> As cclibs) ]); end; diff --git a/src/jbuild_load.ml b/src/jbuild_load.ml index c61e9b8d..ab933935 100644 --- a/src/jbuild_load.ml +++ b/src/jbuild_load.ml @@ -10,7 +10,7 @@ type conf = let load fn ~dir = (dir, Sexp_load.many fn Stanza.t) -let load ftree = +let load () = let rec walk dir stanzas = let path = File_tree.Dir.path dir in let files = File_tree.Dir.files dir in diff --git a/src/jbuild_types.ml b/src/jbuild_types.ml index 3519c7d9..e15f15bc 100644 --- a/src/jbuild_types.ml +++ b/src/jbuild_types.ml @@ -329,7 +329,7 @@ module Library = struct ; cxx_names : string list ; includes : String_with_vars.t list ; library_flags : String_with_vars.t list - ; c_libraries : Ordered_set_lang.Unexpanded.t + ; c_library_flags : Ordered_set_lang.Unexpanded.t ; preprocess : Preprocess_map.t ; preprocessor_deps : Dep_conf.t list ; self_build_stubs_archive : string option @@ -358,7 +358,8 @@ module Library = struct ; field "c_names" (list string) ~default:[] ; field "cxx_names" (list string) ~default:[] ; field "library_flags" (list String_with_vars.t) ~default:[] - ; field_oslu "c_libraries" + ; field "c_libraries" (list string) ~default:[] + ; field_oslu "c_library_flags" ; field_pp "preprocess" ; field "preprocessor_deps" (list Dep_conf.t) ~default:[] ; field "self_build_stubs_archive" (option string) ~default:None @@ -374,7 +375,8 @@ module Library = struct ; field_osl "ocamlopt_flags" ] (fun name public_name synopsis public_headers libraries ppx_runtime_libraries - modules c_flags cxx_flags c_names cxx_names library_flags c_libraries preprocess + modules c_flags cxx_flags c_names cxx_names library_flags c_libraries + c_library_flags preprocess preprocessor_deps self_build_stubs_archive js_of_ocaml virtual_deps modes includes kind wrapped optional flags ocamlc_flags ocamlopt_flags -> { name @@ -392,7 +394,11 @@ module Library = struct ; cxx_flags ; includes ; library_flags - ; c_libraries + ; c_library_flags = + Ordered_set_lang.Unexpanded.append + (Ordered_set_lang.Unexpanded.t + (Sexp.To_sexp.(list string (List.map c_libraries ~f:((^) "-l"))))) + c_library_flags ; preprocess ; preprocessor_deps ; self_build_stubs_archive diff --git a/src/ordered_set_lang.ml b/src/ordered_set_lang.ml index 7db68269..ef52986d 100644 --- a/src/ordered_set_lang.ml +++ b/src/ordered_set_lang.ml @@ -60,6 +60,8 @@ module Unexpanded = struct let t t = t let standard = standard + let append a b = Sexp.List [a; b] + let files t = let rec loop acc : t -> _ = function | Atom _ -> acc diff --git a/src/ordered_set_lang.mli b/src/ordered_set_lang.mli index 8c8c67dd..66e09038 100644 --- a/src/ordered_set_lang.mli +++ b/src/ordered_set_lang.mli @@ -19,6 +19,8 @@ module Unexpanded : sig val t : Sexp.t -> t val standard : t + val append : t -> t -> t + (** List of files needed to expand this set *) val files : t -> String_set.t