ngx_addon_name="ngx_http_tnt_module"

libs="-lyajl -lmsgpuck"

include_paths=" \
          $ngx_addon_dir/src                                       \
          $ngx_addon_dir/third_party                               \
          "

test -f $ngx_addon_dir/third_party/yajl/build/yajl-2.1.0/lib/libyajl_s.a &&
test -f $ngx_addon_dir/third_party/msgpuck/libmsgpuck.a && {
  libs="                                                                \
      $ngx_addon_dir/third_party/yajl/build/yajl-2.1.0/lib/libyajl_s.a  \
      $ngx_addon_dir/third_party/msgpuck/libmsgpuck.a                   \
      "

  include_paths="${include_paths} \
          $ngx_addon_dir/third_party/msgpuck                       \
          $ngx_addon_dir/third_party/yajl/build/yajl-2.1.0/include \
          "
}

module_src_dir="$ngx_addon_dir/src"

sources=" \
          $module_src_dir/json_encoders.c         \
          $module_src_dir/tp_transcode.c          \
          $module_src_dir/ngx_http_tnt_module.c   \
          "

headers=" \
          $module_src_dir/debug.h                 \
          $module_src_dir/tp_ext.h                \
          $module_src_dir/json_encoders.h         \
          $module_src_dir/tp_transcode.h          \
          "

old_style_build=yes
if test -n "$ngx_module_link"; then
  old_style_build=no
fi

#
# Old-style build [[
if test "$old_style_build" = "yes"; then

  CORE_INCS=" \
          $CORE_INCS        \
          $ngx_feature_path \
          "

  CORE_LIBS=" \
          $CORE_LIBS        \
          $ngx_feature_libs \
          $libs           \
          "

  HTTP_MODULES=" \
          $HTTP_MODULES   \
          $ngx_addon_name \
          "

  NGX_ADDON_SRCS=" \
          $NGX_ADDON_SRCS \
          $sources      \
          "

  for path in $include_paths; do
    CFLAGS="$CFLAGS -I$path"
  done
# ]]

# New-style build [[
else

  ngx_module_type=HTTP
  ngx_module_name=$ngx_addon_name
  ngx_module_incs=$include_paths
  ngx_module_deps=$headers
  ngx_module_srcs=$sources
  ngx_module_libs=$libs
  . auto/module

# ]]
fi
