1 # SPDX-License-Identifier: BSD-3-Clause
2 # Copyright 2012 6WIND S.A.
3 # Copyright 2012 Mellanox Technologies, Ltd
5 include $(RTE_SDK)/mk/rte.vars.mk
8 LIB = librte_pmd_mlx4.a
9 LIB_GLUE = $(LIB_GLUE_BASE).$(LIB_GLUE_VERSION)
10 LIB_GLUE_BASE = librte_pmd_mlx4_glue.so
11 LIB_GLUE_VERSION = 18.02.0
14 SRCS-$(CONFIG_RTE_LIBRTE_MLX4_PMD) += mlx4.c
15 SRCS-$(CONFIG_RTE_LIBRTE_MLX4_PMD) += mlx4_ethdev.c
16 SRCS-$(CONFIG_RTE_LIBRTE_MLX4_PMD) += mlx4_flow.c
17 ifneq ($(CONFIG_RTE_LIBRTE_MLX4_DLOPEN_DEPS),y)
18 SRCS-$(CONFIG_RTE_LIBRTE_MLX4_PMD) += mlx4_glue.c
20 SRCS-$(CONFIG_RTE_LIBRTE_MLX4_PMD) += mlx4_intr.c
21 SRCS-$(CONFIG_RTE_LIBRTE_MLX4_PMD) += mlx4_mr.c
22 SRCS-$(CONFIG_RTE_LIBRTE_MLX4_PMD) += mlx4_rxq.c
23 SRCS-$(CONFIG_RTE_LIBRTE_MLX4_PMD) += mlx4_rxtx.c
24 SRCS-$(CONFIG_RTE_LIBRTE_MLX4_PMD) += mlx4_txq.c
25 SRCS-$(CONFIG_RTE_LIBRTE_MLX4_PMD) += mlx4_utils.c
27 ifeq ($(CONFIG_RTE_LIBRTE_MLX4_DLOPEN_DEPS),y)
28 INSTALL-$(CONFIG_RTE_LIBRTE_MLX4_PMD)-lib += $(LIB_GLUE)
33 CFLAGS += -std=c11 -Wall -Wextra
36 CFLAGS += -D_BSD_SOURCE
37 CFLAGS += -D_DEFAULT_SOURCE
38 CFLAGS += -D_XOPEN_SOURCE=600
39 CFLAGS += $(WERROR_FLAGS)
40 CFLAGS += -DALLOW_EXPERIMENTAL_API
41 ifeq ($(CONFIG_RTE_LIBRTE_MLX4_DLOPEN_DEPS),y)
42 CFLAGS += -DMLX4_GLUE='"$(LIB_GLUE)"'
43 CFLAGS += -DMLX4_GLUE_VERSION='"$(LIB_GLUE_VERSION)"'
44 CFLAGS_mlx4_glue.o += -fPIC
47 LDLIBS += -libverbs -lmlx4
49 LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring
50 LDLIBS += -lrte_ethdev -lrte_net -lrte_kvargs
51 LDLIBS += -lrte_bus_pci
53 # A few warnings cannot be avoided in external headers.
54 CFLAGS += -Wno-error=cast-qual
56 EXPORT_MAP := rte_pmd_mlx4_version.map
59 # DEBUG which is usually provided on the command-line may enable
60 # CONFIG_RTE_LIBRTE_MLX4_DEBUG.
62 CONFIG_RTE_LIBRTE_MLX4_DEBUG := y
65 # User-defined CFLAGS.
66 ifeq ($(CONFIG_RTE_LIBRTE_MLX4_DEBUG),y)
67 CFLAGS += -pedantic -UNDEBUG -DPEDANTIC
69 CFLAGS += -DNDEBUG -UPEDANTIC
72 ifdef CONFIG_RTE_LIBRTE_MLX4_TX_MP_CACHE
73 CFLAGS += -DMLX4_PMD_TX_MP_CACHE=$(CONFIG_RTE_LIBRTE_MLX4_TX_MP_CACHE)
76 include $(RTE_SDK)/mk/rte.lib.mk
78 # Generate and clean-up mlx4_autoconf.h.
80 export CC CFLAGS CPPFLAGS EXTRA_CFLAGS EXTRA_CPPFLAGS
81 export AUTO_CONFIG_CFLAGS = -Wno-error
84 AUTOCONF_OUTPUT := >/dev/null
87 mlx4_autoconf.h.new: FORCE
89 mlx4_autoconf.h.new: $(RTE_SDK)/buildtools/auto-config-h.sh
93 # Create mlx4_autoconf.h or update it in case it differs from the new one.
95 mlx4_autoconf.h: mlx4_autoconf.h.new
97 cmp '$<' '$@' $(AUTOCONF_OUTPUT) || \
100 $(SRCS-$(CONFIG_RTE_LIBRTE_MLX4_PMD):.c=.o): mlx4_autoconf.h
102 # Generate dependency plug-in for rdma-core when the PMD must not be linked
103 # directly, so that applications do not inherit this dependency.
105 ifeq ($(CONFIG_RTE_LIBRTE_MLX4_DLOPEN_DEPS),y)
109 $(LIB_GLUE): mlx4_glue.o
110 $Q $(LD) $(LDFLAGS) $(EXTRA_LDFLAGS) \
112 -s -shared -o $@ $< -libverbs -lmlx4
114 mlx4_glue.o: mlx4_autoconf.h
119 $Q rm -f -- mlx4_autoconf.h mlx4_autoconf.h.new
120 $Q rm -f -- mlx4_glue.o $(LIB_GLUE_BASE)*