From 90417cc148e01b746957dbcf375daa3378a50c58 Mon Sep 17 00:00:00 2001 From: Phil Sutter Date: Tue, 14 Nov 2017 21:17:10 +0100 Subject: libnftables: Split code into frontend and library This finally creates the libnftables shared object. For some reason, this causes two compiler warnings to appear: | parser_bison.y: In function 'nft_parse': | parser_bison.y:131:3: warning: implicit declaration of function 'nft_set_debug' [-Wimplicit-function-declaration] | nft_set_debug(1, scanner); | ^~~~~~~~~~~~~ | parser_bison.c:64:25: warning: implicit declaration of function 'nft_lex' [-Wimplicit-function-declaration] | #define yylex nft_lex | ^ | parser_bison.c:4745:16: note: in expansion of macro 'yylex' | yychar = yylex (&yylval, &yylloc, scanner); So this patch contains a workaround, namely declaring both functions in src/parser_bison.y. During linking the objects are found, so this is rather a matter of cosmetics. Signed-off-by: Phil Sutter Signed-off-by: Pablo Neira Ayuso --- src/Makefile.am | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) (limited to 'src/Makefile.am') diff --git a/src/Makefile.am b/src/Makefile.am index 4d613a73..9f7a4bfb 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -27,7 +27,9 @@ parser_bison.o scanner.o: AM_CFLAGS += -Wno-missing-prototypes -Wno-missing-decl BUILT_SOURCES = parser_bison.h -nft_SOURCES = main.c \ +lib_LTLIBRARIES = libnftables.la + +libnftables_la_SOURCES = \ rule.c \ statement.c \ datatype.c \ @@ -59,19 +61,23 @@ nft_SOURCES = main.c \ parser_bison.y \ libnftables.c -if BUILD_CLI -nft_SOURCES += cli.c -endif - if BUILD_MINIGMP mini-gmp.o: AM_CFLAGS += -Wno-sign-compare -nft_SOURCES += mini-gmp.c +libnftables_la_SOURCES += mini-gmp.c endif -nft_LDADD = ${LIBMNL_LIBS} ${LIBNFTNL_LIBS} +libnftables_la_LIBADD = ${LIBMNL_LIBS} ${LIBNFTNL_LIBS} if BUILD_XTABLES -nft_SOURCES += xt.c -nft_LDADD += ${XTABLES_LIBS} +libnftables_la_SOURCES += xt.c +libnftables_la_LIBADD += ${XTABLES_LIBS} endif + +nft_SOURCES = main.c + +if BUILD_CLI +nft_SOURCES += cli.c +endif + +nft_LDADD = libnftables.la -- cgit v1.2.3