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

AM_CPPFLAGS = -I$(top_builddir)/src/lib -I$(top_srcdir)/src/lib
4
AM_CPPFLAGS += $(BOOST_INCLUDES)
5 6 7 8 9 10 11 12 13 14
AM_CXXFLAGS = $(B10_CXXFLAGS)

if USE_STATIC_LINK
AM_LDFLAGS = -static
endif

CLEANFILES = *.gcno *.gcda

TESTS =
if HAVE_GTEST
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32

# Define the flags used in each set of tests
COMMON_CXXFLAGS = $(AM_CXXFLAGS)
if USE_CLANGPP
# Workaround unused variables tcout and tcerr in log4cplus's streams.h.
COMMON_CXXFLAGS += -Wno-unused-variable
endif
COMMON_CPPFLAGS = $(AM_CPPFLAGS) $(GTEST_INCLUDES) $(LOG4CPLUS_INCLUDES)
COMMON_LDFLAGS  = $(AM_LDFLAGS)  $(GTEST_LDFLAGS)

COMMON_LDADD  = $(GTEST_LDADD)
COMMON_LDADD += $(top_builddir)/src/lib/log/liblog.la
COMMON_LDADD += $(top_builddir)/src/lib/util/unittests/libutil_unittests.la
COMMON_LDADD += $(top_builddir)/src/lib/util/libutil.la
COMMON_LDADD += $(top_builddir)/src/lib/exceptions/libexceptions.la
COMMON_LDADD += $(top_builddir)/src/lib/util/unittests/libutil_unittests.la

# Set of unit tests for the general logging classes
33
TESTS += run_unittests
34 35
run_unittests_SOURCES  = run_unittests.cc
run_unittests_SOURCES += log_formatter_unittest.cc
36
run_unittests_SOURCES += logger_level_impl_unittest.cc
37
run_unittests_SOURCES += logger_level_unittest.cc
Stephen Morris's avatar
Stephen Morris committed
38
run_unittests_SOURCES += logger_manager_unittest.cc
39
run_unittests_SOURCES += logger_name_unittest.cc
40
run_unittests_SOURCES += logger_support_unittest.cc
41
run_unittests_SOURCES += logger_unittest.cc
42
run_unittests_SOURCES += logger_specification_unittest.cc
43 44 45
run_unittests_SOURCES += message_dictionary_unittest.cc
run_unittests_SOURCES += message_reader_unittest.cc
run_unittests_SOURCES += output_option_unittest.cc
46

47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73
run_unittests_CPPFLAGS = $(COMMON_CPPFLAGS)
run_unittests_CXXFLAGS = $(COMMON_CXXFLAGS)
run_unittests_LDADD    = $(COMMON_LDADD)
run_unittests_LDFLAGS  = $(COMMON_LDFLAGS)

# logging initialization tests.  These are put in separate programs to
# ensure that the initialization status at the start of each test is known,
# and to prevent circumstances where the execution of one test affects the
# starting conditions of the next.
TESTS += initializer_unittests_1
initializer_unittests_1_SOURCES  = run_initializer_unittests.cc
initializer_unittests_1_SOURCES += message_initializer_1_unittest.cc
initializer_unittests_1_SOURCES += message_initializer_1a_unittest.cc

initializer_unittests_1_CPPFLAGS = $(COMMON_CPPFLAGS)
initializer_unittests_1_CXXFLAGS = $(COMMON_CXXFLAGS)
initializer_unittests_1_LDADD    = $(COMMON_LDADD)
initializer_unittests_1_LDFLAGS  = $(COMMON_LDFLAGS)

TESTS += initializer_unittests_2
initializer_unittests_2_SOURCES  = run_initializer_unittests.cc
initializer_unittests_2_SOURCES += message_initializer_2_unittest.cc

initializer_unittests_2_CPPFLAGS = $(COMMON_CPPFLAGS)
initializer_unittests_2_CXXFLAGS = $(COMMON_CXXFLAGS)
initializer_unittests_2_LDADD    = $(COMMON_LDADD)
initializer_unittests_2_LDFLAGS  = $(COMMON_LDFLAGS)
74

75 76
endif

77
noinst_PROGRAMS = logger_example
78 79
logger_example_SOURCES = logger_example.cc
logger_example_CPPFLAGS = $(AM_CPPFLAGS) $(GTEST_INCLUDES)
80 81 82
logger_example_LDFLAGS = $(AM_LDFLAGS)
logger_example_LDADD  = $(LOG4CPLUS_LIBS)
logger_example_LDADD += $(top_builddir)/src/lib/log/liblog.la
83
logger_example_LDADD += $(top_builddir)/src/lib/util/libutil.la
84
logger_example_LDADD += $(top_builddir)/src/lib/exceptions/libexceptions.la
85

86
noinst_PROGRAMS += init_logger_test
87 88
init_logger_test_SOURCES = init_logger_test.cc
init_logger_test_CPPFLAGS = $(AM_CPPFLAGS) $(GTEST_INCLUDES)
89 90 91
init_logger_test_LDFLAGS = $(AM_LDFLAGS)
init_logger_test_LDADD  = $(LOG4CPLUS_LIBS)
init_logger_test_LDADD += $(top_builddir)/src/lib/log/liblog.la
92
init_logger_test_LDADD += $(top_builddir)/src/lib/util/libutil.la
93
init_logger_test_LDADD += $(top_builddir)/src/lib/exceptions/libexceptions.la
94

95
noinst_PROGRAMS += $(TESTS)
96

97 98 99 100 101
# Additional test using the shell.  These are principally tests
# where the global logging environment is affected, and where the
# output needs to be compared with stored output (where "cut" and
# "diff" are useful utilities).

102
check-local:
103
	$(SHELL) $(abs_builddir)/console_test.sh
104
	$(SHELL) $(abs_builddir)/destination_test.sh
105
	$(SHELL) $(abs_builddir)/init_logger_test.sh
106 107
	$(SHELL) $(abs_builddir)/local_file_test.sh
	$(SHELL) $(abs_builddir)/severity_test.sh