AM_CPPFLAGS += -I${top_srcdir}/src/obproxy\
               -I${top_srcdir}/deps/easy/src/include\
               -I${top_srcdir}/deps/easy/src/io\
               -I${top_srcdir}/deps/easy/src/util\
               -I${top_srcdir}/deps/easy/src/thread\
               -I${DEP_DIR}/include/mariadb\
               -I${DEP_DIR}/include\
               -DSQL_PARSER_COMPILATION

obproxy_libobproxy_la_LIBADD := dbconfig/libdbconfig.la lib/regex/regex/libregex.la prometheus/libprometheus_exporter.la
noinst_LTLIBRARIES += obproxy/libobproxy.la

bin_PROGRAMS += obproxy/obproxy

include obproxy/iocore/eventsystem/Makemodule.am
include obproxy/iocore/net/Makemodule.am
include obproxy/utils/Makemodule.am
include obproxy/proxy/mysql/Makemodule.am
include obproxy/proxy/api/Makemodule.am
include obproxy/proxy/plugins/Makemodule.am
include obproxy/proxy/mysqllib/Makemodule.am
include obproxy/proxy/client/Makemodule.am
include obproxy/proxy/route/Makemodule.am
include obproxy/proxy/shard/Makemodule.am
include obproxy/obutils/Makemodule.am
include obproxy/stat/Makemodule.am
include obproxy/prometheus/Makemodule.am
include obproxy/cmd/Makemodule.am
include obproxy/opsql/Makemodule.am
include obproxy/packet/Makemodule.am
include obproxy/dbconfig/Makemodule.am
include obproxy/engine/Makemodule.am
include obproxy/optimizer/Makemodule.am
include obproxy/executor/Makemodule.am
include obproxy/qos/Makemodule.am
#include obproxy/tests/Makemodule.am

pub_source =                            \
        obproxy/ob_proxy_main.h         \
        obproxy/ob_proxy_main.cpp       \
        obproxy/ob_proxy.h              \
        obproxy/ob_proxy.cpp

obproxy_sources :=\
${iocore_eventsystem_sources}\
${iocore_net_sources}\
${utils_sources}\
${proxy_mysql_sources}\
${proxy_api_sources}\
${proxy_plugins_sources}\
${proxy_mysqllib_sources}\
${proxy_mysql_client_sources}\
${proxy_mysql_route_sources}\
${proxy_mysql_shard_sources}\
${obutils_sources}\
${stat_sources}\
${cmd_sources}\
${tests_lib_sources}\
${opsql_sources}\
${opsql_parser_sources}\
${opsql_dual_parser_sources}\
${opsql_expr_parser_sources}\
${opsql_expr_resolver_sources}\
${opsql_func_expr_parser_sources}\
${opsql_func_expr_resolver_sources}\
${packet_sources}\
${prometheus_sources}\
${obproxy_executor_sources}\
${obproxy_optimizer_sources}\
${obproxy_engine_sources}\
${qos_sources}

obproxy_libobproxy_la_SOURCES :=\
${obproxy_lib_sources}\
${obproxy_common_sources}\
${obproxy_share_sources} ${share_config_sources}\
${rpc_obmysql_packet_sources} ${obproxy_rpc_obmysql_sources} ${rpc_common_sources}\
${obproxy_sql_sources}\
${obproxy_sources}

nodist_obproxy_libobproxy_la_SOURCES = build_version.c
obproxy_obproxy_SOURCES := obproxy/main.cpp ${pub_source}

obproxy_obproxy_LDADD_BASE := obproxy/libobproxy.la lib/compress/libzlib_1.0.la ${BIN_LDFLAGS} ${DEP_DIR}/lib64/libprotobuf.a ${DEP_DIR}/lib/libgrpc.a ${DEP_DIR}/lib/libgrpc++.a ${DEP_DIR}/lib/libgrpc_unsecure.a ${DEP_DIR}/lib/libgrpc++_unsecure.a ${DEP_DIR}/lib/libgrpc++_reflection.a ${DEP_DIR}/lib/libgrpcpp_channelz.a ${DEP_DIR}/lib/libgrpc++_error_details.a ${DEP_DIR}/lib/libgrpc_cronet.a ${DEP_DIR}/lib/libgrpc++_cronet.a ${DEP_DIR}/lib/libgpr.a ${DEP_DIR}/lib/libaddress_sorting.a ${DEP_DIR}/lib/libcares.a ${DEP_DIR}/lib64/libprometheus-cpp-pull.a ${DEP_DIR}/lib64/libprometheus-cpp-core.a ${RUNTIME_DIR}/lib/libob_sql_proxy_parser_static.a ${DEP_DIR}/lib/libssl.a ${DEP_DIR}/lib/libcrypto.a -lpthread ${DEP_DIR}/lib/libcurl.a ${DEP_DIR}/lib/libcrypto.a
obproxy_obproxy_LDFLAGS :=${AM_LDFLAGS} -lpthread -lc -lm -lrt -ldl -L${DEP_DIR}/lib

obproxy_obproxy_LDADD := ${obproxy_obproxy_LDADD_BASE}

EXTRA_DIST += obproxy/proxy/plugins
