]> git.ipfire.org Git - thirdparty/pdns.git/blob - pdns/dnsdistdist/Makefile.am
dnsdist: Allow configure CDB_CLFAGS to work
[thirdparty/pdns.git] / pdns / dnsdistdist / Makefile.am
1 AM_CPPFLAGS += $(SYSTEMD_CFLAGS) $(LUA_CFLAGS) $(LIBEDIT_CFLAGS) $(LIBSODIUM_CFLAGS) $(FSTRM_CFLAGS) $(YAHTTP_CFLAGS) $(SANITIZER_FLAGS) $(NET_SNMP_CFLAGS) $(LIBCAP_CFLAGS) -DSYSCONFDIR=\"${sysconfdir}\"
2
3 ACLOCAL_AMFLAGS = -I m4
4
5 SUBDIRS=ext/ipcrypt \
6 ext/yahttp
7
8 CLEANFILES = \
9 dnsmessage.pb.cc \
10 dnsmessage.pb.h \
11 htmlfiles.h.tmp \
12 htmlfiles.h \
13 dnstap.pb.cc \
14 dnstap.pb.h
15
16 dnslabeltext.cc: dnslabeltext.rl
17 $(AM_V_GEN)$(RAGEL) $< -o dnslabeltext.cc
18
19 BUILT_SOURCES=htmlfiles.h \
20 dnslabeltext.cc
21
22 htmlfiles.h: $(srcdir)/html/*
23 $(AM_V_GEN)$(srcdir)/incfiles $(srcdir) > $@.tmp
24 @mv $@.tmp $@
25
26 SRC_JS_FILES := $(wildcard src_js/*.js)
27 MIN_JS_FILES := $(patsubst src_js/%.js,html/js/%.min.js,$(SRC_JS_FILES))
28
29 html/js/%.min.js: src_js/%.js
30 uglifyjs $< > $@
31
32 min_js: $(MIN_JS_FILES)
33
34 if HAVE_RE2
35 AM_CPPFLAGS += $(RE2_CFLAGS)
36 endif
37
38 if HAVE_DNS_OVER_TLS
39 if HAVE_LIBSSL
40 AM_CPPFLAGS += $(LIBSSL_CFLAGS)
41 endif
42
43 if HAVE_GNUTLS
44 AM_CPPFLAGS += $(GNUTLS_CFLAGS)
45 endif
46 endif
47
48 if HAVE_LIBCRYPTO
49 AM_CPPFLAGS += $(LIBCRYPTO_INCLUDES)
50 endif
51
52 if HAVE_CDB
53 AM_CPPFLAGS += $(CDB_CFLAGS)
54 endif
55
56 if HAVE_LMDB
57 AM_CPPFLAGS += $(LMDB_CFLAGS)
58 endif
59
60 if HAVE_DNS_OVER_HTTPS
61 if HAVE_LIBSSL
62 AM_CPPFLAGS += $(LIBSSL_CFLAGS)
63 endif
64
65 if HAVE_LIBH2OEVLOOP
66 AM_CPPFLAGS += $(LIBH2OEVLOOP_CFLAGS)
67 endif
68 endif
69
70 EXTRA_DIST=COPYING \
71 dnslabeltext.rl \
72 dnsdistconf.lua \
73 dnsmessage.proto \
74 dnstap.proto \
75 README.md \
76 delaypipe.cc delaypipe.hh \
77 html \
78 contrib \
79 ext/incbin/UNLICENSE \
80 incfiles \
81 src_js \
82 dnsdist.service.in \
83 lua_hpp.mk \
84 bpf-filter.main.ebpf \
85 bpf-filter.qname.ebpf \
86 bpf-filter.ebpf.src \
87 DNSDIST-MIB.txt \
88 devpollmplexer.cc \
89 epollmplexer.cc \
90 kqueuemplexer.cc \
91 portsmplexer.cc \
92 cdb.cc cdb.hh \
93 ext/lmdb-safe/lmdb-safe.cc ext/lmdb-safe/lmdb-safe.hh \
94 builder-support/gen-version
95
96 bin_PROGRAMS = dnsdist
97
98 if UNIT_TESTS
99 noinst_PROGRAMS = testrunner
100 TESTS_ENVIRONMENT = env BOOST_TEST_LOG_LEVEL=message SRCDIR='$(srcdir)'
101 TESTS=testrunner
102 else
103 check-local:
104 @echo "Unit tests are not enabled"
105 @echo "Run ./configure --enable-unit-tests"
106 endif
107
108 dnsdist-web.$(OBJEXT): htmlfiles.h
109
110 dnsdist_SOURCES = \
111 ascii.hh \
112 base64.hh \
113 bpf-filter.cc bpf-filter.hh \
114 cachecleaner.hh \
115 capabilities.cc capabilities.hh \
116 circular_buffer.hh \
117 dns.cc dns.hh \
118 dnscrypt.cc dnscrypt.hh \
119 dnsdist.cc dnsdist.hh \
120 dnsdist-dynbpf.cc dnsdist-dynbpf.hh \
121 dnsdist-cache.cc dnsdist-cache.hh \
122 dnsdist-carbon.cc \
123 dnsdist-console.cc dnsdist-console.hh \
124 dnsdist-dnscrypt.cc \
125 dnsdist-dynblocks.hh \
126 dnsdist-ecs.cc dnsdist-ecs.hh \
127 dnsdist-idstate.cc \
128 dnsdist-kvs.hh dnsdist-kvs.cc \
129 dnsdist-lua.hh dnsdist-lua.cc \
130 dnsdist-lua-actions.cc \
131 dnsdist-lua-bindings.cc \
132 dnsdist-lua-bindings-dnscrypt.cc \
133 dnsdist-lua-bindings-dnsquestion.cc \
134 dnsdist-lua-bindings-kvs.cc \
135 dnsdist-lua-bindings-packetcache.cc \
136 dnsdist-lua-bindings-protobuf.cc \
137 dnsdist-lua-inspection.cc \
138 dnsdist-lua-inspection-ffi.cc dnsdist-lua-inspection-ffi.hh \
139 dnsdist-lua-rules.cc \
140 dnsdist-lua-vars.cc \
141 dnsdist-protobuf.cc dnsdist-protobuf.hh \
142 dnsdist-rings.cc dnsdist-rings.hh \
143 dnsdist-rules.hh \
144 dnsdist-secpoll.cc dnsdist-secpoll.hh \
145 dnsdist-snmp.cc dnsdist-snmp.hh \
146 dnsdist-tcp.cc \
147 dnsdist-web.cc \
148 dnsdist-xpf.cc dnsdist-xpf.hh \
149 dnslabeltext.cc \
150 dnsname.cc dnsname.hh \
151 dnsparser.hh dnsparser.cc \
152 dnswriter.cc dnswriter.hh \
153 doh.hh doh.cc \
154 dolog.hh \
155 ednsoptions.cc ednsoptions.hh \
156 ednscookies.cc ednscookies.hh \
157 ednssubnet.cc ednssubnet.hh \
158 fstrm_logger.cc fstrm_logger.hh \
159 gettime.cc gettime.hh \
160 htmlfiles.h \
161 iputils.cc iputils.hh \
162 libssl.cc libssl.hh \
163 lock.hh \
164 misc.cc misc.hh \
165 mplexer.hh \
166 namespaces.hh \
167 pdnsexception.hh \
168 protobuf.cc protobuf.hh \
169 dnstap.cc dnstap.hh \
170 qtype.cc qtype.hh \
171 remote_logger.cc remote_logger.hh \
172 pollmplexer.cc \
173 sholder.hh \
174 snmp-agent.cc snmp-agent.hh \
175 sodcrypto.cc sodcrypto.hh \
176 sstuff.hh \
177 statnode.cc statnode.hh \
178 tcpiohandler.cc tcpiohandler.hh \
179 threadname.hh threadname.cc \
180 uuid-utils.hh uuid-utils.cc \
181 xpf.cc xpf.hh \
182 ext/luawrapper/include/LuaContext.hpp \
183 ext/json11/json11.cpp \
184 ext/json11/json11.hpp \
185 ext/incbin/incbin.h \
186 ext/libbpf/libbpf.h
187
188 testrunner_SOURCES = \
189 base64.hh \
190 dns.hh \
191 test-base64_cc.cc \
192 test-delaypipe_hh.cc \
193 test-dnscrypt_cc.cc \
194 test-dnsdist_cc.cc \
195 test-dnsdistdynblocks_hh.cc \
196 test-dnsdistkvs_cc.cc \
197 test-dnsdistpacketcache_cc.cc \
198 test-dnsdistrings_cc.cc \
199 test-dnsdistrules_cc.cc \
200 test-dnsparser_cc.cc \
201 test-iputils_hh.cc \
202 test-mplexer.cc \
203 cachecleaner.hh \
204 circular_buffer.hh \
205 dnsdist.hh \
206 dnsdist-cache.cc dnsdist-cache.hh \
207 dnsdist-ecs.cc dnsdist-ecs.hh \
208 dnsdist-kvs.cc dnsdist-kvs.hh \
209 dnsdist-rings.hh \
210 dnsdist-xpf.cc dnsdist-xpf.hh \
211 dnscrypt.cc dnscrypt.hh \
212 dnslabeltext.cc \
213 dnsname.cc dnsname.hh \
214 dnsparser.hh dnsparser.cc \
215 dnswriter.cc dnswriter.hh \
216 dolog.hh \
217 ednsoptions.cc ednsoptions.hh \
218 ednscookies.cc ednscookies.hh \
219 ednssubnet.cc ednssubnet.hh \
220 gettime.cc gettime.hh \
221 iputils.cc iputils.hh \
222 misc.cc misc.hh \
223 namespaces.hh \
224 pdnsexception.hh \
225 pollmplexer.cc \
226 qtype.cc qtype.hh \
227 sholder.hh \
228 sodcrypto.cc \
229 sstuff.hh \
230 statnode.cc statnode.hh \
231 threadname.hh threadname.cc \
232 testrunner.cc \
233 xpf.cc xpf.hh
234
235 dnsdist_LDFLAGS = \
236 $(AM_LDFLAGS) \
237 $(PROGRAM_LDFLAGS) \
238 -pthread
239
240 dnsdist_LDADD = \
241 $(LUA_LIBS) \
242 $(LIBEDIT_LIBS) \
243 $(RT_LIBS) \
244 $(YAHTTP_LIBS) \
245 $(LIBSODIUM_LIBS) \
246 $(FSTRM_LIBS) \
247 $(SANITIZER_FLAGS) \
248 $(SYSTEMD_LIBS) \
249 $(NET_SNMP_LIBS) \
250 $(LIBCAP_LIBS) \
251 $(IPCRYPT_LIBS)
252
253 testrunner_LDFLAGS = \
254 $(AM_LDFLAGS) \
255 $(PROGRAM_LDFLAGS) \
256 $(BOOST_UNIT_TEST_FRAMEWORK_LDFLAGS) \
257 -pthread
258
259 testrunner_LDADD = \
260 $(BOOST_UNIT_TEST_FRAMEWORK_LIBS) \
261 $(LIBSODIUM_LIBS) \
262 $(FSTRM_LIBS) \
263 $(RT_LIBS) \
264 $(SANITIZER_FLAGS) \
265 $(LIBCAP_LIBS)
266
267 if HAVE_CDB
268 dnsdist_LDADD += $(CDB_LDFLAGS) $(CDB_LIBS)
269 testrunner_LDADD += $(CDB_LDFLAGS) $(CDB_LIBS)
270 dnsdist_SOURCES += cdb.cc cdb.hh
271 testrunner_SOURCES += cdb.cc cdb.hh
272 endif
273
274 if HAVE_RE2
275 dnsdist_LDADD += $(RE2_LIBS)
276 endif
277
278 if HAVE_LIBSSL
279 dnsdist_LDADD += $(LIBSSL_LIBS)
280 endif
281
282 if HAVE_LIBCRYPTO
283 dnsdist_LDADD += $(LIBCRYPTO_LDFLAGS) $(LIBCRYPTO_LIBS)
284 dnsdist_SOURCES += ipcipher.cc ipcipher.hh
285 endif
286
287 if HAVE_LMDB
288 dnsdist_LDADD += $(LMDB_LDFLAGS) $(LMDB_LIBS)
289 testrunner_LDADD += $(LMDB_LDFLAGS) $(LMDB_LIBS)
290 dnsdist_SOURCES += ext/lmdb-safe/lmdb-safe.cc ext/lmdb-safe/lmdb-safe.hh
291 testrunner_SOURCES += ext/lmdb-safe/lmdb-safe.cc ext/lmdb-safe/lmdb-safe.hh
292 endif
293
294 if HAVE_DNS_OVER_TLS
295 if HAVE_GNUTLS
296 dnsdist_LDADD += -lgnutls
297 endif
298 endif
299
300 if HAVE_DNS_OVER_HTTPS
301
302 if HAVE_LIBH2OEVLOOP
303 dnsdist_LDADD += $(LIBH2OEVLOOP_LIBS)
304 endif
305
306 endif
307
308 if !HAVE_LUA_HPP
309 BUILT_SOURCES += lua.hpp
310 nodist_dnsdist_SOURCES = lua.hpp
311 CLEANFILES += lua.hpp
312 endif
313
314 if HAVE_PROTOBUF
315 if HAVE_PROTOC
316 dnsmessage.pb.cc: dnsmessage.proto
317 $(AM_V_GEN)$(PROTOC) -I$(srcdir) --cpp_out=./ $<
318
319 dnstap.pb.cc: dnstap.proto
320 $(AM_V_GEN)$(PROTOC) -I$(srcdir) --cpp_out=./ $<
321
322 BUILT_SOURCES += dnsmessage.pb.cc dnstap.pb.cc
323
324 nodist_dnsdist_SOURCES = dnsmessage.pb.cc dnsmessage.pb.h dnstap.pb.cc dnstap.pb.h
325 dnsdist_LDADD += $(PROTOBUF_LIBS)
326
327 dnsdist.$(OBJEXT): dnsmessage.pb.cc dnstap.pb.cc
328 endif
329 endif
330
331 if HAVE_FREEBSD
332 dnsdist_SOURCES += kqueuemplexer.cc
333 testrunner_SOURCES += kqueuemplexer.cc
334 endif
335
336 if HAVE_LINUX
337 dnsdist_SOURCES += epollmplexer.cc
338 testrunner_SOURCES += epollmplexer.cc
339 endif
340
341 if HAVE_SOLARIS
342 dnsdist_SOURCES += \
343 devpollmplexer.cc \
344 portsmplexer.cc
345 testrunner_SOURCES += \
346 devpollmplexer.cc \
347 portsmplexer.cc
348 endif
349
350 MANPAGES=dnsdist.1
351
352 dist_man_MANS=$(MANPAGES)
353
354 if HAVE_VIRTUALENV
355 if !HAVE_MANPAGES
356 $(MANPAGES): %: docs/manpages/%.rst .venv
357 $(AM_V_GEN).venv/bin/python -msphinx -b man docs . $<
358 endif # if !HAVE_MANPAGES
359
360 .venv: docs/requirements.txt
361 virtualenv .venv
362 .venv/bin/pip install -U pip setuptools setuptools-git
363 .venv/bin/pip install -r $<
364
365 latex/dnsdist.pdf: docs/** .venv
366 .venv/bin/python -msphinx -M latexpdf docs .
367
368 dnsdist.pdf: latex/dnsdist.pdf
369 mv $< $@
370
371 html-docs.tar.bz2: html-docs
372 tar cjf $@ $<
373
374 html-docs: docs/** .venv
375 .venv/bin/python -msphinx -b html docs html-docs
376
377 all-docs: html-docs html-docs.tar.bz2 dnsdist.pdf
378
379 upload-docs: all-docs
380 rsync -crv --delete --no-p --chmod=g=rwX --exclude '*~' ./html-docs/ web1.powerdns.com:/srv/www/dnsdist.org
381 rsync -crv --no-p --chmod=g=rwX --exclude '*~' ./html-docs.tar.bz2 web1.powerdns.com:/srv/www/dnsdist.org
382 rsync -crv --no-p --chmod=g=rwX --exclude '*~' ./dnsdist.pdf web1.powerdns.com:/srv/www/dnsdist.org
383
384 else # if HAVE_VIRTUALENV
385 $(MANPAGES):
386 @echo "You need virtualenv to generate the manpages"
387 exit 1
388
389 html-docs: %: docs/manpages/%.rst .venv
390 @echo "You need virtualenv to generate the HTML documentation"
391 exit 1
392
393 dnsdist.pdf:
394 @echo "You need virtualenv to generate the pdf documentation"
395 exit 1
396 endif
397
398 if HAVE_SYSTEMD
399 dnsdist.service: dnsdist.service.in
400 $(AM_V_GEN)sed -e 's![@]bindir[@]!$(bindir)!' < $< > $@
401 if !HAVE_SYSTEMD_LOCK_PERSONALITY
402 $(AM_V_GEN)perl -ni -e 'print unless /^LockPersonality/' $@
403 endif
404 if !HAVE_SYSTEMD_PRIVATE_DEVICES
405 $(AM_V_GEN)perl -ni -e 'print unless /^PrivateDevices/' $@
406 endif
407 if !HAVE_SYSTEMD_PRIVATE_TMP
408 $(AM_V_GEN)perl -ni -e 'print unless /^PrivateTmp/' $@
409 endif
410 if !HAVE_SYSTEMD_PROTECT_CONTROL_GROUPS
411 $(AM_V_GEN)perl -ni -e 'print unless /^ProtectControlGroups/' $@
412 endif
413 if !HAVE_SYSTEMD_PROTECT_HOME
414 $(AM_V_GEN)perl -ni -e 'print unless /^ProtectHome/' $@
415 endif
416 if !HAVE_SYSTEMD_PROTECT_KERNEL_MODULES
417 $(AM_V_GEN)perl -ni -e 'print unless /^ProtectKernelModules/' $@
418 endif
419 if !HAVE_SYSTEMD_PROTECT_KERNEL_TUNABLES
420 $(AM_V_GEN)perl -ni -e 'print unless /^ProtectKernelTunables/' $@
421 endif
422 if !HAVE_SYSTEMD_PROTECT_SYSTEM
423 $(AM_V_GEN)perl -ni -e 'print unless /^ProtectSystem/' $@
424 endif
425 if !HAVE_SYSTEMD_RESTRICT_ADDRESS_FAMILIES
426 $(AM_V_GEN)perl -ni -e 'print unless /^RestrictAddressFamilies/' $@
427 endif
428 if !HAVE_SYSTEMD_RESTRICT_NAMESPACES
429 $(AM_V_GEN)perl -ni -e 'print unless /^RestrictNamespaces/' $@
430 endif
431 if !HAVE_SYSTEMD_RESTRICT_REALTIME
432 $(AM_V_GEN)perl -ni -e 'print unless /^RestrictRealtime/' $@
433 endif
434 if !HAVE_SYSTEMD_SYSTEM_CALL_ARCHITECTURES
435 $(AM_V_GEN)perl -ni -e 'print unless /^SystemCallArchitectures/' $@
436 endif
437 if !HAVE_SYSTEMD_SYSTEM_CALL_FILTER
438 $(AM_V_GEN)perl -ni -e 'print unless /^SystemCallFilter/' $@
439 endif
440
441 dnsdist@.service: dnsdist.service
442 $(AM_V_GEN)sed -e 's!/dnsdist !&--config $(sysconfdir)/dnsdist-%i.conf !' < $< >$@
443
444 systemdsystemunitdir = $(SYSTEMD_DIR)
445
446 systemdsystemunit_DATA = \
447 dnsdist.service \
448 dnsdist@.service
449
450 CLEANFILES += \
451 dnsdist.service \
452 dnsdist@.service
453 endif
454
455 if !HAVE_LUA_HPP
456 include lua_hpp.mk
457 endif