summaryrefslogtreecommitdiffstats
path: root/Makefile.am
blob: fef1d8d1632171e3fe2c852cb569ba9d7c87deee (plain)
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
# This is _NOT_ the library release version, it's an API version.
# Extracted from Chapter 6 "Library interface versions" of the libtool docs.
#
# <snippet>
# Here are a set of rules to help you update your library version information:
#
# 1. Start with version information of `0:0:0' for each libtool library.
# 2. Update the version information only immediately before a public release
# of your software. More frequent updates are unnecessary, and only guarantee
# that the current interface number gets larger faster.
# 3. If the library source code has changed at all since the last update,
# then increment revision (`c:r:a' becomes `c:r+1:a').
# 4. If any interfaces have been added, removed, or changed since the last
# update, increment current, and set revision to 0.
# 5. If any interfaces have been added since the last public release, then
# increment age.
# 6. If any interfaces have been removed since the last public release, then
# set age to 0.
# </snippet>
#
libnftables_LIBVERSION = 2:0:1

###############################################################################

ACLOCAL_AMFLAGS = -I m4

EXTRA_DIST =
BUILT_SOURCES =
LDADD =
lib_LTLIBRARIES =
noinst_LTLIBRARIES =
sbin_PROGRAMS =
check_PROGRAMS =
dist_man_MANS =
CLEANFILES =

###############################################################################

pkginclude_HEADERS = \
	include/nftables/libnftables.h \
	$(NULL)

noinst_HEADERS = \
	\
	include/linux/netfilter.h \
	include/linux/netfilter/nf_conntrack_common.h \
	include/linux/netfilter/nf_conntrack_tuple_common.h \
	include/linux/netfilter/nf_log.h \
	include/linux/netfilter/nf_nat.h \
	include/linux/netfilter/nf_synproxy.h \
	include/linux/netfilter/nf_tables.h \
	include/linux/netfilter/nf_tables_compat.h \
	include/linux/netfilter/nfnetlink.h \
	include/linux/netfilter/nfnetlink_hook.h \
	include/linux/netfilter/nfnetlink_osf.h \
	include/linux/netfilter_arp.h \
	include/linux/netfilter_arp/arp_tables.h \
	include/linux/netfilter_bridge.h \
	include/linux/netfilter_bridge/ebtables.h \
	include/linux/netfilter_decnet.h \
	include/linux/netfilter_ipv4.h \
	include/linux/netfilter_ipv4/ip_tables.h \
	include/linux/netfilter_ipv6.h \
	include/linux/netfilter_ipv6/ip6_tables.h \
	\
	include/cache.h \
	include/cli.h \
	include/cmd.h \
	include/ct.h \
	include/datatype.h \
	include/dccpopt.h \
	include/erec.h \
	include/expression.h \
	include/exthdr.h \
	include/fib.h \
	include/gmputil.h \
	include/hash.h \
	include/headers.h \
	include/iface.h \
	include/intervals.h \
	include/ipopt.h \
	include/json.h \
	include/list.h \
	include/meta.h \
	include/mini-gmp.h \
	include/misspell.h \
	include/mnl.h \
	include/netlink.h \
	include/nft.h \
	include/nftables.h \
	include/numgen.h \
	include/osf.h \
	include/owner.h \
	include/parser.h \
	include/payload.h \
	include/proto.h \
	include/rt.h \
	include/rule.h \
	include/sctp_chunk.h \
	include/socket.h \
	include/statement.h \
	include/tcpopt.h \
	include/utils.h \
	include/xfrm.h \
	include/xt.h \
	\
	$(NULL)

###############################################################################

AM_CPPFLAGS = \
	"-I$(srcdir)/include" \
	"-DDEFAULT_INCLUDE_PATH=\"${sysconfdir}\"" \
	$(LIBMNL_CFLAGS) \
	$(LIBNFTNL_CFLAGS) \
	$(NULL)

