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 include $(RTE_SDK)/mk/rte.lib.mk
74 # Generate and clean-up mlx4_autoconf.h.
76 export CC CFLAGS CPPFLAGS EXTRA_CFLAGS EXTRA_CPPFLAGS
77 export AUTO_CONFIG_CFLAGS = -Wno-error
80 AUTOCONF_OUTPUT := >/dev/null
83 mlx4_autoconf.h.new: FORCE
85 mlx4_autoconf.h.new: $(RTE_SDK)/buildtools/auto-config-h.sh
89 HAVE_IBV_MLX4_WQE_LSO_SEG \
91 type 'struct mlx4_wqe_lso_seg' \
94 # Create mlx4_autoconf.h or update it in case it differs from the new one.
96 mlx4_autoconf.h: mlx4_autoconf.h.new
98 cmp '$<' '$@' $(AUTOCONF_OUTPUT) || \
101 $(SRCS-$(CONFIG_RTE_LIBRTE_MLX4_PMD):.c=.o): mlx4_autoconf.h
103 # Generate dependency plug-in for rdma-core when the PMD must not be linked
104 # directly, so that applications do not inherit this dependency.
106 ifeq ($(CONFIG_RTE_LIBRTE_MLX4_DLOPEN_DEPS),y)
110 ifeq ($(LINK_USING_CC),1)
111 GLUE_LDFLAGS := $(call linkerprefix,$(LDFLAGS))
113 GLUE_LDFLAGS := $(LDFLAGS)
115 $(LIB_GLUE): mlx4_glue.o
116 $Q $(LD) $(GLUE_LDFLAGS) $(EXTRA_LDFLAGS) \
118 -s -shared -o $@ $< -libverbs -lmlx4
120 mlx4_glue.o: mlx4_autoconf.h
125 $Q rm -f -- mlx4_autoconf.h mlx4_autoconf.h.new
126 $Q rm -f -- mlx4_glue.o $(LIB_GLUE_BASE)*