configure: use mk/config.mk instead of CONFIG.local
We have hairy configuration method. First configure script uses CONFIG, environment and arguments to produce CONFIG.local and config.h then makefile uses CONFIG, environment and CONFIG.local to produce config.h again. First time config.h can't be generated reliably as config.h target in Makefile is passing MAKEFLAGS and they are unknown at configuration phase. Lets remove this mess by producing final mk/config.mk file and get rid of CONFIG.local. This will also generate full build configuration in one file instead scattering them in CONFIG and CONFIG.local. In next patch scripts/genconfig.py can be removed. Change-Id: I5696813312edff7e493207f7aa8569234a365ec0 Signed-off-by: Pawel Wodkowski <pawelx.wodkowski@intel.com> Reviewed-on: https://review.gerrithub.io/426364 Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com> Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com> Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
This commit is contained in:
parent
34387cccec
commit
85bc2bbe7d
1
.gitignore
vendored
1
.gitignore
vendored
@ -26,4 +26,5 @@ CONFIG.local
|
||||
.cproject
|
||||
.settings
|
||||
mk/cc.mk
|
||||
mk/config.mk
|
||||
PYTHON_COMMAND
|
||||
|
55
CONFIG
55
CONFIG
@ -32,82 +32,83 @@
|
||||
#
|
||||
|
||||
# Installation prefix
|
||||
CONFIG_PREFIX?=/usr/local
|
||||
CONFIG_PREFIX="/usr/local"
|
||||
|
||||
# Build with debug logging. Turn off for performance testing and normal usage
|
||||
CONFIG_DEBUG?=n
|
||||
CONFIG_DEBUG=n
|
||||
|
||||
# Build with support of backtrace printing in log messages. Requires libunwind.
|
||||
CONFIG_LOG_BACKTRACE?=n
|
||||
CONFIG_LOG_BACKTRACE=n
|
||||
|
||||
# Treat warnings as errors (fail the build on any warning).
|
||||
CONFIG_WERROR?=n
|
||||
CONFIG_WERROR=n
|
||||
|
||||
# Build with link-time optimization.
|
||||
CONFIG_LTO?=n
|
||||
CONFIG_LTO=n
|
||||
|
||||
# Build with code coverage instrumentation.
|
||||
CONFIG_COVERAGE?=n
|
||||
CONFIG_COVERAGE=n
|
||||
|
||||
# Build with Address Sanitizer enabled
|
||||
CONFIG_ASAN?=n
|
||||
CONFIG_ASAN=n
|
||||
|
||||
# Build with Undefined Behavior Sanitizer enabled
|
||||
CONFIG_UBSAN?=n
|
||||
CONFIG_UBSAN=n
|
||||
|
||||
# Build with Thread Sanitizer enabled
|
||||
CONFIG_TSAN?=n
|
||||
CONFIG_TSAN=n
|
||||
|
||||
# Build tests
|
||||
CONFIG_TESTS?=y
|
||||
CONFIG_TESTS=y
|
||||
|
||||
# Directory that contains the desired SPDK environment library.
|
||||
# By default, this is implemented using DPDK.
|
||||
CONFIG_ENV?=
|
||||
CONFIG_ENV=
|
||||
|
||||
# This directory should contain 'include' and 'lib' directories for your DPDK
|
||||
# installation.
|
||||
CONFIG_DPDK_DIR?=
|
||||
CONFIG_DPDK_DIR=
|
||||
|
||||
# Build SPDK FIO plugin. Requires CONFIG_FIO_SOURCE_DIR set to a valid
|
||||
# fio source code directory.
|
||||
CONFIG_FIO_PLUGIN?=n
|
||||
CONFIG_FIO_PLUGIN=n
|
||||
|
||||
# This directory should contain the source code directory for fio
|
||||
# which is required for building the SPDK FIO plugin.
|
||||
CONFIG_FIO_SOURCE_DIR?=/usr/src/fio
|
||||
CONFIG_FIO_SOURCE_DIR=/usr/src/fio
|
||||
|
||||
# Enable RDMA support for the NVMf target.
|
||||
# Requires ibverbs development libraries.
|
||||
CONFIG_RDMA?=n
|
||||
CONFIG_RDMA_SEND_WITH_INVAL?=n
|
||||
CONFIG_RDMA=n
|
||||
CONFIG_RDMA_SEND_WITH_INVAL=n
|
||||
|
||||
# Build Ceph RBD support in bdev modules
|
||||
# Requires librbd development libraries
|
||||
CONFIG_RBD?=n
|
||||
CONFIG_RBD=n
|
||||
|
||||
# Build vhost library.
|
||||
CONFIG_VHOST?=y
|
||||
CONFIG_VHOST=y
|
||||
|
||||
# Build vhost initiator (Virtio) driver.
|
||||
CONFIG_VIRTIO?=y
|
||||
CONFIG_VIRTIO=y
|
||||
|
||||
# Build with PMDK backends
|
||||
CONFIG_PMDK?=n
|
||||
CONFIG_PMDK_DIR?=
|
||||
CONFIG_PMDK=n
|
||||
CONFIG_PMDK_DIR=
|
||||
|
||||
# Build with VPP
|
||||
CONFIG_VPP?=n
|
||||
CONFIG_VPP=n
|
||||
CONFIG_VPP_DIR=
|
||||
|
||||
# Requires libiscsi development libraries.
|
||||
CONFIG_ISCSI_INITIATOR?=n
|
||||
CONFIG_ISCSI_INITIATOR=n
|
||||
|
||||
# Enable the dependencies for building the crypto vbdev
|
||||
CONFIG_CRYPTO?=n
|
||||
CONFIG_CRYPTO=n
|
||||
|
||||
# Build spdk shared libraries in addition to the static ones.
|
||||
CONFIG_SHARED?=n
|
||||
CONFIG_SHARED=n
|
||||
|
||||
# Build with VTune suport.
|
||||
CONFIG_VTUNE?=n
|
||||
CONFIG_VTUNE_DIR?=
|
||||
CONFIG_VTUNE=n
|
||||
CONFIG_VTUNE_DIR=
|
||||
|
4
Makefile
4
Makefile
@ -41,7 +41,7 @@ DIRS-$(CONFIG_SHARED) += shared_lib
|
||||
DIRS-y += examples app include
|
||||
DIRS-$(CONFIG_TESTS) += test
|
||||
|
||||
.PHONY: all clean $(DIRS-y) include/spdk/config.h CONFIG.local mk/cc.mk cc_version cxx_version
|
||||
.PHONY: all clean $(DIRS-y) include/spdk/config.h mk/config.mk mk/cc.mk cc_version cxx_version
|
||||
|
||||
ifeq ($(SPDK_ROOT_DIR)/lib/env_dpdk,$(CONFIG_ENV))
|
||||
ifeq ($(CURDIR)/dpdk/build,$(CONFIG_DPDK_DIR))
|
||||
@ -81,7 +81,7 @@ mk/cc.mk:
|
||||
cmp -s $@.tmp $@ || mv $@.tmp $@ ; \
|
||||
rm -f $@.tmp
|
||||
|
||||
include/spdk/config.h: CONFIG CONFIG.local scripts/genconfig.py
|
||||
include/spdk/config.h: mk/config.mk scripts/genconfig.py
|
||||
$(Q)PYCMD=$$(cat PYTHON_COMMAND 2>/dev/null) ; \
|
||||
test -z "$$PYCMD" && PYCMD=python ; \
|
||||
echo "#ifndef SPDK_CONFIG_H" > $@.tmp; \
|
||||
|
21
README.md
21
README.md
@ -103,12 +103,12 @@ Details on the Vagrant setup can be found in the
|
||||
## Advanced Build Options
|
||||
|
||||
Optional components and other build-time configuration are controlled by
|
||||
settings in two Makefile fragments in the root of the repository. `CONFIG`
|
||||
contains the base settings. Running the `configure` script generates a new
|
||||
file, `CONFIG.local`, that contains overrides to the base `CONFIG` file. For
|
||||
advanced configuration, there are a number of additional options to `configure`
|
||||
that may be used, or `CONFIG.local` can simply be created and edited by hand. A
|
||||
description of all possible options is located in `CONFIG`.
|
||||
settings in the Makefile configuration file in the root of the repository. `CONFIG`
|
||||
contains the base settings for the `configure` script. This script generates a new
|
||||
file, `mk/config.mk`, that contains final build settings. For advanced configuration,
|
||||
there are a number of additional options to `configure` that may be used, or
|
||||
`mk/config.mk` can simply be created and edited by hand. A description of all
|
||||
possible options is located in `CONFIG`.
|
||||
|
||||
Boolean (on/off) options are configured with a 'y' (yes) or 'n' (no). For
|
||||
example, this line of `CONFIG` controls whether the optional RDMA (libibverbs)
|
||||
@ -116,7 +116,7 @@ support is enabled:
|
||||
|
||||
CONFIG_RDMA?=n
|
||||
|
||||
To enable RDMA, this line may be added to `CONFIG.local` with a 'y' instead of
|
||||
To enable RDMA, this line may be added to `mk/config.mk` with a 'y' instead of
|
||||
'n'. For the majority of options this can be done using the `configure` script.
|
||||
For example:
|
||||
|
||||
@ -152,10 +152,9 @@ gmake
|
||||
~~~
|
||||
|
||||
The options specified on the `make` command line take precedence over the
|
||||
default values in `CONFIG` and `CONFIG.local`. This can be useful if you, for
|
||||
example, generate a `CONFIG.local` using the `configure` script and then have
|
||||
one or two options (i.e. debug builds) that you wish to turn on and off
|
||||
frequently.
|
||||
values in `mk/config.mk`. This can be useful if you, for example, generate
|
||||
a `mk/config.mk` using the `configure` script and then have one or two
|
||||
options (i.e. debug builds) that you wish to turn on and off frequently.
|
||||
|
||||
<a id="huge"></a>
|
||||
## Hugepages and Device Binding
|
||||
|
34
configure
vendored
34
configure
vendored
@ -70,7 +70,7 @@ function usage()
|
||||
|
||||
# Load default values
|
||||
# Convert config to sourcable configuration file
|
||||
sed -r 's/CONFIG_([[:alnum:]_]+)\?=(.*)/CONFIG[\1]=\2/g' CONFIG > CONFIG.sh
|
||||
sed -r 's/CONFIG_([[:alnum:]_]+)=(.*)/CONFIG[\1]=\2/g' CONFIG > CONFIG.sh
|
||||
declare -A CONFIG
|
||||
source CONFIG.sh
|
||||
rm CONFIG.sh
|
||||
@ -362,39 +362,35 @@ fi
|
||||
|
||||
# We are now ready to generate final configuration. But first do sanity
|
||||
# check to see if all keys in CONFIG array have its reflection in CONFIG file.
|
||||
if [ $(egrep -c "^\s*CONFIG_[[:alnum:]_]+\?=" CONFIG) -ne ${#CONFIG[@]} ]; then
|
||||
if [ $(egrep -c "^\s*CONFIG_[[:alnum:]_]+=" CONFIG) -ne ${#CONFIG[@]} ]; then
|
||||
echo ""
|
||||
echo "BUG: Some configuration options are not present in CONFIG file. Please update this file."
|
||||
echo "Missing options in CONFIG (+) file and in current config (-): "
|
||||
diff -u --label "CONFIG file" --label "CONFIG[@]" \
|
||||
<(sed -r -e '/^\s*$/d; /^\s*#.*/d; s/(CONFIG_[[:alnum:]_]+)\?=.*/\1/g' CONFIG | sort) \
|
||||
<(sed -r -e '/^\s*$/d; /^\s*#.*/d; s/(CONFIG_[[:alnum:]_]+)=.*/\1/g' CONFIG | sort) \
|
||||
<(printf "CONFIG_%s\n" ${!CONFIG[@]} | sort)
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo -n "Creating CONFIG.local..."
|
||||
cp -f CONFIG CONFIG.local
|
||||
echo -n "Creating mk/config.mk..."
|
||||
cp -f CONFIG mk/config.mk
|
||||
for key in ${!CONFIG[@]}; do
|
||||
sed -i.bak -r "s#^\s*CONFIG_${key}\?=.*#CONFIG_${key}\?=${CONFIG[$key]}#g" CONFIG.local
|
||||
sed -i.bak -r "s#^\s*CONFIG_${key}=.*#CONFIG_${key}\?=${CONFIG[$key]}#g" mk/config.mk
|
||||
done
|
||||
# On FreeBSD sed -i 'SUFFIX' - SUFFIX is mandatory. So no way but to delete the backed file.
|
||||
rm -f CONFIG.local.bak
|
||||
rm -f mk/config.mk.bak
|
||||
|
||||
# Environment variables
|
||||
if [ -n "$CFLAGS" ]; then
|
||||
echo "CFLAGS?=$CFLAGS" >> CONFIG.local
|
||||
fi
|
||||
if [ -n "$CXXFLAGS" ]; then
|
||||
echo "CXXFLAGS?=$CXXFLAGS" >> CONFIG.local
|
||||
fi
|
||||
if [ -n "$LDFLAGS" ]; then
|
||||
echo "LDFLAGS?=$LDFLAGS" >> CONFIG.local
|
||||
fi
|
||||
if [ -n "$DESTDIR" ]; then
|
||||
echo "DESTDIR?=$DESTDIR" >> CONFIG.local
|
||||
fi
|
||||
[ -n "$CFLAGS" ] && echo "CFLAGS?=$CFLAGS" >> mk/config.mk
|
||||
[ -n "$CXXFLAGS" ] && echo "CXXFLAGS?=$CXXFLAGS" >> mk/config.mk
|
||||
[ -n "$LDFLAGS" ] && echo "LDFLAGS?=$LDFLAGS" >> mk/config.mk
|
||||
[ -n "$DESTDIR" ] && echo "DESTDIR?=$DESTDIR" >> mk/config.mk
|
||||
|
||||
# When nvme-cli repo will be update this link can be removed
|
||||
ln -fs mk/config.mk CONFIG.local
|
||||
|
||||
echo "done."
|
||||
|
||||
if [[ "$OSTYPE" == "freebsd"* ]]; then
|
||||
echo "Type 'gmake' to build."
|
||||
else
|
||||
|
@ -137,7 +137,7 @@ vagrant@vagrant:~/spdk_repo/spdk$ sudo scripts/pkgdep.sh
|
||||
<<output trimmed>>
|
||||
|
||||
vagrant@vagrant:~/spdk_repo/spdk$ ./configure
|
||||
Creating CONFIG.local...done.
|
||||
Creating mk/config.mk...done.
|
||||
Type 'make' to build.
|
||||
|
||||
vagrant@vagrant:~/spdk_repo/spdk$ make
|
||||
|
@ -32,8 +32,13 @@
|
||||
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
|
||||
-include $(SPDK_ROOT_DIR)/CONFIG.local
|
||||
include $(SPDK_ROOT_DIR)/CONFIG
|
||||
ifneq ($(MAKECMDGOALS),clean)
|
||||
ifeq ($(wildcard $(SPDK_ROOT_DIR)/mk/config.mk),)
|
||||
$(error mk/config.mk: file not found. Please run configure before 'make $(filter-out clean,$(MAKECMDGOALS))')
|
||||
endif
|
||||
endif
|
||||
|
||||
include $(SPDK_ROOT_DIR)/mk/config.mk
|
||||
|
||||
-include $(SPDK_ROOT_DIR)/mk/cc.mk
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user