gnunet-qr: Use GNUNET_PROGRAM_run to simplify the code.
[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_PROGRAMS = \
208  gnunet-resolver \
209  gnunet-config \
210  $(GNUNET_ECC) \
211  $(GNUNET_SCRYPT) \
212  gnunet-uri
213 if HAVE_ZBAR
214 bin_PROGRAMS += gnunet-qr
215 endif
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 gnunet_service_resolver_SOURCES = \
240  gnunet-service-resolver.c
241 gnunet_service_resolver_LDADD = \
242   libgnunetutil.la \
243   $(GN_LIBINTL)
244 if HAVE_GETADDRINFO_A
245 gnunet_service_resolver_LDADD += -lanl
246 endif
247
248
249 gnunet_resolver_SOURCES = \
250  gnunet-resolver.c
251 gnunet_resolver_LDADD = \
252   libgnunetutil.la \
253   $(GN_LIBINTL)
254
255
256 gnunet_ecc_SOURCES = \
257  gnunet-ecc.c
258 gnunet_ecc_LDADD = \
259   libgnunetutil.la \
260   $(GN_LIBINTL) -lgcrypt
261
262 gnunet_scrypt_SOURCES = \
263  gnunet-scrypt.c
264 gnunet_scrypt_LDADD = \
265   libgnunetutil.la \
266   $(GN_LIBINTL) -lgcrypt
267
268
269 gnunet_config_SOURCES = \
270  gnunet-config.c
271 gnunet_config_LDADD = \
272   libgnunetutil.la \
273   $(GN_LIBINTL)
274
275 gnunet_uri_SOURCES = \
276  gnunet-uri.c
277 gnunet_uri_LDADD = \
278   libgnunetutil.la \
279   $(GN_LIBINTL)
280
281
282 gnunet_qr_SOURCES = \
283   gnunet-qr.c \
284   gnunet-qr-utils.h
285 gnunet_qr_LDADD = \
286   libgnunetutil.la \
287   $(GN_LIBINTL)
288 gnunet_qr_LDFLAGS= $(libzbar_LIBS)
289 gnunet_qr_CFLAGS = $(libzbar_CFLAGS) -DBINDIR=\"@bindir@/\"
290
291 plugin_LTLIBRARIES = \
292   libgnunet_plugin_test.la
293
294 libgnunet_plugin_test_la_SOURCES = \
295   test_plugin_plug.c
296 libgnunet_plugin_test_la_LDFLAGS = \
297  $(GN_PLUGIN_LDFLAGS)
298
299 if HAVE_BENCHMARKS
300  BENCHMARKS = \
301   perf_crypto_hash \
302   perf_crypto_ecc_dlog \
303   perf_crypto_rsa \
304   perf_crypto_paillier \
305   perf_crypto_symmetric \
306   perf_crypto_asymmetric \
307   perf_malloc
308 endif
309
310 if HAVE_SSH_KEY
311 # SSH_USING_TESTS = test_socks.nc
312 endif
313
314 check_PROGRAMS = \
315  test_bio \
316  test_client.nc \
317  $(TEST_CLIENT_UNIX_NC) \
318  test_common_allocation \
319  test_common_endian \
320  test_common_logging \
321  test_configuration \
322  test_container_bloomfilter \
323  test_container_dll \
324  test_container_meta_data \
325  test_container_multihashmap \
326  test_container_multihashmap32 \
327  test_container_multipeermap \
328  test_container_heap \
329  test_crypto_symmetric \
330  test_crypto_crc \
331  test_crypto_ecdsa \
332  test_crypto_eddsa \
333  test_crypto_ecdhe \
334  test_crypto_ecdh_eddsa \
335  test_crypto_ecc_dlog \
336  test_crypto_hash \
337  test_crypto_hash_context \
338  test_crypto_hkdf \
339  test_crypto_kdf \
340  test_crypto_paillier \
341  test_crypto_random \
342  test_crypto_rsa \
343  test_disk \
344  test_getopt \
345  test_hexcoder \
346  test_mq \
347  test_os_network \
348  test_peer \
349  test_plugin \
350  test_program \
351  test_regex \
352  test_resolver_api.nc \
353  test_scheduler \
354  test_scheduler_delay \
355  test_service \
356  test_strings \
357  test_strings_to_data \
358  test_speedup \
359  test_time \
360  test_tun \
361  $(BENCHMARKS) \
362  test_os_start_process \
363  test_common_logging_runtime_loglevels
364
365
366 # Declare .nc (NO-CONCURRENCY) as a test extension so that we can impart
367 # sequential execution order for them
368 TEST_EXTENSIONS = .nc
369 test_test_client_unix.log: test_client.log
370
371 test_bio_SOURCES = \
372  test_bio.c
373 test_bio_LDADD = \
374  libgnunetutil.la
375
376 test_hexcoder_SOURCES = \
377  test_hexcoder.c
378 test_hexcoder_LDADD = \
379  libgnunetutil.la
380
381 test_tun_SOURCES = \
382  test_tun.c
383 test_tun_LDADD = \
384  libgnunetutil.la
385
386 test_regex_SOURCES = \
387  test_regex.c
388 test_regex_LDADD = \
389  libgnunetutil.la
390
391 test_os_start_process_SOURCES = \
392  test_os_start_process.c
393 test_os_start_process_LDADD = \
394  libgnunetutil.la
395 test_os_start_process_DEPENDENCIES = \
396  libgnunetutil.la \
397  $(WINCAT)
398
399 test_client_nc_SOURCES = \
400  test_client.c
401 test_client_nc_LDADD = \
402  libgnunetutil.la
403
404 test_client_unix_nc_SOURCES = \
405  test_client.c
406 test_client_unix_nc_LDADD = \
407  libgnunetutil.la
408
409 #test_socks_nc_SOURCES = \
410 # test_socks.c
411 #test_socks_nc_LDADD = \
412 # libgnunetutil.la
413
414 test_common_allocation_SOURCES = \
415  test_common_allocation.c
416 test_common_allocation_LDADD = \
417  libgnunetutil.la
418
419 test_common_endian_SOURCES = \
420  test_common_endian.c
421 test_common_endian_LDADD = \
422  libgnunetutil.la
423
424 test_common_logging_SOURCES = \
425  test_common_logging.c
426 test_common_logging_LDADD = \
427  libgnunetutil.la
428
429 test_common_logging_runtime_loglevels_SOURCES = \
430  test_common_logging_runtime_loglevels.c
431 test_common_logging_runtime_loglevels_LDADD = \
432  libgnunetutil.la
433
434 test_configuration_SOURCES = \
435  test_configuration.c
436 test_configuration_LDADD = \
437  libgnunetutil.la
438
439 test_container_bloomfilter_SOURCES = \
440  test_container_bloomfilter.c
441 test_container_bloomfilter_LDADD = \
442  libgnunetutil.la
443
444 test_container_dll_SOURCES = \
445  test_container_dll.c
446 test_container_dll_LDADD = \
447  libgnunetutil.la
448
449 test_container_meta_data_SOURCES = \
450  test_container_meta_data.c
451 test_container_meta_data_LDADD = \
452  libgnunetutil.la
453
454 test_container_multihashmap_SOURCES = \
455  test_container_multihashmap.c
456 test_container_multihashmap_LDADD = \
457  libgnunetutil.la
458
459 test_container_multihashmap32_SOURCES = \
460  test_container_multihashmap32.c
461 test_container_multihashmap32_LDADD = \
462  libgnunetutil.la
463
464 test_container_multipeermap_SOURCES = \
465  test_container_multipeermap.c
466 test_container_multipeermap_LDADD = \
467  libgnunetutil.la
468
469 test_container_heap_SOURCES = \
470  test_container_heap.c
471 test_container_heap_LDADD = \
472  libgnunetutil.la
473
474 test_crypto_symmetric_SOURCES = \
475  test_crypto_symmetric.c
476 test_crypto_symmetric_LDADD = \
477  libgnunetutil.la
478
479 test_crypto_crc_SOURCES = \
480  test_crypto_crc.c
481 test_crypto_crc_LDADD = \
482  libgnunetutil.la
483
484 test_crypto_ecdsa_SOURCES = \
485  test_crypto_ecdsa.c
486 test_crypto_ecdsa_LDADD = \
487  libgnunetutil.la \
488  $(LIBGCRYPT_LIBS)
489
490 test_crypto_eddsa_SOURCES = \
491  test_crypto_eddsa.c
492 test_crypto_eddsa_LDADD = \
493  libgnunetutil.la \
494  $(LIBGCRYPT_LIBS)
495
496 test_crypto_ecc_dlog_SOURCES = \
497  test_crypto_ecc_dlog.c
498 test_crypto_ecc_dlog_LDADD = \
499  libgnunetutil.la \
500  $(LIBGCRYPT_LIBS)
501
502 test_crypto_ecdhe_SOURCES = \
503  test_crypto_ecdhe.c
504 test_crypto_ecdhe_LDADD = \
505  libgnunetutil.la \
506  $(LIBGCRYPT_LIBS)
507
508 test_crypto_ecdh_eddsa_SOURCES = \
509  test_crypto_ecdh_eddsa.c
510 test_crypto_ecdh_eddsa_LDADD = \
511  libgnunetutil.la \
512  $(LIBGCRYPT_LIBS)
513
514 test_crypto_hash_SOURCES = \
515  test_crypto_hash.c
516 test_crypto_hash_LDADD = \
517  libgnunetutil.la
518
519 test_crypto_hash_context_SOURCES = \
520  test_crypto_hash_context.c
521 test_crypto_hash_context_LDADD = \
522  libgnunetutil.la
523
524 test_crypto_hkdf_SOURCES = \
525  test_crypto_hkdf.c
526 test_crypto_hkdf_LDADD = \
527  libgnunetutil.la
528
529 test_crypto_kdf_SOURCES = \
530  test_crypto_kdf.c
531 test_crypto_kdf_LDADD = \
532  libgnunetutil.la -lgcrypt
533
534 test_crypto_paillier_SOURCES = \
535  test_crypto_paillier.c
536 test_crypto_paillier_LDADD = \
537  $(LIBGCRYPT_LIBS) \
538  libgnunetutil.la
539
540 test_crypto_random_SOURCES = \
541  test_crypto_random.c
542 test_crypto_random_LDADD = \
543  libgnunetutil.la
544
545 test_crypto_rsa_SOURCES = \
546  test_crypto_rsa.c
547 test_crypto_rsa_LDADD = \
548  libgnunetutil.la -lgcrypt
549
550 test_disk_SOURCES = \
551  test_disk.c
552 test_disk_LDADD = \
553  libgnunetutil.la
554
555 test_getopt_SOURCES = \
556  test_getopt.c
557 test_getopt_LDADD = \
558  libgnunetutil.la
559
560 test_mq_SOURCES = \
561  test_mq.c
562 test_mq_LDADD = \
563  libgnunetutil.la
564
565 test_os_network_SOURCES = \
566  test_os_network.c
567 test_os_network_LDADD = \
568  libgnunetutil.la
569
570 test_peer_SOURCES = \
571  test_peer.c
572 test_peer_LDADD = \
573  libgnunetutil.la -lgcrypt
574
575 test_plugin_SOURCES = \
576  test_plugin.c
577 test_plugin_LDADD = \
578  libgnunetutil.la
579
580 test_program_SOURCES = \
581  test_program.c
582 test_program_LDADD = \
583  libgnunetutil.la
584
585 test_resolver_api_nc_SOURCES = \
586  test_resolver_api.c
587 test_resolver_api_nc_LDADD = \
588  libgnunetutil.la
589
590 test_scheduler_SOURCES = \
591  test_scheduler.c
592 test_scheduler_LDADD = \
593  libgnunetutil.la
594
595 test_scheduler_delay_SOURCES = \
596  test_scheduler_delay.c
597 test_scheduler_delay_LDADD = \
598  libgnunetutil.la
599
600 test_service_SOURCES = \
601  test_service.c
602 test_service_LDADD = \
603  libgnunetutil.la
604
605 test_strings_SOURCES = \
606  test_strings.c
607 test_strings_LDADD = \
608  libgnunetutil.la
609
610 test_strings_to_data_SOURCES = \
611  test_strings_to_data.c
612 test_strings_to_data_LDADD = \
613  libgnunetutil.la
614
615
616 test_time_SOURCES = \
617  test_time.c
618 test_time_LDADD = \
619  libgnunetutil.la
620
621 test_speedup_SOURCES = \
622  test_speedup.c
623 test_speedup_LDADD = \
624  libgnunetutil.la
625
626 perf_crypto_hash_SOURCES = \
627  perf_crypto_hash.c
628 perf_crypto_hash_LDADD = \
629  libgnunetutil.la
630
631 perf_crypto_ecc_dlog_SOURCES = \
632  perf_crypto_ecc_dlog.c
633 perf_crypto_ecc_dlog_LDADD = \
634  libgnunetutil.la \
635  -lgcrypt
636
637 perf_crypto_rsa_SOURCES = \
638  perf_crypto_rsa.c
639 perf_crypto_rsa_LDADD = \
640  libgnunetutil.la
641
642 perf_crypto_symmetric_SOURCES = \
643  perf_crypto_symmetric.c
644 perf_crypto_symmetric_LDADD = \
645  libgnunetutil.la
646
647 perf_crypto_asymmetric_SOURCES = \
648  perf_crypto_asymmetric.c
649 perf_crypto_asymmetric_LDADD = \
650  libgnunetutil.la
651
652 perf_crypto_paillier_SOURCES = \
653  perf_crypto_paillier.c
654 perf_crypto_paillier_LDADD = \
655  libgnunetutil.la \
656  -lgcrypt
657
658 perf_malloc_SOURCES = \
659  perf_malloc.c
660 perf_malloc_LDADD = \
661  libgnunetutil.la
662
663
664 EXTRA_DIST = \
665   test_client_data.conf \
666   test_client_unix.conf \
667   test_configuration_data.conf \
668   test_program_data.conf \
669   test_resolver_api_data.conf \
670   test_service_data.conf \
671   test_speedup_data.conf