Skip to contentSkip to conversation

no recursive make

PATCH Superseded Thomas Haller 2 participants 9 messages Aug 25, 2023 – Sep 8, 2023

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover no recursive make

Switch from recursive make to a single toplevel Makefile.

[Quote commit message from first commit]

Unlike meson's subdir() or C's #include, automake's SUBDIRS= does not include a Makefile. Instead, it calls make -C $dir.

https://www.gnu.org/software/make/manual/html_node/Recursion.html
https://www.gnu.org/software/automake/manual/html_node/Subdirectories.html

This has several problems, which we an avoid with a single Makefile:

- recursive make is harder to maintain and understand as a whole. Recursive make makes sense, when there are truly independent sub-projects. Which is not the case here. The project needs to be considered as a whole and not one directory at a time. When we add unit tests (which we should), those would reside in separate directories but have dependencies between directories. With a single Makefile, we see all at once. There is a certain complexity to the build setup, that complexity is not automatically reduced by splitting it into more files. On the contrary it helps to have it all at once place, provided that it's still sensibly structured, named and organized.

- typing make prints irrelevant "Entering directory" messages. So much so, that at the end of the build, the terminal is filled with such messages and we have to scroll to see what happened.

- with recursive make, during build we see:

make[3]: Entering directory '.../nftables/src'
CC meta.lo
meta.c:13:2: error: #warning hello test [-Werror=cpp]
13 | #warning hello test
| ^~~~~~~

With a single Makefile we get

CC src/meta.lo
src/meta.c:13:2: error: #warning hello test [-Werror=cpp]
13 | #warning hello test
| ^~~~~~~

This shows the full filename, assuming that the developer works from the top level directory. The full name is useful, for example to copy+paste into the terminal.

- single Makefile is also faster:

    $ make && perf stat -r 200 -B make -j

I measure 35msec vs. 80msec.

- recursive make limits parallel make. You have to craft the SUBDIRS= in the correct order. The dependencies between directories are limited, as make only sees "LDADD = $(top_builddir)/src/libnftables.la" and not the deeper dependencies for the library.

- I presume, some people like recursive make because of make -C $subdir to only rebuild one directory. Rebuilding the entire tree is very fast, so this feature seems not relevant. Also, as dependency handling is limited, we might wrongly not rebuild a target. For example,

make check
touch src/meta.c
make -C examples check

does not rebuild "examples/nft-json-file".
What we now can do with single Makefile (and better than before), is make examples/nft-json-file, which works as desired.

Thomas Haller (6):
build: drop recursive make for "include/**/Makefile.am"
build: drop recursive make for "py/Makefile.am"
build: drop recursive make for "files/**/Makefile.am"
build: drop recursive make for "src/Makefile.am"
build: drop recursive make for "examples/Makefile.am"
build: drop recursive make for "doc/Makefile.am"

 Make_global.am                             |  21 --
 Makefile.am                                | 408 ++++++++++++++++++++-
 configure.ac                               |  16 -
 doc/Makefile.am                            |  30 --
 examples/Makefile.am                       |   6 -
 files/Makefile.am                          |   3 -
 files/examples/Makefile.am                 |   5 -
 files/nftables/Makefile.am                 |  14 -
 files/osf/Makefile.am                      |   2 -
 include/Makefile.am                        |  42 ---
 include/linux/Makefile.am                  |  12 -
 include/linux/netfilter/Makefile.am        |  10 -
 include/linux/netfilter_arp/Makefile.am    |   1 -
 include/linux/netfilter_bridge/Makefile.am |   1 -
 include/linux/netfilter_ipv4/Makefile.am   |   1 -
 include/linux/netfilter_ipv6/Makefile.am   |   1 -
 include/nftables/Makefile.am               |   1 -
 py/Makefile.am                             |   1 -
 src/Makefile.am                            | 122 ------
 19 files changed, 399 insertions(+), 298 deletions(-)
 delete mode 100644 Make_global.am
 delete mode 100644 doc/Makefile.am
 delete mode 100644 examples/Makefile.am
 delete mode 100644 files/Makefile.am
 delete mode 100644 files/examples/Makefile.am
 delete mode 100644 files/nftables/Makefile.am
 delete mode 100644 files/osf/Makefile.am
 delete mode 100644 include/Makefile.am
 delete mode 100644 include/linux/Makefile.am
 delete mode 100644 include/linux/netfilter/Makefile.am
 delete mode 100644 include/linux/netfilter_arp/Makefile.am
 delete mode 100644 include/linux/netfilter_bridge/Makefile.am
 delete mode 100644 include/linux/netfilter_ipv4/Makefile.am
 delete mode 100644 include/linux/netfilter_ipv6/Makefile.am
 delete mode 100644 include/nftables/Makefile.am
 delete mode 100644 py/Makefile.am
 delete mode 100644 src/Makefile.am
