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
|
.cproject
|
||||||
.settings
|
.settings
|
||||||
mk/cc.mk
|
mk/cc.mk
|
||||||
|
mk/config.mk
|
||||||
PYTHON_COMMAND
|
PYTHON_COMMAND
|
||||||
|
55
CONFIG
55
CONFIG
@ -32,82 +32,83 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
# Installation prefix
|
# Installation prefix
|
||||||
CONFIG_PREFIX?=/usr/local
|
CONFIG_PREFIX="/usr/local"
|
||||||
|
|
||||||
# Build with debug logging. Turn off for performance testing and normal usage
|
# 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.
|
# 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).
|
# Treat warnings as errors (fail the build on any warning).
|
||||||
CONFIG_WERROR?=n
|
CONFIG_WERROR=n
|
||||||
|
|
||||||
# Build with link-time optimization.
|
# Build with link-time optimization.
|
||||||
CONFIG_LTO?=n
|
CONFIG_LTO=n
|
||||||
|
|
||||||
# Build with code coverage instrumentation.
|
# Build with code coverage instrumentation.
|
||||||
CONFIG_COVERAGE?=n
|
CONFIG_COVERAGE=n
|
||||||
|
|
||||||
# Build with Address Sanitizer enabled
|
# Build with Address Sanitizer enabled
|
||||||
CONFIG_ASAN?=n
|
CONFIG_ASAN=n
|
||||||
|
|
||||||
# Build with Undefined Behavior Sanitizer enabled
|
# Build with Undefined Behavior Sanitizer enabled
|
||||||
CONFIG_UBSAN?=n
|
CONFIG_UBSAN=n
|
||||||
|
|
||||||
# Build with Thread Sanitizer enabled
|
# Build with Thread Sanitizer enabled
|
||||||
CONFIG_TSAN?=n
|
CONFIG_TSAN=n
|
||||||
|
|
||||||
# Build tests
|
# Build tests
|
||||||
CONFIG_TESTS?=y
|
CONFIG_TESTS=y
|
||||||
|
|
||||||
# Directory that contains the desired SPDK environment library.
|
# Directory that contains the desired SPDK environment library.
|
||||||
# By default, this is implemented using DPDK.
|
# By default, this is implemented using DPDK.
|
||||||
CONFIG_ENV?=
|
CONFIG_ENV=
|
||||||
|
|
||||||
# This directory should contain 'include' and 'lib' directories for your DPDK
|
# This directory should contain 'include' and 'lib' directories for your DPDK
|
||||||
# installation.
|
# installation.
|
||||||
CONFIG_DPDK_DIR?=
|
CONFIG_DPDK_DIR=
|
||||||
|
|
||||||
# Build SPDK FIO plugin. Requires CONFIG_FIO_SOURCE_DIR set to a valid
|
# Build SPDK FIO plugin. Requires CONFIG_FIO_SOURCE_DIR set to a valid
|
||||||
# fio source code directory.
|
# fio source code directory.
|
||||||
CONFIG_FIO_PLUGIN?=n
|
CONFIG_FIO_PLUGIN=n
|
||||||
|
|
||||||
# This directory should contain the source code directory for fio
|
# This directory should contain the source code directory for fio
|
||||||
# which is required for building the SPDK FIO plugin.
|
# 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.
|
# Enable RDMA support for the NVMf target.
|
||||||
# Requires ibverbs development libraries.
|
# Requires ibverbs development libraries.
|
||||||
CONFIG_RDMA?=n
|
CONFIG_RDMA=n
|
||||||
CONFIG_RDMA_SEND_WITH_INVAL?=n
|
CONFIG_RDMA_SEND_WITH_INVAL=n
|
||||||
|
|
||||||
# Build Ceph RBD support in bdev modules
|
# Build Ceph RBD support in bdev modules
|
||||||
# Requires librbd development libraries
|
# Requires librbd development libraries
|
||||||
CONFIG_RBD?=n
|
CONFIG_RBD=n
|
||||||
|
|
||||||
# Build vhost library.
|
# Build vhost library.
|
||||||
CONFIG_VHOST?=y
|
CONFIG_VHOST=y
|
||||||
|
|
||||||
# Build vhost initiator (Virtio) driver.
|
# Build vhost initiator (Virtio) driver.
|
||||||
CONFIG_VIRTIO?=y
|
CONFIG_VIRTIO=y
|
||||||
|
|
||||||
# Build with PMDK backends
|
# Build with PMDK backends
|
||||||
CONFIG_PMDK?=n
|
CONFIG_PMDK=n
|
||||||
CONFIG_PMDK_DIR?=
|
CONFIG_PMDK_DIR=
|
||||||
|
|
||||||
# Build with VPP
|
# Build with VPP
|
||||||
CONFIG_VPP?=n
|
CONFIG_VPP=n
|
||||||
|
CONFIG_VPP_DIR=
|
||||||
|
|
||||||
# Requires libiscsi development libraries.
|
# Requires libiscsi development libraries.
|
||||||
CONFIG_ISCSI_INITIATOR?=n
|
CONFIG_ISCSI_INITIATOR=n
|
||||||
|
|
||||||
# Enable the dependencies for building the crypto vbdev
|
# Enable the dependencies for building the crypto vbdev
|
||||||
CONFIG_CRYPTO?=n
|
CONFIG_CRYPTO=n
|
||||||
|
|
||||||
# Build spdk shared libraries in addition to the static ones.
|
# Build spdk shared libraries in addition to the static ones.
|
||||||
CONFIG_SHARED?=n
|
CONFIG_SHARED=n
|
||||||
|
|
||||||
# Build with VTune suport.
|
# Build with VTune suport.
|
||||||
CONFIG_VTUNE?=n
|
CONFIG_VTUNE=n
|
||||||
CONFIG_VTUNE_DIR?=
|
CONFIG_VTUNE_DIR=
|
||||||
|
4
Makefile
4
Makefile
@ -41,7 +41,7 @@ DIRS-$(CONFIG_SHARED) += shared_lib
|
|||||||
DIRS-y += examples app include
|
DIRS-y += examples app include
|
||||||
DIRS-$(CONFIG_TESTS) += test
|
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 ($(SPDK_ROOT_DIR)/lib/env_dpdk,$(CONFIG_ENV))
|
||||||
ifeq ($(CURDIR)/dpdk/build,$(CONFIG_DPDK_DIR))
|
ifeq ($(CURDIR)/dpdk/build,$(CONFIG_DPDK_DIR))
|
||||||
@ -81,7 +81,7 @@ mk/cc.mk:
|
|||||||
cmp -s $@.tmp $@ || mv $@.tmp $@ ; \
|
cmp -s $@.tmp $@ || mv $@.tmp $@ ; \
|
||||||
rm -f $@.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) ; \
|
$(Q)PYCMD=$$(cat PYTHON_COMMAND 2>/dev/null) ; \
|
||||||
test -z "$$PYCMD" && PYCMD=python ; \
|
test -z "$$PYCMD" && PYCMD=python ; \
|
||||||
echo "#ifndef SPDK_CONFIG_H" > $@.tmp; \
|
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
|
## Advanced Build Options
|
||||||
|
|
||||||
Optional components and other build-time configuration are controlled by
|
Optional components and other build-time configuration are controlled by
|
||||||
settings in two Makefile fragments in the root of the repository. `CONFIG`
|
settings in the Makefile configuration file in the root of the repository. `CONFIG`
|
||||||
contains the base settings. Running the `configure` script generates a new
|
contains the base settings for the `configure` script. This script generates a new
|
||||||
file, `CONFIG.local`, that contains overrides to the base `CONFIG` file. For
|
file, `mk/config.mk`, that contains final build settings. For advanced configuration,
|
||||||
advanced configuration, there are a number of additional options to `configure`
|
there are a number of additional options to `configure` that may be used, or
|
||||||
that may be used, or `CONFIG.local` can simply be created and edited by hand. A
|
`mk/config.mk` can simply be created and edited by hand. A description of all
|
||||||
description of all possible options is located in `CONFIG`.
|
possible options is located in `CONFIG`.
|
||||||
|
|
||||||
Boolean (on/off) options are configured with a 'y' (yes) or 'n' (no). For
|
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)
|
example, this line of `CONFIG` controls whether the optional RDMA (libibverbs)
|
||||||
@ -116,7 +116,7 @@ support is enabled:
|
|||||||
|
|
||||||
CONFIG_RDMA?=n
|
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.
|
'n'. For the majority of options this can be done using the `configure` script.
|
||||||
For example:
|
For example:
|
||||||
|
|
||||||
@ -152,10 +152,9 @@ gmake
|
|||||||
~~~
|
~~~
|
||||||
|
|
||||||
The options specified on the `make` command line take precedence over the
|
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
|
values in `mk/config.mk`. This can be useful if you, for example, generate
|
||||||
example, generate a `CONFIG.local` using the `configure` script and then have
|
a `mk/config.mk` using the `configure` script and then have one or two
|
||||||
one or two options (i.e. debug builds) that you wish to turn on and off
|
options (i.e. debug builds) that you wish to turn on and off frequently.
|
||||||
frequently.
|
|
||||||
|
|
||||||
<a id="huge"></a>
|
<a id="huge"></a>
|
||||||
## Hugepages and Device Binding
|
## Hugepages and Device Binding
|
||||||
|
34
configure
vendored
34
configure
vendored
@ -70,7 +70,7 @@ function usage()
|
|||||||
|
|
||||||
# Load default values
|
# Load default values
|
||||||
# Convert config to sourcable configuration file
|
# 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
|
declare -A CONFIG
|
||||||
source CONFIG.sh
|
source CONFIG.sh
|
||||||
rm CONFIG.sh
|
rm CONFIG.sh
|
||||||
@ -362,39 +362,35 @@ fi
|
|||||||
|
|
||||||
# We are now ready to generate final configuration. But first do sanity
|
# 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.
|
# 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 ""
|
||||||
echo "BUG: Some configuration options are not present in CONFIG file. Please update this file."
|
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 (-): "
|
echo "Missing options in CONFIG (+) file and in current config (-): "
|
||||||
diff -u --label "CONFIG file" --label "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)
|
<(printf "CONFIG_%s\n" ${!CONFIG[@]} | sort)
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo -n "Creating CONFIG.local..."
|
echo -n "Creating mk/config.mk..."
|
||||||
cp -f CONFIG CONFIG.local
|
cp -f CONFIG mk/config.mk
|
||||||
for key in ${!CONFIG[@]}; do
|
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
|
done
|
||||||
# On FreeBSD sed -i 'SUFFIX' - SUFFIX is mandatory. So no way but to delete the backed file.
|
# 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
|
# Environment variables
|
||||||
if [ -n "$CFLAGS" ]; then
|
[ -n "$CFLAGS" ] && echo "CFLAGS?=$CFLAGS" >> mk/config.mk
|
||||||
echo "CFLAGS?=$CFLAGS" >> CONFIG.local
|
[ -n "$CXXFLAGS" ] && echo "CXXFLAGS?=$CXXFLAGS" >> mk/config.mk
|
||||||
fi
|
[ -n "$LDFLAGS" ] && echo "LDFLAGS?=$LDFLAGS" >> mk/config.mk
|
||||||
if [ -n "$CXXFLAGS" ]; then
|
[ -n "$DESTDIR" ] && echo "DESTDIR?=$DESTDIR" >> mk/config.mk
|
||||||
echo "CXXFLAGS?=$CXXFLAGS" >> CONFIG.local
|
|
||||||
fi
|
# When nvme-cli repo will be update this link can be removed
|
||||||
if [ -n "$LDFLAGS" ]; then
|
ln -fs mk/config.mk CONFIG.local
|
||||||
echo "LDFLAGS?=$LDFLAGS" >> CONFIG.local
|
|
||||||
fi
|
|
||||||
if [ -n "$DESTDIR" ]; then
|
|
||||||
echo "DESTDIR?=$DESTDIR" >> CONFIG.local
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "done."
|
echo "done."
|
||||||
|
|
||||||
if [[ "$OSTYPE" == "freebsd"* ]]; then
|
if [[ "$OSTYPE" == "freebsd"* ]]; then
|
||||||
echo "Type 'gmake' to build."
|
echo "Type 'gmake' to build."
|
||||||
else
|
else
|
||||||
|
@ -137,7 +137,7 @@ vagrant@vagrant:~/spdk_repo/spdk$ sudo scripts/pkgdep.sh
|
|||||||
<<output trimmed>>
|
<<output trimmed>>
|
||||||
|
|
||||||
vagrant@vagrant:~/spdk_repo/spdk$ ./configure
|
vagrant@vagrant:~/spdk_repo/spdk$ ./configure
|
||||||
Creating CONFIG.local...done.
|
Creating mk/config.mk...done.
|
||||||
Type 'make' to build.
|
Type 'make' to build.
|
||||||
|
|
||||||
vagrant@vagrant:~/spdk_repo/spdk$ make
|
vagrant@vagrant:~/spdk_repo/spdk$ make
|
||||||
|
@ -32,8 +32,13 @@
|
|||||||
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#
|
#
|
||||||
|
|
||||||
-include $(SPDK_ROOT_DIR)/CONFIG.local
|
ifneq ($(MAKECMDGOALS),clean)
|
||||||
include $(SPDK_ROOT_DIR)/CONFIG
|
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
|
-include $(SPDK_ROOT_DIR)/mk/cc.mk
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user