intf_libs = # Interface dependencies.
impl_libs = # Implementation dependencies.

lib{threadable}: libul{threadable}: {hxx ixx txx cxx}{** -version} hxx{version} $impl_libs $intf_libs

# Include the generated version header into the distribution (so that we don't
# pick up an installed one) and don't remove it when cleaning in src (so that
# clean results in a state identical to distributed).
#
hxx{version}: in{version} $src_root/manifest
{
  dist  = true
  clean = ($src_root != $out_root)
}

# Build options.
#
cxx.poptions =+ "-I$out_root" "-I$src_root"

if ($cxx.target.system != 'win32-msvc')
{
  cxx.libs += -pthread
  lib{threadable}: cxx.export.libs += -pthread
}

if($cxx.id == 'gcc')
{
  cxx.coptions += -Wno-interference-size
}

# Export options.
libs{threadable}: def{threadable}: include = ($cxx.target.system == 'win32-msvc')
def{threadable}: libul{threadable}

if ($cxx.target.system == 'mingw32')
  cxx.loptions += -Wl,--export-all-symbols

lib{threadable}:
{
  cxx.export.poptions += "-I$out_root" "-I$src_root"
  cxx.export.libs += $intf_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{threadable}: bin.lib.version = "-$version.project_id"
else
  lib{threadable}: bin.lib.version = "-$version.major.$version.minor"

# Install into the threadable/ subdirectory of, say, /usr/include/
# recreating subdirectories.
#
{hxx ixx txx}{*}:
{
  install         = include/threadable/
  install.subdirs = true
}
