(executable
 (name gen_stubs)
 (modules gen_stubs)
 (libraries posix-math2.stubs posix-base))

(executable
 (name gen_types_c)
 (modules gen_types_c)
 (libraries posix-math2.types posix-base))

(rule
 (targets gen_types.c)
 (action
  (run ./gen_types_c.exe %{targets})))

(rule
 (targets gen_types_c)
 (deps
  (:c_code ./gen_types.c))
 (action
  (run
   %{ocaml-config:c_compiler}
   -I
   %{lib:ctypes:}
   -I
   %{ocaml-config:standard_library}
   -o
   %{targets}
   %{c_code})))

(executable
 (name gen_constants_c)
 (modules gen_constants_c)
 (libraries posix-math2.constants posix-base))

(rule
 (targets gen_constants.c)
 (action
  (run ./gen_constants_c.exe %{targets})))

(rule
 (targets gen_constants_c)
 (deps
  (:c_code ./gen_constants.c))
 (action
  (run
   %{ocaml-config:c_compiler}
   -I
   %{lib:ctypes:}
   -I
   %{ocaml-config:standard_library}
   -o
   %{targets}
   %{c_code})))
