Merge remote-tracking branch 'github/pr/1366'
[collectd.git] / src / daemon / Makefile.am
1 AM_CPPFLAGS = -I$(top_srcdir)/src
2 AM_CPPFLAGS += -DPREFIX='"${prefix}"'
3 AM_CPPFLAGS += -DCONFIGFILE='"${sysconfdir}/${PACKAGE_NAME}.conf"'
4 AM_CPPFLAGS += -DLOCALSTATEDIR='"${localstatedir}"'
5 AM_CPPFLAGS += -DPKGLOCALSTATEDIR='"${localstatedir}/lib/${PACKAGE_NAME}"'
6 if BUILD_FEATURE_DAEMON
7 AM_CPPFLAGS += -DPIDFILE='"${localstatedir}/run/${PACKAGE_NAME}.pid"'
8 endif
9 AM_CPPFLAGS += -DPLUGINDIR='"${pkglibdir}"'
10 AM_CPPFLAGS += -DPKGDATADIR='"${pkgdatadir}"'
11
12 # Link to these libraries..
13 COMMON_LIBS =
14 if BUILD_WITH_LIBRT
15 COMMON_LIBS += -lrt
16 endif
17 if BUILD_WITH_LIBPOSIX4
18 COMMON_LIBS += -lposix4
19 endif
20 if BUILD_WITH_LIBSOCKET
21 COMMON_LIBS += -lsocket
22 endif
23 if BUILD_WITH_LIBRESOLV
24 COMMON_LIBS += -lresolv
25 endif
26 if BUILD_WITH_LIBPTHREAD
27 COMMON_LIBS += -lpthread
28 endif
29 if BUILD_WITH_LIBKSTAT
30 COMMON_LIBS += -lkstat
31 endif
32 if BUILD_WITH_LIBDEVINFO
33 COMMON_LIBS += -ldevinfo
34 endif
35
36 AUTOMAKE_OPTIONS = subdir-objects
37
38 sbin_PROGRAMS = collectd
39
40 noinst_LTLIBRARIES = libavltree.la libcommon.la libheap.la libmetadata.la libplugin_mock.la
41
42 libavltree_la_SOURCES = utils_avltree.c utils_avltree.h
43
44 libcommon_la_SOURCES = common.c common.h
45 libcommon_la_LIBADD = $(COMMON_LIBS)
46
47 libheap_la_SOURCES = utils_heap.c utils_heap.h
48
49 libmetadata_la_SOURCES = meta_data.c meta_data.h
50
51 libplugin_mock_la_SOURCES = plugin_mock.c utils_cache_mock.c utils_time_mock.c
52 libplugin_mock_la_LIBADD = $(COMMON_LIBS)
53
54 collectd_SOURCES = collectd.c collectd.h \
55                    configfile.c configfile.h \
56                    filter_chain.c filter_chain.h \
57                    meta_data.c meta_data.h \
58                    plugin.c plugin.h \
59                    utils_cache.c utils_cache.h \
60                    utils_complain.c utils_complain.h \
61                    utils_ignorelist.c utils_ignorelist.h \
62                    utils_llist.c utils_llist.h \
63                    utils_random.c utils_random.h \
64                    utils_tail_match.c utils_tail_match.h \
65                    utils_match.c utils_match.h \
66                    utils_subst.c utils_subst.h \
67                    utils_tail.c utils_tail.h \
68                    utils_time.c utils_time.h \
69                    types_list.c types_list.h \
70                    utils_threshold.c utils_threshold.h
71
72
73 collectd_CPPFLAGS =  $(AM_CPPFLAGS) $(LTDLINCL)
74 collectd_CFLAGS = $(AM_CFLAGS)
75 collectd_LDFLAGS = -export-dynamic
76 collectd_LDADD = libavltree.la libcommon.la libheap.la -lm $(COMMON_LIBS)
77 collectd_DEPENDENCIES = libavltree.la libcommon.la libheap.la libmetadata.la
78
79 # The daemon needs to call sg_init, so we need to link it against libstatgrab,
80 # too. -octo
81 if BUILD_WITH_LIBSTATGRAB
82 collectd_CFLAGS += $(BUILD_WITH_LIBSTATGRAB_CFLAGS)
83 collectd_LDADD += $(BUILD_WITH_LIBSTATGRAB_LDFLAGS)
84 endif
85
86 if BUILD_WITH_OWN_LIBOCONFIG
87 collectd_LDADD += $(LIBLTDL) $(top_builddir)/src/liboconfig/liboconfig.la
88 collectd_DEPENDENCIES += $(top_builddir)/src/liboconfig/liboconfig.la
89 else
90 collectd_LDADD += -loconfig
91 endif
92
93 check_PROGRAMS = test_common test_meta_data test_utils_avltree test_utils_heap test_utils_time test_utils_subst
94 TESTS          = test_common test_meta_data test_utils_avltree test_utils_heap test_utils_time test_utils_subst
95
96 test_common_SOURCES = common_test.c ../testing.h
97 test_common_LDADD = libcommon.la libplugin_mock.la
98
99 test_meta_data_SOURCES = meta_data_test.c ../testing.h
100 test_meta_data_LDADD = libmetadata.la libplugin_mock.la
101
102 test_utils_avltree_SOURCES = utils_avltree_test.c ../testing.h
103 test_utils_avltree_LDADD = libavltree.la $(COMMON_LIBS)
104
105 test_utils_heap_SOURCES = utils_heap_test.c ../testing.h
106 test_utils_heap_LDADD = libheap.la $(COMMON_LIBS)
107
108 test_utils_time_SOURCES = utils_time_test.c ../testing.h
109
110 test_utils_subst_SOURCES = utils_subst_test.c ../testing.h \
111                            utils_subst.c utils_subst.h
112 test_utils_subst_LDADD = libcommon.la libplugin_mock.la