Signature · 1 line
2.41.0
#1 lore raw

PATCH 1/6 build: drop recursive make for "include/**/Makefile.am"

Switch from recursive make to a single toplevel Makefile. This is the first step, the following patches will complete this.

Unlike meson's subdir() or C's #include, automake's SUBDIRS= does not include a Makefile. Instead, it calls make -C $dir.

https://www.gnu.org/software/make/manual/html_node/Recursion.html
https://www.gnu.org/software/automake/manual/html_node/Subdirectories.html

This has several problems, which we an avoid with a single Makefile:

- recursive make is harder to maintain and understand as a whole. Recursive make makes sense, when there are truly independent sub-projects. Which is not the case here. The project needs to be considered as a whole and not one directory at a time. When we add unit tests (which we should), those would reside in separate directories but have dependencies between directories. With a single Makefile, we see all at once. There is a certain complexity to the build setup, that complexity is not automatically reduced by splitting it into more files. On the contrary it helps to have it all at once place, provided that it's still sensibly structured, named and organized.

- typing make prints irrelevant "Entering directory" messages. So much so, that at the end of the build, the terminal is filled with such messages and we have to scroll to see what happened.

- with recursive make, during build we see:

make[3]: Entering directory '.../nftables/src'
CC meta.lo
meta.c:13:2: error: #warning hello test [-Werror=cpp]
13 | #warning hello test
| ^~~~~~~

With a single Makefile we get

CC src/meta.lo
src/meta.c:13:2: error: #warning hello test [-Werror=cpp]
13 | #warning hello test
| ^~~~~~~

This shows the full filename, assuming that the developer works from the top level directory. The full name is useful, for example to copy+paste into the terminal.

- single Makefile is also faster:

    $ make && perf stat -r 200 -B make -j

I measure 35msec vs. 80msec.

- recursive make limits parallel make. You have to craft the SUBDIRS= in the correct order. The dependencies between directories are limited, as make only sees "LDADD = $(top_builddir)/src/libnftables.la" and not the deeper dependencies for the library.

- I presume, some people like recursive make because of make -C $subdir to only rebuild one directory. Rebuilding the entire tree is very fast, so this feature seems not relevant. Also, as dependency handling is limited, we might wrongly not rebuild a target. For example,

make check
touch src/meta.c
make -C examples check

does not rebuild "examples/nft-json-file".
What we now can do with single Makefile (and better than before), is make examples/nft-json-file, which works as desired.

---
 Makefile.am                                | 74 +++++++++++++++++++++-
 configure.ac                               |  8 ---
 include/Makefile.am                        | 42 ------------
 include/linux/Makefile.am                  | 12 ----
 include/linux/netfilter/Makefile.am        | 10 ---
 include/linux/netfilter_arp/Makefile.am    |  1 -
 include/linux/netfilter_bridge/Makefile.am |  1 -
 include/linux/netfilter_ipv4/Makefile.am   |  1 -
 include/linux/netfilter_ipv6/Makefile.am   |  1 -
 include/nftables/Makefile.am               |  1 -
 10 files changed, 71 insertions(+), 80 deletions(-)
 delete mode 100644 include/Makefile.am
 delete mode 100644 include/linux/Makefile.am
 delete mode 100644 include/linux/netfilter/Makefile.am
 delete mode 100644 include/linux/netfilter_arp/Makefile.am
 delete mode 100644 include/linux/netfilter_bridge/Makefile.am
 delete mode 100644 include/linux/netfilter_ipv4/Makefile.am
 delete mode 100644 include/linux/netfilter_ipv6/Makefile.am
 delete mode 100644 include/nftables/Makefile.am
