import intf_libs = libavutil%lib{avutil}

# A utility library is required by the bin.def rule and the unit test
# executables.
#
./: lib{postproc}: libul{postproc}

# Headers.
#
libul{postproc}: libpostproc/h{*}

# Included source files
#
libul{postproc}: libpostproc/c{postprocess_template}: include = adhoc

# Compiled source files
#
libul{postproc}: libpostproc/c{postprocess      \
                               version}

# Libraries
#
libul{postproc}: $intf_libs

# Build options.
#
c.poptions =+ "-I$out_base" "-I$src_base"       \
              $common_poptions                  \
              -DBUILDING_postproc

obj{*}: c.coptions += $common_coptions

objs{*}: c.poptions += $common_objs_poptions
obja{*}: c.poptions += $common_obja_poptions

lib{postproc}: c.loptions += $common_loptions

# Export all symbols from the DLL if on Windows.
#
libs{postproc}: def{postproc}: include = ($c.target.system == 'win32-msvc')
def{postproc}: libul{postproc}

if $tgt_mingw
  libs{postproc}: c.loptions += -Wl,--export-all-symbols

libul{postproc}: c.libs += $common_libs

# Export options.
#
lib{postproc}:
{
  c.export.poptions =+ "-I$out_base" "-I$src_base"

  # @@ TMP Let's hold off on exporting any system libraries until it's clear
  #    which ones we have to export. Upstream doesn't appear to be concerned
  #    about these sorts of things at all.
  #
  c.export.libs = $intf_libs # $sys_libs
}

# For pre-releases use the complete version to make sure they cannot
# be used in place of another pre-release or the final version. See
# the version module for details on the version.* variable values.
#
if $version.pre_release
  lib{postproc}: bin.lib.version = "-$version.project_id"
else
  lib{postproc}: bin.lib.version = "-$version.major.$version.minor"

# Installation.
#
# Don't install private headers because no other FFmpeg library depends on
# postproc. Some tools do but they include only public headers.
#
pub_hdr = postprocess   \
          version       \
          version_major

h{*}: install = false

for h: $pub_hdr
  libpostproc/h{$h}@./libpostproc/: install = include/libpostproc/

lib{postproc}: c.pkgconfig.include = include/