if BUILD_DEBUG
AM_CPPFLAGS += -g -DDEBUG
endif
if BUILD_XTABLES
AM_CPPFLAGS += $(XTABLES_CFLAGS)
endif
if BUILD_MINIGMP
AM_CPPFLAGS += -DHAVE_MINIGMP
endif
if BUILD_JSON
AM_CPPFLAGS += -DHAVE_JSON
endif
if BUILD_XTABLES
AM_CPPFLAGS += -DHAVE_XTABLES
endif

AM_CFLAGS = \
	-Wall \
	\
	-Waggregate-return \
	-Wbad-function-cast \
	-Wcast-align \
	-Wdeclaration-after-statement \
	-Wformat-nonliteral \
	-Wformat-security \
	-Winit-self \
	-Wmissing-declarations \
	-Wmissing-format-attribute \
	-Wmissing-prototypes \
	-Wsign-compare \
	-Wstrict-prototypes \
	-Wundef \
	-Wunused \
	-Wwrite-strings \
	\
	$(GCC_FVISIBILITY_HIDDEN) \
	\
	$(NULL)

AM_YFLAGS = -d -Wno-yacc

###############################################################################

BUILT_SOURCES += src/parser_bison.h

# yacc and lex generate dirty code
noinst_LTLIBRARIES += src/libparser.la

src_libparser_la_SOURCES = \
	src/parser_bison.y \
	src/scanner.l \
	$(NULL)

src_libparser_la_CFLAGS = \
	$(AM_CFLAGS) \
	-Wno-missing-declarations \
	-Wno-missing-prototypes \
	-Wno-nested-externs \
	-Wno-redundant-decls \
	-Wno-undef \
	-Wno-unused-but-set-variable \
	$(NULL)

###############################################################################

if BUILD_MINIGMP

noinst_LTLIBRARIES += src/libminigmp.la

src_libminigmp_la_SOURCES = src/mini-gmp.c

src_libminigmp_la_CFLAGS = \
	$(AM_CFLAGS) \
	-Wno-sign-compare \
	$(NULL)

endif

###############################################################################

lib_LTLIBRARIES += src/libnftables.la

src_libnftables_la_SOURCES = \
	src/libnftables.map \
	\
	src/cache.c \
	src/cmd.c \
	src/ct.c \
	src/datatype.c \
	src/dccpopt.c \
	src/erec.c \
	src/evaluate.c \
	src/expression.c \
	src/exthdr.c \
	src/fib.c \
	src/gmputil.c \
	src/hash.c \
	src/iface.c \
	src/intervals.c \
	src/ipopt.c \
	src/libnftables.c \
	src/mergesort.c \
	src/meta.c \
	src/misspell.c \
	src/mnl.c \
	src/monitor.c \
	src/netlink.c \
	src/netlink_delinearize.c \
	src/netlink_linearize.c \
	src/nfnl_osf.c \
	src/nftutils.c \
	src/nftutils.h \
	src/numgen.c \
	src/optimize.c \
	src/osf.c \
	src/owner.c \
	src/payload.c \
	src/print.c \
	src/proto.c \
	src/rt.c \
	src/rule.c \
	src/sctp_chunk.c \
	src/segtree.c \
	src/socket.c \
	src/statement.c \
	src/tcpopt.c \
	src/utils.c \
	src/xfrm.c \
	$(NULL)

src_libnftables_la_SOURCES += src/xt.c

if BUILD_JSON
src_libnftables_la_SOURCES += \
	src/json.c \
	src/parser_json.c \
	$(NULL)
endif

src_libnftables_la_LDFLAGS = \
	-version-info "${libnftables_LIBVERSION}" \
	-Wl,--version-script="$(srcdir)/src//libnftables.map" \
	$(NULL)

src_libnftables_la_LIBADD = \
	$(LIBMNL_LIBS) \
	$(LIBNFTNL_LIBS) \
	src/libparser.la \
	$(NULL)

