From 3660cdf9904bba449d6acdb03dce6592917be2e1 Mon Sep 17 00:00:00 2001 From: Neil Horman Date: Mon, 21 Apr 2014 10:59:28 -0400 Subject: [PATCH] pcap: convert to use of PMD_REGISTER_DRIVER and fix linking Convert the pcap driver to use the PMD_REGISTER_DRIVER macro and fix up the Makefile so that its linkage is only done if we are building static libraries. This means that the test applications now have no reference to the pcap library when building DSO's and must specify its use on the command line with the -d option. Static linking will still initalize the driver automatically. Signed-off-by: Neil Horman Acked-by: Thomas Monjalon --- lib/librte_pmd_pcap/rte_eth_pcap.c | 7 +------ mk/rte.app.mk | 2 ++ 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/lib/librte_pmd_pcap/rte_eth_pcap.c b/lib/librte_pmd_pcap/rte_eth_pcap.c index 680dfdce91..c987940fd9 100644 --- a/lib/librte_pmd_pcap/rte_eth_pcap.c +++ b/lib/librte_pmd_pcap/rte_eth_pcap.c @@ -772,9 +772,4 @@ static struct rte_vdev_driver pmd_pcap_drv = { .init = rte_pmd_pcap_devinit, }; -__attribute__((constructor)) -static void -rte_pmd_pcap_init(void) -{ - rte_eal_vdev_driver_register(&pmd_pcap_drv); -} +PMD_REGISTER_DRIVER(pmd_pcap_drv, PMD_VDEV); diff --git a/mk/rte.app.mk b/mk/rte.app.mk index a2c60b6059..8c054f0cbf 100644 --- a/mk/rte.app.mk +++ b/mk/rte.app.mk @@ -172,9 +172,11 @@ ifeq ($(CONFIG_RTE_LIBRTE_CMDLINE),y) LDLIBS += -lrte_cmdline endif +ifeq ($(RTE_BUILD_SHARED_LIB),n) ifeq ($(CONFIG_RTE_LIBRTE_PMD_PCAP),y) LDLIBS += -lrte_pmd_pcap -lpcap endif +endif LDLIBS += $(EXECENV_LDLIBS) -- 2.20.1