diff --git a/build_system/clerk_driver.ml b/build_system/clerk_driver.ml index 5851c9b7..468cb638 100644 --- a/build_system/clerk_driver.ml +++ b/build_system/clerk_driver.ml @@ -493,6 +493,10 @@ let[@ocamlformat "disable"] static_base_rules = ] ~description:[""; "⇒"; !output]; + Nj.rule "python" + ~command:[!catala_exe; "python"; !catala_flags; !input; "-o"; !output] + ~description:[""; "python"; "⇒"; !output]; + Nj.rule "out-test" ~command: [ !catala_exe; !test_command; "--plugin-dir="; "-o -"; !catala_flags; !input; @@ -591,21 +595,30 @@ let gen_build_statements ~outputs:[modd m]) item.module_def in - let ml_file = + let target_file ext = match item.module_def with - | Some m -> (!Var.builddir / src /../ m) ^ ".ml" - | None -> (!Var.builddir / !Var.src) ^ ".ml" + | Some m -> (!Var.builddir / src /../ m) ^ "." ^ ext + | None -> (!Var.builddir / !Var.src) ^ "." ^ ext in - let ocaml = + let ml_file = target_file "ml" in + let py_file = target_file "py" in + let ocaml, python = if item.extrnal then - Nj.build "copy" - ~implicit_in:[inc srcv] - ~inputs:[src -.- "ml"] - ~outputs:[ml_file] + ( Nj.build "copy" + ~implicit_in:[inc srcv] + ~inputs:[src -.- "ml"] + ~outputs:[ml_file], + Nj.build "copy" + ~implicit_in:[inc srcv] + ~inputs:[src -.- "py"] + ~outputs:[py_file] ) else - Nj.build "catala-ocaml" - ~inputs:[inc srcv] - ~implicit_in:[!Var.catala_exe] ~outputs:[ml_file] + ( Nj.build "catala-ocaml" + ~inputs:[inc srcv] + ~implicit_in:[!Var.catala_exe] ~outputs:[ml_file], + Nj.build "python" + ~inputs:[inc srcv] + ~implicit_in:[!Var.catala_exe] ~outputs:[py_file] ) in let ocamlopt = let implicit_out_exts = ["cmi"; "cmx"; "cmt"; "o"] in @@ -774,6 +787,7 @@ let gen_build_statements Option.to_seq expose_module; Seq.return ocaml; Seq.return ocamlopt; + Seq.return python; List.to_seq tests; Seq.return interpret; ]