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 <dariusz.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/460528
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
This commit is contained in:
Darek Stojaczyk 2019-07-04 13:39:26 +00:00
parent efef26e234
commit 2201e2e701
2 changed files with 2 additions and 2 deletions

View File

@ -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

2
configure vendored
View File

@ -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"