2015-09-21 15:52:41 +00:00
|
|
|
#
|
|
|
|
# BSD LICENSE
|
|
|
|
#
|
2016-01-26 17:47:22 +00:00
|
|
|
# Copyright (c) Intel Corporation.
|
2020-08-31 14:13:34 +00:00
|
|
|
# Copyright (c) 2020, Mellanox Corporation.
|
2015-09-21 15:52:41 +00:00
|
|
|
# All rights reserved.
|
|
|
|
#
|
|
|
|
# Redistribution and use in source and binary forms, with or without
|
|
|
|
# modification, are permitted provided that the following conditions
|
|
|
|
# are met:
|
|
|
|
#
|
|
|
|
# * Redistributions of source code must retain the above copyright
|
|
|
|
# notice, this list of conditions and the following disclaimer.
|
|
|
|
# * Redistributions in binary form must reproduce the above copyright
|
|
|
|
# notice, this list of conditions and the following disclaimer in
|
|
|
|
# the documentation and/or other materials provided with the
|
|
|
|
# distribution.
|
|
|
|
# * Neither the name of Intel Corporation nor the names of its
|
|
|
|
# contributors may be used to endorse or promote products derived
|
|
|
|
# from this software without specific prior written permission.
|
|
|
|
#
|
|
|
|
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
|
|
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
|
|
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
|
|
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
|
|
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
|
|
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
|
|
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
|
|
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
|
|
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
|
|
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
|
|
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
#
|
|
|
|
|
2016-03-08 17:59:56 +00:00
|
|
|
S :=
|
|
|
|
|
2015-09-21 15:52:41 +00:00
|
|
|
SPDK_ROOT_DIR := $(CURDIR)
|
|
|
|
include $(SPDK_ROOT_DIR)/mk/spdk.common.mk
|
|
|
|
|
2018-08-14 17:56:26 +00:00
|
|
|
DIRS-y += lib
|
2019-08-16 16:45:58 +00:00
|
|
|
DIRS-y += module
|
2018-08-14 17:56:26 +00:00
|
|
|
DIRS-$(CONFIG_SHARED) += shared_lib
|
2020-02-27 16:59:20 +00:00
|
|
|
DIRS-y += app include
|
|
|
|
DIRS-$(CONFIG_EXAMPLES) += examples
|
2020-03-06 09:08:29 +00:00
|
|
|
DIRS-y += test
|
2019-01-13 20:28:21 +00:00
|
|
|
DIRS-$(CONFIG_IPSEC_MB) += ipsecbuild
|
2019-01-21 09:05:59 +00:00
|
|
|
DIRS-$(CONFIG_ISAL) += isalbuild
|
2015-09-21 15:52:41 +00:00
|
|
|
|
2019-07-24 17:15:08 +00:00
|
|
|
.PHONY: all clean $(DIRS-y) include/spdk/config.h mk/config.mk \
|
2019-01-02 09:28:02 +00:00
|
|
|
cc_version cxx_version .libs_only_other .ldflags ldflags install \
|
|
|
|
uninstall
|
2015-09-21 15:52:41 +00:00
|
|
|
|
dpdkbuild: build dpdk with meson+ninja
Makefile support in DPDK was deprecated and will be removed soon,
so switch to the officially supported way of building DPDK -
with meson and ninja. Two new tools. Basically, our Makefiles
will invoke meson+ninja for DPDK, no other SPDK components are
affected.
Apparently DPDK wanted to move away from an octopus-like config
system and the ideology behind meson configuration is simple now:
build everything by default. Some PMDs can be explicitly disabled
with meson command line, but all libraries (both static and shared
versions) and test apps are built unconditionally.
How long does it take to build minimal DPDK with meson? Too much.
On my machine half of the total build time is spent on libraries
we don't need at all. (I have some hacks up my sleeve to disable
building those libraries - see the subsequent patch.) As for the
official way of building a minimal DPDK, there was a patch [1]
on dpdk mailing list to introduce more specific configuration,
but it was rejected:
> We talked about this a few times in the past, and it was actually one
> of the design goals to _avoid_ replicating the octopus-like config
> system of the makefiles. That's because it makes the test matrix
> insanely complicated, not to mention the harm to user friendliness,
> among other things.
>
> If someone doesn't want to use a PMD, they can just avoid installing it
> - it's simple enough.
>
> Sorry, but from me it's a very strong NACK.
Let's not follow that direction, hack the DPDK build system instead.
As for advantages of meson+ninja over Makefiles? I can't find any.
It's another build system that does a lot for you with some functions,
magic options, and a built-in dependency system. It seems nice if you know
the syntax, but it's another component that you need to learn, debug,
and possibly find bugs in (there's a lot of github issues open for meson).
I would compare it to CMake.
As for changes in this patch: rather that explicitly disabling
PMDs we don't need, specify a list of PMDs we do need and disable
everything else found in ./dpdk/drivers/*. This way we won't have
to disable the new PMDs as they're added to DPDK.
Meson configuration also sets RTE_EAL_PMD_PATH #define to a valid directory
with built PMD shared libs. When it's set, DPDK dynamically loads all shared
libraries inside. The drivers there depend on DPDK shared libs and fail to
load in static SPDK builds, so we disable them altogether by unsetting
RTE_EAL_PMD_PATH in the meson-generated config file - just like
DPDK Makefiles did. EAL checks for RTE_EAL_PMD_PATH being empty and skips
loading any external PMDs then. We do it for both static and shared libs.
We specify all PMDs at build time for now, so there's just no need to load
them dynamically.
We have three more hacks in our submodule:
* disable building dpdk apps by commenting-out a line in dpdk/meson.build
* disable building unnecessary libs (build everything that spdk *may*
need)
* build isa-l compress pmd with `-L[...] -lisal`. DPDK expects to find
libisal with pkg-config. We don't want to prepare a pkg-config file,
so comment-out a failing check in another meson.build file and provide
isa-l through CFLAGS and LDFLAGS.
We also need to make some changes to our test/external_code. First of
all, -ldpdk is no more. Meson build generates a pkg-config file with all
libs, but we'll switch to it in a separate patch - for now just specify
all -lrte_ libs one by one. -Wl,--no-as-needed has to be added to some
test cases, otherwise rte_mempool_ring isn't loaded. We don't use any
APIs from this library, it only has a static constructor that provides
a few callbacks used by rte_mempool_create(). Also, since DPDK now builds
both static and shared libraries, we need to add -Wl,-Bstatic to force
using static libswhere required. It's only needed for DPDK libs, but we
use it for SPDK libs as well since there's no harm.
As for performance:
$ ./configure --enable-debug --with-crypto --with-reduce
$ time make -j40 -C dpdkbuild all
with meson:
real 0m8.287s
user 1m7.983s
sys 0m10.548s
before, with the old DPDK makefiles:
real 0m20.232s
user 0m55.921s
sys 0m16.491s
The subsequent builds are much faster too:
$ time make -j40 -C dpdkbuild all
meson:
real 0m0.876s
user 0m0.663s
sys 0m0.217s
makefiles:
real 0m10.150s
user 0m11.740s
sys 0m6.772s
[1] http://inbox.dpdk.org/dev/1a07d1cd59d84dce84e56c10fdabf5e5504560a6.camel@debian.org/
Change-Id: Ic65db563014100bafb12e61ee0530cc2ae64401d
Signed-off-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/1440
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2020-03-23 16:55:08 +00:00
|
|
|
# Workaround for ninja. See dpdkbuild/Makefile
|
|
|
|
export MAKE_PID := $(shell echo $$PPID)
|
|
|
|
|
2018-07-19 19:43:14 +00:00
|
|
|
ifeq ($(SPDK_ROOT_DIR)/lib/env_dpdk,$(CONFIG_ENV))
|
2017-05-08 22:07:13 +00:00
|
|
|
ifeq ($(CURDIR)/dpdk/build,$(CONFIG_DPDK_DIR))
|
2018-02-07 20:12:05 +00:00
|
|
|
ifneq ($(SKIP_DPDK_BUILD),1)
|
2017-05-08 22:07:13 +00:00
|
|
|
DPDKBUILD = dpdkbuild
|
|
|
|
DIRS-y += dpdkbuild
|
|
|
|
endif
|
2018-02-07 20:12:05 +00:00
|
|
|
endif
|
2018-07-19 19:43:14 +00:00
|
|
|
endif
|
2017-05-08 22:07:13 +00:00
|
|
|
|
2018-09-05 19:58:01 +00:00
|
|
|
ifeq ($(CONFIG_SHARED),y)
|
|
|
|
LIB = shared_lib
|
|
|
|
else
|
2019-08-16 16:45:58 +00:00
|
|
|
LIB = module
|
2018-09-05 19:58:01 +00:00
|
|
|
endif
|
|
|
|
|
2019-01-13 20:28:21 +00:00
|
|
|
ifeq ($(CONFIG_IPSEC_MB),y)
|
|
|
|
LIB += ipsecbuild
|
2019-05-28 05:49:55 +00:00
|
|
|
DPDK_DEPS += ipsecbuild
|
2019-01-13 20:28:21 +00:00
|
|
|
endif
|
|
|
|
|
2019-01-21 09:05:59 +00:00
|
|
|
ifeq ($(CONFIG_ISAL),y)
|
|
|
|
LIB += isalbuild
|
2019-05-28 05:49:55 +00:00
|
|
|
DPDK_DEPS += isalbuild
|
2019-01-21 09:05:59 +00:00
|
|
|
endif
|
|
|
|
|
2019-07-24 17:15:08 +00:00
|
|
|
all: mk/cc.mk $(DIRS-y)
|
2015-09-21 15:52:41 +00:00
|
|
|
clean: $(DIRS-y)
|
2018-09-28 12:29:04 +00:00
|
|
|
$(Q)rm -f include/spdk/config.h
|
2020-05-11 21:15:03 +00:00
|
|
|
$(Q)rm -rf build/bin
|
2020-05-28 18:39:36 +00:00
|
|
|
$(Q)rm -rf build/fio
|
2020-05-11 22:02:01 +00:00
|
|
|
$(Q)rm -rf build/examples
|
2020-05-11 22:36:18 +00:00
|
|
|
$(Q)rm -rf build/include
|
2020-08-31 14:13:34 +00:00
|
|
|
$(Q)find build/lib ! -name .gitignore -type f -delete
|
2015-09-21 15:52:41 +00:00
|
|
|
|
2017-11-15 17:36:36 +00:00
|
|
|
install: all
|
|
|
|
$(Q)echo "Installed to $(DESTDIR)$(CONFIG_PREFIX)"
|
|
|
|
|
2019-01-02 09:28:02 +00:00
|
|
|
uninstall: $(DIRS-y)
|
|
|
|
$(Q)echo "Uninstalled spdk"
|
|
|
|
|
2019-02-26 14:46:52 +00:00
|
|
|
ifneq ($(SKIP_DPDK_BUILD),1)
|
2019-05-28 05:49:55 +00:00
|
|
|
dpdkbuild: $(DPDK_DEPS)
|
2019-02-26 14:46:52 +00:00
|
|
|
endif
|
|
|
|
|
2017-05-08 22:07:13 +00:00
|
|
|
lib: $(DPDKBUILD)
|
2019-08-16 16:45:58 +00:00
|
|
|
module: lib
|
|
|
|
shared_lib: module
|
2018-09-05 19:58:01 +00:00
|
|
|
app: $(LIB)
|
|
|
|
test: $(LIB)
|
|
|
|
examples: $(LIB)
|
2017-08-21 16:37:37 +00:00
|
|
|
pkgdep:
|
|
|
|
sh ./scripts/pkgdep.sh
|
2015-09-21 15:52:41 +00:00
|
|
|
|
2020-05-11 21:15:03 +00:00
|
|
|
$(DIRS-y): mk/cc.mk build_dir include/spdk/config.h
|
2016-03-24 20:27:53 +00:00
|
|
|
|
|
|
|
mk/cc.mk:
|
2019-07-24 17:15:08 +00:00
|
|
|
$(Q)echo "Please run configure prior to make"
|
|
|
|
false
|
2016-06-07 18:31:12 +00:00
|
|
|
|
2020-05-11 21:15:03 +00:00
|
|
|
build_dir: mk/cc.mk
|
|
|
|
$(Q)mkdir -p build/lib
|
|
|
|
$(Q)mkdir -p build/bin
|
2020-05-28 18:39:36 +00:00
|
|
|
$(Q)mkdir -p build/fio
|
2020-05-11 22:02:01 +00:00
|
|
|
$(Q)mkdir -p build/examples
|
2020-05-11 22:36:18 +00:00
|
|
|
$(Q)mkdir -p build/include/spdk
|
2020-05-11 21:15:03 +00:00
|
|
|
|
2018-09-21 14:32:36 +00:00
|
|
|
include/spdk/config.h: mk/config.mk scripts/genconfig.py
|
2020-02-04 13:21:42 +00:00
|
|
|
$(Q)echo "#ifndef SPDK_CONFIG_H" > $@.tmp; \
|
2018-09-25 11:04:46 +00:00
|
|
|
echo "#define SPDK_CONFIG_H" >> $@.tmp; \
|
2020-01-07 22:19:53 +00:00
|
|
|
scripts/genconfig.py $(MAKEFLAGS) >> $@.tmp; \
|
2018-09-25 11:04:46 +00:00
|
|
|
echo "#endif /* SPDK_CONFIG_H */" >> $@.tmp; \
|
2016-06-07 18:31:12 +00:00
|
|
|
cmp -s $@.tmp $@ || mv $@.tmp $@ ; \
|
|
|
|
rm -f $@.tmp
|
|
|
|
|
2018-02-12 15:53:33 +00:00
|
|
|
cc_version: mk/cc.mk
|
|
|
|
$(Q)echo "SPDK using CC=$(CC)"; $(CC) -v
|
|
|
|
|
|
|
|
cxx_version: mk/cc.mk
|
|
|
|
$(Q)echo "SPDK using CXX=$(CXX)"; $(CXX) -v
|
|
|
|
|
2018-10-05 14:01:40 +00:00
|
|
|
.libs_only_other:
|
|
|
|
$(Q)echo -n '$(SYS_LIBS) '
|
|
|
|
$(Q)if [ "$(CONFIG_SHARED)" = "y" ]; then \
|
|
|
|
echo -n '-lspdk '; \
|
|
|
|
fi
|
|
|
|
|
|
|
|
.ldflags:
|
|
|
|
$(Q)echo -n '$(LDFLAGS) '
|
|
|
|
|
|
|
|
ldflags: .ldflags .libs_only_other
|
|
|
|
$(Q)echo ''
|
|
|
|
|
2015-09-21 15:52:41 +00:00
|
|
|
include $(SPDK_ROOT_DIR)/mk/spdk.subdirs.mk
|