summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Marchand <david.marchand@6wind.com>2013-11-22 11:24:55 +0100
committerThomas Monjalon <thomas.monjalon@6wind.com>2013-11-22 13:36:57 +0100
commitfedd1c636bd3c94213cedc25210567df356e64be (patch)
tree72ca2951606618d8e9787d7471642ef694cb23c5
parentb108d90ccb17f244fa8e9e20e1354451361aac32 (diff)
downloaddpdk-stable-fedd1c636bd3c94213cedc25210567df356e64be.zip
dpdk-stable-fedd1c636bd3c94213cedc25210567df356e64be.tar.gz
dpdk-stable-fedd1c636bd3c94213cedc25210567df356e64be.tar.xz
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>
-rw-r--r--app/test-pmd/Makefile4
-rw-r--r--doc/build-sdk-quick.txt2
-rw-r--r--mk/rte.app.mk5
-rw-r--r--mk/rte.sdkbuild.mk8
-rw-r--r--mk/target/generic/rte.vars.mk2
5 files changed, 15 insertions, 6 deletions
diff --git a/app/test-pmd/Makefile b/app/test-pmd/Makefile
index cd04ea5..2ced595 100644
--- a/app/test-pmd/Makefile
+++ b/app/test-pmd/Makefile
@@ -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
#
diff --git a/doc/build-sdk-quick.txt b/doc/build-sdk-quick.txt
index 18b0ee6..ca39c33 100644
--- a/doc/build-sdk-quick.txt
+++ b/doc/build-sdk-quick.txt
@@ -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
CROSS toolchain prefix
V verbose
D debug dependencies
diff --git a/mk/rte.app.mk b/mk/rte.app.mk
index d2ce5c0..9420f24 100644
--- a/mk/rte.app.mk
+++ b/mk/rte.app.mk
@@ -150,7 +150,10 @@ LDLIBS += -lrte_eal
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)
diff --git a/mk/rte.sdkbuild.mk b/mk/rte.sdkbuild.mk
index 0dc23ff..33bed57 100644
--- a/mk/rte.sdkbuild.mk
+++ b/mk/rte.sdkbuild.mk
@@ -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.
diff --git a/mk/target/generic/rte.vars.mk b/mk/target/generic/rte.vars.mk
index 9030f44..22893fc 100644
--- a/mk/target/generic/rte.vars.mk
+++ b/mk/target/generic/rte.vars.mk
@@ -104,7 +104,7 @@ ifeq ($(KERNELRELEASE),)
# 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)