diff mbox series

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

Message ID 20230825113042.2607496-6-thaller@redhat.com
State Changes Requested
Delegated to: Pablo Neira
Headers show
Series no recursive make | expand

Commit Message

Thomas Haller Aug. 25, 2023, 11:27 a.m. UTC
Signed-off-by: Thomas Haller <thaller@redhat.com>
---
 Makefile.am          | 19 ++++++++++++++++---
 configure.ac         |  1 -
 examples/Makefile.am |  6 ------
 3 files changed, 16 insertions(+), 10 deletions(-)
 delete mode 100644 examples/Makefile.am

Comments

Phil Sutter Sept. 8, 2023, 11:09 a.m. UTC | #1
On Fri, Aug 25, 2023 at 01:27:37PM +0200, Thomas Haller wrote:
[...]
> +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
Thomas Haller Sept. 8, 2023, 11:50 a.m. UTC | #2
On Fri, 2023-09-08 at 13:09 +0200, Phil Sutter wrote:
> On Fri, Aug 25, 2023 at 01:27:37PM +0200, Thomas Haller wrote:
> [...]
> > +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
> 


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
diff mbox series

Patch

diff --git a/Makefile.am b/Makefile.am
index 2ad18f72dfd6..4af2d1f88b46 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -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
 
 ###############################################################################
 
diff --git a/configure.ac b/configure.ac
index 739434b7f474..b5cc2587253b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -116,7 +116,6 @@  AC_CONFIG_FILES([					\
 		Makefile				\
 		libnftables.pc				\
 		doc/Makefile				\
-		examples/Makefile			\
 		])
 AC_OUTPUT
 
diff --git a/examples/Makefile.am b/examples/Makefile.am
deleted file mode 100644
index 3b8b0b6708dc..000000000000
--- a/examples/Makefile.am
+++ /dev/null
@@ -1,6 +0,0 @@ 
-check_PROGRAMS	= nft-buffer		\
-		  nft-json-file
-
-AM_CPPFLAGS = -I$(top_srcdir)/include
-
-LDADD = $(top_builddir)/src/libnftables.la