Use pcap-config to populate CFLAGS and LDFLAGS.
LIBPCAP_CFLAGS and LIBPCAP_LDFLAGS can be used to override this (useful when
cross-compiling).
Signed-off-by: David Marchand <david.marchand@6wind.com>
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
CFLAGS += -O3
CFLAGS += $(WERROR_FLAGS)
-ifeq ($(CONFIG_RTE_LIBRTE_PMD_PCAP),y)
-LDFLAGS += -lpcap
-endif
-
#
# all source are stored in SRCS-y
#
EXTRA_CPPFLAGS preprocessor options
EXTRA_CFLAGS compiler options
EXTRA_LDFLAGS linker options
+ LIBPCAP_CFLAGS libpcap compiler options
+ LIBPCAP_LDFLAGS libpcap linker options
RTE_KERNELDIR linux headers path
CROSS toolchain prefix
V verbose
endif
ifeq ($(CONFIG_RTE_LIBRTE_PMD_PCAP),y)
-LDLIBS += -lrte_pmd_pcap -lpcap
+LDLIBS += -lrte_pmd_pcap
+LIBPCAP_LDFLAGS ?= $(shell pcap-config --libs)
+$(if $(LIBPCAP_LDFLAGS),,$(error LIBPCAP_LDFLAGS is undefined))
+LDLIBS += $(LIBPCAP_LDFLAGS)
endif
LDLIBS += $(EXECENV_LDLIBS)
include $(RTE_SDK)/mk/rte.vars.mk
endif
+ifeq ($(CONFIG_RTE_LIBRTE_PMD_PCAP),y)
+LIBPCAP_CFLAGS ?= $(shell pcap-config --cflags)
+$(if $(LIBPCAP_CFLAGS),,$(error LIBPCAP_CFLAGS is undefined))
+EXTERNAL_LIB_CFLAGS += $(LIBPCAP_CFLAGS)
+endif
+
+export EXTERNAL_LIB_CFLAGS
+
#
# include .depdirs and define rules to order priorities between build
# of directories.
# merge all CFLAGS
CFLAGS := $(CPU_CFLAGS) $(EXECENV_CFLAGS) $(TOOLCHAIN_CFLAGS) $(MACHINE_CFLAGS)
-CFLAGS += $(TARGET_CFLAGS)
+CFLAGS += $(TARGET_CFLAGS) $(EXTERNAL_LIB_CFLAGS)
# merge all LDFLAGS
LDFLAGS := $(CPU_LDFLAGS) $(EXECENV_LDFLAGS) $(TOOLCHAIN_LDFLAGS) $(MACHINE_LDFLAGS)