netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeremy Sowden <jeremy@azazel.net>
To: Netfilter Devel <netfilter-devel@vger.kernel.org>
Subject: [ulogd2 PATCH 08/13] build: only conditionally enter sub-directories containing optional code
Date: Sat, 30 Oct 2021 17:01:36 +0100	[thread overview]
Message-ID: <20211030160141.1132819-9-jeremy@azazel.net> (raw)
In-Reply-To: <20211030160141.1132819-1-jeremy@azazel.net>

Currently, make enters all sub-directories containing source-code, even if they
only contain optional targets which are not configured to be built.  Instead,
change the Makefiles so that the sub-directories are optional, rather than the
targets.

Signed-off-by: Jeremy Sowden <jeremy@azazel.net>
---
 input/Makefile.am          | 10 +++++++++-
 input/flow/Makefile.am     |  2 --
 input/sum/Makefile.am      |  3 +--
 output/Makefile.am         | 33 +++++++++++++++++++++++++++++----
 output/dbi/Makefile.am     |  4 ----
 output/mysql/Makefile.am   |  4 ----
 output/pcap/Makefile.am    |  4 ----
 output/pgsql/Makefile.am   |  4 ----
 output/sqlite3/Makefile.am |  4 ----
 9 files changed, 39 insertions(+), 29 deletions(-)

diff --git a/input/Makefile.am b/input/Makefile.am
index 8f2e934fcdfa..668fc2b1444a 100644
--- a/input/Makefile.am
+++ b/input/Makefile.am
@@ -1 +1,9 @@
-SUBDIRS = packet flow sum
+if BUILD_NFCT
+    OPT_SUBDIR_FLOW = flow
+endif
+
+if BUILD_NFACCT
+    OPT_SUBDIR_SUM = sum
+endif
+
+SUBDIRS = packet $(OPT_SUBDIR_FLOW) $(OPT_SUBDIR_SUM)
diff --git a/input/flow/Makefile.am b/input/flow/Makefile.am
index 004e532981a4..2171a0cd80c8 100644
--- a/input/flow/Makefile.am
+++ b/input/flow/Makefile.am
@@ -2,12 +2,10 @@ include $(top_srcdir)/Make_global.am
 
 AM_CPPFLAGS += ${LIBNETFILTER_CONNTRACK_CFLAGS}
 
-if BUILD_NFCT
 pkglib_LTLIBRARIES = ulogd_inpflow_NFCT.la # ulogd_inpflow_IPFIX.la
 
 ulogd_inpflow_NFCT_la_SOURCES = ulogd_inpflow_NFCT.c
 ulogd_inpflow_NFCT_la_LDFLAGS = -avoid-version -module $(LIBNETFILTER_CONNTRACK_LIBS)
-endif
 
 #ulogd_inpflow_IPFIX_la_SOURCES = ulogd_inpflow_IPFIX.c
 #ulogd_inpflow_IPFIX_la_LDFLAGS = -avoid-version -module
diff --git a/input/sum/Makefile.am b/input/sum/Makefile.am
index e0c42f7de376..b24af7b5606c 100644
--- a/input/sum/Makefile.am
+++ b/input/sum/Makefile.am
@@ -2,9 +2,8 @@ include $(top_srcdir)/Make_global.am
 
 AM_CPPFLAGS += $(LIBNETFILTER_ACCT_CFLAGS) $(LIBMNL_CFLAGS)
 
-if BUILD_NFACCT
 pkglib_LTLIBRARIES = ulogd_inpflow_NFACCT.la
+
 ulogd_inpflow_NFACCT_la_SOURCES = ulogd_inpflow_NFACCT.c
 ulogd_inpflow_NFACCT_la_LDFLAGS = -avoid-version -module
 ulogd_inpflow_NFACCT_la_LIBADD  = $(LIBMNL_LIBS) $(LIBNETFILTER_ACCT_LIBS)
