(library
 (name avutil)
 (public_name ffmpeg-avutil)
 (synopsis "Bindings to ffmpeg's avutil library")
 (foreign_stubs
  (language c)
  (names avutil_stubs)
  (flags
   (:include c_flags.sexp)))
 (c_library_flags
  (:include c_library_flags.sexp))
 (install_c_headers
  avutil_stubs
  polymorphic_variant_values_stubs
  media_types_stubs)
 (libraries threads))

(rule
 (targets c_flags c_flags.sexp c_library_flags.sexp)
 (action
  (run ./config/discover.exe)))

(rule
 (targets avutil_stubs.c)
 (mode fallback)
 (deps
  polymorphic_variant_values_stubs.h
  pixel_format_stubs.h
  media_types_stubs.h
  hw_device_type_stubs.h
  pixel_format_flag_stubs.h
  sample_format_stubs.h
  channel_layout_stubs.h)
 (action
  (echo "this should not happen")))

(rule
 (targets hw_device_type_stubs.h)
 (deps c_flags)
 (action
  (run
   ../gen_code/gen_code.exe
   "%{cc}"
   hw_device_type
   h
   %{read-lines:c_flags})))

(rule
 (targets hw_device_type.ml)
 (deps hw_device_type_stubs.h c_flags)
 (action
  (run
   ../gen_code/gen_code.exe
   "%{cc}"
   hw_device_type
   ml
   %{read-lines:c_flags})))

(rule
 (targets media_types_stubs.h)
 (deps c_flags)
 (action
  (run ../gen_code/gen_code.exe "%{cc}" media_types h %{read-lines:c_flags})))

(rule
 (targets media_types.ml)
 (deps media_types_stubs.h c_flags)
 (action
  (run ../gen_code/gen_code.exe "%{cc}" media_types ml %{read-lines:c_flags})))

(rule
 (targets polymorphic_variant_values_stubs.h)
 (deps c_flags)
 (action
  (run
   ../gen_code/gen_code.exe
   "%{cc}"
   polymorphic_variant
   h
   %{read-lines:c_flags})))

(rule
 (targets pixel_format_stubs.h)
 (deps c_flags)
 (action
  (run ../gen_code/gen_code.exe "%{cc}" pixel_format h %{read-lines:c_flags})))

(rule
 (targets pixel_format.ml)
 (deps c_flags)
 (action
  (run
   ../gen_code/gen_code.exe
   "%{cc}"
   pixel_format
   ml
   %{read-lines:c_flags})))

(rule
 (targets pixel_format_flag_stubs.h)
 (deps c_flags)
 (action
  (run
   ../gen_code/gen_code.exe
   "%{cc}"
   pixel_format_flag
   h
   %{read-lines:c_flags})))

(rule
 (targets pixel_format_flag.ml)
 (deps c_flags)
 (action
  (run
   ../gen_code/gen_code.exe
   "%{cc}"
   pixel_format_flag
   ml
   %{read-lines:c_flags})))

(rule
 (targets sample_format_stubs.h)
 (deps c_flags)
 (action
  (run
   ../gen_code/gen_code.exe
   "%{cc}"
   sample_format
   h
   %{read-lines:c_flags})))

(rule
 (targets sample_format.ml)
 (deps c_flags)
 (action
  (run
   ../gen_code/gen_code.exe
   "%{cc}"
   sample_format
   ml
   %{read-lines:c_flags})))

(rule
 (targets channel_layout_stubs.h)
 (deps c_flags)
 (action
  (run
   ../gen_code/gen_code.exe
   "%{cc}"
   channel_layout
   h
   %{read-lines:c_flags})))

(rule
 (targets channel_layout.ml)
 (deps c_flags)
 (action
  (run
   ../gen_code/gen_code.exe
   "%{cc}"
   channel_layout
   ml
   %{read-lines:c_flags})))
