build: Allow the user to set target architecture in configure

Change-Id: I7f2a1464c0c8872e5e7856a830aaf7ea8cdf4e81
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/463013
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
This commit is contained in:
Ben Walker 2019-07-23 10:52:47 -07:00 committed by Jim Harris
parent ebd32197ba
commit 0e6ddfd66a
3 changed files with 8 additions and 1 deletions

3
CONFIG
View File

@ -34,6 +34,9 @@
# Installation prefix
CONFIG_PREFIX="/usr/local"
# Target architecture
CONFIG_ARCH=native
# Build with debug logging. Turn off for performance testing and normal usage
CONFIG_DEBUG=n

4
configure vendored
View File

@ -16,6 +16,7 @@ function usage()
echo " -h, --help Display this help and exit"
echo ""
echo " --prefix=path Configure installation prefix (default: /usr/local)"
echo " --target-arch=arch Target build architecture. Must be a valid GNU arch. Default: native"
echo ""
echo " --enable-debug Configure for debug builds"
echo " --enable-log-bt Enable support of backtrace printing in SPDK logs (requires libunwind)."
@ -119,6 +120,9 @@ for i in "$@"; do
--prefix=*)
CONFIG[PREFIX]="${i#*=}"
;;
--target-arch=*)
CONFIG[ARCH]="${i#*=}"
;;
--enable-debug)
CONFIG[DEBUG]=y
;;

View File

@ -72,7 +72,7 @@ ifneq ($(filter freebsd%,$(TARGET_TRIPLET_WORDS)),)
OS = FreeBSD
endif
TARGET_ARCHITECTURE ?= native
TARGET_ARCHITECTURE ?= $(CONFIG_ARCH)
TARGET_MACHINE := $(firstword $(TARGET_TRIPLET_WORDS))
COMMON_CFLAGS = -g $(C_OPT) -Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Wmissing-declarations -fno-strict-aliasing -I$(SPDK_ROOT_DIR)/include