Makefile.am 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. SUBDIRS = .
  2. AM_CPPFLAGS = -I$(top_builddir)/src/lib -I$(top_srcdir)/src/lib
  3. AM_CPPFLAGS += $(BOOST_INCLUDES)
  4. AM_CXXFLAGS = $(KEA_CXXFLAGS)
  5. # Kea libraries against which the test user libraries are linked.
  6. HOOKS_LIB = $(top_builddir)/src/lib/hooks/libkea-hooks.la
  7. LOG_LIB = $(top_builddir)/src/lib/log/libkea-log.la
  8. THREADS_LIB = $(top_builddir)/src/lib/util/threads/libkea-threads.la
  9. UTIL_LIB = $(top_builddir)/src/lib/util/libkea-util.la
  10. EXCEPTIONS_LIB = $(top_builddir)/src/lib/exceptions/libkea-exceptions.la
  11. ALL_LIBS = $(HOOKS_LIB) $(LOG_LIB) $(THREADS_LIB) $(UTIL_LIB) $(EXCEPTIONS_LIB) $(LOG4CPLUS_LIBS)
  12. # Files to clean include the file created by testing.
  13. CLEANFILES = *.gcno *.gcda $(builddir)/marker_file.dat
  14. # Files generated by configure
  15. DISTCLEANFILES = marker_file.h test_libraries.h
  16. TESTS_ENVIRONMENT = \
  17. $(LIBTOOL) --mode=execute $(VALGRIND_COMMAND)
  18. TESTS =
  19. if HAVE_GTEST
  20. # Build shared libraries for testing. The libtool way to create a shared library
  21. # is to specify "-avoid-version -export-dynamic -module" in the library LDFLAGS
  22. # (see http://www.gnu.org/software/libtool/manual/html_node/Link-mode.html).
  23. # Use of these switches will guarantee that the .so files are created in the
  24. # .libs folder and they can be dlopened.
  25. #
  26. # Note that the shared libraries with callouts should not be used together with
  27. # the --enable-static-link option. With this option, the bind10 libraries are
  28. # statically linked with the program and if the callout invokes the methods
  29. # which belong to these libraries, the library with the callout will get its
  30. # own copy of the static objects (e.g. logger, ServerHooks) and that will lead
  31. # to unexpected errors. For this reason, the --enable-static-link option is
  32. # ignored for unit tests built here.
  33. noinst_LTLIBRARIES = libnvl.la libivl.la libfxl.la libbcl.la liblcl.la \
  34. liblecl.la libucl.la libfcl.la libpcl.la
  35. # -rpath /nowhere is a hack to trigger libtool to not create a
  36. # convenience archive, resulting in shared modules
  37. # No version function
  38. libnvl_la_SOURCES = no_version_library.cc
  39. libnvl_la_CXXFLAGS = $(AM_CXXFLAGS)
  40. libnvl_la_CPPFLAGS = $(AM_CPPFLAGS)
  41. libnvl_la_LDFLAGS = -avoid-version -export-dynamic -module -rpath /nowhere
  42. # Incorrect version function
  43. libivl_la_SOURCES = incorrect_version_library.cc
  44. libivl_la_CXXFLAGS = $(AM_CXXFLAGS)
  45. libivl_la_CPPFLAGS = $(AM_CPPFLAGS)
  46. libivl_la_LDFLAGS = -avoid-version -export-dynamic -module -rpath /nowhere
  47. # All framework functions throw an exception
  48. libfxl_la_SOURCES = framework_exception_library.cc
  49. libfxl_la_CXXFLAGS = $(AM_CXXFLAGS)
  50. libfxl_la_CPPFLAGS = $(AM_CPPFLAGS)
  51. libfxl_la_LDFLAGS = -avoid-version -export-dynamic -module -rpath /nowhere
  52. # The basic callout library - contains standard callouts
  53. libbcl_la_SOURCES = basic_callout_library.cc
  54. libbcl_la_CXXFLAGS = $(AM_CXXFLAGS)
  55. libbcl_la_CPPFLAGS = $(AM_CPPFLAGS)
  56. libbcl_la_LDFLAGS = -avoid-version -export-dynamic -module -rpath /nowhere
  57. # The load callout library - contains a load function
  58. liblcl_la_SOURCES = load_callout_library.cc
  59. liblcl_la_CXXFLAGS = $(AM_CXXFLAGS)
  60. liblcl_la_CPPFLAGS = $(AM_CPPFLAGS)
  61. liblcl_la_LDFLAGS = -avoid-version -export-dynamic -module -rpath /nowhere
  62. # The load error callout library - contains a load function that returns
  63. # an error.
  64. liblecl_la_SOURCES = load_error_callout_library.cc
  65. liblecl_la_CXXFLAGS = $(AM_CXXFLAGS)
  66. liblecl_la_CPPFLAGS = $(AM_CPPFLAGS)
  67. liblecl_la_LDFLAGS = -avoid-version -export-dynamic -module -rpath /nowhere
  68. # The unload callout library - contains an unload function that
  69. # creates a marker file.
  70. libucl_la_SOURCES = unload_callout_library.cc
  71. libucl_la_CXXFLAGS = $(AM_CXXFLAGS)
  72. libucl_la_CPPFLAGS = $(AM_CPPFLAGS)
  73. libucl_la_LDFLAGS = -avoid-version -export-dynamic -module -rpath /nowhere
  74. # The full callout library - contains all three framework functions.
  75. libfcl_la_SOURCES = full_callout_library.cc
  76. libfcl_la_CXXFLAGS = $(AM_CXXFLAGS)
  77. libfcl_la_CPPFLAGS = $(AM_CPPFLAGS)
  78. libfcl_la_LDFLAGS = -avoid-version -export-dynamic -module -rpath /nowhere
  79. # The parameters checking callout library - expects
  80. libpcl_la_SOURCES = callout_params_library.cc
  81. libpcl_la_CXXFLAGS = $(AM_CXXFLAGS)
  82. libpcl_la_CPPFLAGS = $(AM_CPPFLAGS)
  83. libpcl_la_LDFLAGS = -avoid-version -export-dynamic -module -rpath /nowhere
  84. libpcl_la_LDFLAGS += $(top_builddir)/src/lib/util/libkea-util.la
  85. TESTS += run_unittests
  86. run_unittests_SOURCES = run_unittests.cc
  87. run_unittests_SOURCES += callout_handle_unittest.cc
  88. run_unittests_SOURCES += callout_manager_unittest.cc
  89. run_unittests_SOURCES += common_test_class.h
  90. run_unittests_SOURCES += handles_unittest.cc
  91. run_unittests_SOURCES += hooks_manager_unittest.cc
  92. run_unittests_SOURCES += library_manager_collection_unittest.cc
  93. run_unittests_SOURCES += library_manager_unittest.cc
  94. run_unittests_SOURCES += server_hooks_unittest.cc
  95. nodist_run_unittests_SOURCES = marker_file.h
  96. nodist_run_unittests_SOURCES += test_libraries.h
  97. run_unittests_CXXFLAGS = $(AM_CXXFLAGS)
  98. run_unittests_CPPFLAGS = $(AM_CPPFLAGS) $(GTEST_INCLUDES)
  99. run_unittests_LDFLAGS = $(AM_LDFLAGS) $(GTEST_LDFLAGS)
  100. if USE_STATIC_LINK
  101. run_unittests_LDFLAGS += -static -export-dynamic
  102. endif
  103. run_unittests_LDADD = $(AM_LDADD)
  104. run_unittests_LDADD += $(ALL_LIBS)
  105. run_unittests_LDADD += $(top_builddir)/src/lib/util/unittests/libutil_unittests.la
  106. run_unittests_LDADD += $(top_builddir)/src/lib/cc/libkea-cc.la
  107. run_unittests_LDADD += $(GTEST_LDADD)
  108. # As noted in configure.ac, libtool doesn't work perfectly with Darwin: it
  109. # embeds the final install path in dynamic libraries and loadable modules refer
  110. # to that path even if its loaded within the source tree, so preventing tests
  111. # from working - but only when linking statically. The solution used in other
  112. # Makefiles (setting the path to the dynamic libraries via an environment
  113. # variable) don't seem to work. What does work is to run the unit test using
  114. # libtool and specifying paths via -dlopen switches. So... If running in an
  115. # environment where we have to set the library path AND if linking statically,
  116. # override the "check" target and run the unit tests ourselves.
  117. endif
  118. noinst_PROGRAMS = $(TESTS)
  119. EXTRA_DIST = marker_file.h.in test_libraries.h.in