Commits

Dmitry Grebeniuk  committed 3c672a9 Draft

*nstall.make: + ?opts

  • Participants
  • Parent commits a56e755

Comments (0)

Files changed (1)

File src/pre_template.ml

   end
 
 
-let make_gen funcname targets =
+let make_gen ~opts funcname targets =
   let check_target =
     String.iter
       (function
            target
          in
          let argv =
-           if target = ""
-           then [| Reb_sys.make_exe |]
-           else [| Reb_sys.make_exe ; target |]
+           Array.of_list
+             ( [Reb_sys.make_exe]
+             @ opts
+             @ (if target = "" then [] else [target])
+             )
          in
          if 0 = Reb_sys.run ~show:true argv
          then ()
-         else failwith "%s: failed to build target %S" funcname target
+         else failwith "%s: failed to build target %S with command %s"
+                funcname target (Reb_sys.dump_argv argv)
       )
       targets
   in
  :
   sig
     val configure : string list (* args *) -> installation_instructions
-    val make : string list (* targets *) -> installation_instructions
+    val make : ?opts:string list -> string list (* targets *)
+               -> installation_instructions
     val none : installation_instructions
     val run : string list -> installation_instructions
     val patch : ?p:int -> string -> installation_instructions
                | c -> failwith "Install.configure: failed with code %i" c
       )
 
-    let make targets = (make_gen "Install.make" targets)
+    let make ?(opts=[]) targets = (make_gen ~opts "Install.make" targets)
 
     let run argv =
       let argv = Array.of_list argv in
 module Uninstall
  :
   sig
-    val make : string list -> uninstallation_instructions
+    val make : ?opts:string list -> string list -> uninstallation_instructions
     val none : uninstallation_instructions
     val ocamlfind_remove : string list -> uninstallation_instructions
   end
  =
   struct
     let none () = ()
-    let make targets = (make_gen "Uninstall.make" targets)
+    let make ?(opts=[]) targets = (make_gen ~opts "Uninstall.make" targets)
     let ocamlfind_remove lst () =
       List.iter
         (fun p ->