4 # Copyright (c) Intel Corporation.
7 # Redistribution and use in source and binary forms, with or without
8 # modification, are permitted provided that the following conditions
11 # * Redistributions of source code must retain the above copyright
12 # notice, this list of conditions and the following disclaimer.
13 # * Redistributions in binary form must reproduce the above copyright
14 # notice, this list of conditions and the following disclaimer in
15 # the documentation and/or other materials provided with the
17 # * Neither the name of Intel Corporation nor the names of its
18 # contributors may be used to endorse or promote products derived
19 # from this software without specific prior written permission.
21 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24 # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34 SPDK_ROOT_DIR
:= $(abspath
$(CURDIR
)/..
)
35 include $(SPDK_ROOT_DIR
)/mk
/spdk.common.mk
37 .PHONY
: all clean install uninstall
39 DPDK_OPTS
= -Denable_docs
=false
43 ifeq ($(CONFIG_IGB_UIO_DRIVER
),y
)
49 DPDK_OPTS
+= -Denable_kmods
=$(DPDK_KMODS
)
52 DPDK_DRIVERS
= bus bus
/pci bus
/vdev mempool
/ring
54 ifeq ($(CONFIG_CRYPTO
),y
)
55 # crypto/qat is just a stub, the compress/qat pmd is used instead
56 DPDK_DRIVERS
+= crypto crypto
/aesni_mb crypto
/qat compress
/qat common
/qat
57 DPDK_CFLAGS
+= -I
$(IPSEC_MB_DIR
)
58 DPDK_LDFLAGS
+= -L
$(IPSEC_MB_DIR
)
61 ifeq ($(CONFIG_REDUCE
),y
)
62 DPDK_DRIVERS
+= compress compress
/isal compress
/qat common
/qat
63 DPDK_CFLAGS
+= -I
$(ISAL_DIR
)
64 DPDK_LDFLAGS
+= -L
$(ISAL_DIR
)/.libs
-lisal
67 DPDK_OPTS
+= -Dmachine
=$(TARGET_ARCHITECTURE
)
69 ifneq ($(CONFIG_CROSS_PREFIX
),)
70 $(error Automatic DPDK cross build is not supported. Please compile DPDK manually \
71 with e.g.
`meson build --cross-file config/arm/arm64_armv8_linux_gcc`)
76 ifeq ($(CONFIG_DEBUG
),y
)
80 ifeq ($(CONFIG_WERROR
),y
)
81 DPDK_CFLAGS
+= -Werror
83 DPDK_CFLAGS
+= -Wno-error
86 ifdef EXTRA_DPDK_CFLAGS
87 $(warning EXTRA_DPDK_CFLAGS defined
, possibly to work around an unsupported compiler version
)
91 # Allow users to specify EXTRA_DPDK_CFLAGS if they want to build DPDK using unsupported compiler versions
92 DPDK_CFLAGS
+= $(EXTRA_DPDK_CFLAGS
)
95 GCC_MAJOR
= $(shell echo __GNUC__ |
$(CC
) -E
-x c
- | tail
-n
1)
96 ifeq ($(shell test $(GCC_MAJOR
) -ge
10 && echo
1), 1)
97 #1. gcc 10 complains on operations with zero size arrays in rte_cryptodev.c, so
99 #2. gcc 10 disables fcommon by default and complains on multiple definition of
100 #aesni_mb_logtype_driver symbol which is defined in header file and presented in sevral
102 DPDK_CFLAGS
+= -Wno-stringop-overflow
-fcommon
106 # Force-disable scan-build
107 SUB_CC
= $(patsubst %ccc-analyzer
,$(DEFAULT_CC
),$(CC
))
109 DPDK_ALL_DRIVER_DIRS
= $(shell find
$(SPDK_ROOT_DIR
)/dpdk
/drivers
-mindepth
1 -type d
)
110 DPDK_ALL_DRIVERS
= $(DPDK_ALL_DRIVER_DIRS
:$(SPDK_ROOT_DIR
)/dpdk
/drivers
/%=%)
111 DPDK_DISABLED_DRVERS
= $(filter-out $(DPDK_DRIVERS
),$(DPDK_ALL_DRIVERS
))
114 SED_INPLACE_FLAG
= "-i"
115 MESON_PREFIX
= $(SPDK_ROOT_DIR
)/dpdk
/build
117 SED_INPLACE_FLAG
= "-i ''"
121 # Some ninja versions come with a (broken?) jobserver which defaults to use
122 # only 1 thread for the build. We workaround this by specifying -j to ninja
123 # with the same value as top-makefile. This is OK as long as DPDK is not built
124 # in parralel with anything else, which is the case for now.
126 MAKE_PID
:= $(shell echo
$$PPID)
129 MAKE_NUMJOBS
:= $(shell ps T | sed
-nE
's/\s*$(MAKE_PID)\s.* (-j|--jobs=)( *[0-9]+).*/\1\2/p')
131 all: $(SPDK_ROOT_DIR
)/dpdk
/build-tmp
132 $(Q
)# DPDK doesn't handle nested make calls, so unset MAKEFLAGS
133 $(Q
)env
-u MAKEFLAGS ninja
-C
$(SPDK_ROOT_DIR
)/dpdk
/build-tmp
$(MAKE_NUMJOBS
)
135 # Meson on FreeBSD sometimes appends --prefix value to the default DESTDIR (which is e.g. \
136 # /usr/local) instead of replacing it. --prefix needs to be an absolute path, so we set \
137 # it to / and then set DESTDIR directly, so libs and headers are copied to "DESTDIR//". \
138 # DPDK kernel modules are set to install in $DESTDIR/boot/modules, but we move them \
139 # to DESTDIR/kmod to be consistent with the makefile build.
140 $(Q
)if
[ "$(OS)" = "FreeBSD" ]; then \
141 env
-u MAKEFLAGS DESTDIR
=$(SPDK_ROOT_DIR
)/dpdk
/build ninja
-C
$(SPDK_ROOT_DIR
)/dpdk
/build-tmp
$(MAKE_NUMJOBS
) install > /dev
/null
&& \
142 mv
$(SPDK_ROOT_DIR
)/dpdk
/build
/boot
/modules
$(SPDK_ROOT_DIR
)/dpdk
/build
/kmod
; \
144 env
-u MAKEFLAGS ninja
-C
$(SPDK_ROOT_DIR
)/dpdk
/build-tmp
$(MAKE_NUMJOBS
) install > /dev
/null
; \
147 $(SPDK_ROOT_DIR
)/dpdk
/build-tmp
: $(SPDK_ROOT_DIR
)/mk
/cc.mk
$(SPDK_ROOT_DIR
)/include/spdk
/config.h
148 $(Q
)rm -rf
$(SPDK_ROOT_DIR
)/dpdk
/build
$(SPDK_ROOT_DIR
)/dpdk
/build-tmp
149 $(Q
)cd
"$(SPDK_ROOT_DIR)/dpdk"; CC
="$(SUB_CC)" meson
--prefix="$(MESON_PREFIX)" --libdir lib
-Dc_args
="$(DPDK_CFLAGS)" -Dc_link_args
="$(DPDK_LDFLAGS)" $(DPDK_OPTS
) -Ddisable_drivers
="$(shell echo $(DPDK_DISABLED_DRVERS) | sed -E "s
/ +/,/g
")" build-tmp
150 $(Q
)sed
$(SED_INPLACE_FLAG
) 's/#define RTE_EAL_PMD_PATH .*/#define RTE_EAL_PMD_PATH ""/g' $(SPDK_ROOT_DIR
)/dpdk
/build-tmp
/rte_build_config.h
152 # TODO Meson build adds libbsd dependency when it's available. This means any app will be \
153 # forced to link with -lbsd, but only if it's available on the system. The clean way to \
154 # handle this would be to rely on DPDK's pkg-config file which will contain the -lbsd when \
155 # required. For now just remove the libbsd dependency. DPDK will fallback to its internal \
157 $(Q
)sed
$(SED_INPLACE_FLAG
) 's/#define RTE_USE_LIBBSD .*//g' $(SPDK_ROOT_DIR
)/dpdk
/build-tmp
/rte_build_config.h
160 $(Q
)rm -rf
$(SPDK_ROOT_DIR
)/dpdk
/build
$(SPDK_ROOT_DIR
)/dpdk
/build-tmp