Makefile.am +71 -3
index 84c3c366b86a..2be6329275e0 100644
@@ -1,7 +1,75 @@
-ACLOCAL_AMFLAGS	= -I m4
+ACLOCAL_AMFLAGS = -I m4
 
-SUBDIRS = 	src	\
-		include	\
+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/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)
+
+SUBDIRS =	src	\
 		files	\
 		doc	\
 		examples\
configure.ac +0 -8
index 42f0dc4cf392..ca2eaca09869 100644
@@ -116,14 +116,6 @@ AC_CONFIG_FILES([					\
 		Makefile				\
 		libnftables.pc				\
 		src/Makefile				\
-		include/Makefile			\
-		include/nftables/Makefile		\
-		include/linux/Makefile			\
-		include/linux/netfilter/Makefile	\
-		include/linux/netfilter_arp/Makefile	\
-		include/linux/netfilter_bridge/Makefile	\
-		include/linux/netfilter_ipv4/Makefile	\
-		include/linux/netfilter_ipv6/Makefile	\
 		files/Makefile				\
 		files/examples/Makefile			\
 		files/nftables/Makefile			\
include/Makefile.am deleted +0 -42

42 lines not on this page · raw message

include/linux/Makefile.am deleted +0 -12
deleted file mode 100644
index eb9fc4e4a6bd..000000000000
@@ -1,12 +0,0 @@
-SUBDIRS =		netfilter		\
-			netfilter_arp		\
-			netfilter_bridge	\
-			netfilter_ipv4		\
-			netfilter_ipv6
-
-noinst_HEADERS =	netfilter_arp.h		\
-			netfilter_bridge.h	\
-			netfilter_decnet.h	\
-			netfilter.h		\
-			netfilter_ipv4.h	\
-			netfilter_ipv6.h
include/linux/netfilter/Makefile.am deleted +0 -10
deleted file mode 100644
index 22f66a7e1ebf..000000000000
@@ -1,10 +0,0 @@
-noinst_HEADERS = 	nf_conntrack_common.h		\
-			nf_conntrack_tuple_common.h	\
-			nf_log.h			\
-			nf_nat.h			\
-			nf_tables.h			\
-			nf_tables_compat.h		\
-			nf_synproxy.h			\
-			nfnetlink_osf.h			\
-			nfnetlink_hook.h		\
-			nfnetlink.h
include/linux/netfilter_arp/Makefile.am deleted +0 -1
deleted file mode 100644
index 0a16c1abd072..000000000000
@@ -1 +0,0 @@
-noinst_HEADERS =	arp_tables.h
include/linux/netfilter_bridge/Makefile.am deleted +0 -1
deleted file mode 100644
index d2e8b38b196e..000000000000
@@ -1 +0,0 @@
-noinst_HEADERS =	ebtables.h
include/linux/netfilter_ipv4/Makefile.am deleted +0 -1
deleted file mode 100644
index fec42533ab81..000000000000
@@ -1 +0,0 @@
-noinst_HEADERS =	ip_tables.h
include/linux/netfilter_ipv6/Makefile.am deleted +0 -1
deleted file mode 100644
index bec6c3f16694..000000000000
@@ -1 +0,0 @@
-noinst_HEADERS =	ip6_tables.h
include/nftables/Makefile.am deleted +0 -1
deleted file mode 100644
index 5cfb0c6c5a92..000000000000
@@ -1 +0,0 @@
-pkginclude_HEADERS = libnftables.h
Signature · 1 line
2.41.0
#2 lore raw

PATCH 2/6 build: drop recursive make for "py/Makefile.am"

In reply to Thomas Haller
---
 Makefile.am    | 19 +++++++++++++++----
 configure.ac   |  1 -
 py/Makefile.am |  1 -
 3 files changed, 15 insertions(+), 6 deletions(-)
 delete mode 100644 py/Makefile.am
Makefile.am +15 -4
index 2be6329275e0..feb21454b5eb 100644
@@ -1,5 +1,7 @@
 ACLOCAL_AMFLAGS = -I m4
 
+EXTRA_DIST =
+
 pkginclude_HEADERS = \
 	include/nftables/libnftables.h \
 	$(NULL)
@@ -72,11 +74,20 @@ noinst_HEADERS = \
 SUBDIRS =	src	\
 		files	\
 		doc	\
-		examples\
-		py
+		examples
+
+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 =	tests	\
-		files
+EXTRA_DIST += \
+	tests \
+	files
 
 pkgconfigdir = $(libdir)/pkgconfig
 pkgconfig_DATA = libnftables.pc
configure.ac +0 -1
index ca2eaca09869..06ac7da27ae3 100644
@@ -121,7 +121,6 @@ AC_CONFIG_FILES([					\
 		files/nftables/Makefile			\
 		files/osf/Makefile			\
 		doc/Makefile				\
-		py/Makefile				\
 		examples/Makefile			\
 		])
 AC_OUTPUT
py/Makefile.am deleted +0 -1
deleted file mode 100644
index 76aa082f8709..000000000000
@@ -1 +0,0 @@
-EXTRA_DIST = pyproject.toml setup.cfg setup.py src
Signature · 1 line
2.41.0
#3 lore raw

PATCH 3/6 build: drop recursive make for "files/**/Makefile.am"

In reply to Thomas Haller
---
 Makefile.am                | 43 +++++++++++++++++++++++++++++++++++++-
 configure.ac               |  4 ----
 files/Makefile.am          |  3 ---
 files/examples/Makefile.am |  5 -----
 files/nftables/Makefile.am | 14 -------------
 files/osf/Makefile.am      |  2 --
 6 files changed, 42 insertions(+), 29 deletions(-)
 delete mode 100644 files/Makefile.am
 delete mode 100644 files/examples/Makefile.am
 delete mode 100644 files/nftables/Makefile.am
 delete mode 100644 files/osf/Makefile.am
Makefile.am +42 -1
index feb21454b5eb..07d15938f479 100644
@@ -2,6 +2,8 @@ ACLOCAL_AMFLAGS = -I m4
 
 EXTRA_DIST =
 
+###############################################################################
+
 pkginclude_HEADERS = \
 	include/nftables/libnftables.h \
 	$(NULL)
@@ -71,11 +73,48 @@ noinst_HEADERS = \
 	\
 	$(NULL)
 
+###############################################################################
+
 SUBDIRS =	src	\
-		files	\
 		doc	\
 		examples
 
+###############################################################################
+
+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 \
@@ -85,6 +124,8 @@ EXTRA_DIST += \
 	py/src/schema.json \
 	$(NULL)
 
+###############################################################################
+
 EXTRA_DIST += \
 	tests \
 	files
configure.ac +0 -4
index 06ac7da27ae3..d86be5e3fd24 100644
@@ -116,10 +116,6 @@ AC_CONFIG_FILES([					\
 		Makefile				\
 		libnftables.pc				\
 		src/Makefile				\
-		files/Makefile				\
-		files/examples/Makefile			\
-		files/nftables/Makefile			\
-		files/osf/Makefile			\
 		doc/Makefile				\
 		examples/Makefile			\
 		])
files/Makefile.am deleted +0 -3
deleted file mode 100644
index 7deec1512977..000000000000
@@ -1,3 +0,0 @@
-SUBDIRS =	nftables \
-		examples \
-		osf
files/examples/Makefile.am deleted +0 -5
deleted file mode 100644
index b29e9f614203..000000000000
@@ -1,5 +0,0 @@
-pkgdocdir = ${docdir}/examples
-dist_pkgdoc_SCRIPTS = ct_helpers.nft \
-		load_balancing.nft \
-		secmark.nft \
-		sets_and_maps.nft
files/nftables/Makefile.am deleted +0 -14
deleted file mode 100644
index ee88dd896743..000000000000
@@ -1,14 +0,0 @@
-dist_pkgdata_DATA =	all-in-one.nft		\
-			arp-filter.nft		\
-			bridge-filter.nft	\
-			inet-filter.nft		\
-			inet-nat.nft		\
-			ipv4-filter.nft		\
-			ipv4-mangle.nft		\
-			ipv4-nat.nft		\
-			ipv4-raw.nft		\
-			ipv6-filter.nft		\
-			ipv6-mangle.nft		\
-			ipv6-nat.nft		\
-			ipv6-raw.nft		\
-			netdev-ingress.nft
files/osf/Makefile.am deleted +0 -2
deleted file mode 100644
index d80196dd7388..000000000000
@@ -1,2 +0,0 @@
-pkgsysconfdir = ${sysconfdir}/nftables/osf
-dist_pkgsysconf_DATA = pf.os
Signature · 1 line
2.41.0
#4 lore raw

PATCH 4/6 build: drop recursive make for "src/Makefile.am"

In reply to Thomas Haller
---
 Make_global.am  |  21 -----
 Makefile.am     | 209 +++++++++++++++++++++++++++++++++++++++++++++++-
 configure.ac    |   1 -
 src/Makefile.am | 122 ----------------------------
 4 files changed, 208 insertions(+), 145 deletions(-)
 delete mode 100644 Make_global.am
 delete mode 100644 src/Makefile.am
Make_global.am deleted +0 -21
deleted file mode 100644
index 5bb541f61388..000000000000
@@ -1,21 +0,0 @@
-# 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
Makefile.am +208 -1

221 lines not on this page · raw message

configure.ac +0 -1
index d86be5e3fd24..739434b7f474 100644
@@ -115,7 +115,6 @@ AC_CHECK_DECLS([getprotobyname_r, getprotobynumber_r, getservbyport_r], [], [],
 AC_CONFIG_FILES([					\
 		Makefile				\
 		libnftables.pc				\
-		src/Makefile				\
 		doc/Makefile				\
 		examples/Makefile			\
 		])
src/Makefile.am deleted +0 -122

122 lines not on this page · raw message

Signature · 1 line
2.41.0
#5 lore raw

PATCH 5/6 build: drop recursive make for "examples/Makefile.am"

In reply to Thomas Haller
---
 Makefile.am          | 19 ++++++++++++++++---
 configure.ac         |  1 -
 examples/Makefile.am |  6 ------
 3 files changed, 16 insertions(+), 10 deletions(-)
 delete mode 100644 examples/Makefile.am
Makefile.am +16 -3
index 2ad18f72dfd6..4af2d1f88b46 100644
@@ -26,9 +26,11 @@ ACLOCAL_AMFLAGS = -I m4
 
 EXTRA_DIST =
 BUILT_SOURCES =
+LDADD =
 lib_LTLIBRARIES =
 noinst_LTLIBRARIES =
 sbin_PROGRAMS =
+check_PROGRAMS =
 
 ###############################################################################
 
@@ -282,9 +284,20 @@ src_nft_LDADD = src/libnftables.la
 
 ###############################################################################
 
-SUBDIRS = \
-		doc	\
-		examples
+SUBDIRS = doc
+
+###############################################################################
+
+
+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
 
 ###############################################################################
 
configure.ac +0 -1
index 739434b7f474..b5cc2587253b 100644
@@ -116,7 +116,6 @@ AC_CONFIG_FILES([					\
 		Makefile				\
 		libnftables.pc				\
 		doc/Makefile				\
-		examples/Makefile			\
 		])
 AC_OUTPUT
 
examples/Makefile.am deleted +0 -6
deleted file mode 100644
index 3b8b0b6708dc..000000000000
@@ -1,6 +0,0 @@
-check_PROGRAMS	= nft-buffer		\
-		  nft-json-file
-
-AM_CPPFLAGS = -I$(top_srcdir)/include
-
-LDADD = $(top_builddir)/src/libnftables.la
Signature · 1 line
2.41.0
reviewer
#6 lore raw

Re: [PATCH nft 5/6] build: drop recursive make for "examples/Makefile.am"

On Fri, Aug 25, 2023 at 01:27:37PM +0200, Thomas Haller wrote:
[...]

Makefile.am src_nft_LDADD = src/libnftables.la · line 300

Quoted 9 lines
Makefile.am +9 -0
+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

Does this replace or extend AM_CPPFLAGS/LDADD for the example programs? IOW, do the global AM_CPPFLAGS added in the previous patch leak into the example program compile calls or not?

Cheers, Phil

#7 lore raw

Re: [PATCH nft 5/6] build: drop recursive make for "examples/Makefile.am"

Quoted 18 lines · Phil Sutter

On Fri, Aug 25, 2023 at 01:27:37PM +0200, Thomas Haller wrote:
[...]

Makefile.am src_nft_LDADD = src/libnftables.la · line 300

Quoted 9 lines
Makefile.am +9 -0
+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

Does this replace or extend AM_CPPFLAGS/LDADD for the example programs?
IOW, do the global AM_CPPFLAGS added in the previous patch leak into the
example program compile calls or not?

Quoted 2 lines

Cheers, Phil

Replace.

Described here:
https://www.gnu.org/software/automake/manual/html_node/Flag-Variables-Ordering.html

Basically, if you explicitly define CFLAGS,CPPFLAGS,LDFLAGS,etc for a target like

inst_LTLIBRARIES = /path/to/libtarget.la
path_to_libtarget_CPPFLAGS = -ABC

then this gets build with $(path_to_libtarget_CPPFLAGS) $(CPPFLAGS).

Otherwise, it gets $(AM_CPPFLAGS) $(CPPFLAGS)

Thomas

#8 lore raw

PATCH 6/6 build: drop recursive make for "doc/Makefile.am"

In reply to Thomas Haller
---
 Makefile.am     | 60 ++++++++++++++++++++++++++++++++++++++++++++-----
 configure.ac    |  1 -
 doc/Makefile.am | 30 -------------------------
 3 files changed, 55 insertions(+), 36 deletions(-)
 delete mode 100644 doc/Makefile.am
Makefile.am +55 -5
index 4af2d1f88b46..3f7a8ca9bc9f 100644
@@ -31,6 +31,8 @@ lib_LTLIBRARIES =
 noinst_LTLIBRARIES =
 sbin_PROGRAMS =
 check_PROGRAMS =
+dist_man_MANS =
+CLEANFILES =
 
 ###############################################################################
 
@@ -284,11 +286,6 @@ src_nft_LDADD = src/libnftables.la
 
 ###############################################################################
 
-SUBDIRS = doc
-
-###############################################################################
-
-
 check_PROGRAMS += examples/nft-buffer
 
 examples_nft_buffer_AM_CPPFLAGS = -I$(srcdir)/include
@@ -301,6 +298,59 @@ 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)
+	$(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 \
configure.ac +0 -1
index b5cc2587253b..f1e38e9d697d 100644
@@ -115,7 +115,6 @@ AC_CHECK_DECLS([getprotobyname_r, getprotobynumber_r, getservbyport_r], [], [],
 AC_CONFIG_FILES([					\
 		Makefile				\
 		libnftables.pc				\
-		doc/Makefile				\
 		])
 AC_OUTPUT
 
doc/Makefile.am deleted +0 -30
deleted file mode 100644
index b43cb08d2d14..000000000000
@@ -1,30 +0,0 @@
-if BUILD_MAN
-dist_man_MANS = nft.8 libnftables-json.5 libnftables.3
-
-A2X_OPTS_MANPAGE = -L --doctype manpage --format manpage -D ${builddir}
-
-ASCIIDOC_MAIN = nft.txt
-ASCIIDOC_INCLUDES = \
-       data-types.txt \
-       payload-expression.txt \
-       primary-expression.txt \
-       stateful-objects.txt \
-       statements.txt
-ASCIIDOCS = ${ASCIIDOC_MAIN} ${ASCIIDOC_INCLUDES}
-
-EXTRA_DIST = ${ASCIIDOCS} libnftables-json.adoc libnftables.adoc
-
-CLEANFILES = \
-	*~
-
-nft.8: ${ASCIIDOCS}
-	${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
Signature · 1 line
2.41.0