pcap: use pcap-config to guess compilation flags
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>
This commit is contained in:
parent
a007988d5d
commit
a0cdfcf936
@ -39,10 +39,6 @@ APP = testpmd
|
||||
CFLAGS += -O3
|
||||
CFLAGS += $(WERROR_FLAGS)
|
||||
|
||||
ifeq ($(CONFIG_RTE_LIBRTE_PMD_PCAP),y)
|
||||
LDFLAGS += -lpcap
|
||||
endif
|
||||
|
||||
#
|
||||
# all source are stored in SRCS-y
|
||||
#
|
||||
|
@ -11,6 +11,8 @@ Build variables
|
||||
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
|
||||
|
@ -170,7 +170,10 @@ LDLIBS += -lrte_cmdline
|
||||
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)
|
||||
|
@ -40,6 +40,14 @@ else
|
||||
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.
|
||||
|
@ -108,7 +108,7 @@ include $(RTE_SDK)/mk/rte.cpuflags.mk
|
||||
|
||||
# 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)
|
||||
|
Loading…
Reference in New Issue
Block a user