-endif
diff --git a/output/Makefile.am b/output/Makefile.am
index 2b7d12b12be3..981ff0a30808 100644
--- a/output/Makefile.am
+++ b/output/Makefile.am
@@ -1,4 +1,29 @@
-SUBDIRS= pcap mysql pgsql sqlite3 dbi ipfix
+if HAVE_PCAP
+  OPT_SUBDIR_PCAP = pcap
+endif
+
+if HAVE_MYSQL
+  OPT_SUBDIR_MYSQL = mysql
+endif
+
+if HAVE_PGSQL
+  OPT_SUBDIR_PGSQL = pgsql
+endif
+
+if HAVE_SQLITE3
+  OPT_SUBDIR_SQLITE3 = sqlite3
+endif
+
+if HAVE_DBI
+  OPT_SUBDIR_DBI = dbi
+endif
+
+SUBDIRS = $(OPT_SUBDIR_PCAP) \
+	  $(OPT_SUBDIR_MYSQL) \
+	  $(OPT_SUBDIR_PGSQL) \
+	  $(OPT_SUBDIR_SQLITE3) \
+	  $(OPT_SUBDIR_DBI) \
+	  ipfix
 
 include $(top_srcdir)/Make_global.am
 
@@ -7,9 +32,9 @@ AM_CPPFLAGS += ${LIBNETFILTER_ACCT_CFLAGS} \
 	       ${LIBNETFILTER_LOG_CFLAGS}
 
 pkglib_LTLIBRARIES = ulogd_output_LOGEMU.la ulogd_output_SYSLOG.la \
-			 ulogd_output_OPRINT.la ulogd_output_GPRINT.la \
-			 ulogd_output_NACCT.la ulogd_output_XML.la \
-			 ulogd_output_GRAPHITE.la
+		     ulogd_output_OPRINT.la ulogd_output_GPRINT.la \
+		     ulogd_output_NACCT.la ulogd_output_XML.la \
+		     ulogd_output_GRAPHITE.la
 
 if HAVE_JANSSON
 pkglib_LTLIBRARIES += ulogd_output_JSON.la
diff --git a/output/dbi/Makefile.am b/output/dbi/Makefile.am
index 38db0a26fd84..f8b0a9c68c78 100644
--- a/output/dbi/Makefile.am
+++ b/output/dbi/Makefile.am
@@ -2,12 +2,8 @@ include $(top_srcdir)/Make_global.am
 
 AM_CPPFLAGS += $(DBI_INC)
 
-if HAVE_DBI
-
 pkglib_LTLIBRARIES = ulogd_output_DBI.la
 
 ulogd_output_DBI_la_SOURCES = ulogd_output_DBI.c ../../util/db.c
 ulogd_output_DBI_la_LIBADD  = ${DBI_LIB}
 ulogd_output_DBI_la_LDFLAGS = -avoid-version -module
-
-endif
diff --git a/output/mysql/Makefile.am b/output/mysql/Makefile.am
index 3839a135c926..54abb9654eb7 100644
--- a/output/mysql/Makefile.am
+++ b/output/mysql/Makefile.am
@@ -2,12 +2,8 @@ include $(top_srcdir)/Make_global.am
 
 AM_CPPFLAGS += $(MYSQL_INC)
 
-if HAVE_MYSQL
-
 pkglib_LTLIBRARIES = ulogd_output_MYSQL.la
 
 ulogd_output_MYSQL_la_SOURCES = ulogd_output_MYSQL.c ../../util/db.c
 ulogd_output_MYSQL_la_LIBADD  = ${MYSQL_LIB}
 ulogd_output_MYSQL_la_LDFLAGS = -avoid-version -module
-
-endif
diff --git a/output/pcap/Makefile.am b/output/pcap/Makefile.am
index a022bf0cc15c..9b4b3dde3a9c 100644
--- a/output/pcap/Makefile.am
+++ b/output/pcap/Makefile.am
@@ -1,11 +1,7 @@
 include $(top_srcdir)/Make_global.am
 
-if HAVE_PCAP
-
 pkglib_LTLIBRARIES = ulogd_output_PCAP.la
 
 ulogd_output_PCAP_la_SOURCES = ulogd_output_PCAP.c
 ulogd_output_PCAP_la_LIBADD  = ${libpcap_LIBS}
 ulogd_output_PCAP_la_LDFLAGS = -avoid-version -module
