DPDK patches and discussions
 help / color / mirror / Atom feed
From: David Marchand <david.marchand@6wind.com>
To: dev@dpdk.org
Subject: [dpdk-dev] [PATCH 1/3] pcap: use pcap-config to guess compilation flags
Date: Fri, 22 Nov 2013 11:24:55 +0100	[thread overview]
Message-ID: <b0610977f075c3e78d4a518f0d68b7c6a42d1451.1385115073.git.david.marchand@6wind.com> (raw)
In-Reply-To: <cover.1385115073.git.david.marchand@6wind.com>
In-Reply-To: <cover.1385115073.git.david.marchand@6wind.com>

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>
---
 app/test-pmd/Makefile         |    4 ----
 doc/build-sdk-quick.txt       |    2 ++
 mk/rte.app.mk                 |    5 ++++-
 mk/rte.sdkbuild.mk            |    8 ++++++++
 mk/target/generic/rte.vars.mk |    2 +-
 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)
-- 
1.7.10.4

  reply	other threads:[~2013-11-22 10:24 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-22 10:24 [dpdk-dev] [PATCH 0/3] pcap build fixes David Marchand
2013-11-22 10:24 ` David Marchand [this message]
2013-11-22 10:24 ` [dpdk-dev] [PATCH 2/3] pcap: fix build with old libpcap David Marchand
2013-11-22 10:24 ` [dpdk-dev] [PATCH 3/3] pcap: fix build when pcap_sendpacket is unavailable David Marchand
2013-11-22 12:38 ` [dpdk-dev] [PATCH 0/3] pcap build fixes Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b0610977f075c3e78d4a518f0d68b7c6a42d1451.1385115073.git.david.marchand@6wind.com \
    --to=david.marchand@6wind.com \
    --cc=dev@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).