253f67d2950db5fdea71c59495502a3a54b9d495
[oweals/gnunet.git] / src / gns / Makefile.am
1 # This Makefile.am is in the public domain
2 AM_CPPFLAGS = -I$(top_srcdir)/src/include
3
4 if HAVE_GLIBCNSS
5 NSS_SUBDIR = nss
6 endif
7
8 SUBDIRS = . $(NSS_SUBDIR)
9
10 pkgdata_DATA = \
11   gnunet-gns-proxy-ca.template
12
13 EXTRA_DIST = \
14   test_gns_defaults.conf \
15   test_gns_lookup.conf \
16   test_gns_proxy.conf \
17   test_gns_simple_lookup.conf \
18   openssl.cnf \
19   gnunet-gns-proxy-setup-ca.in \
20   zonefiles/J7POEUT41A8PBFS7KVVDRF88GBOU4HK8PSU5QKVLVE3R9T91E99G.zkey \
21   zonefiles/OEFL7A4VEF1B40QLEMTG5D8G1CN6EN16QUSG5R2DT71GRJN34LSG.zkey \
22   zonefiles/test_zonekey \
23   $(check_SCRIPTS) \
24   $(pkgdata_DATA)
25
26 USE_VPN = $(top_builddir)/src/vpn/libgnunetvpn.la
27
28 if USE_COVERAGE
29   AM_CFLAGS = --coverage -O0
30 endif
31
32 pkgcfgdir = $(pkgdatadir)/config.d/
33
34 libexecdir= $(pkglibdir)/libexec/
35
36 plugindir = $(libdir)/gnunet
37
38 pkgcfg_DATA = \
39   gns.conf
40
41 lib_LTLIBRARIES = \
42   libgnunetgns.la
43
44
45 if HAVE_MHD
46 if HAVE_GNUTLS
47 if HAVE_LIBGNURL
48   DO_PROXY=gnunet-gns-proxy
49 LIB_GNURL=@LIBGNURL@
50 CPP_GNURL=@LIBGNURL_CPPFLAGS@
51 else
52 if HAVE_LIBCURL
53   DO_PROXY=gnunet-gns-proxy
54 LIB_GNURL=@LIBCURL@
55 CPP_GNURL=@LIBCURL_CPPFLAGS@
56 endif
57 endif
58 endif
59 endif
60
61 libexec_PROGRAMS = \
62   gnunet-service-gns \
63   gnunet-dns2gns \
64   $(DO_PROXY)
65
66 bin_PROGRAMS = \
67   gnunet-gns
68
69 noinst_PROGRAMS = \
70   gnunet-gns-benchmark
71
72 if HAVE_MHD
73 if LINUX
74 bin_PROGRAMS += gnunet-bcd
75 endif
76 endif
77
78 if HAVE_MHD
79 if HAVE_JSON
80 REST_PLUGIN = libgnunet_plugin_rest_gns.la
81 endif
82 endif
83
84 plugin_LTLIBRARIES = \
85   libgnunet_plugin_block_gns.la \
86   libgnunet_plugin_gnsrecord_gns.la \
87   $(REST_PLUGIN)
88
89
90 bin_SCRIPTS = \
91   gnunet-gns-proxy-setup-ca
92
93 # See: https://www.gnu.org/software/automake/manual/html_node/Scripts.html#Scripts
94 do_subst = sed -e 's,[@]pkgdatadir[@],$(pkgdatadir),g'
95
96 gnunet-gns-proxy-setup-ca: gnunet-gns-proxy-setup-ca.in Makefile
97         $(do_subst) < $(srcdir)/gnunet-gns-proxy-setup-ca.in > gnunet-gns-proxy-setup-ca
98         chmod +x gnunet-gns-proxy-setup-ca
99
100
101 libgnunet_plugin_rest_gns_la_SOURCES = \
102   plugin_rest_gns.c
103 libgnunet_plugin_rest_gns_la_LIBADD = \
104   $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
105   libgnunetgns.la \
106   $(top_builddir)/src/rest/libgnunetrest.la \
107   $(top_builddir)/src/identity/libgnunetidentity.la \
108   $(top_builddir)/src/json/libgnunetjson.la \
109   $(top_builddir)/src/util/libgnunetutil.la $(XLIBS) \
110   $(LTLIBINTL) -ljansson $(MHD_LIBS)
111 libgnunet_plugin_rest_gns_la_LDFLAGS = \
112  $(GN_PLUGIN_LDFLAGS)
113 libgnunet_plugin_rest_gns_la_CFLAGS = $(MHD_CFLAGS) $(AM_CFLAGS)
114
115
116 libgnunet_plugin_gnsrecord_gns_la_SOURCES = \
117   plugin_gnsrecord_gns.c
118 libgnunet_plugin_gnsrecord_gns_la_LIBADD = \
119   $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
120   $(top_builddir)/src/util/libgnunetutil.la \
121   $(LTLIBINTL)
122 libgnunet_plugin_gnsrecord_gns_la_LDFLAGS = \
123  $(GN_PLUGIN_LDFLAGS)
124
125
126 gnunet_gns_SOURCES = \
127  gnunet-gns.c
128 gnunet_gns_LDADD = \
129   libgnunetgns.la \
130   $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
131   $(top_builddir)/src/util/libgnunetutil.la \
132   $(GN_LIBINTL)
133
134 gnunet_gns_benchmark_SOURCES = \
135  gnunet-gns-benchmark.c
136 gnunet_gns_benchmark_LDADD = \
137   libgnunetgns.la \
138   $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
139   $(top_builddir)/src/util/libgnunetutil.la \
140   $(GN_LIBINTL)
141
142
143 gnunet_bcd_SOURCES = \
144  gnunet-bcd.c
145 gnunet_bcd_LDADD = \
146   $(top_builddir)/src/util/libgnunetutil.la \
147   $(GN_LIBINTL) $(MHD_LIBS)
148 gnunet_bcd_CFLAGS = $(MHD_CFLAGS) $(AM_CFLAGS)
149
150
151 gnunet_dns2gns_SOURCES = \
152  gnunet-dns2gns.c
153 gnunet_dns2gns_LDADD = \
154   $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
155   libgnunetgns.la \
156   $(top_builddir)/src/util/libgnunetutil.la \
157   $(top_builddir)/src/identity/libgnunetidentity.la \
158   $(GN_LIBINTL)
159
160 if HAVE_SUDO
161 SUDO_OR_DOAS_BINARY= $(SUDO_BINARY)
162 else
163 if HAVE_DOAS_BINARY
164 SUDO_OR_DOAS_BINARY= $(DOAS_BINARY)
165 endif
166 endif
167
168 if LINUX
169 HIJACKBIN = gnunet-dns2gns
170 install-exec-hook:
171         $(SUDO_OR_DOAS_BINARY) setcap 'cap_net_bind_service=+ep' $(DESTDIR)$(libexecdir)/gnunet-dns2gns || true
172 else
173 install-exec-hook:
174 endif
175
176 gnunet_gns_proxy_SOURCES = \
177  gnunet-gns-proxy.c
178 gnunet_gns_proxy_LDADD = $(MHD_LIBS) $(LIB_GNURL) -lgnutls \
179   libgnunetgns.la \
180   $(top_builddir)/src/identity/libgnunetidentity.la \
181   $(top_builddir)/src/util/libgnunetutil.la \
182   $(GN_LIBINTL)
183 if HAVE_GNUTLS_DANE
184 gnunet_gns_proxy_LDADD += -lgnutls-dane
185 endif
186 gnunet_gns_proxy_CFLAGS = $(MHD_CFLAGS) $(CPP_GNURL) $(AM_CFLAGS)
187
188 test_gns_proxy_SOURCES = \
189   test_gns_proxy.c
190 test_gns_proxy_LDADD = $(MHD_LIBS) $(LIB_GNURL) -lgnutls \
191   $(top_builddir)/src/util/libgnunetutil.la \
192   $(GN_LIBINTL)
193 test_gns_proxy_CFLAGS = $(MHD_CFLAGS) $(CPP_GNURL) $(AM_CFLAGS)
194
195 #gnunet_gns_import_SOURCES = \
196 #  gnunet-gns-import.c
197 #gnunet_gns_import_LDADD = \
198 #  $(top_builddir)/src/identity/libgnunetidentity.la \
199 #  $(top_builddir)/src/namestore/libgnunetnamestore.la \
200 #  $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
201 #  $(top_builddir)/src/util/libgnunetutil.la \
202 #  $(GN_LIBINTL)
203
204
205 gnunet_service_gns_SOURCES = \
206  gnunet-service-gns.c gnunet-service-gns.h \
207  gnunet-service-gns_resolver.c gnunet-service-gns_resolver.h \
208  gnunet-service-gns_interceptor.c gnunet-service-gns_interceptor.h
209 gnunet_service_gns_LDADD = \
210   -lm \
211   $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
212   $(top_builddir)/src/identity/libgnunetidentity.la \
213   $(top_builddir)/src/revocation/libgnunetrevocation.la \
214   $(top_builddir)/src/statistics/libgnunetstatistics.la \
215   $(top_builddir)/src/util/libgnunetutil.la \
216   $(top_builddir)/src/dns/libgnunetdns.la \
217   $(top_builddir)/src/dht/libgnunetdht.la \
218   $(top_builddir)/src/namecache/libgnunetnamecache.la \
219   $(USE_VPN) \
220   $(GN_LIBINTL)
221
222
223 libgnunetgns_la_SOURCES = \
224  gns_api.c gns_api.h \
225  gns_tld_api.c gns.h
226 libgnunetgns_la_LIBADD = \
227  $(top_builddir)/src/util/libgnunetutil.la $(XLIB) \
228  $(top_builddir)/src/identity/libgnunetidentity.la \
229  $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la
230 libgnunetgns_la_LDFLAGS = \
231   $(GN_LIBINTL) \
232   $(GN_LIB_LDFLAGS)
233
234
235 libgnunet_plugin_block_gns_la_SOURCES = \
236   plugin_block_gns.c
237 libgnunet_plugin_block_gns_la_LIBADD = \
238   $(top_builddir)/src/util/libgnunetutil.la \
239   $(top_builddir)/src/block/libgnunetblock.la \
240   $(top_builddir)/src/block/libgnunetblockgroup.la \
241   $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la
242 libgnunet_plugin_block_gns_la_LDFLAGS = \
243   $(GN_LIBINTL) \
244   $(GN_PLUGIN_LDFLAGS)
245
246 if HAVE_MHD
247 if HAVE_GNUTLS
248 if HAVE_LIBGNURL
249 check_PROGRAMS = \
250   test_gns_proxy
251 endif
252 endif
253 endif
254
255 check_SCRIPTS = \
256   test_gns_lookup.sh \
257   test_gns_config_lookup.sh \
258   test_gns_ipv6_lookup.sh\
259   test_gns_txt_lookup.sh\
260   test_gns_caa_lookup.sh\
261   test_gns_mx_lookup.sh \
262   test_gns_gns2dns_lookup.sh \
263   test_gns_gns2dns_cname_lookup.sh \
264   test_gns_dht_lookup.sh\
265   test_gns_delegated_lookup.sh \
266   test_gns_at_lookup.sh\
267   test_gns_zkey_lookup.sh\
268   test_gns_rel_expiration.sh\
269   test_gns_soa_lookup.sh\
270   test_gns_revocation.sh\
271   test_gns_cname_lookup.sh
272
273 if HAVE_MHD
274 if HAVE_GNUTLS
275 if HAVE_LIBGNURL
276 check_SCRIPTS += \
277   test_proxy.sh
278 endif
279 endif
280 if HAVE_JSON
281 check_SCRIPTS += \
282   test_plugin_rest_gns.sh
283 endif
284 endif
285
286
287 if ENABLE_TEST_RUN
288 if HAVE_SQLITE
289  AM_TESTS_ENVIRONMENT=export GNUNET_PREFIX=$${GNUNET_PREFIX:-@libdir@};export PATH=$${GNUNET_PREFIX:-@prefix@}/bin:$$PATH;unset XDG_DATA_HOME;unset XDG_CONFIG_HOME;
290  TESTS = $(check_SCRIPTS)
291 endif
292 endif