Makefile.am 5.6 KB
Newer Older
1 2 3 4
SUBDIRS = .

AM_CPPFLAGS = -I$(top_builddir)/src/lib -I$(top_srcdir)/src/lib
AM_CPPFLAGS += $(BOOST_INCLUDES)
5 6
AM_CPPFLAGS += -DTEST_DATA_BUILDDIR=\"$(abs_top_builddir)/src/lib/dhcpsrv/tests\"
AM_CPPFLAGS += -DDHCP_DATA_DIR=\"$(abs_top_builddir)/src/lib/dhcpsrv/tests\"
7 8
AM_CPPFLAGS += -DINSTALL_PROG=\"$(abs_top_srcdir)/install-sh\"

9
AM_CXXFLAGS = $(KEA_CXXFLAGS)
10 11 12 13 14 15 16 17 18 19 20 21 22 23

# Some versions of GCC warn about some versions of Boost regarding
# missing initializer for members in its posix_time.
# https://svn.boost.org/trac/boost/ticket/3477
# But older GCC compilers don't have the flag.
AM_CXXFLAGS += $(WARNING_NO_MISSING_FIELD_INITIALIZERS_CFLAG)

CLEANFILES = *.gcno *.gcda

TESTS_ENVIRONMENT = \
	$(LIBTOOL) --mode=execute $(VALGRIND_COMMAND)

TESTS =
if HAVE_GTEST
24 25 26 27 28 29 30 31 32 33 34 35 36
# Build shared libraries for testing. The libtool way to create a shared library
# is to specify "-avoid-version -export-dynamic -module" in the library LDFLAGS
# (see http://www.gnu.org/software/libtool/manual/html_node/Link-mode.html).
# Use of these switches will guarantee that the .so files are created in the
# .libs folder and they can be dlopened.
# Note that the shared libraries with callouts should not be used together with
# the --enable-static-link option. With this option, the bind10 libraries are
# statically linked with the program and if the callout invokes the methods
# which belong to these libraries, the library with the callout will get its
# own copy of the static objects (e.g. logger, ServerHooks) and that will lead
# to unexpected errors. For this reason, the --enable-static-link option is
# ignored for unit tests built here.

37 38 39 40
noinst_LTLIBRARIES = libco1.la libco2.la

# -rpath /nowhere is a hack to trigger libtool to not create a
# convenience archive, resulting in shared modules
41 42 43 44

libco1_la_SOURCES  = callout_library.cc
libco1_la_CXXFLAGS = $(AM_CXXFLAGS)
libco1_la_CPPFLAGS = $(AM_CPPFLAGS) $(LOG4CPLUS_INCLUDES)
45
libco1_la_LDFLAGS = -avoid-version -export-dynamic -module -rpath /nowhere
46 47 48 49

libco2_la_SOURCES  = callout_library.cc
libco2_la_CXXFLAGS = $(AM_CXXFLAGS)
libco2_la_CPPFLAGS = $(AM_CPPFLAGS) $(LOG4CPLUS_INCLUDES)
50
libco2_la_LDFLAGS = -avoid-version -export-dynamic -module -rpath /nowhere
51

52 53 54 55 56
TESTS += libdhcpsrv_unittests

