Makefile.am 6.11 KB
Newer Older
1
2
3
SUBDIRS = .

AM_CPPFLAGS  = -I$(top_builddir)/src/lib -I$(top_srcdir)/src/lib
Francis Dupont's avatar
Francis Dupont committed
4
AM_CPPFLAGS += $(BOOST_INCLUDES)
5

6
AM_CXXFLAGS  = $(KEA_CXXFLAGS)
7

8
# Kea libraries against which the test user libraries are linked.
9
10
11
HOOKS_LIB      = $(top_builddir)/src/lib/hooks/libkea-hooks.la
LOG_LIB        = $(top_builddir)/src/lib/log/libkea-log.la
THREADS_LIB    = $(top_builddir)/src/lib/util/threads/libkea-threads.la
12
13
UTIL_LIB       = $(top_builddir)/src/lib/util/libkea-util.la
EXCEPTIONS_LIB = $(top_builddir)/src/lib/exceptions/libkea-exceptions.la
14

15
ALL_LIBS       = $(HOOKS_LIB) $(LOG_LIB) $(THREADS_LIB) $(UTIL_LIB) $(EXCEPTIONS_LIB) $(LOG4CPLUS_LIBS)
16

17
18
# Files to clean include the file created by testing.
CLEANFILES = *.gcno *.gcda $(builddir)/marker_file.dat
19

20
21
22
# Files generated by configure
DISTCLEANFILES = marker_file.h test_libraries.h

23
24
25
TESTS_ENVIRONMENT = \
	$(LIBTOOL) --mode=execute $(VALGRIND_COMMAND)

Stephen Morris's avatar
Stephen Morris committed
26
27
TESTS =
if HAVE_GTEST
28
29
30
31
32
# 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.
33
#
34
35
36
37
38
39
40
41
# 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.

42
noinst_LTLIBRARIES = libnvl.la  libivl.la libfxl.la libbcl.la liblcl.la \
43
                     liblecl.la libucl.la libfcl.la libpcl.la
44

45
46
47
# -rpath /nowhere is a hack to trigger libtool to not create a
# convenience archive, resulting in shared modules

48
# No version function
49
50
libnvl_la_SOURCES  = no_version_library.cc
libnvl_la_CXXFLAGS = $(AM_CXXFLAGS)
51
libnvl_la_CPPFLAGS = $(AM_CPPFLAGS)
52
libnvl_la_LDFLAGS  = -avoid-version -export-dynamic -module -rpath /nowhere
53

54
# Incorrect version function
55
56
libivl_la_SOURCES  = incorrect_version_library.cc
libivl_la_CXXFLAGS = $(AM_CXXFLAGS)
57
libivl_la_CPPFLAGS = $(AM_CPPFLAGS)
58
libivl_la_LDFLAGS  = -avoid-version -export-dynamic -module -rpath /nowhere
59
60

# All framework functions throw an exception
61
libfxl_la_SOURCES  = framework_exception_library.cc
62
libfxl_la_CXXFLAGS = $(AM_CXXFLAGS)
63
libfxl_la_CPPFLAGS = $(AM_CPPFLAGS)
64
libfxl_la_LDFLAGS  = -avoid-version -export-dynamic -module -rpath /nowhere
65

66
67
68
# The basic callout library - contains standard callouts
libbcl_la_SOURCES  = basic_callout_library.cc
libbcl_la_CXXFLAGS = $(AM_CXXFLAGS)
69
libbcl_la_CPPFLAGS = $(AM_CPPFLAGS)
70
libbcl_la_LDFLAGS  = -avoid-version -export-dynamic -module -rpath /nowhere
71

72
73
74
# The load callout library - contains a load function
liblcl_la_SOURCES  = load_callout_library.cc
liblcl_la_CXXFLAGS = $(AM_CXXFLAGS)
75
liblcl_la_CPPFLAGS = $(AM_CPPFLAGS)
76
liblcl_la_LDFLAGS  = -avoid-version -export-dynamic -module -rpath /nowhere
77
78
79
80
81

