noinst_LTLIBRARIES = libsql.la libdriver_test.la SQL_DRIVER_PLUGINS = # automake seems to force making this unconditional.. NOPLUGIN_LDFLAGS = if SQL_PLUGINS if BUILD_MYSQL MYSQL_LIB = libdriver_mysql.la SQL_DRIVER_PLUGINS += mysql endif if BUILD_PGSQL PGSQL_LIB = libdriver_pgsql.la SQL_DRIVER_PLUGINS += pgsql endif if BUILD_SQLITE SQLITE_LIB = libdriver_sqlite.la SQL_DRIVER_PLUGINS += sqlite endif if BUILD_CASSANDRA CASSANDRA_LIB = libdriver_cassandra.la SQL_DRIVER_PLUGINS += cassandra endif sql_module_LTLIBRARIES = \ $(MYSQL_LIB) \ $(PGSQL_LIB) \ $(SQLITE_LIB) \ $(CASSANDRA_LIB) sql_moduledir = $(moduledir) endif sql_drivers = @sql_drivers@ AM_CPPFLAGS = \ -I$(top_srcdir)/src/lib \ -I$(top_srcdir)/src/lib-settings \ $(SQL_CFLAGS) dist_sources = \ sql-api.c \ sql-db-cache.c if ! SQL_PLUGINS driver_sources = \ driver-mysql.c \ driver-pgsql.c \ driver-sqlite.c \ driver-cassandra.c endif libsql_la_SOURCES = \ $(dist_sources) \ $(driver_sources) \ driver-sqlpool.c libsql_la_LIBADD = $(SQL_LIBS) nodist_libsql_la_SOURCES = sql-drivers-register.c deplibs = \ ../lib-dovecot/libdovecot.la if SQL_PLUGINS libdriver_mysql_la_LDFLAGS = -module -avoid-version libdriver_mysql_la_LIBADD = $(MYSQL_LIBS) libdriver_mysql_la_CPPFLAGS = $(AM_CPPFLAGS) $(MYSQL_CFLAGS) libdriver_mysql_la_SOURCES = driver-mysql.c libdriver_pgsql_la_LDFLAGS = -module -avoid-version libdriver_pgsql_la_LIBADD = $(PGSQL_LIBS) libdriver_pgsql_la_CPPFLAGS = $(AM_CPPFLAGS) $(PGSQL_CFLAGS) libdriver_pgsql_la_SOURCES = driver-pgsql.c libdriver_sqlite_la_LDFLAGS = -module -avoid-version libdriver_sqlite_la_LIBADD = $(SQLITE_LIBS) libdriver_sqlite_la_CPPFLAGS = $(AM_CPPFLAGS) $(SQLITE_CFLAGS) libdriver_sqlite_la_SOURCES = driver-sqlite.c libdriver_cassandra_la_LDFLAGS = -module -avoid-version libdriver_cassandra_la_LIBADD = $(CASSANDRA_LIBS) libdriver_cassandra_la_CPPFLAGS = $(AM_CPPFLAGS) $(CASSANDRA_CFLAGS) libdriver_cassandra_la_SOURCES = driver-cassandra.c else endif libdriver_test_la_LDFLAGS = -avoid-version libdriver_test_la_CPPFLAGS = $(AM_CPPFLAGS) \ -I$(top_srcdir)/src/lib-test libdriver_test_la_SOURCES = driver-test.c noinst_HEADERS = driver-test.h pkglib_LTLIBRARIES = libdovecot-sql.la libdovecot_sql_la_SOURCES = libdovecot_sql_la_LIBADD = libsql.la $(deplibs) libdovecot_sql_la_DEPENDENCIES = libsql.la libdovecot_sql_la_LDFLAGS = -export-dynamic headers = \ sql-api.h \ sql-api-private.h \ sql-db-cache.h pkginc_libdir=$(pkgincludedir) pkginc_lib_HEADERS = $(headers) sql-drivers-register.c: Makefile rm -f $@ echo '/* this file automatically generated by Makefile */' >$@ echo '#include "lib.h"' >>$@ echo '#include "sql-api.h"' >>$@ if ! SQL_PLUGINS for i in $(sql_drivers) null; do \ if [ "$${i}" != "null" ]; then \ echo "extern struct sql_db driver_$${i}_db;" >>$@ ; \ fi; \ done endif echo 'void sql_drivers_register_all(void) {' >>$@ if ! SQL_PLUGINS for i in $(sql_drivers) null; do \ if [ "$${i}" != "null" ]; then \ echo "sql_driver_register(&driver_$${i}_db);" >>$@ ; \ fi; \ done endif echo '}' >>$@ if SQL_PLUGINS install-exec-local: for d in auth dict; do \ $(mkdir_p) $(DESTDIR)$(moduledir)/$$d; \ for driver in $(SQL_DRIVER_PLUGINS); do \ rm -f $(DESTDIR)$(moduledir)/$$d/libdriver_$$driver.so; \ $(LN_S) ../libdriver_$$driver.so $(DESTDIR)$(moduledir)/$$d; \ done; \ done endif distclean-generic: rm -f Makefile sql-drivers-register.c