From: Phil Sutter <phil@nwl.cc>
To: netfilter-devel@vger.kernel.org
Subject: [iptables PATCH 1/9] Makefile: Add --enable-profiling configure option
Date: Wed, 8 Jun 2022 18:27:04 +0200 [thread overview]
Message-ID: <20220608162712.31202-2-phil@nwl.cc> (raw)
In-Reply-To: <20220608162712.31202-1-phil@nwl.cc>
A little convenience to prepare a build for analysis with gcov/gprof.
Signed-off-by: Phil Sutter <phil@nwl.cc>
---
.gitignore | 4 ++++
configure.ac | 10 ++++++++++
extensions/GNUmakefile.in | 2 +-
iptables/Makefile.am | 1 +
libipq/Makefile.am | 1 +
libiptc/Makefile.am | 1 +
libxtables/Makefile.am | 1 +
utils/Makefile.am | 1 +
8 files changed, 20 insertions(+), 1 deletion(-)
diff --git a/.gitignore b/.gitignore
index e55952642ed0d..a206fb4870bc8 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,8 @@
*.a
+*.gcda
+*.gcno
+*.gcno.gcov.json.gz
+*.gcov
*.la
*.lo
*.so
diff --git a/configure.ac b/configure.ac
index 071afaf1515de..ea5d2d49112a3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -71,6 +71,9 @@ AC_ARG_WITH([xt-lock-name], AS_HELP_STRING([--with-xt-lock-name=PATH],
[Path to the xtables lock [[/run/xtables.lock]]]),
[xt_lock_name="$withval"],
[xt_lock_name="/run/xtables.lock"])
+AC_ARG_ENABLE([profiling],
+ AS_HELP_STRING([--enable-profiling], [build for use of gcov/gprof]),
+ [enable_profiling="$enableval"], [enable_profiling="no"])
AC_MSG_CHECKING([whether $LD knows -Wl,--no-undefined])
saved_LDFLAGS="$LDFLAGS";
@@ -188,6 +191,11 @@ if [[ -n "$ksourcedir" ]]; then
fi;
pkgdatadir='${datadir}/xtables';
+if test "x$enable_profiling" = "xyes"; then
+ regular_CFLAGS+=" -fprofile-arcs -ftest-coverage"
+ regular_LDFLAGS+=" -lgcov --coverage"
+fi
+
define([EXPAND_VARIABLE],
[$2=[$]$1
if test $prefix = 'NONE'; then
@@ -205,6 +213,7 @@ eval "$2=[$]$2"
AC_SUBST([regular_CFLAGS])
AC_SUBST([regular_CPPFLAGS])
AC_SUBST([noundef_LDFLAGS])
+AC_SUBST([regular_LDFLAGS])
AC_SUBST([kinclude_CPPFLAGS])
AC_SUBST([kbuilddir])
AC_SUBST([ksourcedir])
@@ -250,6 +259,7 @@ Iptables Configuration:
nfsynproxy util support: ${enable_nfsynproxy}
nftables support: ${enable_nftables}
connlabel support: ${enable_connlabel}
+ profiling support: ${enable_profiling}
Build parameters:
Put plugins into executable (static): ${enable_static}
diff --git a/extensions/GNUmakefile.in b/extensions/GNUmakefile.in
index 6dad4e02481bd..3c68f8decd13f 100644
--- a/extensions/GNUmakefile.in
+++ b/extensions/GNUmakefile.in
@@ -24,7 +24,7 @@ kinclude_CPPFLAGS = @kinclude_CPPFLAGS@
AM_CFLAGS = ${regular_CFLAGS}
AM_CPPFLAGS = ${regular_CPPFLAGS} -I${top_builddir}/include -I${top_builddir} -I${top_srcdir}/include -I${top_srcdir} ${kinclude_CPPFLAGS} ${CPPFLAGS} @libnetfilter_conntrack_CFLAGS@ @libnftnl_CFLAGS@
AM_DEPFLAGS = -Wp,-MMD,$(@D)/.$(@F).d,-MT,$@
-AM_LDFLAGS = @noundef_LDFLAGS@
+AM_LDFLAGS = @noundef_LDFLAGS@ @regular_LDFLAGS@
ifeq (${V},)
AM_LIBTOOL_SILENT = --silent
diff --git a/iptables/Makefile.am b/iptables/Makefile.am
index 0258264c4c705..23f8352d30610 100644
--- a/iptables/Makefile.am
+++ b/iptables/Makefile.am
@@ -2,6 +2,7 @@
AM_CFLAGS = ${regular_CFLAGS}
AM_CPPFLAGS = ${regular_CPPFLAGS} -I${top_builddir}/include -I${top_srcdir}/include -I${top_srcdir} ${kinclude_CPPFLAGS} ${libmnl_CFLAGS} ${libnftnl_CFLAGS} ${libnetfilter_conntrack_CFLAGS}
+AM_LDFLAGS = ${regular_LDFLAGS}
BUILT_SOURCES =
diff --git a/libipq/Makefile.am b/libipq/Makefile.am
index 9e3a2ca6c42e2..2cdaf32e03292 100644
--- a/libipq/Makefile.am
+++ b/libipq/Makefile.am
@@ -2,6 +2,7 @@
AM_CFLAGS = ${regular_CFLAGS}
AM_CPPFLAGS = ${regular_CPPFLAGS} -I${top_builddir}/include -I${top_srcdir}/include
+AM_LDFLAGS = ${regular_LDFLAGS}
libipq_la_SOURCES = libipq.c
lib_LTLIBRARIES = libipq.la
diff --git a/libiptc/Makefile.am b/libiptc/Makefile.am
index 464a069628f0c..097842f212bb5 100644
--- a/libiptc/Makefile.am
+++ b/libiptc/Makefile.am
@@ -2,6 +2,7 @@
AM_CFLAGS = ${regular_CFLAGS}
AM_CPPFLAGS = ${regular_CPPFLAGS} -I${top_builddir}/include -I${top_srcdir}/include ${kinclude_CPPFLAGS}
+AM_LDFLAGS = ${regular_LDFLAGS}
pkgconfig_DATA = libiptc.pc libip4tc.pc libip6tc.pc
diff --git a/libxtables/Makefile.am b/libxtables/Makefile.am
index 3bfded8570e08..2f4a12e571b9b 100644
--- a/libxtables/Makefile.am
+++ b/libxtables/Makefile.am
@@ -2,6 +2,7 @@
AM_CFLAGS = ${regular_CFLAGS}
AM_CPPFLAGS = ${regular_CPPFLAGS} -I${top_builddir}/include -I${top_srcdir}/include -I${top_srcdir}/iptables -I${top_srcdir} ${kinclude_CPPFLAGS}
+AM_LDFLAGS = ${regular_LDFLAGS}
lib_LTLIBRARIES = libxtables.la
libxtables_la_SOURCES = xtables.c xtoptions.c getethertype.c
diff --git a/utils/Makefile.am b/utils/Makefile.am
index 42bd973730194..327a29e028c4d 100644
--- a/utils/Makefile.am
+++ b/utils/Makefile.am
@@ -3,6 +3,7 @@
AM_CFLAGS = ${regular_CFLAGS}
AM_CPPFLAGS = ${regular_CPPFLAGS} -I${top_builddir}/include \
-I${top_srcdir}/include ${libnfnetlink_CFLAGS}
+AM_LDFLAGS = ${regular_LDFLAGS}
sbin_PROGRAMS =
pkgdata_DATA =
--
2.34.1
next prev parent reply other threads:[~2022-06-08 16:28 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-08 16:27 [iptables PATCH 0/9] Improve testsuites' code coverage Phil Sutter
2022-06-08 16:27 ` Phil Sutter [this message]
2022-06-08 16:27 ` [iptables PATCH 2/9] tests: shell: Add some more rules to 0002-verbose-output_0 Phil Sutter
2022-06-08 16:27 ` [iptables PATCH 3/9] tests: shell: Extend iptables-xml test a bit Phil Sutter
2022-06-08 16:27 ` [iptables PATCH 4/9] tests: shell: Extend zero counters test a bit further Phil Sutter
2022-06-08 16:27 ` [iptables PATCH 5/9] extensions: libebt_standard.t: Test logical-{in,out} as well Phil Sutter
2022-06-08 16:27 ` [iptables PATCH 6/9] ebtables-restore: Deny --init-table Phil Sutter
2022-06-08 16:27 ` [iptables PATCH 7/9] extensions: string: Do not print default --to value Phil Sutter
2022-06-08 16:27 ` [iptables PATCH 8/9] extensions: string: Review parse_string() function Phil Sutter
2022-06-08 16:27 ` [iptables PATCH 9/9] extensions: string: Fix and enable tests Phil Sutter
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220608162712.31202-2-phil@nwl.cc \
--to=phil@nwl.cc \
--cc=netfilter-devel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).