libdhcpsrv_unittests_SOURCES  = run_unittests.cc
libdhcpsrv_unittests_SOURCES += addr_utilities_unittest.cc
libdhcpsrv_unittests_SOURCES += alloc_engine_unittest.cc
57
libdhcpsrv_unittests_SOURCES += callout_handle_store_unittest.cc
58
libdhcpsrv_unittests_SOURCES += configuration_unittest.cc
59
libdhcpsrv_unittests_SOURCES += cfgmgr_unittest.cc
60
libdhcpsrv_unittests_SOURCES += csv_lease_file4_unittest.cc
61
libdhcpsrv_unittests_SOURCES += csv_lease_file6_unittest.cc
62
libdhcpsrv_unittests_SOURCES += d2_client_unittest.cc
63
libdhcpsrv_unittests_SOURCES += d2_udp_unittest.cc
64
libdhcpsrv_unittests_SOURCES += daemon_unittest.cc
65
libdhcpsrv_unittests_SOURCES += dbaccess_parser_unittest.cc
66
libdhcpsrv_unittests_SOURCES += cfg_iface_unittest.cc
67
libdhcpsrv_unittests_SOURCES += lease_file_io.cc lease_file_io.h
68
libdhcpsrv_unittests_SOURCES += lease_unittest.cc
69 70
libdhcpsrv_unittests_SOURCES += lease_mgr_factory_unittest.cc
libdhcpsrv_unittests_SOURCES += lease_mgr_unittest.cc
71
libdhcpsrv_unittests_SOURCES += logging_unittest.cc
72
libdhcpsrv_unittests_SOURCES += logging_info_unittest.cc
73
libdhcpsrv_unittests_SOURCES += generic_lease_mgr_unittest.cc generic_lease_mgr_unittest.h
74
libdhcpsrv_unittests_SOURCES += memfile_lease_mgr_unittest.cc
75
libdhcpsrv_unittests_SOURCES += dhcp_parsers_unittest.cc
76 77 78
if HAVE_MYSQL
libdhcpsrv_unittests_SOURCES += mysql_lease_mgr_unittest.cc
endif
79 80 81
if HAVE_PGSQL
libdhcpsrv_unittests_SOURCES += pgsql_lease_mgr_unittest.cc
endif
82
libdhcpsrv_unittests_SOURCES += pool_unittest.cc
83 84
libdhcpsrv_unittests_SOURCES += schema_mysql_copy.h
libdhcpsrv_unittests_SOURCES += schema_pgsql_copy.h
85
libdhcpsrv_unittests_SOURCES += subnet_unittest.cc
86
libdhcpsrv_unittests_SOURCES += test_get_callout_handle.cc test_get_callout_handle.h
87
libdhcpsrv_unittests_SOURCES += triplet_unittest.cc
Tomek Mrugalski's avatar
Tomek Mrugalski committed
88
libdhcpsrv_unittests_SOURCES += test_utils.cc test_utils.h
89 90 91 92 93

libdhcpsrv_unittests_CPPFLAGS = $(AM_CPPFLAGS) $(GTEST_INCLUDES) $(LOG4CPLUS_INCLUDES)
if HAVE_MYSQL
libdhcpsrv_unittests_CPPFLAGS += $(MYSQL_CPPFLAGS)
endif
94 95 96
if HAVE_PGSQL
libdhcpsrv_unittests_CPPFLAGS += $(PGSQL_CPPFLAGS)
endif
97 98 99 100 101

libdhcpsrv_unittests_LDFLAGS  = $(AM_LDFLAGS)  $(GTEST_LDFLAGS)
if HAVE_MYSQL
libdhcpsrv_unittests_LDFLAGS  += $(MYSQL_LIBS)
endif
102 103 104
if HAVE_PGSQL
libdhcpsrv_unittests_LDFLAGS  += $(PGSQL_LIBS)
endif
105 106 107 108 109 110 111 112 113

libdhcpsrv_unittests_CXXFLAGS = $(AM_CXXFLAGS)
if USE_CLANGPP
# This is to workaround unused variables tcout and tcerr in
# log4cplus's streams.h and unused parameters from some of the
# Boost headers.
libdhcpsrv_unittests_CXXFLAGS += -Wno-unused-variable -Wno-unused-parameter
endif

114
libdhcpsrv_unittests_LDADD  = $(top_builddir)/src/lib/dhcpsrv/libkea-dhcpsrv.la
115
libdhcpsrv_unittests_LDADD += $(top_builddir)/src/lib/dhcpsrv/testutils/libdhcpsrvtest.la
116
libdhcpsrv_unittests_LDADD += $(top_builddir)/src/lib/dhcp/tests/libdhcptest.la
117 118 119 120 121 122 123 124
libdhcpsrv_unittests_LDADD += $(top_builddir)/src/lib/dhcp/libkea-dhcp++.la
libdhcpsrv_unittests_LDADD += $(top_builddir)/src/lib/dhcp_ddns/libkea-dhcp_ddns.la
libdhcpsrv_unittests_LDADD += $(top_builddir)/src/lib/config/libkea-cfgclient.la
libdhcpsrv_unittests_LDADD += $(top_builddir)/src/lib/cc/libkea-cc.la
libdhcpsrv_unittests_LDADD += $(top_builddir)/src/lib/asiolink/libkea-asiolink.la
libdhcpsrv_unittests_LDADD += $(top_builddir)/src/lib/hooks/libkea-hooks.la
libdhcpsrv_unittests_LDADD += $(top_builddir)/src/lib/log/libkea-log.la
libdhcpsrv_unittests_LDADD += $(top_builddir)/src/lib/exceptions/libkea-exceptions.la
125 126 127 128
libdhcpsrv_unittests_LDADD += $(GTEST_LDADD)
endif

noinst_PROGRAMS = $(TESTS)