pcap: convert to use of PMD_REGISTER_DRIVER and fix linking
authorNeil Horman <nhorman@tuxdriver.com>
Mon, 21 Apr 2014 14:59:28 +0000 (10:59 -0400)
committerThomas Monjalon <thomas.monjalon@6wind.com>
Tue, 20 May 2014 12:28:16 +0000 (14:28 +0200)
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 <nhorman@tuxdriver.com>
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
lib/librte_pmd_pcap/rte_eth_pcap.c
mk/rte.app.mk

index 680dfdc..c987940 100644 (file)
@@ -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);
index a2c60b6..8c054f0 100644 (file)
@@ -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)