Merge branch 'master' of gnunet.org:gnunet
[oweals/gnunet.git] / src / util / 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 libexecdir= $(pkglibdir)/libexec/
7
8 pkgcfgdir= $(pkgdatadir)/config.d/
9
10 dist_pkgcfg_DATA = \
11   util.conf
12
13 pkgcfg_DATA = \
14   resolver.conf
15
16 if MINGW
17 noinst_LTLIBRARIES = \
18   libgnunetutilwin.la
19 libgnunetutilwin_la_SOURCES = \
20   win.c \
21   winproc.c
22 libgnunetutilwin_la_LDFLAGS = \
23   -no-undefined -Wl,--export-all-symbols
24 libgnunetutilwin_la_LIBADD = \
25   -lshell32 -liconv -lstdc++ \
26   -lcomdlg32 -lgdi32 -liphlpapi
27 WINLIB = libgnunetutilwin.la
28 W32CAT = w32cat
29 W32CONSOLEHELPER = gnunet-helper-w32-console
30 endif
31
32 if !MINGW
33  TEST_CLIENT_UNIX_NC = test_client_unix.nc
34 else
35  TEST_CLIENT_UNIX_NC =
36 endif
37
38 if USE_COVERAGE
39   AM_CFLAGS = --coverage -O0
40   XLIB = -lgcov
41 endif
42
43 if ENABLE_BENCHMARK
44   BENCHMARK = benchmark.c benchmark.h
45   PTHREAD = -lpthread
46 endif
47
48 w32cat_SOURCES = w32cat.c
49
50 gnunet_helper_w32_console_SOURCES = \
51   gnunet-helper-w32-console.c \
52   gnunet-helper-w32-console.h
53 gnunet_helper_w32_console_LDADD = \
54   libgnunetutil.la
55
56 gnunet_config_diff_SOURCES = \
57  gnunet-config-diff.c
58 gnunet_config_diff_LDADD = \
59  libgnunetutil.la
60
61 test_common_logging_dummy_SOURCES = \
62  test_common_logging_dummy.c
63 test_common_logging_dummy_LDADD = \
64  libgnunetutil.la
65
66 libgnunetutil_la_SOURCES = \
67   bandwidth.c \
68   $(BENCHMARK) \
69   bio.c \
70   client.c \
71   common_allocation.c \
72   common_endian.c \
73   common_logging.c \
74   configuration.c \
75   configuration_loader.c \
76   container_bloomfilter.c \
77   container_heap.c \
78   container_meta_data.c \
79   container_multihashmap.c \
80   container_multishortmap.c \
81   container_multipeermap.c \
82   container_multihashmap32.c \
83   crypto_symmetric.c \
84   crypto_crc.c \
85   crypto_ecc.c \
86   crypto_ecc_dlog.c \
87   crypto_ecc_setup.c \
88   crypto_hash.c \
89   crypto_hash_file.c \
90   crypto_hkdf.c \
91   crypto_kdf.c \
92   crypto_mpi.c \
93   crypto_paillier.c \
94   crypto_random.c \
95   crypto_rsa.c \
96   disk.c \
97   disk.h \
98   dnsparser.c \
99   dnsstub.c \
100   getopt.c \
101   getopt_helpers.c \
102   helper.c \
103   load.c \
104   mst.c \
105   mq.c \
106   nc.c \
107   network.c \
108   op.c \
109   os_installation.c \
110   os_network.c \
111   os_priority.c \
112   peer.c \
113   plugin.c \
114   program.c \
115   regex.c \
116   resolver_api.c resolver.h \
117   scheduler.c \
118   service.c \
119   signal.c \
120   strings.c \
121   time.c \
122   tun.c \
123   speedup.c speedup.h \
124         proc_compat.c
125
126 if HAVE_LIBATOMIC
127 if DARWIN
128         LIBATOMIC=
129 else
130   LIBATOMIC= -latomic
131 endif
132 else
133   LIBATOMIC=
134 endif
135
136 if HAVE_LIBIDN
137   LIBIDN= -lidn
138 else
139   LIBIDN=
140 endif
141
142 if HAVE_LIBIDN2
143   LIBIDN2= -lidn2
144 else
145   LIBIDN2=
146 endif
147
148 libgnunetutil_la_LIBADD = \
149   $(GCLIBADD) $(WINLIB) \
150   $(LIBATOMIC) \
151   $(LIBGCRYPT_LIBS) \
152   $(LTLIBICONV) \
153   $(LTLIBINTL) \
154   -lltdl \
155   $(LIBIDN) $(LIBIDN2) \
156   $(Z_LIBS) \
157   -lunistring \
158   $(XLIB) \
159   $(PTHREAD)
160
161 libgnunetutil_la_LDFLAGS = \
162   $(GN_LIB_LDFLAGS) \
163   -version-info 13:0:0
164
165 libgnunetutil_taler_wallet_la_SOURCES = \
166   common_allocation.c \
167   common_endian.c \
168   common_logging.c \
169   container_heap.c \
170   container_multihashmap.c \
171   container_multihashmap32.c \
172   crypto_symmetric.c \
173   crypto_crc.c \
174   crypto_ecc.c \
175   crypto_hash.c \
176   crypto_hkdf.c \
177   crypto_kdf.c \
178   crypto_mpi.c \
179   crypto_random.c \
180   crypto_rsa.c \
181   strings.c \
182   time.c
183
184 libgnunetutil_taler_wallet_la_LIBADD = \
185   $(LIBGCRYPT_LIBS) \
186   -lunistring
187
188 libgnunetutil_taler_wallet_la_LDFLAGS = \
189   $(GN_LIB_LDFLAGS) \
190   -version-info 0:0:0
191
192 if HAVE_TESTING
193   GNUNET_ECC = gnunet-ecc
194   GNUNET_SCRYPT = gnunet-scrypt
195 endif
196
197 if TALER_ONLY
198 lib_LTLIBRARIES = libgnunetutil_taler_wallet.la
199 else
200 lib_LTLIBRARIES = libgnunetutil.la
201
202 libexec_PROGRAMS = \
203  gnunet-service-resolver \
204  gnunet-timeout \
205  $(W32CONSOLEHELPER)
206
207 bin_SCRIPTS =\
208  gnunet-qr
209
210 bin_PROGRAMS = \
211  gnunet-resolver \
212  gnunet-config \
213  $(GNUNET_ECC) \
214  $(GNUNET_SCRYPT) \
215  gnunet-uri
216
217 noinst_PROGRAMS = \
218  gnunet-config-diff \
219  $(W32CAT) \
220  test_common_logging_dummy
221
222
223 if ENABLE_TEST_RUN
224 AM_TESTS_ENVIRONMENT=export GNUNET_PREFIX=$${GNUNET_PREFIX:-@libdir@};export PATH=$${GNUNET_PREFIX:-@prefix@}/bin:$$PATH;unset XDG_DATA_HOME;unset XDG_CONFIG_HOME;
225 TESTS = $(check_PROGRAMS)
226 endif
227
228 endif
229
230
231 if !MINGW
232 gnunet_timeout_SOURCES = \
233  gnunet-timeout.c
234 else
235 gnunet_timeout_SOURCES = \
236  gnunet-timeout-w32.c
237 endif
238
239 # This is horrible, but compared to the alternatives and the solution
240 # which preceded this it is a good compromise and good enough for one
241 # file. Everyone else is invited to patch it locally.
242 # In case someone reads this file and is wondering about the
243 # assignment operator below, it's explained here:
244 # https://lists.gnu.org/archive/html/make-w32/2013-10/msg00021.html
245
246 xENV != which env
247
248 do_subst = $(SED) -e 's,[@]ENV[@],${xENV},g'
249
250 gnunet-qr: gnunet-qr.py.in Makefile
251         $(do_subst) < $(top_srcdir)/src/util/gnunet-qr.py.in > gnunet-qr
252         chmod +x gnunet-qr
253
254 gnunet_service_resolver_SOURCES = \
255  gnunet-service-resolver.c
256 gnunet_service_resolver_LDADD = \
257   libgnunetutil.la \
258   $(GN_LIBINTL)
259 if HAVE_GETADDRINFO_A
260 gnunet_service_resolver_LDADD += -lanl
261 endif
262
263
264 gnunet_resolver_SOURCES = \
265  gnunet-resolver.c
266 gnunet_resolver_LDADD = \
267   libgnunetutil.la \
268   $(GN_LIBINTL)
269
270
271 gnunet_ecc_SOURCES = \
272  gnunet-ecc.c
273 gnunet_ecc_LDADD = \
274   libgnunetutil.la \
275   $(GN_LIBINTL) -lgcrypt
276
277 gnunet_scrypt_SOURCES = \
278  gnunet-scrypt.c
279 gnunet_scrypt_LDADD = \
280   libgnunetutil.la \
281   $(GN_LIBINTL) -lgcrypt
282
283
284 gnunet_config_SOURCES = \
285  gnunet-config.c
286 gnunet_config_LDADD = \
287   libgnunetutil.la \
288   $(GN_LIBINTL)
289
290
291 gnunet_uri_SOURCES = \
292  gnunet-uri.c
293 gnunet_uri_LDADD = \
294   libgnunetutil.la \
295   $(GN_LIBINTL)
296
297 plugin_LTLIBRARIES = \
298   libgnunet_plugin_test.la
299
300 libgnunet_plugin_test_la_SOURCES = \
301   test_plugin_plug.c
302 libgnunet_plugin_test_la_LDFLAGS = \
303  $(GN_PLUGIN_LDFLAGS)
304
305 if HAVE_BENCHMARKS
306  BENCHMARKS = \
307   perf_crypto_hash \
308   perf_crypto_ecc_dlog \
309   perf_crypto_rsa \
310   perf_crypto_paillier \
311   perf_crypto_symmetric \
312   perf_crypto_asymmetric \
313   perf_malloc
314 endif
315
316 if HAVE_SSH_KEY
317 # SSH_USING_TESTS = test_socks.nc
318 endif
319
320 check_PROGRAMS = \
321  test_bio \
322  test_client.nc \
323  $(TEST_CLIENT_UNIX_NC) \
324  test_common_allocation \
325  test_common_endian \
326  test_common_logging \
327  test_configuration \
328  test_container_bloomfilter \
329  test_container_dll \
330  test_container_meta_data \
331  test_container_multihashmap \
332  test_container_multihashmap32 \
333  test_container_multipeermap \
334  test_container_heap \
335  test_crypto_symmetric \
336  test_crypto_crc \
337  test_crypto_ecdsa \
338  test_crypto_eddsa \
339  test_crypto_ecdhe \
340  test_crypto_ecdh_eddsa \
341  test_crypto_ecc_dlog \
342  test_crypto_hash \
343  test_crypto_hash_context \
344  test_crypto_hkdf \
345  test_crypto_kdf \
346  test_crypto_paillier \
347  test_crypto_random \
348  test_crypto_rsa \
349  test_disk \
350  test_getopt \
351  test_hexcoder \
352  test_mq \
353  test_os_network \
354  test_peer \
355  test_plugin \
356  test_program \
357  test_regex \
358  test_resolver_api.nc \
359  test_scheduler \
360  test_scheduler_delay \
361  test_service \
362  test_strings \
363  test_strings_to_data \
364  test_speedup \
365  test_time \
366  test_tun \
367  $(BENCHMARKS) \
368  test_os_start_process \
369  test_common_logging_runtime_loglevels
370
371
372 # Declare .nc (NO-CONCURRENCY) as a test extension so that we can impart
373 # sequential execution order for them
374 TEST_EXTENSIONS = .nc
375 test_test_client_unix.log: test_client.log
376
377 test_bio_SOURCES = \
378  test_bio.c
379 test_bio_LDADD = \
380  libgnunetutil.la
381
382 test_hexcoder_SOURCES = \
383  test_hexcoder.c
384 test_hexcoder_LDADD = \
385  libgnunetutil.la
386
387 test_tun_SOURCES = \
388  test_tun.c
389 test_tun_LDADD = \
390  libgnunetutil.la
391
392 test_regex_SOURCES = \
393  test_regex.c
394 test_regex_LDADD = \
395  libgnunetutil.la
396
397 test_os_start_process_SOURCES = \
398  test_os_start_process.c
399 test_os_start_process_LDADD = \
400  libgnunetutil.la
401 test_os_start_process_DEPENDENCIES = \
402  libgnunetutil.la \
403  $(WINCAT)
404
405 test_client_nc_SOURCES = \
406  test_client.c
407 test_client_nc_LDADD = \
408  libgnunetutil.la
409
410 test_client_unix_nc_SOURCES = \
411  test_client.c
412 test_client_unix_nc_LDADD = \
413  libgnunetutil.la
414
415 #test_socks_nc_SOURCES = \
416 # test_socks.c
417 #test_socks_nc_LDADD = \
418 # libgnunetutil.la
419
420 test_common_allocation_SOURCES = \
421  test_common_allocation.c
422 test_common_allocation_LDADD = \
423  libgnunetutil.la
424
425 test_common_endian_SOURCES = \
426  test_common_endian.c
427 test_common_endian_LDADD = \
428  libgnunetutil.la
429
430 test_common_logging_SOURCES = \
431  test_common_logging.c
432 test_common_logging_LDADD = \
433  libgnunetutil.la
434
435 test_common_logging_runtime_loglevels_SOURCES = \
436  test_common_logging_runtime_loglevels.c
437 test_common_logging_runtime_loglevels_LDADD = \
438  libgnunetutil.la
439
440 test_configuration_SOURCES = \
441  test_configuration.c
442 test_configuration_LDADD = \
443  libgnunetutil.la
444
445 test_container_bloomfilter_SOURCES = \
446  test_container_bloomfilter.c
447 test_container_bloomfilter_LDADD = \
448  libgnunetutil.la
449
450 test_container_dll_SOURCES = \
451  test_container_dll.c
452 test_container_dll_LDADD = \
453  libgnunetutil.la
454
455 test_container_meta_data_SOURCES = \
456  test_container_meta_data.c
457 test_container_meta_data_LDADD = \
458  libgnunetutil.la
459
460 test_container_multihashmap_SOURCES = \
461  test_container_multihashmap.c
462 test_container_multihashmap_LDADD = \
463  libgnunetutil.la
464
465 test_container_multihashmap32_SOURCES = \
466  test_container_multihashmap32.c
467 test_container_multihashmap32_LDADD = \
468  libgnunetutil.la
469
470 test_container_multipeermap_SOURCES = \
471  test_container_multipeermap.c
472 test_container_multipeermap_LDADD = \
473  libgnunetutil.la
474
475 test_container_heap_SOURCES = \
476  test_container_heap.c
477 test_container_heap_LDADD = \
478  libgnunetutil.la
479
480 test_crypto_symmetric_SOURCES = \
481  test_crypto_symmetric.c
482 test_crypto_symmetric_LDADD = \
483  libgnunetutil.la
484
485 test_crypto_crc_SOURCES = \
486  test_crypto_crc.c
487 test_crypto_crc_LDADD = \
488  libgnunetutil.la
489
490 test_crypto_ecdsa_SOURCES = \
491  test_crypto_ecdsa.c
492 test_crypto_ecdsa_LDADD = \
493  libgnunetutil.la \
494  $(LIBGCRYPT_LIBS)
495
496 test_crypto_eddsa_SOURCES = \
497  test_crypto_eddsa.c
498 test_crypto_eddsa_LDADD = \
499  libgnunetutil.la \
500  $(LIBGCRYPT_LIBS)
501
502 test_crypto_ecc_dlog_SOURCES = \
503  test_crypto_ecc_dlog.c
504 test_crypto_ecc_dlog_LDADD = \
505  libgnunetutil.la \
506  $(LIBGCRYPT_LIBS)
507
508 test_crypto_ecdhe_SOURCES = \
509  test_crypto_ecdhe.c
510 test_crypto_ecdhe_LDADD = \
511  libgnunetutil.la \
512  $(LIBGCRYPT_LIBS)
513
514 test_crypto_ecdh_eddsa_SOURCES = \
515  test_crypto_ecdh_eddsa.c
516 test_crypto_ecdh_eddsa_LDADD = \
517  libgnunetutil.la \
518  $(LIBGCRYPT_LIBS)
519
520 test_crypto_hash_SOURCES = \
521  test_crypto_hash.c
522 test_crypto_hash_LDADD = \
523  libgnunetutil.la
524
525 test_crypto_hash_context_SOURCES = \
526  test_crypto_hash_context.c
527 test_crypto_hash_context_LDADD = \
528  libgnunetutil.la
529
530 test_crypto_hkdf_SOURCES = \
531  test_crypto_hkdf.c
532 test_crypto_hkdf_LDADD = \
533  libgnunetutil.la
534
535 test_crypto_kdf_SOURCES = \
536  test_crypto_kdf.c
537 test_crypto_kdf_LDADD = \
538  libgnunetutil.la -lgcrypt
539
540 test_crypto_paillier_SOURCES = \
541  test_crypto_paillier.c
542 test_crypto_paillier_LDADD = \
543  $(LIBGCRYPT_LIBS) \
544  libgnunetutil.la
545
546 test_crypto_random_SOURCES = \
547  test_crypto_random.c
548 test_crypto_random_LDADD = \
549  libgnunetutil.la
550
551 test_crypto_rsa_SOURCES = \
552  test_crypto_rsa.c
553 test_crypto_rsa_LDADD = \
554  libgnunetutil.la -lgcrypt
555
556 test_disk_SOURCES = \
557  test_disk.c
558 test_disk_LDADD = \
559  libgnunetutil.la
560
561 test_getopt_SOURCES = \
562  test_getopt.c
563 test_getopt_LDADD = \
564  libgnunetutil.la
565
566 test_mq_SOURCES = \
567  test_mq.c
568 test_mq_LDADD = \
569  libgnunetutil.la
570
571 test_os_network_SOURCES = \
572  test_os_network.c
573 test_os_network_LDADD = \
574  libgnunetutil.la
575
576 test_peer_SOURCES = \
577  test_peer.c
578 test_peer_LDADD = \
579  libgnunetutil.la -lgcrypt
580
581 test_plugin_SOURCES = \
582  test_plugin.c
583 test_plugin_LDADD = \
584  libgnunetutil.la
585
586 test_program_SOURCES = \
587  test_program.c
588 test_program_LDADD = \
589  libgnunetutil.la
590
591 test_resolver_api_nc_SOURCES = \
592  test_resolver_api.c
593 test_resolver_api_nc_LDADD = \
594  libgnunetutil.la
595
596 test_scheduler_SOURCES = \
597  test_scheduler.c
598 test_scheduler_LDADD = \
599  libgnunetutil.la
600
601 test_scheduler_delay_SOURCES = \
602  test_scheduler_delay.c
603 test_scheduler_delay_LDADD = \
604  libgnunetutil.la
605
606 test_service_SOURCES = \
607  test_service.c
608 test_service_LDADD = \
609  libgnunetutil.la
610
611 test_strings_SOURCES = \
612  test_strings.c
613 test_strings_LDADD = \
614  libgnunetutil.la
615
616 test_strings_to_data_SOURCES = \
617  test_strings_to_data.c
618 test_strings_to_data_LDADD = \
619  libgnunetutil.la
620
621
622 test_time_SOURCES = \
623  test_time.c
624 test_time_LDADD = \
625  libgnunetutil.la
626
627 test_speedup_SOURCES = \
628  test_speedup.c
629 test_speedup_LDADD = \
630  libgnunetutil.la
631
632 perf_crypto_hash_SOURCES = \
633  perf_crypto_hash.c
634 perf_crypto_hash_LDADD = \
635  libgnunetutil.la
636
637 perf_crypto_ecc_dlog_SOURCES = \
638  perf_crypto_ecc_dlog.c
639 perf_crypto_ecc_dlog_LDADD = \
640  libgnunetutil.la \
641  -lgcrypt
642
643 perf_crypto_rsa_SOURCES = \
644  perf_crypto_rsa.c
645 perf_crypto_rsa_LDADD = \
646  libgnunetutil.la
647
648 perf_crypto_symmetric_SOURCES = \
649  perf_crypto_symmetric.c
650 perf_crypto_symmetric_LDADD = \
651  libgnunetutil.la
652
653 perf_crypto_asymmetric_SOURCES = \
654  perf_crypto_asymmetric.c
655 perf_crypto_asymmetric_LDADD = \
656  libgnunetutil.la
657
658 perf_crypto_paillier_SOURCES = \
659  perf_crypto_paillier.c
660 perf_crypto_paillier_LDADD = \
661  libgnunetutil.la \
662  -lgcrypt
663
664 perf_malloc_SOURCES = \
665  perf_malloc.c
666 perf_malloc_LDADD = \
667  libgnunetutil.la
668
669
670 EXTRA_DIST = \
671   test_client_data.conf \
672   test_client_unix.conf \
673   test_configuration_data.conf \
674   test_program_data.conf \
675   test_resolver_api_data.conf \
676   test_service_data.conf \
677   test_speedup_data.conf \
678   gnunet-qr.py.in