(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
  color_space_stubs.h
  color_range_stubs.h
  color_primaries_stubs.h
  color_trc_stubs.h
  chroma_location_stubs.h
  sample_format_stubs.h
  channel_layout_stubs.h
  subtitle_type_stubs.h
  subtitle_flag_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 color_space_stubs.h)
 (deps c_flags)
 (action
  (run ../gen_code/gen_code.exe "%{cc}" color_space h %{read-lines:c_flags})))

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

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

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

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

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

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

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

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

(rule
 (targets chroma_location.ml)
 (deps c_flags)
 (action
  (run
   ../gen_code/gen_code.exe
   "%{cc}"
   chroma_location
   ml
   %{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})))

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

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

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

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