# The load error callout library - contains a load function that returns
# an error.
liblecl_la_SOURCES  = load_error_callout_library.cc
liblecl_la_CXXFLAGS = $(AM_CXXFLAGS)
82
liblecl_la_CPPFLAGS = $(AM_CPPFLAGS)
83
liblecl_la_LDFLAGS  = -avoid-version -export-dynamic -module -rpath /nowhere
84

Stephen Morris's avatar
Stephen Morris committed
85
86
87
88
# The unload callout library - contains an unload function that
# creates a marker file.
libucl_la_SOURCES  = unload_callout_library.cc
libucl_la_CXXFLAGS = $(AM_CXXFLAGS)
89
libucl_la_CPPFLAGS = $(AM_CPPFLAGS)
90
libucl_la_LDFLAGS  = -avoid-version -export-dynamic -module -rpath /nowhere
Stephen Morris's avatar
Stephen Morris committed
91

92
93
94
# The full callout library - contains all three framework functions.
libfcl_la_SOURCES  = full_callout_library.cc
libfcl_la_CXXFLAGS = $(AM_CXXFLAGS)
95
libfcl_la_CPPFLAGS = $(AM_CPPFLAGS)
96
libfcl_la_LDFLAGS  = -avoid-version -export-dynamic -module -rpath /nowhere
97

98
99
100
101
102
103
104
# The parameters checking callout library - expects
libpcl_la_SOURCES  = callout_params_library.cc
libpcl_la_CXXFLAGS = $(AM_CXXFLAGS)
libpcl_la_CPPFLAGS = $(AM_CPPFLAGS)
libpcl_la_LDFLAGS  = -avoid-version -export-dynamic -module -rpath /nowhere
libpcl_la_LDFLAGS += $(top_builddir)/src/lib/util/libkea-util.la

105
106
107
108
TESTS += run_unittests
run_unittests_SOURCES  = run_unittests.cc
run_unittests_SOURCES += callout_handle_unittest.cc
run_unittests_SOURCES += callout_manager_unittest.cc
109
run_unittests_SOURCES += common_test_class.h
110
run_unittests_SOURCES += handles_unittest.cc
111
run_unittests_SOURCES += hooks_manager_unittest.cc
112
run_unittests_SOURCES += library_manager_collection_unittest.cc
113
run_unittests_SOURCES += library_manager_unittest.cc
114
115
run_unittests_SOURCES += server_hooks_unittest.cc

116
117
118
nodist_run_unittests_SOURCES  = marker_file.h
nodist_run_unittests_SOURCES += test_libraries.h

119
120
121
run_unittests_CXXFLAGS  = $(AM_CXXFLAGS)
run_unittests_CPPFLAGS  = $(AM_CPPFLAGS) $(GTEST_INCLUDES)
run_unittests_LDFLAGS   = $(AM_LDFLAGS)  $(GTEST_LDFLAGS)
122
if USE_STATIC_LINK
Francis Dupont's avatar
Francis Dupont committed
123
run_unittests_LDFLAGS  += -static -export-dynamic
124
endif
125

126
127
128
run_unittests_LDADD     = $(AM_LDADD)
run_unittests_LDADD    += $(ALL_LIBS)
run_unittests_LDADD    += $(top_builddir)/src/lib/util/unittests/libutil_unittests.la
129
run_unittests_LDADD    += $(top_builddir)/src/lib/cc/libkea-cc.la
130
run_unittests_LDADD    += $(GTEST_LDADD) $(LOG4CPLUS_LIBS) $(BOOST_LIBS)
131
132
133
134
135
136
137
138
139
140
# As noted in configure.ac, libtool doesn't work perfectly with Darwin: it
# embeds the final install path in dynamic libraries and loadable modules refer
# to that path even if its loaded within the source tree, so preventing tests
# from working - but only when linking statically.  The solution used in other
# Makefiles (setting the path to the dynamic libraries via an environment
# variable) don't seem to work.  What does work is to run the unit test using
# libtool and specifying paths via -dlopen switches.  So... If running in an
# environment where we have to set the library path AND if linking statically,
# override the "check" target and run the unit tests ourselves.

141
142
143
endif

noinst_PROGRAMS = $(TESTS)
Stephen Morris's avatar
Stephen Morris committed
144

145
EXTRA_DIST = marker_file.h.in test_libraries.h.in