1SUBDIRS = .
2
3AM_CPPFLAGS = -I$(top_builddir)/src/lib -I$(top_srcdir)/src/lib
4AM_CPPFLAGS += $(BOOST_INCLUDES)
5AM_CXXFLAGS = $(KEA_CXXFLAGS)
6AM_LDADD    =
7AM_LDFLAGS  =
8
9if USE_STATIC_LINK
10AM_LDFLAGS += -static
11endif
12
13CLEANFILES = *.gcno *.gcda *.lock
14DISTCLEANFILES = buffer_logger_test.sh
15DISTCLEANFILES += console_test.sh destination_test.sh init_logger_test.sh
16DISTCLEANFILES += local_file_test.sh logger_lock_test.sh severity_test.sh
17DISTCLEANFILES += tempdir.h
18
19EXTRA_DIST = log_test_messages.mes
20
21noinst_PROGRAMS = logger_example
22logger_example_SOURCES = logger_example.cc
23logger_example_CPPFLAGS = $(AM_CPPFLAGS)
24logger_example_LDFLAGS = $(AM_LDFLAGS)
25logger_example_LDADD  = $(top_builddir)/src/lib/log/libkea-log.la
26logger_example_LDADD += $(top_builddir)/src/lib/util/libkea-util.la
27logger_example_LDADD += $(top_builddir)/src/lib/exceptions/libkea-exceptions.la
28logger_example_LDADD += $(AM_LDADD) $(LOG4CPLUS_LIBS)
29
30noinst_PROGRAMS += init_logger_test
31init_logger_test_SOURCES = init_logger_test.cc
32init_logger_test_CPPFLAGS = $(AM_CPPFLAGS)
33init_logger_test_LDFLAGS = $(AM_LDFLAGS)
34init_logger_test_LDADD  = $(top_builddir)/src/lib/log/libkea-log.la
35init_logger_test_LDADD += $(top_builddir)/src/lib/util/libkea-util.la
36init_logger_test_LDADD += $(top_builddir)/src/lib/exceptions/libkea-exceptions.la
37init_logger_test_LDADD += $(AM_LDADD) $(LOG4CPLUS_LIBS)
38
39noinst_PROGRAMS += buffer_logger_test
40buffer_logger_test_SOURCES = buffer_logger_test.cc
41buffer_logger_test_CPPFLAGS = $(AM_CPPFLAGS)
42buffer_logger_test_LDFLAGS = $(AM_LDFLAGS)
43buffer_logger_test_LDADD  = $(top_builddir)/src/lib/log/libkea-log.la
44buffer_logger_test_LDADD += $(top_builddir)/src/lib/util/libkea-util.la
45buffer_logger_test_LDADD += $(top_builddir)/src/lib/exceptions/libkea-exceptions.la
46buffer_logger_test_LDADD += $(AM_LDADD) $(LOG4CPLUS_LIBS)
47
48noinst_PROGRAMS += logger_lock_test
49logger_lock_test_SOURCES = logger_lock_test.cc
50logger_lock_test_SOURCES += log_test_messages.cc log_test_messages.h
51logger_lock_test_CPPFLAGS = $(AM_CPPFLAGS)
52logger_lock_test_LDFLAGS = $(AM_LDFLAGS)
53logger_lock_test_LDADD  = $(top_builddir)/src/lib/log/libkea-log.la
54logger_lock_test_LDADD += $(top_builddir)/src/lib/util/libkea-util.la
55logger_lock_test_LDADD += $(top_builddir)/src/lib/exceptions/libkea-exceptions.la
56logger_lock_test_LDADD += $(AM_LDADD) $(LOG4CPLUS_LIBS)
57
58TESTS_ENVIRONMENT = \
59	$(LIBTOOL) --mode=execute $(VALGRIND_COMMAND)
60
61if HAVE_GTEST
62TESTS =
63
64# Define the flags used in each set of tests
65TESTSCXXFLAGS  = $(AM_CXXFLAGS)
66TESTSCPPFLAGS  = $(AM_CPPFLAGS) $(GTEST_INCLUDES) $(LOG4CPLUS_INCLUDES)
67TESTSLDFLAGS  = $(AM_LDFLAGS) $(GTEST_LDFLAGS)
68
69TESTSLDADD  = $(AM_LDADD)
70TESTSLDADD += $(top_builddir)/src/lib/log/libkea-log.la
71TESTSLDADD += $(top_builddir)/src/lib/util/unittests/libutil_unittests.la
72TESTSLDADD += $(top_builddir)/src/lib/util/libkea-util.la
73TESTSLDADD += $(top_builddir)/src/lib/exceptions/libkea-exceptions.la
74TESTSLDADD += $(LOG4CPLUS_LIBS) $(GTEST_LDADD)
75
76# Set of unit tests for the general logging classes
77TESTS += run_unittests
78run_unittests_SOURCES  = run_unittests.cc
79run_unittests_SOURCES += log_formatter_unittest.cc
80run_unittests_SOURCES += logger_level_impl_unittest.cc
81run_unittests_SOURCES += logger_level_unittest.cc
82run_unittests_SOURCES += logger_manager_unittest.cc
83run_unittests_SOURCES += logger_name_unittest.cc
84run_unittests_SOURCES += logger_support_unittest.cc
85run_unittests_SOURCES += logger_unittest.cc
86run_unittests_SOURCES += logger_specification_unittest.cc
87run_unittests_SOURCES += message_dictionary_unittest.cc
88run_unittests_SOURCES += message_reader_unittest.cc
89run_unittests_SOURCES += output_option_unittest.cc
90run_unittests_SOURCES += buffer_appender_unittest.cc
91run_unittests_SOURCES += log_test_messages.cc log_test_messages.h
92
93run_unittests_CPPFLAGS = $(TESTSCPPFLAGS)
94run_unittests_CXXFLAGS = $(TESTSCXXFLAGS)
95run_unittests_LDADD    = $(TESTSLDADD)
96run_unittests_LDFLAGS  = $(TESTSLDFLAGS)
97
98# logging initialization tests.  These are put in separate programs to
99# ensure that the initialization status at the start of each test is known,
100# and to prevent circumstances where the execution of one test affects the
101# starting conditions of the next.
102TESTS += initializer_unittests_1
103initializer_unittests_1_SOURCES  = run_initializer_unittests.cc
104initializer_unittests_1_SOURCES += message_initializer_1_unittest.cc
105initializer_unittests_1_SOURCES += message_initializer_1a_unittest.cc
106
107initializer_unittests_1_CPPFLAGS = $(TESTSCPPFLAGS)
108initializer_unittests_1_CXXFLAGS = $(TESTSCXXFLAGS)
109initializer_unittests_1_LDADD    = $(TESTSLDADD)
110initializer_unittests_1_LDFLAGS  = $(TESTSLDFLAGS)
111
112noinst_PROGRAMS += $(TESTS)
113endif
114
115noinst_SCRIPTS  =
116noinst_SCRIPTS += buffer_logger_test.sh
117noinst_SCRIPTS += console_test.sh
118noinst_SCRIPTS += destination_test.sh
119noinst_SCRIPTS += init_logger_test.sh
120noinst_SCRIPTS += local_file_test.sh
121noinst_SCRIPTS += logger_lock_test.sh
122noinst_SCRIPTS += severity_test.sh
123
124# Additional test using the shell.  These are principally tests
125# where the global logging environment is affected, and where the
126# output needs to be compared with stored output (where "cut" and
127# "diff" are useful utilities).
128check-local:
129	$(SHELL) $(abs_builddir)/buffer_logger_test.sh
130	$(SHELL) $(abs_builddir)/console_test.sh
131	$(SHELL) $(abs_builddir)/destination_test.sh
132	$(SHELL) $(abs_builddir)/init_logger_test.sh
133	$(SHELL) $(abs_builddir)/local_file_test.sh
134	$(SHELL) $(abs_builddir)/logger_lock_test.sh
135	$(SHELL) $(abs_builddir)/severity_test.sh
136
137# If we want to get rid of all generated messages files, we need to use
138# make maintainer-clean. The proper way to introduce custom commands for
139# that operation is to define maintainer-clean-local target. However,
140# make maintainer-clean also removes Makefile, so running configure script
141# is required.  To make it easy to rebuild messages without going through
142# reconfigure, a new target messages-clean has been added.
143maintainer-clean-local:
144	rm -f log_test_messages.h log_test_messages.cc
145
146# To regenerate messages files, one can do:
147#
148# make messages-clean
149# make messages
150#
151# This is needed only when a .mes file is modified.
152messages-clean: maintainer-clean-local
153
154if GENERATE_MESSAGES
155
156# Define rule to build logging source files from message file
157messages: log_test_messages.h log_test_messages.cc
158	@echo Message files regenerated
159
160log_test_messages.h log_test_messages.cc: log_test_messages.mes
161	$(top_builddir)/src/lib/log/compiler/kea-msg-compiler $(top_srcdir)/src/lib/log/tests/log_test_messages.mes
162
163else
164
165messages log_test_messages.h log_test_messages.cc:
166	@echo Messages generation disabled. Configure with --enable-generate-messages to enable it.
167
168endif
169