Commit 2201e2e7 authored by Darek Stojaczyk's avatar Darek Stojaczyk
Browse files

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: default avatarDarek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/460528


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-by: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
parent efef26e2
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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

+1 −1
Original line number Diff line number Diff line
@@ -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"