# Makefile template for SQLite ODBC Driver

prefix =	$(DESTDIR)@prefix@
exec_prefix =	@exec_prefix@
libdir =	@libdir@/odbc
CC =		@CC@
INSTALL =	@INSTALL@
LIBTOOL =	./libtool
CFLAGS=		@CFLAGS@ -DDRIVER_VER_INFO=\"@VER_INFO@\"
SQLITE_INC =	@SQLITE_INC@
SQLITE_LIB =	@SQLITE_LIB@
SQLITE_FLAGS =	-DHAVE_LIBVERSION=@SQLITE_LIBVERSION@ \
		-DHAVE_ENCDEC=@SQLITE_ENCDEC@ \
		-DHAVE_SQLITEATOF=@SQLITE_ATOF@ \
		-DHAVE_SQLITEMPRINTF=@SQLITE_MPRINTF@ \
		-DHAVE_SQLITETRACE=@SQLITE_TRACE@
SQLITE3_INC =	@SQLITE3_INC@
SQLITE3_LIB =	@SQLITE3_LIB@
SQLITE3_FLAGS = -DHAVE_SQLITE3COLUMNTABLENAME=@SQLITE3_COLUMNTABLENAME@
ODBC_FLAGS =	@ODBC_FLAGS@
ODBC_LIB =	@ODBC_LIB@
VER_INFO =	@VER_INFO@

all:		@LIB_TARGETS@

libsqliteodbc.la:	sqliteodbc.lo
		$(LIBTOOL) $(CC) $(CFLAGS) -o libsqliteodbc.la \
		    sqliteodbc.lo -rpath $(libdir) $(SQLITE_LIB) \
		    $(ODBC_LIB) -release $(VER_INFO)

libsqlite3odbc.la:	sqlite3odbc.lo
		$(LIBTOOL) $(CC) $(CFLAGS) -o libsqlite3odbc.la \
		    sqlite3odbc.lo -rpath $(libdir) $(SQLITE3_LIB) \
		    $(ODBC_LIB) -release $(VER_INFO)

sqliteodbc.lo:	sqliteodbc.c sqliteodbc.h
		$(LIBTOOL) $(CC) $(CFLAGS) -c -I$(SQLITE_INC) $(ODBC_FLAGS) \
		    $(SQLITE_FLAGS) sqliteodbc.c

sqlite3odbc.lo:	sqlite3odbc.c sqlite3odbc.h
		$(LIBTOOL) $(CC) $(CFLAGS) -c -I$(SQLITE3_INC) $(ODBC_FLAGS) \
		    $(SQLITE3_FLAGS) sqlite3odbc.c

install-2:	libsqliteodbc.la
		$(LIBTOOL) $(INSTALL) libsqliteodbc.la $(libdir)

drvinst-2:	install-2
		sh drvdsninst.sh SQLITE "SQLite Datasource" \
			libsqliteodbc.la $(libdir)

drvuninst-2:	uninstall-2
		sh drvdsnuninst.sh SQLITE "SQLite Datasource"

uninstall-2:
		$(LIBTOOL) --mode=uninstall \
		    $(RM) $(libdir)/libsqliteodbc.la

install-3:	libsqlite3odbc.la
		$(LIBTOOL) $(INSTALL) libsqlite3odbc.la $(libdir)

uninstall-3:
		$(LIBTOOL) --mode=uninstall \
		    $(RM) $(libdir)/libsqlite3odbc.la

drvinst-3:	install-3
		sh drvdsninst.sh SQLITE3 "SQLite3 Datasource" \
			libsqlite3odbc.la $(libdir)

drvuninst-3:	uninstall-3
		sh drvdsnuninst.sh SQLITE3 "SQLite3 Datasource"

install:	@INST_TARGETS@

uninstall:	@UNINST_TARGETS@

drvinst:	@DRVINST_TARGETS@

drvuninst:	@DRVUNINST_TARGETS@

doxy:
		doxygen doxygen.conf

clean:
		rm -f *.lo *.la *.o libsqliteodbc.la libsqlite3odbc.la *~ core
		rm -rf .libs .deps

distclean:	clean
		rm -f config.status config.log config.cache Makefile
