1SUBDIRS		=	. unittests
2AM_CPPFLAGS	=	-I$(top_srcdir)/include $(ODBC_INC)
3
4lib_LTLIBRARIES	=	libtdsodbc.la
5##EXTRA_LTLIBRARIES	=	libtdsodbc.la
6libtdsodbc_la_SOURCES =	odbc.c connectparams.c convert_tds2sql.c \
7	descriptor.c prepare_query.c odbc_util.c bcp.c \
8	native.c sql2tds.c error.c odbc_checks.c sqlwchar.c sqlwparams.h \
9	odbc_export.h error_export.h odbc_data.c
10# -module is needed by Darwin (Mac OS X)
11libtdsodbc_la_LDFLAGS = \
12	$(ODBCINST_LDFLAGS) $(LTLIBICONV) $(FREETDS_LIBGCC) \
13	$(FREETDS_SYMBOLIC) $(FREETDS_ODBC_MODULE)
14libtdsodbc_la_LIBADD =	../tds/libtds.la ../replacements/libreplacements.la
15
16if MINGW32
17libtdsodbc_la_SOURCES += winlogin.c winsetup.c winmain.c
18endif
19
20if MINGW32
21libtdsodbc_la_LIBADD +=	setup.res
22libtdsodbc_la_LDFLAGS += -Wl,--kill-at -Wl,--enable-stdcall-fixup -Wl,-s -Wl,@srcdir@/odbc_w.def -Wl,setup.res
23
24.rc.res:
25	$(RC) -i $< --input-format=rc -o $@ -O coff
26else
27if !MACOSX
28libtdsodbc_la_LDFLAGS += -export-symbols-regex '^(SQL|ODBCINST).*'
29endif
30endif
31
32EXTRA_DIST = CMakeLists.txt winmain.c winlogin.c winsetup.c \
33	     version.rc version.rc.in setup.rc resource.h \
34	     odbc.def odbc_w.def
35CLEANFILES = setup.res
36
37## Need blank statement to avoid compiling odbc.c
38odbc: $(EXTRA_LTLIBRARIES)
39	@echo ''
40
41if HAVE_PERL_SOURCES
42BUILT_SOURCES = odbc_export.h error_export.h
43
44clean-local:
45	cd $(srcdir) && rm -f $(BUILT_SOURCES)
46
47odbc_export.h: odbc_export.pl Makefile odbc.c
48	perl $(srcdir)/odbc_export.pl $(srcdir)/odbc.c > $@.tmp
49	mv $@.tmp $@
50
51error_export.h: odbc_export.pl Makefile error.c
52	perl $(srcdir)/odbc_export.pl $(srcdir)/error.c > $@.tmp
53	mv $@.tmp $@
54
55endif
56