-
Notifications
You must be signed in to change notification settings - Fork 12
/
Makefile.am
460 lines (408 loc) · 15.7 KB
/
Makefile.am
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
#
# Copyright 2016-2021 Internet Corporation for Assigned Names and Numbers.
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, you can obtain one at https://mozilla.org/MPL/2.0/.
#
ACLOCAL_AMFLAGS = ${ACLOCAL_FLAGS} -I m4
bin_PROGRAMS = compactor inspector
dist_doc_DATA = LICENSE.txt ChangeLog.txt KNOWN_ISSUES.txt
if BUILD_DOCS
man_MANS = doc/compactor.1 doc/inspector.1
doc_DATA = doc/user-guide.html doc/overview.png README.html
endif
common_doc_sources = \
doc/user-guide/compactor-command-options.adoc.in \
doc/user-guide/compactor-capture-from-network.adoc.in \
doc/user-guide/compactor-capture-from-dnstap.adoc.in \
doc/user-guide/compactor-outputs.adoc.in \
doc/user-guide/compactor-query-response-matching.adoc.in
common_doc_gen_sources = $(common_doc_sources:.adoc.in=.adoc)
man_sources = \
doc/compactor.adoc.in doc/inspector.adoc.in
man_gen_sources = \
$(common_doc_gen_sources) \
$(man_sources:.adoc.in=.adoc)
user_guide_sources = \
doc/user-guide.adoc.in \
doc/user-guide/overview.adoc.in \
doc/user-guide/installation.adoc.in \
doc/user-guide/configuring.adoc.in \
doc/user-guide/running.adoc.in \
doc/user-guide/appendices.adoc.in
user_guide_gen_sources = \
$(common_doc_gen_sources) \
$(user_guide_sources:.adoc.in=.adoc)
dslocalstatedir=$(localstatedir)/lib/$(PACKAGE)
dsconfdir=$(sysconfdir)/$(PACKAGE)
dsconf_DATA = etc/compactor.conf \
etc/excluded_fields.conf.sample \
etc/default_values.conf
dist_dsconf_DATA = etc/compactor.conf \
etc/excluded_fields.conf.sample \
etc/default_values.conf
dist_noinst_DATA = README.adoc \
doc/user-guide/overview.png \
dnstap/dnstap.proto \
$(common_doc_sources) \
$(man_sources) \
$(user_guide_sources)
conffile=$(dsconfdir)/compactor.conf
excludesfile=$(dsconfdir)/excluded_fields.conf
defaultsfile=$(dsconfdir)/default_values.conf
%.conf :: %.conf.in ; mkdir -p `dirname $@`; sed -e "s|@DSLOCALSTATEDIR@|$(dslocalstatedir)|g" $< > $@
%.adoc :: %.adoc.in ; mkdir -p `dirname $@`; sed -e "s|@ETCPATH@|$(dsconfdir)|" -e "s|@VARLIBPATH@|$(dslocalstatedir)|g" $< > $@
%.1 : %.adoc ; @ASCIIDOC@ -b manpage -d manpage -o $@ $<
%.html : %.adoc ; @ASCIIDOC@ -b html5 -d article -a appversion=$(PACKAGE_VERSION) -o $@ $<
%.pdf : %.adoc ; @ASCIIDOC@ -b pdf -d article -r asciidoctor-pdf -a appversion=$(PACKAGE_VERSION) -o $@ $<
% :: test-scripts/%.xz ; xz --decompress --to-stdout $< > $@
%.pb.cc %.pb.h: %.proto ; $(PROTOC) --proto_path=$(srcdir) --cpp_out=@builddir@ $<
check_PROGRAMS = compactor-tests
check_SCRIPTS = test-scripts/check-config-info.sh \
test-scripts/check-defaults-required.sh \
test-scripts/check-dnscap.sh \
test-scripts/check-outputs.sh \
test-scripts/check-query-only.sh \
test-scripts/check-response-opt.sh \
test-scripts/check-stats.sh \
test-scripts/check-template.sh \
test-scripts/check-testcontent.sh \
test-scripts/check-testcontent-endtime.sh \
test-scripts/check-testcontent-exclude.sh \
test-scripts/check-addressprefix.sh \
test-scripts/inspector-outputs.sh \
test-scripts/output-size-limit.sh \
test-scripts/same-output.sh \
test-scripts/same-output-gzip.sh \
test-scripts/same-output-xz.sh \
test-scripts/same-file-output.sh \
test-scripts/same-pcap-cbor-pcap.sh \
test-scripts/same-qr-dump.sh \
test-scripts/tmp-output.sh \
test-scripts/same-tshark-output.sh \
test-scripts/same-live.sh \
test-scripts/verify-cbor02.sh \
test-scripts/verify-cbor05.sh \
test-scripts/verify-cddl.sh
if ENABLE_DNSTAP
check_SCRIPTS += test-scripts/check-dnstap.sh
dist_check_SCRIPTS = $(check_SCRIPTS)
else
dist_check_SCRIPTS = $(check_SCRIPTS)
dist_check_SCRIPTS += test-scripts/check-dnstap.sh
endif
if ENABLE_PSEUDOANONYMISATION
check_SCRIPTS += test-scripts/pseudoanon-tshark-output.sh \
test-scripts/pseudoanon-inspector-output.sh
dist_check_SCRIPTS = $(check_SCRIPTS)
else
dist_check_SCRIPTS = $(check_SCRIPTS)
dist_check_SCRIPTS += test-scripts/pseudoanon-tshark-output.sh \
test-scripts/pseudoanon-inspector-output.sh
endif
dist_check_DATA = doc/c-dns.cddl \
test-scripts/GeoLite2-ASN.mmdb.xz \
test-scripts/GeoLite2-City.mmdb.xz \
test-scripts/dns.pcap.xz \
test-scripts/dnscap.pcap.xz \
test-scripts/test.dnstap \
test-scripts/test.dnstap.debug-dns \
test-scripts/test.dnstap.debug-dns-reportinfo \
test-scripts/gold.pcap.xz \
test-scripts/gold.cbor.xz \
test-scripts/gold.cbor02.xz \
test-scripts/gold.cbor05.xz \
test-scripts/gold.pcap.info \
test-scripts/malformed.pcap.xz \
test-scripts/matching.pcap.xz \
test-scripts/oldfmtgold.pcap.xz \
test-scripts/testcontent.pcap.xz \
test-scripts/testcontent.diag \
test-scripts/testcontent-endtime.diag \
test-scripts/testcontent-endtime.info \
test-scripts/testcontent-endtime.big2.info \
test-scripts/testcontent-endtime.big.info \
test-scripts/testcontent-exclude.conf \
test-scripts/testcontent-exclude.diag \
test-scripts/testcontent-exclude-sig.conf \
test-scripts/testcontent-exclude-sig.diag \
test-scripts/testcontent-exclude-sigflags.conf \
test-scripts/testcontent-exclude-sigflags.diag \
test-scripts/testcontent.debugqr \
test-scripts/addressprefix.diag \
test-scripts/addressprefix.debugqr \
test-scripts/unmatched.pcap.xz \
test-scripts/nsd-live.dump.xz \
test-scripts/nsd-live.raw.pcap.xz \
test-scripts/nsd-live.ignored.pcap.xz \
test-scripts/nsd-live.info \
test-scripts/knot-live.raw.pcap.xz \
test-scripts/knot-live.ignored.pcap.xz \
test-scripts/knot-live.info \
test-scripts/knot-live.anon.info \
test-scripts/check-live-pcap.sh \
test-scripts/template.dump \
test-scripts/template.pcap \
test-scripts/test-csv.tpl \
test-scripts/test-block.tpl \
test-scripts/test.defaults \
test-scripts/teststats.info \
test-scripts/teststats.pcap
EXTRA_DIST = getversion.sh .version
check_DATA = GeoLite2-ASN.mmdb \
GeoLite2-City.mmdb \
dns.pcap \
dnscap.pcap \
gold.pcap \
gold.cbor \
gold.cbor02 \
gold.cbor05 \
malformed.pcap \
matching.pcap \
oldfmtgold.pcap \
testcontent.pcap \
unmatched.pcap \
nsd-live.dump \
nsd-live.raw.pcap \
nsd-live.ignored.pcap \
knot-live.raw.pcap \
knot-live.ignored.pcap
CLEANFILES = $(check_DATA) $(dist_man_MANS) \
$(user_guide_gen_sources) \
etc/compactor.conf \
doc/user-guide.html doc/user-guide.pdf \
doc/overview.png doc/user-guide/compactor.conf \
doc/user-guide/excluded_fields.conf.sample \
doc/user-guide/default_values.conf \
doc/inspector.adoc doc/compactor.adoc
MOSTLYCLEANFILES = dnstap/dnstap.pb.h dnstap/dnstap.pb.cc $(DX_CLEANFILES)
BUILT_SOURCES = dnstap/dnstap.pb.h
TESTS = $(check_PROGRAMS) $(check_SCRIPTS)
AM_CPPFLAGS = -I$(srcdir)/src $(BOOST_CPPFLAGS) \
-DCONFFILE=\"$(conffile)\" \
-DEXCLUDESFILE=\"$(excludesfile)\" \
-DDEFAULTSFILE=\"$(defaultsfile)\" \
$(OPENSSL_INCLUDES) -DGEOIPDIR=\"$(geoipdir)\"
doc/user-guide.html: $(user_guide_gen_sources) doc/user-guide/compactor.conf doc/user-guide/excluded_fields.conf.sample doc/user-guide/default_values.conf doc/overview.png
doc/user-guide.pdf: $(user_guide_gen_sources) doc/user-guide/compactor.conf doc/user-guide/excluded_fields.conf.sample doc/user-guide/default_values.conf doc/overview.png
doc/user-guide/compactor.conf: etc/compactor.conf ; cp $< $@
doc/user-guide/excluded_fields.conf.sample: etc/excluded_fields.conf.sample ; cp $< $@
doc/user-guide/default_values.conf: etc/default_values.conf ; cp $< $@
doc/overview.png: doc/user-guide/overview.png ; cp $< $@
doc/compactor.1: $(common_doc_gen_sources)
doc/inspector.1: $(common_doc_gen_sources)
README.html: README.adoc ; @ASCIIDOC@ -b html5 -d article -o $@ $<
.PHONY: user-guide user-guide-html user-guide-pdf manpages
user-guide : user-guide-html user-guide-pdf
user-guide-html : doc/user-guide.html
user-guide-pdf : doc/user-guide.pdf
manpages: $(dist_man_MANS)
# To speed builds, build common files into a static library.
noinst_LIBRARIES = libcdns.a
libcdns_a_headers = \
src/addressevent.hpp \
src/baseoutputwriter.hpp \
src/bytestring.hpp \
src/capturedns.hpp \
src/cbordecoder.hpp \
src/cborencoder.hpp \
src/blockcbor.hpp \
src/blockcbordata.hpp \
src/configuration.hpp \
src/dnsmessage.hpp \
src/ipaddress.hpp \
src/log.hpp \
src/makeunique.hpp \
src/no-register-warning.hpp \
src/pseudoanonymise.hpp \
src/queryresponse.hpp \
src/rotatingfilename.hpp \
src/streamwriter.hpp \
src/transporttype.hpp \
src/util.hpp
libcdns_a_SOURCES = \
$(libcdns_a_headers) \
src/baseoutputwriter.cpp \
src/bytestring.cpp \
src/capturedns.cpp \
src/cbordecoder.cpp \
src/cborencoder.cpp \
src/blockcbor.cpp \
src/blockcbordata.cpp \
src/configuration.cpp \
src/dnsmessage.cpp \
src/ipaddress.cpp \
src/log.cpp \
src/pseudoanonymise.cpp \
src/queryresponse.cpp \
src/rotatingfilename.cpp \
src/streamwriter.cpp \
src/util.cpp
libcdns_a_CXXFLAGS = -DBOOST_LOG_DYN_LINK
compactor_headers = \
src/blockcborwriter.hpp \
src/channel.hpp \
src/dnstap.hpp \
src/matcher.hpp \
src/nocopypacket.hpp \
src/packetstatistics.hpp \
src/packetstream.hpp \
src/pcapwriter.hpp \
src/signalhandler.hpp \
src/sniffers.hpp
inspector_headers = \
src/backend.hpp \
src/blockcborreader.hpp \
src/geoip.hpp \
src/pcapwriter.hpp \
src/template-backend.hpp
# _internal_test items work by #including the corresponding .cpp to get
# access to its internals. You can't have the _internal_test.cpp and the .cpp
# in the executable because you'll get duplicate definitions and linker
# complaints.
compactor_src_with_internal_tests = \
src/matcher.cpp
compactor_src_without_internal_tests = \
src/blockcborwriter.cpp \
src/packetstream.cpp \
src/signalhandler.cpp \
src/sniffers.cpp
if ENABLE_DNSTAP
compactor_src_without_internal_tests += \
src/dnstap.cpp
nodist_compactor_SOURCES = \
@builddir@/dnstap/dnstap.pb.h \
@builddir@/dnstap/dnstap.pb.cc
endif
compactor_SOURCES = \
$(compactor_headers) \
$(compactor_src_without_internal_tests) \
$(compactor_src_with_internal_tests) \
src/compactor.cpp
compactor_CXXFLAGS = $(PTHREAD_CFLAGS) -DBOOST_LOG_DYN_LINK
compactor_LDADD = \
libcdns.a \
$(BOOST_FILESYSTEM_LIB) \
$(BOOST_IOSTREAMS_LIB) \
$(BOOST_LOG_LIB) \
$(BOOST_PROGRAM_OPTIONS_LIB) \
$(BOOST_SYSTEM_LIB) \
$(BOOST_THREAD_LIB) \
$(PCAP_LIB) \
$(LZMA_LIB) \
$(TCMALLOC_LIB) \
$(PTHREAD_LIBS) \
$(libtins_LIBS)
compactor_LDFLAGS = \
$(BOOST_LDFLAGS)
if ENABLE_PSEUDOANONYMISATION
compactor_LDADD += \
$(OPENSSL_LIBS)
compactor_LDFLAGS += \
$(OPENSSL_LDFLAGS)
endif
if ENABLE_DNSTAP
compactor_CXXFLAGS += \
$(PROTOBUF_CFLAGS)
compactor_LDADD += \
$(PROTOBUF_LIBS)
endif
compactor_tests_SOURCES = \
tests/catch.hpp \
tests/catch_main.cpp \
$(compactor_src_without_internal_tests) \
tests/baseoutputwriter_test.cpp \
tests/capturedns_test.cpp \
tests/cbordecoder_test.cpp \
tests/cborencoder_test.cpp \
tests/channel_test.cpp \
tests/blockcbor_test.cpp \
tests/blockcbordata_test.cpp \
tests/dnsmessage_test.cpp \
tests/ipaddress_test.cpp \
tests/matcher_test.cpp \
tests/matcher_internal_test.cpp \
tests/packetstream_test.cpp \
tests/rotatingfilename_test.cpp
if ENABLE_PSEUDOANONYMISATION
compactor_tests_SOURCES += \
tests/pseudoanonymise_test.cpp
endif
if ENABLE_DNSTAP
compactor_tests_SOURCES += \
tests/dnstap_test.cpp
nodist_compactor_tests_SOURCES = \
@builddir@/dnstap/dnstap.pb.h \
@builddir@/dnstap/dnstap.pb.cc
endif
compactor_tests_CXXFLAGS = @PTHREAD_CFLAGS@ -DBOOST_LOG_DYN_LINK
compactor_tests_LDADD = \
libcdns.a \
$(BOOST_FILESYSTEM_LIB) \
$(BOOST_IOSTREAMS_LIB) \
$(BOOST_LOG_LIB) \
$(BOOST_PROGRAM_OPTIONS_LIB) \
$(BOOST_SYSTEM_LIB) \
$(BOOST_THREAD_LIB) \
$(PCAP_LIB) \
$(PROTOBUF_LIBS) \
$(LZMA_LIB) \
$(TCMALLOC_LIB) \
$(PTHREAD_LIBS) \
$(libtins_LIBS)
compactor_tests_LDFLAGS = \
$(BOOST_LDFLAGS)
if ENABLE_PSEUDOANONYMISATION
compactor_tests_LDADD += \
$(OPENSSL_LIBS)
compactor_tests_LDFLAGS += \
$(OPENSSL_LDFLAGS)
endif
if ENABLE_DNSTAP
compactor_tests_CXXFLAGS += \
$(PROTOBUF_CFLAGS)
compactor_tests_LDADD += \
$(PROTOBUF_LIBS)
endif
inspector_SOURCES = \
$(inspector_headers) \
src/backend.cpp \
src/blockcborreader.cpp \
src/geoip.cpp \
src/inspector.cpp \
src/template-backend.cpp
inspector_CXXFLAGS = @PTHREAD_CFLAGS@ -DBOOST_LOG_DYN_LINK
inspector_LDADD = \
libcdns.a \
$(BOOST_FILESYSTEM_LIB) \
$(BOOST_IOSTREAMS_LIB) \
$(BOOST_LOG_LIB) \
$(BOOST_PROGRAM_OPTIONS_LIB) \
$(BOOST_SYSTEM_LIB) \
$(BOOST_THREAD_LIB) \
$(LZMA_LIB) \
$(PTHREAD_LIBS) \
$(libtins_LIBS) \
$(CTEMPLATE_LIB) \
$(MAXMINDDB_LIB)
inspector_LDFLAGS = \
$(BOOST_LDFLAGS)
if ENABLE_PSEUDOANONYMISATION
inspector_LDADD += \
$(OPENSSL_LIBS)
inspector_LDFLAGS += \
$(OPENSSL_LDFLAGS)
endif
.PHONY: cppcheck
CPPCHECK_DIRS = $(srcdir)/src
CPPCHECK_INCLUDE_DIRS = -I$(srcdir)/src -I.
CPPCHECK_CMD = cppcheck \
--std=c++11 --language=c++ \
--xml --xml-version=2 \
-D CPPCHECK --force \
--relative-paths=$(srcdir) \
--suppressions-list=$(srcdir)/cppcheck-suppressions.txt
CPPCHECK_FLAGS = -U DLT_PKTAP
cppcheck: ; $(CPPCHECK_CMD) $(CPPCHECK_INCLUDE_DIRS) $(CPPCHECK_FLAGS) --enable=all $(CPPCHECK_DIRS)
@DX_RULES@