if BUILD_MINIGMP
src_libnftables_la_LIBADD += src/libminigmp.la
endif

if BUILD_XTABLES
src_libnftables_la_LIBADD += $(XTABLES_LIBS)
endif

if BUILD_JSON
src_libnftables_la_LIBADD += $(JANSSON_LIBS)
endif

###############################################################################

sbin_PROGRAMS += src/nft

src_nft_SOURCES = src/main.c

if BUILD_CLI
src_nft_SOURCES += src/cli.c
endif

src_nft_LDADD = src/libnftables.la

###############################################################################

check_PROGRAMS += examples/nft-buffer

examples_nft_buffer_AM_CPPFLAGS = -I$(srcdir)/include
examples_nft_buffer_LDADD = src/libnftables.la

check_PROGRAMS += examples/nft-json-file

examples_nft_json_file_AM_CPPFLAGS = -I$(srcdir)/include
examples_nft_json_file_LDADD = src/libnftables.la

###############################################################################

if BUILD_MAN

dist_man_MANS += \
	doc/nft.8 \
	doc/libnftables-json.5 \
	doc/libnftables.3 \
	$(NULL)

A2X_OPTS_MANPAGE = \
	-L \
	--doctype manpage \
	--format manpage \
	-D "${builddir}/doc" \
	$(NULL)

ASCIIDOC_MAIN = doc/nft.txt

ASCIIDOC_INCLUDES = \
	doc/data-types.txt \
	doc/payload-expression.txt \
	doc/primary-expression.txt \
	doc/stateful-objects.txt \
	doc/statements.txt \
	$(NULL)

ASCIIDOCS = \
	$(ASCIIDOC_MAIN) \
	$(ASCIIDOC_INCLUDES) \
	$(NULL)

EXTRA_DIST += \
	$(ASCIIDOCS) \
	doc/libnftables-json.adoc \
	doc/libnftables.adoc \
	$(NULL)

CLEANFILES += doc/*~

doc/nft.8: $(ASCIIDOCS)
	mkdir -p ${builddir}/doc
	$(AM_V_GEN)$(A2X) $(A2X_OPTS_MANPAGE) $<

.adoc.3:
	$(AM_V_GEN)$(A2X) $(A2X_OPTS_MANPAGE) $<

.adoc.5:
	$(AM_V_GEN)$(A2X) $(A2X_OPTS_MANPAGE) $<

MAINTAINERCLEANFILES = ${dist_man_MANS}

endif

###############################################################################

dist_pkgdata_DATA = \
	files/nftables/all-in-one.nft \
	files/nftables/arp-filter.nft \
	files/nftables/bridge-filter.nft \
	files/nftables/inet-filter.nft \
	files/nftables/inet-nat.nft \
	files/nftables/ipv4-filter.nft \
	files/nftables/ipv4-mangle.nft \
	files/nftables/ipv4-nat.nft \
	files/nftables/ipv4-raw.nft \
	files/nftables/ipv6-filter.nft \
	files/nftables/ipv6-mangle.nft \
	files/nftables/ipv6-nat.nft \
	files/nftables/ipv6-raw.nft \
	files/nftables/netdev-ingress.nft \
	$(NULL)

pkgdocdir = ${docdir}/examples

dist_pkgdoc_SCRIPTS = \
	files/examples/ct_helpers.nft \
	files/examples/load_balancing.nft \
	files/examples/secmark.nft \
	files/examples/sets_and_maps.nft \
	$(NULL)

pkgsysconfdir = ${sysconfdir}/nftables/osf

dist_pkgsysconf_DATA = \
	files/osf/pf.os \
	$(NULL)

###############################################################################

EXTRA_DIST += \
	py/pyproject.toml \
	py/setup.cfg \
	py/setup.py \
	py/src/__init__.py \
	py/src/nftables.py \
	py/src/schema.json \
	$(NULL)

###############################################################################

EXTRA_DIST += \
	files \
	tests \
	$(NULL)

pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = libnftables.pc