# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0.  If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
# Copyright 1997 - July 2008 CWI, August 2008 - 2016 MonetDB B.V.

INCLUDES = ../../include ../../common ../../storage ../../server \
		   ../../../mal/modules/atoms \
		   ../../../mal/modules/kernel \
		   ../../../mal/mal \
		   ../../../mal/modules/mal \
		   ../../../mal/optimizer \
		   ../../../mal/scheduler \
		   ../../../mal/extras/rapi \
		   ../../../common/options \
		   ../../../common/stream \
		   ../../../common/utils \
		   ../../../gdk

lib__sql = {
	MODULE
	DIR = libdir/monetdb5
	SOURCES = \
		sql.c sql.h \
		mal_backend.c mal_backend.h \
		sql_user.c sql_user.h \
		sql_scenario.c sql_scenario.h \
		sql_execute.c sql_execute.h \
		sql_assert.c sql_assert.h \
		sql_upgrades.c sql_upgrades.h \
		rel_bin.c rel_bin.h \
		sql_statement.c sql_statement.h \
		sql_statistics.c sql_statistics.h \
		sql_gencode.c sql_gencode.h \
		sql_optimizer.c sql_optimizer.h \
		sql_result.c sql_result.h \
		sql_cast.c sql_cast.h \
		sql_cast_impl_down_from_flt.h \
		sql_cast_impl_down_from_int.h \
		sql_cast_impl_up_to_flt.h \
		sql_cast_impl_up_to_int.h \
		sql_round.c sql_round_impl.h sql_bat2time.c \
		sql_fround.c sql_fround_impl.h \
		sql_orderidx.c sql_orderidx.h \
		sql_rank.c sql_rank.h
	LIBS = ../../server/libsqlserver \
		   ../../storage/libstore \
		   ../../storage/bat/libbatstore \
		   ../../common/libsqlcommon \
 		   ../../../mal/tools/libmonetdb5 \
		   ../../../gdk/libbat \
		   ../../../common/stream/libstream \
		   ../../../common/utils/libmcrypt \
		   $(PTHREAD_LIBS) \
		   $(openssl_LIBS) $(MATH_LIBS)
}

headers_mal = {
	HEADERS = mal
	DIR = libdir/monetdb5
	SOURCES = sql_aggr_bte.mal  sql_aggr_flt.mal sql_aggr_dbl.mal  sql_aggr_int.mal  sql_aggr_lng.mal \
		sql_aggr_sht.mal  sql_decimal.mal  sql_inspect.mal \
		sql_rank.mal sql.mal
}

headers_mal_hge = {
	COND = HAVE_HGE
	HEADERS = mal
	DIR = libdir/monetdb5
	SOURCES = sql_hge.mal sql_aggr_hge.mal sql_decimal_hge.mal
}

headers_autoload = {
	HEADERS = mal
	DIR = libdir/monetdb5/autoload
	SOURCES = 40_sql.mal
}

headers_autoload_hge = {
	COND = HAVE_HGE
	HEADERS = mal
	DIR = libdir/monetdb5/autoload
	SOURCES = 41_sql_hge.mal
}

EXTRA_DIST = 40_sql.mal \
	41_sql_hge.mal sql_hge.mal sql_aggr_hge.mal sql_decimal_hge.mal \
	sql_aggr_bte.mal  sql_aggr_flt.mal  sql_aggr_int.mal  sql_aggr_lng.mal \
	sql_aggr_sht.mal  sql_decimal.mal  sql_inspect.mal \
	sql_rank.mal sql.mal 

EXTRA_DIST_DIR = Tests
