BPF List
 help / color / mirror / Atom feed
* [PATCH bpf-next] selftests/bpf: use simply-expanded variables for libpcap flags
@ 2024-08-23 19:44 Eduard Zingerman
  2024-08-23 19:49 ` Eduard Zingerman
  2024-08-23 22:30 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Eduard Zingerman @ 2024-08-23 19:44 UTC (permalink / raw)
  To: bpf, ast
  Cc: andrii, daniel, martin.lau, kernel-team, yonghong.song,
	Eduard Zingerman

Save pkg-config output for libpcap as simply-expanded variables.
For an obscure reason 'shell' call in LDLIBS/CFLAGS recursively
expanded variables makes *.test.o files compilation non-parallel
when make is executed with -j option.

While at it, reuse 'pkg-config --cflags' call to define
-DTRAFFIC_MONITOR=1 option, it's exit status is the same as for
'pkg-config --exists'.

Fixes: f52403b6bfea ("selftests/bpf: Add traffic monitor functions.")
Signed-off-by: Eduard Zingerman <eddyz87@gmail.com>
---
 tools/testing/selftests/bpf/Makefile | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile
index ec7d425c4022..c120617b64ad 100644
--- a/tools/testing/selftests/bpf/Makefile
+++ b/tools/testing/selftests/bpf/Makefile
@@ -48,9 +48,10 @@ CFLAGS += -g $(OPT_FLAGS) -rdynamic					\
 LDFLAGS += $(SAN_LDFLAGS)
 LDLIBS += $(LIBELF_LIBS) -lz -lrt -lpthread
 
-LDLIBS += $(shell $(PKG_CONFIG) --libs libpcap 2>/dev/null)
-CFLAGS += $(shell $(PKG_CONFIG) --cflags libpcap 2>/dev/null)
-CFLAGS += $(shell $(PKG_CONFIG) --exists libpcap 2>/dev/null && echo "-DTRAFFIC_MONITOR=1")
+PCAP_CFLAGS	:= $(shell $(PKG_CONFIG) --cflags libpcap 2>/dev/null && echo "-DTRAFFIC_MONITOR=1")
+PCAP_LIBS	:= $(shell $(PKG_CONFIG) --libs libpcap 2>/dev/null)
+LDLIBS += $(PCAP_LIBS)
+CFLAGS += $(PCAP_CFLAGS)
 
 # The following tests perform type punning and they may break strict
 # aliasing rules, which are exploited by both GCC and clang by default
-- 
2.46.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH bpf-next] selftests/bpf: use simply-expanded variables for libpcap flags
  2024-08-23 19:44 [PATCH bpf-next] selftests/bpf: use simply-expanded variables for libpcap flags Eduard Zingerman
@ 2024-08-23 19:49 ` Eduard Zingerman
  2024-08-23 22:30 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Eduard Zingerman @ 2024-08-23 19:49 UTC (permalink / raw)
  To: bpf, ast; +Cc: andrii, daniel, martin.lau, kernel-team, yonghong.song

On Fri, 2024-08-23 at 12:44 -0700, Eduard Zingerman wrote:
> Save pkg-config output for libpcap as simply-expanded variables.
> For an obscure reason 'shell' call in LDLIBS/CFLAGS recursively
> expanded variables makes *.test.o files compilation non-parallel
> when make is executed with -j option.

If someone on the mailing list understands why having
`CFLAGS += $(shell ...)` makes make -j non-parallel,
please let me know.

[...]


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH bpf-next] selftests/bpf: use simply-expanded variables for libpcap flags
  2024-08-23 19:44 [PATCH bpf-next] selftests/bpf: use simply-expanded variables for libpcap flags Eduard Zingerman
  2024-08-23 19:49 ` Eduard Zingerman
@ 2024-08-23 22:30 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-08-23 22:30 UTC (permalink / raw)
  To: Eduard Zingerman
  Cc: bpf, ast, andrii, daniel, martin.lau, kernel-team, yonghong.song

Hello:

This patch was applied to bpf/bpf-next.git (master)
by Martin KaFai Lau <martin.lau@kernel.org>:

On Fri, 23 Aug 2024 12:44:09 -0700 you wrote:
> Save pkg-config output for libpcap as simply-expanded variables.
> For an obscure reason 'shell' call in LDLIBS/CFLAGS recursively
> expanded variables makes *.test.o files compilation non-parallel
> when make is executed with -j option.
> 
> While at it, reuse 'pkg-config --cflags' call to define
> -DTRAFFIC_MONITOR=1 option, it's exit status is the same as for
> 'pkg-config --exists'.
> 
> [...]

Here is the summary with links:
  - [bpf-next] selftests/bpf: use simply-expanded variables for libpcap flags
    https://git.kernel.org/bpf/bpf-next/c/5772c3458bb8

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-08-23 22:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-23 19:44 [PATCH bpf-next] selftests/bpf: use simply-expanded variables for libpcap flags Eduard Zingerman
2024-08-23 19:49 ` Eduard Zingerman
2024-08-23 22:30 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox