add integer overflow guards and avoid (unlimited) stack allocation
[oweals/gnunet.git] / src / datastore / Makefile.am
1 # This Makefile.am is in the public domain
2 AM_CPPFLAGS = -I$(top_srcdir)/src/include
3
4 plugindir = $(libdir)/gnunet
5
6 pkgcfgdir= $(pkgdatadir)/config.d/
7
8 libexecdir= $(pkglibdir)/libexec/
9
10 pkgcfg_DATA = \
11   datastore.conf
12
13 if USE_COVERAGE
14   AM_CFLAGS = --coverage -O0
15   XLIBS = -lgcov
16 endif
17
18
19 lib_LTLIBRARIES = \
20   libgnunetdatastore.la
21
22 libgnunetdatastore_la_SOURCES = \
23   datastore_api.c datastore.h
24 libgnunetdatastore_la_LIBADD = \
25   $(top_builddir)/src/statistics/libgnunetstatistics.la \
26   $(top_builddir)/src/util/libgnunetutil.la \
27   $(GN_LIBINTL)
28 libgnunetdatastore_la_LDFLAGS = \
29   $(GN_LIB_LDFLAGS)  \
30   -version-info 1:0:0
31
32 bin_PROGRAMS = \
33  gnunet-datastore
34
35 libexec_PROGRAMS = \
36  gnunet-service-datastore
37
38 gnunet_service_datastore_SOURCES = \
39  gnunet-service-datastore.c
40 gnunet_service_datastore_LDADD = \
41   $(top_builddir)/src/statistics/libgnunetstatistics.la \
42   $(top_builddir)/src/util/libgnunetutil.la \
43   $(GN_LIBINTL)
44
45 gnunet_datastore_SOURCES = \
46  gnunet-datastore.c
47 gnunet_datastore_LDADD = \
48   libgnunetdatastore.la \
49   $(top_builddir)/src/util/libgnunetutil.la \
50   $(GN_LIBINTL)
51
52
53 if HAVE_MYSQL
54  MYSQL_PLUGIN = libgnunet_plugin_datastore_mysql.la
55 if HAVE_TESTING
56 if HAVE_BENCHMARKS
57   MYSQL_BENCHMARKS = \
58    perf_datastore_api_mysql \
59    perf_plugin_datastore_mysql
60 endif
61  MYSQL_TESTS = \
62   test_datastore_api_mysql \
63   test_datastore_api_management_mysql \
64   test_plugin_datastore_mysql \
65   $(MYSQL_BENCHMARKS)
66 endif
67 endif
68 if HAVE_SQLITE
69  SQLITE_PLUGIN = libgnunet_plugin_datastore_sqlite.la
70 if HAVE_TESTING
71 if HAVE_BENCHMARKS
72   SQLITE_BENCHMARKS = \
73    perf_datastore_api_sqlite \
74    perf_plugin_datastore_sqlite
75 endif
76  SQLITE_TESTS = \
77   test_datastore_api_sqlite \
78   test_datastore_api_management_sqlite \
79   test_plugin_datastore_sqlite \
80   $(SQLITE_BENCHMARKS)
81 endif
82 endif
83 if HAVE_POSTGRESQL
84  POSTGRES_PLUGIN = libgnunet_plugin_datastore_postgres.la
85 if HAVE_TESTING
86 if HAVE_BENCHMARKS
87   POSTGRES_BENCHMARKS = \
88    perf_datastore_api_postgres \
89    perf_plugin_datastore_postgres
90 endif
91  POSTGRES_TESTS = \
92   test_datastore_api_postgres \
93   test_datastore_api_management_postgres \
94   test_plugin_datastore_postgres \
95   $(POSTGRES_BENCHMARKS)
96 endif
97 endif
98
99 plugin_LTLIBRARIES = \
100   $(SQLITE_PLUGIN) \
101   $(MYSQL_PLUGIN) \
102   $(POSTGRES_PLUGIN) \
103   libgnunet_plugin_datastore_heap.la
104
105 # Real plugins should of course go into
106 # plugin_LTLIBRARIES
107 noinst_LTLIBRARIES = \
108   libgnunet_plugin_datastore_template.la
109
110
111 libgnunet_plugin_datastore_sqlite_la_SOURCES = \
112   plugin_datastore_sqlite.c
113 libgnunet_plugin_datastore_sqlite_la_LIBADD = \
114   $(top_builddir)/src/sq/libgnunetsq.la \
115   $(top_builddir)/src/statistics/libgnunetstatistics.la \
116   $(top_builddir)/src/util/libgnunetutil.la $(XLIBS) -lsqlite3 \
117   $(LTLIBINTL)
118 libgnunet_plugin_datastore_sqlite_la_LDFLAGS = \
119  $(GN_PLUGIN_LDFLAGS)
120
121
122 libgnunet_plugin_datastore_heap_la_SOURCES = \
123   plugin_datastore_heap.c
124 libgnunet_plugin_datastore_heap_la_LIBADD = \
125   $(top_builddir)/src/util/libgnunetutil.la $(XLIBS) \
126   $(LTLIBINTL)
127 libgnunet_plugin_datastore_heap_la_LDFLAGS = \
128  $(GN_PLUGIN_LDFLAGS)
129
130
131 libgnunet_plugin_datastore_mysql_la_SOURCES = \
132   plugin_datastore_mysql.c
133 libgnunet_plugin_datastore_mysql_la_LIBADD = \
134   $(top_builddir)/src/my/libgnunetmy.la \
135   $(top_builddir)/src/mysql/libgnunetmysql.la \
136   $(top_builddir)/src/statistics/libgnunetstatistics.la \
137   $(top_builddir)/src/util/libgnunetutil.la $(XLIBS) $(Z_LIBS) -lmysqlclient
138 libgnunet_plugin_datastore_mysql_la_LDFLAGS = \
139  $(GN_PLUGIN_LDFLAGS) $(MYSQL_LDFLAGS) -lmysqlclient
140 libgnunet_plugin_datastore_mysql_la_CPPFLAGS = \
141  $(MYSQL_CPPFLAGS) $(AM_CPPFLAGS)
142
143 libgnunet_plugin_datastore_postgres_la_SOURCES = \
144   plugin_datastore_postgres.c
145 libgnunet_plugin_datastore_postgres_la_LIBADD = \
146   $(top_builddir)/src/statistics/libgnunetstatistics.la \
147   $(top_builddir)/src/pq/libgnunetpq.la \
148   $(top_builddir)/src/util/libgnunetutil.la $(XLIBS) -lpq
149 libgnunet_plugin_datastore_postgres_la_LDFLAGS = \
150  $(GN_PLUGIN_LDFLAGS) $(POSTGRESQL_LDFLAGS)
151 libgnunet_plugin_datastore_postgres_la_CPPFLAGS = \
152  $(POSTGRESQL_CPPFLAGS) $(AM_CPPFLAGS)
153
154
155 libgnunet_plugin_datastore_template_la_SOURCES = \
156   plugin_datastore_template.c
157 libgnunet_plugin_datastore_template_la_LIBADD = \
158   $(top_builddir)/src/util/libgnunetutil.la $(XLIBS) \
159   $(LTLIBINTL)
160 libgnunet_plugin_datastore_template_la_LDFLAGS = \
161  $(GN_PLUGIN_LDFLAGS)
162
163 check_PROGRAMS = \
164   test_datastore_api_heap \
165   test_datastore_api_management_heap \
166   perf_datastore_api_heap \
167   perf_plugin_datastore_heap \
168   test_plugin_datastore_heap \
169   $(SQLITE_TESTS) \
170   $(MYSQL_TESTS) \
171   $(POSTGRES_TESTS)
172
173 if ENABLE_TEST_RUN
174 AM_TESTS_ENVIRONMENT=export GNUNET_PREFIX=$${GNUNET_PREFIX:-@libdir@};export PATH=$${GNUNET_PREFIX:-@prefix@}/bin:$$PATH;unset XDG_DATA_HOME;unset XDG_CONFIG_HOME;
175 TESTS = $(check_PROGRAMS)
176 endif
177
178 test_datastore_api_heap_SOURCES = \
179  test_datastore_api.c
180 test_datastore_api_heap_LDADD = \
181  $(top_builddir)/src/testing/libgnunettesting.la \
182  libgnunetdatastore.la \
183  $(top_builddir)/src/util/libgnunetutil.la
184
185 test_datastore_api_management_heap_SOURCES = \
186  test_datastore_api_management.c
187 test_datastore_api_management_heap_LDADD = \
188  $(top_builddir)/src/testing/libgnunettesting.la \
189  libgnunetdatastore.la \
190  $(top_builddir)/src/util/libgnunetutil.la
191
192 perf_datastore_api_heap_SOURCES = \
193  perf_datastore_api.c
194 perf_datastore_api_heap_LDADD = \
195  $(top_builddir)/src/testing/libgnunettesting.la \
196  libgnunetdatastore.la \
197  $(top_builddir)/src/util/libgnunetutil.la
198
199 perf_plugin_datastore_heap_SOURCES = \
200  perf_plugin_datastore.c
201 perf_plugin_datastore_heap_LDADD = \
202  $(top_builddir)/src/testing/libgnunettesting.la \
203  $(top_builddir)/src/util/libgnunetutil.la
204
205 test_plugin_datastore_heap_SOURCES = \
206  test_plugin_datastore.c
207 test_plugin_datastore_heap_LDADD = \
208  $(top_builddir)/src/testing/libgnunettesting.la \
209  $(top_builddir)/src/util/libgnunetutil.la
210
211
212 test_datastore_api_sqlite_SOURCES = \
213  test_datastore_api.c
214 test_datastore_api_sqlite_LDADD = \
215  $(top_builddir)/src/testing/libgnunettesting.la \
216  libgnunetdatastore.la \
217  $(top_builddir)/src/util/libgnunetutil.la
218
219 test_datastore_api_management_sqlite_SOURCES = \
220  test_datastore_api_management.c
221 test_datastore_api_management_sqlite_LDADD = \
222  $(top_builddir)/src/testing/libgnunettesting.la \
223  libgnunetdatastore.la \
224  $(top_builddir)/src/util/libgnunetutil.la
225
226 perf_datastore_api_sqlite_SOURCES = \
227  perf_datastore_api.c
228 perf_datastore_api_sqlite_LDADD = \
229  $(top_builddir)/src/testing/libgnunettesting.la \
230  libgnunetdatastore.la \
231  $(top_builddir)/src/util/libgnunetutil.la
232
233 perf_plugin_datastore_sqlite_SOURCES = \
234  perf_plugin_datastore.c
235 perf_plugin_datastore_sqlite_LDADD = \
236  $(top_builddir)/src/testing/libgnunettesting.la \
237  $(top_builddir)/src/util/libgnunetutil.la
238
239 test_plugin_datastore_sqlite_SOURCES = \
240  test_plugin_datastore.c
241 test_plugin_datastore_sqlite_LDADD = \
242  $(top_builddir)/src/testing/libgnunettesting.la \
243  $(top_builddir)/src/util/libgnunetutil.la
244
245
246 test_datastore_api_mysql_SOURCES = \
247  test_datastore_api.c
248 test_datastore_api_mysql_LDADD = \
249  $(top_builddir)/src/testing/libgnunettesting.la \
250  libgnunetdatastore.la \
251  $(top_builddir)/src/util/libgnunetutil.la
252
253 test_datastore_api_management_mysql_SOURCES = \
254  test_datastore_api_management.c
255 test_datastore_api_management_mysql_LDADD = \
256  $(top_builddir)/src/testing/libgnunettesting.la \
257  libgnunetdatastore.la \
258  $(top_builddir)/src/util/libgnunetutil.la
259
260 perf_datastore_api_mysql_SOURCES = \
261  perf_datastore_api.c
262 perf_datastore_api_mysql_LDADD = \
263  $(top_builddir)/src/testing/libgnunettesting.la \
264  libgnunetdatastore.la \
265  $(top_builddir)/src/util/libgnunetutil.la
266
267 test_plugin_datastore_mysql_SOURCES = \
268  test_plugin_datastore.c
269 test_plugin_datastore_mysql_LDADD = \
270  $(top_builddir)/src/testing/libgnunettesting.la \
271  $(top_builddir)/src/util/libgnunetutil.la
272
273 perf_plugin_datastore_mysql_SOURCES = \
274  perf_plugin_datastore.c
275 perf_plugin_datastore_mysql_LDADD = \
276  $(top_builddir)/src/testing/libgnunettesting.la \
277  $(top_builddir)/src/util/libgnunetutil.la
278
279
280 test_datastore_api_postgres_SOURCES = \
281  test_datastore_api.c
282 test_datastore_api_postgres_LDADD = \
283  $(top_builddir)/src/testing/libgnunettesting.la \
284  libgnunetdatastore.la \
285  $(top_builddir)/src/util/libgnunetutil.la
286
287 test_datastore_api_management_postgres_SOURCES = \
288  test_datastore_api_management.c
289 test_datastore_api_management_postgres_LDADD = \
290  $(top_builddir)/src/testing/libgnunettesting.la \
291  libgnunetdatastore.la \
292  $(top_builddir)/src/util/libgnunetutil.la
293
294 perf_datastore_api_postgres_SOURCES = \
295  perf_datastore_api.c
296 perf_datastore_api_postgres_LDADD = \
297  $(top_builddir)/src/testing/libgnunettesting.la \
298  libgnunetdatastore.la \
299  $(top_builddir)/src/util/libgnunetutil.la
300
301 test_plugin_datastore_postgres_SOURCES = \
302  test_plugin_datastore.c
303 test_plugin_datastore_postgres_LDADD = \
304  $(top_builddir)/src/testing/libgnunettesting.la \
305  $(top_builddir)/src/util/libgnunetutil.la
306
307 perf_plugin_datastore_postgres_SOURCES = \
308  perf_plugin_datastore.c
309 perf_plugin_datastore_postgres_LDADD = \
310  $(top_builddir)/src/testing/libgnunettesting.la \
311  $(top_builddir)/src/util/libgnunetutil.la
312
313
314 EXTRA_DIST = \
315  test_defaults.conf \
316  test_datastore_api_data_sqlite.conf \
317  perf_plugin_datastore_data_sqlite.conf \
318  test_plugin_datastore_data_sqlite.conf \
319  test_datastore_api_data_heap.conf \
320  perf_plugin_datastore_data_heap.conf \
321  test_plugin_datastore_data_heap.conf \
322  test_datastore_api_data_mysql.conf \
323  perf_plugin_datastore_data_mysql.conf \
324  test_plugin_datastore_data_mysql.conf \
325  test_datastore_api_data_postgres.conf \
326  perf_plugin_datastore_data_postgres.conf \
327  test_plugin_datastore_data_postgres.conf