33 lines
		
	
	
		
			878 B
		
	
	
	
		
			OCaml
		
	
	
	
	
	
			
		
		
	
	
			33 lines
		
	
	
		
			878 B
		
	
	
	
		
			OCaml
		
	
	
	
	
	
open Ocamlbuild_plugin
 | 
						|
 | 
						|
module MyProject = struct
 | 
						|
  flag ["js_of_ocaml";"prettyjs"](A"--pretty");
 | 
						|
  flag ["link";"byte";"ocaml";"program";"no_check_prims"](A"-no-check-prims");
 | 
						|
  rule "%.byte -> %js"
 | 
						|
       ~dep:"%.byte"
 | 
						|
       ~prod:"%.js"
 | 
						|
       (
 | 
						|
         fun env _ ->
 | 
						|
         let input = env "%.byte" in
 | 
						|
         let tags = tags_of_pathname input ++ "js_of_ocaml" in
 | 
						|
         Cmd(S[A"js_of_ocaml"; T tags; A"+gen_js_api/ojs_runtime.js"; A input])
 | 
						|
       );
 | 
						|
  rule "%.mli -> %.ml"
 | 
						|
       ~dep:"%.mli"
 | 
						|
       ~prod:"%.ml"
 | 
						|
       (
 | 
						|
         fun env _ ->
 | 
						|
         let input = env "%.mli" in
 | 
						|
         Cmd(S[A"ocamlfind"; A"gen_js_api/gen_js_api"; A input])
 | 
						|
       )
 | 
						|
end
 | 
						|
 | 
						|
let () = dispatch (
 | 
						|
             function
 | 
						|
             | Before_options ->
 | 
						|
                Options.use_ocamlfind := true;
 | 
						|
             | After_rules ->
 | 
						|
                ()
 | 
						|
             | _ -> ()
 | 
						|
           )
 |