From 2201e2e701f0047658ce4c09e46c458550aa1c3d Mon Sep 17 00:00:00 2001 From: Darek Stojaczyk Date: Thu, 4 Jul 2019 13:39:26 +0000 Subject: [PATCH] Makefile: handle multi-word CC and LD variables Besides executable name, those variables might also contain some predefined flags. So far we didn't pass those correctly to detect_cc.sh, causing it to fail on argument parsing. While here, also fix accessing CONFIG[LTO], which needs to be done in curly brackets ${} just like any other bash array element. Change-Id: Icb830a11ca128eb8ee327dad44dae62ab0cf2cce Signed-off-by: Darek Stojaczyk Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/460528 Tested-by: SPDK CI Jenkins Reviewed-by: Ben Walker Reviewed-by: Shuhei Matsumoto --- Makefile | 2 +- configure | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 3a92fdfb8..565c20f52 100644 --- a/Makefile +++ b/Makefile @@ -98,7 +98,7 @@ pkgdep: $(DIRS-y): mk/cc.mk include/spdk/config.h mk/cc.mk: - $(Q)scripts/detect_cc.sh --cc=$(CC) --cxx=$(CXX) --lto=$(CONFIG_LTO) --ld=$(LD) > $@.tmp; \ + $(Q)scripts/detect_cc.sh --cc="$(CC)" --cxx="$(CXX)" --lto="$(CONFIG_LTO)" --ld="$(LD)" > $@.tmp; \ cmp -s $@.tmp $@ || mv $@.tmp $@ ; \ rm -f $@.tmp diff --git a/configure b/configure index 4760c3329..a1abdf342 100755 --- a/configure +++ b/configure @@ -606,7 +606,7 @@ if [[ "${CONFIG[PGO_CAPTURE]}" = "y" && "${CONFIG[PGO_USE]}" = "y" ]]; then echo "ERROR: --enable-pgo-capture and --enable-pgo-use are mutually exclusive." exit 1 elif [[ "${CONFIG[PGO_USE]}" = "y" ]]; then - CC_TYPE=$($rootdir/scripts/detect_cc.sh --cc=$CC --cxx=$CXX --lto=$CONFIG[LTO] --ld=$LD | grep "CC_TYPE" | cut -d "=" -f 2) + CC_TYPE=$($rootdir/scripts/detect_cc.sh --cc="$CC" --cxx="$CXX" --lto="${CONFIG[LTO]}" --ld="$LD" | grep "CC_TYPE" | cut -d "=" -f 2) if [[ "$CC_TYPE" = "clang" ]]; then # For clang we need to run an extra step on gathered profiling data. echo "Generating suitable profile data"