Skip to content

Commit 5772c34

Browse files
eddyz87Martin KaFai Lau
authored andcommitted
selftests/bpf: use simply-expanded variables for libpcap flags
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: f52403b ("selftests/bpf: Add traffic monitor functions.") Signed-off-by: Eduard Zingerman <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Martin KaFai Lau <[email protected]>
1 parent 5cd0aea commit 5772c34

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

tools/testing/selftests/bpf/Makefile

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,10 @@ CFLAGS += -g $(OPT_FLAGS) -rdynamic \
4848
LDFLAGS += $(SAN_LDFLAGS)
4949
LDLIBS += $(LIBELF_LIBS) -lz -lrt -lpthread
5050

51-
LDLIBS += $(shell $(PKG_CONFIG) --libs libpcap 2>/dev/null)
52-
CFLAGS += $(shell $(PKG_CONFIG) --cflags libpcap 2>/dev/null)
53-
CFLAGS += $(shell $(PKG_CONFIG) --exists libpcap 2>/dev/null && echo "-DTRAFFIC_MONITOR=1")
51+
PCAP_CFLAGS := $(shell $(PKG_CONFIG) --cflags libpcap 2>/dev/null && echo "-DTRAFFIC_MONITOR=1")
52+
PCAP_LIBS := $(shell $(PKG_CONFIG) --libs libpcap 2>/dev/null)
53+
LDLIBS += $(PCAP_LIBS)
54+
CFLAGS += $(PCAP_CFLAGS)
5455

5556
# The following tests perform type punning and they may break strict
5657
# aliasing rules, which are exploited by both GCC and clang by default

0 commit comments

Comments
 (0)