Close file descriptor on error handling.
[oweals/gnunet.git] / src / statistics / Makefile.am
1 # This Makefile.am is in the public domain
2 AM_CPPFLAGS = -I$(top_srcdir)/src/include
3
4 if MINGW
5  WINFLAGS = -Wl,--no-undefined -Wl,--export-all-symbols
6 endif
7
8 if USE_COVERAGE
9   AM_CFLAGS = --coverage -O0
10   XLIB = -lgcov
11 endif
12
13 pkgcfgdir= $(pkgdatadir)/config.d/
14
15 libexecdir= $(pkglibdir)/libexec/
16
17 pkgcfg_DATA = \
18   statistics.conf
19
20 lib_LTLIBRARIES = libgnunetstatistics.la
21
22 libgnunetstatistics_la_SOURCES = \
23   statistics_api.c statistics.h
24 libgnunetstatistics_la_LIBADD = \
25   $(top_builddir)/src/util/libgnunetutil.la \
26   $(GN_LIBINTL) $(XLIB)
27 libgnunetstatistics_la_LDFLAGS = \
28   $(GN_LIB_LDFLAGS)  $(WINFLAGS) \
29   -version-info 2:0:0
30
31 libexec_PROGRAMS = \
32  gnunet-service-statistics
33
34 bin_PROGRAMS = \
35  gnunet-statistics
36
37 gnunet_statistics_SOURCES = \
38  gnunet-statistics.c
39 gnunet_statistics_LDADD = \
40   libgnunetstatistics.la \
41   $(top_builddir)/src/util/libgnunetutil.la \
42   $(GN_LIBINTL)
43
44 gnunet_service_statistics_SOURCES = \
45  gnunet-service-statistics.c
46 gnunet_service_statistics_LDADD = \
47   libgnunetstatistics.la \
48   $(top_builddir)/src/util/libgnunetutil.la \
49   $(GN_LIBINTL)
50
51 check_PROGRAMS = \
52  test_statistics_api \
53  test_statistics_api_loop \
54  test_statistics_api_watch \
55  test_statistics_api_watch_zero_value
56
57 if ENABLE_TEST_RUN
58 AM_TESTS_ENVIRONMENT=export GNUNET_PREFIX=$${GNUNET_PREFIX:-@libdir@};export PATH=$${GNUNET_PREFIX:-@prefix@}/bin:$$PATH;unset XDG_DATA_HOME;unset XDG_CONFIG_HOME;
59 TESTS = $(check_PROGRAMS) $(check_SCRIPTS)
60 endif
61
62 test_statistics_api_SOURCES = \
63  test_statistics_api.c
64 test_statistics_api_LDADD = \
65   libgnunetstatistics.la \
66   $(top_builddir)/src/util/libgnunetutil.la
67
68 test_statistics_api_loop_SOURCES = \
69  test_statistics_api_loop.c
70 test_statistics_api_loop_LDADD = \
71   libgnunetstatistics.la \
72   $(top_builddir)/src/util/libgnunetutil.la
73
74 test_statistics_api_watch_SOURCES = \
75  test_statistics_api_watch.c
76 test_statistics_api_watch_LDADD = \
77   libgnunetstatistics.la \
78   $(top_builddir)/src/util/libgnunetutil.la
79
80 test_statistics_api_watch_zero_value_SOURCES = \
81  test_statistics_api_watch_zero_value.c
82 test_statistics_api_watch_zero_value_LDADD = \
83   libgnunetstatistics.la \
84   $(top_builddir)/src/util/libgnunetutil.la
85
86 if HAVE_PYTHON
87 check_SCRIPTS = \
88   test_gnunet_statistics.py
89 endif
90
91 do_subst = $(SED) -e 's,[@]PYTHON[@],$(PYTHON),g'
92
93 SUFFIXES = .py.in .py
94 .py.in.py:
95         $(do_subst) < $(srcdir)/$< > $@
96         chmod +x $@
97
98 test_gnunet_statistics.py: test_gnunet_statistics.py.in Makefile
99         $(do_subst) < $(srcdir)/test_gnunet_statistics.py.in > test_gnunet_statistics.py
100         chmod +x test_gnunet_statistics.py
101
102 EXTRA_DIST = \
103   test_statistics_api_data.conf \
104   test_gnunet_statistics.py.in