Makefile.am 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. # need this for Doxygen integration
  2. include $(top_srcdir)/aminclude.am
  3. AUTOMAKE_OPTIONS = serial-tests
  4. if SOLARIS
  5. SOLARIS_CPPFLAGS = -D_POSIX_PTHREAD_SEMANTICS
  6. SOLARIS_LIB_LDFLAGS = -lnsl -lsocket
  7. endif
  8. AM_CPPFLAGS = -I${srcdir}/include -I${srcdir}/tests -I${srcdir}/generated $(SOLARIS_CPPFLAGS)
  9. AM_CFLAGS = -Wall -Werror -Wdeclaration-after-statement
  10. AM_CXXFLAGS = -Wall $(USEIPV6)
  11. # Additional flags for coverage testing (if enabled)
  12. if ENABLEGCOV
  13. AM_CFLAGS += -fprofile-arcs -ftest-coverage
  14. AM_LDFLAGS = -lgcov
  15. endif
  16. LIB_LDFLAGS = -no-undefined -version-info 2 $(SOLARIS_LIB_LDFLAGS)
  17. pkginclude_HEADERS = include/zookeeper.h include/zookeeper_version.h include/zookeeper_log.h include/proto.h include/recordio.h generated/zookeeper.jute.h
  18. EXTRA_DIST=LICENSE
  19. HASHTABLE_SRC = src/hashtable/hashtable_itr.h src/hashtable/hashtable_itr.c \
  20. src/hashtable/hashtable_private.h src/hashtable/hashtable.h src/hashtable/hashtable.c
  21. noinst_LTLIBRARIES = libhashtable.la
  22. libhashtable_la_SOURCES = $(HASHTABLE_SRC)
  23. COMMON_SRC = src/zookeeper.c include/zookeeper.h include/zookeeper_version.h include/zookeeper_log.h\
  24. src/recordio.c include/recordio.h include/proto.h \
  25. src/zk_adaptor.h generated/zookeeper.jute.c \
  26. src/zk_log.c src/zk_hashtable.h src/zk_hashtable.c \
  27. src/addrvec.h src/addrvec.c
  28. # These are the symbols (classes, mostly) we want to export from our library.
  29. EXPORT_SYMBOLS = '(zoo_|zookeeper_|zhandle|Z|format_log_message|log_message|logLevel|deallocate_|allocate_|zerror|is_unrecoverable)'
  30. noinst_LTLIBRARIES += libzkst.la
  31. libzkst_la_SOURCES =$(COMMON_SRC) src/st_adaptor.c
  32. libzkst_la_LIBADD = -lm $(CLOCK_GETTIME_LIBS)
  33. lib_LTLIBRARIES = libzookeeper_st.la
  34. libzookeeper_st_la_SOURCES =
  35. libzookeeper_st_la_LIBADD=libzkst.la libhashtable.la
  36. libzookeeper_st_la_DEPENDENCIES=libzkst.la libhashtable.la
  37. libzookeeper_st_la_LDFLAGS = $(LIB_LDFLAGS) -export-symbols-regex $(EXPORT_SYMBOLS)
  38. if WANT_SYNCAPI
  39. noinst_LTLIBRARIES += libzkmt.la
  40. libzkmt_la_SOURCES =$(COMMON_SRC) src/mt_adaptor.c
  41. libzkmt_la_CFLAGS = -DTHREADED
  42. libzkmt_la_LIBADD = -lm $(CLOCK_GETTIME_LIBS)
  43. lib_LTLIBRARIES += libzookeeper_mt.la
  44. libzookeeper_mt_la_SOURCES =
  45. libzookeeper_mt_la_LIBADD=libzkmt.la libhashtable.la -lpthread
  46. libzookeeper_mt_la_DEPENDENCIES=libzkmt.la libhashtable.la
  47. libzookeeper_mt_la_LDFLAGS = $(LIB_LDFLAGS) -export-symbols-regex $(EXPORT_SYMBOLS)
  48. endif
  49. bin_PROGRAMS = cli_st
  50. cli_st_SOURCES = src/cli.c
  51. cli_st_LDADD = libzookeeper_st.la
  52. if WANT_SYNCAPI
  53. bin_PROGRAMS += cli_mt load_gen
  54. cli_mt_SOURCES = src/cli.c
  55. cli_mt_LDADD = libzookeeper_mt.la
  56. cli_mt_CFLAGS = -DTHREADED
  57. load_gen_SOURCES = src/load_gen.c
  58. load_gen_LDADD = libzookeeper_mt.la
  59. load_gen_CFLAGS = -DTHREADED
  60. endif
  61. #########################################################################
  62. # build and run unit tests
  63. EXTRA_DIST+=$(wildcard ${srcdir}/tests/*.cc) $(wildcard ${srcdir}/tests/*.h) \
  64. ${srcdir}/tests/wrappers.opt ${srcdir}/tests/wrappers-mt.opt
  65. # These tests are ordered in a logical manner such that each builds upon basic
  66. # functionality tested in prior tests. e.g. the most basic functionality is
  67. # tested in TestZookeeperInit and TestZookeeperClose and as such should be tested
  68. # first as a foundation with more complex test suites to follow.
  69. TEST_SOURCES = \
  70. tests/TestDriver.cc \
  71. tests/LibCMocks.cc \
  72. tests/LibCSymTable.cc \
  73. tests/MocksBase.cc \
  74. tests/ZKMocks.cc \
  75. tests/Util.cc \
  76. tests/ThreadingUtil.cc \
  77. tests/TestZookeeperInit.cc \
  78. tests/TestZookeeperClose.cc \
  79. tests/TestReconfig.cc \
  80. tests/TestReconfigServer.cc \
  81. tests/TestClientRetry.cc \
  82. tests/TestOperations.cc \
  83. tests/TestMulti.cc \
  84. tests/TestWatchers.cc \
  85. tests/TestClient.cc \
  86. tests/ZooKeeperQuorumServer.cc \
  87. tests/ZooKeeperQuorumServer.h \
  88. tests/TestReadOnlyClient.cc \
  89. tests/TestLogClientEnv.cc \
  90. $(NULL)
  91. if SOLARIS
  92. SHELL_SYMBOL_WRAPPERS = cat ${srcdir}/tests/wrappers.opt
  93. SYMBOL_WRAPPERS=$(SHELL_SYMBOL_WRAPPERS:sh)
  94. else
  95. SYMBOL_WRAPPERS=$(shell cat ${srcdir}/tests/wrappers.opt)
  96. endif
  97. check_PROGRAMS = zktest-st
  98. TESTS_ENVIRONMENT = ZKROOT=${srcdir}/../.. \
  99. CLASSPATH=$$CLASSPATH:$$CLOVER_HOME/lib/clover*.jar
  100. nodist_zktest_st_SOURCES = $(TEST_SOURCES)
  101. zktest_st_LDADD = libzkst.la libhashtable.la $(CPPUNIT_LIBS) -ldl
  102. zktest_st_CXXFLAGS = -DUSE_STATIC_LIB $(CPPUNIT_CFLAGS) $(USEIPV6) $(SOLARIS_CPPFLAGS)
  103. zktest_st_LDFLAGS = -shared $(SYMBOL_WRAPPERS) $(SOLARIS_LIB_LDFLAGS)
  104. if WANT_SYNCAPI
  105. check_PROGRAMS += zktest-mt
  106. nodist_zktest_mt_SOURCES = $(TEST_SOURCES) tests/PthreadMocks.cc
  107. zktest_mt_LDADD = libzkmt.la libhashtable.la -lpthread $(CPPUNIT_LIBS) -ldl
  108. zktest_mt_CXXFLAGS = -DUSE_STATIC_LIB -DTHREADED $(CPPUNIT_CFLAGS) $(USEIPV6)
  109. if SOLARIS
  110. SHELL_SYMBOL_WRAPPERS_MT = cat ${srcdir}/tests/wrappers-mt.opt
  111. SYMBOL_WRAPPERS_MT=$(SYMBOL_WRAPPERS) $(SHELL_SYMBOL_WRAPPERS_MT:sh)
  112. else
  113. SYMBOL_WRAPPERS_MT=$(SYMBOL_WRAPPERS) $(shell cat ${srcdir}/tests/wrappers-mt.opt)
  114. endif
  115. zktest_mt_LDFLAGS = -shared $(SYMBOL_WRAPPERS_MT) $(SOLARIS_LIB_LDFLAGS)
  116. endif
  117. TESTS = $(check_PROGRAMS)
  118. clean-local: clean-check
  119. $(RM) $(DX_CLEANFILES)
  120. clean-check:
  121. $(RM) $(nodist_zktest_st_OBJECTS) $(nodist_zktest_mt_OBJECTS)