]> git.ipfire.org Git - thirdparty/iptables.git/commitdiff
Makefile: Add --enable-profiling configure option
authorPhil Sutter <phil@nwl.cc>
Thu, 20 May 2021 09:59:23 +0000 (11:59 +0200)
committerPhil Sutter <phil@nwl.cc>
Sat, 11 Jun 2022 09:47:03 +0000 (11:47 +0200)
A little convenience to prepare a build for analysis with gcov/gprof.

Signed-off-by: Phil Sutter <phil@nwl.cc>
.gitignore
configure.ac
extensions/GNUmakefile.in
iptables/Makefile.am
libipq/Makefile.am
libiptc/Makefile.am
libxtables/Makefile.am
utils/Makefile.am

index e55952642ed0d0c2bc2ac9492922a9983a987c2b..a206fb4870bc899b91bfa9bdf57f28394c36b252 100644 (file)
@@ -1,4 +1,8 @@
 *.a
+*.gcda
+*.gcno
+*.gcno.gcov.json.gz
+*.gcov
 *.la
 *.lo
 *.so
index 071afaf1515de87764e3f00c44d2a5c9b9c7bb82..ea5d2d49112a3c374a9b6b887fcd0c472a7c9b84 100644 (file)
@@ -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}
index 6dad4e02481bd9e0720619b23200b4ab657c07ee..3c68f8decd13f963dd4abc272c46a778e02828b5 100644 (file)
@@ -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
index 0258264c4c705cf5914b421c401fcf8b8fdc8e57..23f8352d3061067ec9471d1551490bf53a722093 100644 (file)
@@ -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 =
 
index 9e3a2ca6c42e2da360c526fef59db8277d7e15b1..2cdaf32e032929f8ed7294e29c8a027591b967c3 100644 (file)
@@ -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
index 464a069628f0c0436b65612a9c1d9dea27b2d17b..097842f212bb54852c801358fb86b2543e1d3551 100644 (file)
@@ -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
 
index 3bfded8570e085889e6331336ec61e72766d3a51..2f4a12e571b9bfea7893ad1e9a617e06ef6c80a6 100644 (file)
@@ -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
index 42bd973730194232537eae9a6a86e694df5928d6..327a29e028c4dc5b1280c5f467e93fda177a18db 100644 (file)
@@ -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 =