Commit 9dd998cd authored by Ben Walker's avatar Ben Walker Committed by Daniel Verkamp
Browse files

Add a configure script to generate the CONFIG file



Add a configure script in the root of the repository
that looks and feels like one that would be generated
by autotools. This script simply generates a CONFIG
file for you, which used to be done by hand.

Now to build SPDK you can do the following:

./configure --with-dpdk=path
make

Change-Id: I44ebb91f0cb1468b86da4c0033ac1406595d4967
Signed-off-by: default avatarBen Walker <benjamin.walker@intel.com>
parent 86840974
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@ cscope.out
dpdk-*
CUnit-Memory-Dump.xml
config.h
CONFIG.local
*VC.db
.vscode
.project
+2 −2
Original line number Diff line number Diff line
@@ -38,7 +38,7 @@ include $(SPDK_ROOT_DIR)/mk/spdk.common.mk

DIRS-y += lib test examples app

.PHONY: all clean $(DIRS-y) config.h
.PHONY: all clean $(DIRS-y) config.h CONFIG.local

all: $(DIRS-y)
clean: $(DIRS-y)
@@ -50,7 +50,7 @@ examples: lib

$(DIRS-y): config.h

config.h: CONFIG scripts/genconfig.py
config.h: CONFIG CONFIG.local scripts/genconfig.py
	$(Q)python scripts/genconfig.py $(MAKEFLAGS) > $@.tmp; \
	cmp -s $@.tmp $@ || mv $@.tmp $@ ; \
	rm -f $@.tmp
+36 −22
Original line number Diff line number Diff line
@@ -67,41 +67,55 @@ FreeBSD:

    4) (cd dpdk-17.02 && gmake install T=x86_64-native-bsdapp-clang DESTDIR=.)

Build Configuration
===================
Building
========

Optional components and other build-time configuration are controlled by the `CONFIG` file
in the root SPDK directory.  `CONFIG` is a Makefile fragment that may be edited before building to
control which options are enabled.
Once the prerequisites are installed, building follows the common configure
and make pattern. If you followed the instructions above for building DPDK:

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) support is enabled:
Linux:

    CONFIG_RDMA?=n
    ./configure --with-dpdk=./dpdk-17.02/x86_64-native-linuxapp-gcc
    make

To enable RDMA, this line of CONFIG may be modified to contain 'y' instead of 'n'.
FreeBSD:

Alternatively, `CONFIG` options may also be overrriden on the `make` command line:
    ./configure --with-dpdk=./dpdk-17.02/x86_64-native-bsdapp-clang
    gmake

    make CONFIG_RDMA=y
Advanced Build Options
======================

The options specified on the `make` command line take precedence over the default values in
`CONFIG`.
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`.

Building
========
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)
support is enabled:

Once the prerequisites are installed, run 'make' within the SPDK directory
to build the SPDK libraries and examples.
If you followed the instructions above for building DPDK:
    CONFIG_RDMA?=n

Linux:
To enable RDMA, this line may be added to `CONFIG.local` with a 'y' instead of
'n'. For the majority of options this can be done using the `configure` script.
For example:

    make DPDK_DIR=./dpdk-17.02/x86_64-native-linuxapp-gcc
    ./configure --with-dpdk=./dpdk-17.02/x86_64-native-linuxapp-gcc --with-rdma

FreeBSD:
Additionally, `CONFIG` options may also be overrriden on the `make` command
line:

    make CONFIG_RDMA=y

    gmake DPDK_DIR=./dpdk-17.02/x86_64-native-bsdapp-clang
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.

Hugepages and Device Binding
============================
+4 −10
Original line number Diff line number Diff line
@@ -14,16 +14,10 @@ cd $rootdir
date -u
git describe --tags

if [ -d /usr/src/fio ]; then
	MAKECONFIG="$MAKECONFIG CONFIG_FIO_PLUGIN=y FIO_SOURCE_DIR=/usr/src/fio"
fi

if [ -d /usr/include/rbd ] &&  [ -d /usr/include/rados ]; then
	MAKECONFIG="$MAKECONFIG CONFIG_RBD=y"
fi

timing_enter autobuild

./configure $config_params

timing_enter check_format
./scripts/check_format.sh
timing_exit check_format
@@ -41,7 +35,7 @@ $MAKE $MAKEFLAGS clean

timing_enter scanbuild_make
fail=0
time $scanbuild $MAKE $MAKEFLAGS DPDK_DIR=$DPDK_DIR $MAKECONFIG || fail=1
time $scanbuild $MAKE $MAKEFLAGS || fail=1
if [ $fail -eq 1 ]; then
	if [ -d $out/scan-build-tmp ]; then
		scanoutput=$(ls -1 $out/scan-build-tmp/)
@@ -61,7 +55,7 @@ timing_exit scanbuild_make
STAT1=`stat examples/nvme/identify/identify`
sleep 1
touch lib/nvme/nvme_internal.h
$MAKE $MAKEFLAGS DPDK_DIR=$DPDK_DIR $MAKECONFIG
$MAKE $MAKEFLAGS
STAT2=`stat examples/nvme/identify/identify`

if [ "$STAT1" == "$STAT2" ]; then
+2 −1
Original line number Diff line number Diff line
@@ -33,7 +33,8 @@ echo "tmpdir=$tmpdir"
tar -C "$tmpdir" -xf $tarball
(
	cd "$tmpdir"/spdk-*
	time $MAKE ${MAKEFLAGS} DPDK_DIR=$DPDK_DIR CONFIG_DEBUG=n CONFIG_WERROR=y
	./configure $config_params --disable-debug --enable-werror
	time $MAKE ${MAKEFLAGS}
)
rm -rf "$tmpdir"

Loading