-
-endif
diff --git a/output/pgsql/Makefile.am b/output/pgsql/Makefile.am
index fbc0d04c9f11..9cdf22d7f765 100644
--- a/output/pgsql/Makefile.am
+++ b/output/pgsql/Makefile.am
@@ -2,12 +2,8 @@ include $(top_srcdir)/Make_global.am
 
 AM_CPPFLAGS += -I$(PQINCPATH)
 
-if HAVE_PGSQL
-
 pkglib_LTLIBRARIES = ulogd_output_PGSQL.la
 
 ulogd_output_PGSQL_la_SOURCES = ulogd_output_PGSQL.c ../../util/db.c
 ulogd_output_PGSQL_la_LIBADD  = ${PQLIBS}
 ulogd_output_PGSQL_la_LDFLAGS = -avoid-version -module
-
-endif
diff --git a/output/sqlite3/Makefile.am b/output/sqlite3/Makefile.am
index e00e1d6cf11c..72fd1a6a8db4 100644
--- a/output/sqlite3/Makefile.am
+++ b/output/sqlite3/Makefile.am
@@ -2,12 +2,8 @@ include $(top_srcdir)/Make_global.am
 
 AM_CPPFLAGS += ${libsqlite3_CFLAGS}
 
-if HAVE_SQLITE3
-
 pkglib_LTLIBRARIES = ulogd_output_SQLITE3.la
 
 ulogd_output_SQLITE3_la_SOURCES = ulogd_output_SQLITE3.c ../../util/db.c
 ulogd_output_SQLITE3_la_LIBADD  = ${libsqlite3_LIBS}
 ulogd_output_SQLITE3_la_LDFLAGS = -avoid-version -module
-
-endif
-- 
2.33.0


  parent reply	other threads:[~2021-10-30 16:01 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-30 16:01 [ulogd2 PATCH 00/13] Build Improvements Jeremy Sowden
2021-10-30 16:01 ` [ulogd2 PATCH 01/13] gitignore: Add Emacs artefacts Jeremy Sowden
2021-10-30 16:01 ` [ulogd2 PATCH 02/13] gitignore: ignore util/.dirstamp Jeremy Sowden
2021-10-30 17:05   ` Jan Engelhardt
2021-11-06 11:06     ` Jeremy Sowden
2021-10-30 16:01 ` [ulogd2 PATCH 03/13] build: remove unused Makefile fragment Jeremy Sowden
2021-10-30 16:01 ` [ulogd2 PATCH 04/13] build: remove empty filter sub-directory Jeremy Sowden
2021-10-30 16:01 ` [ulogd2 PATCH 05/13] build: move cpp flag to the only Makefile.am file where it's needed Jeremy Sowden
2021-10-30 16:01 ` [ulogd2 PATCH 06/13] build: add Make_global.am for common flags and include it where necessary Jeremy Sowden
2021-10-30 16:01 ` [ulogd2 PATCH 07/13] build: use `dist_man_MANS` Jeremy Sowden
2021-10-30 16:01 ` Jeremy Sowden [this message]
2021-10-30 17:15   ` [ulogd2 PATCH 08/13] build: only conditionally enter sub-directories containing optional code Jan Engelhardt
2021-11-06 11:06     ` Jeremy Sowden
2021-10-30 16:01 ` [ulogd2 PATCH 09/13] build: move library dependencies from LDFLAGS to LIBADD Jeremy Sowden
2021-10-30 16:01 ` [ulogd2 PATCH 10/13] build: update obsolete autoconf macros Jeremy Sowden
2021-10-30 17:16   ` Jan Engelhardt
2021-11-06 11:07     ` Jeremy Sowden
2021-10-30 16:01 ` [ulogd2 PATCH 11/13] build: quote and reformat some autoconf macro arguments Jeremy Sowden
2021-10-30 16:01 ` [ulogd2 PATCH 12/13] build: reformat autoconf AC_ARG_WITH, AC_ARG_ENABLE and related macros Jeremy Sowden
2021-10-30 16:01 ` [ulogd2 PATCH 13/13] build: bump autoconf version to 2.71 Jeremy Sowden
2021-10-30 17:21   ` Jan Engelhardt
2021-11-06 11:07     ` Jeremy Sowden

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=20211030160141.1132819-9-jeremy@azazel.net \
    --to=jeremy@azazel.net \
    --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).