common.mk: fix CCACHE handling

OP-TEE build system defines the CCACHE variable as the host installed
ccache tool path when ccache is installed [1]. When ccache is not
installed the CCACHE variable is defined as single blank character.
CROSS_COMPILE variable is prefixed with CCACHE as defined in [2].
TF-A v2.11 introduced a build system hardening implying CROSS_COMPILE
must contain the exact toolchain path. For the case when ccache is not
installed, CROSS_COMPILE gets an extra heading space and TF-A build
breaks.
Fix by defining CCACHE only when ccache is effectively installed and
leave CCACHE empty when ccache is not installed.

[1] https://github.com/OP-TEE/build/blob/0c249c77d333c4bdc461650e3bdba5c87a48f0dc/common.mk#L54
[2] https://github.com/OP-TEE/build/blob/b80d8cb05ef6b789e536631f6e8d88118e8483b4/common.mk#L195

Signed-off-by: Olivier Deprez <olivier.deprez@arm.com>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org>
diff --git a/common.mk b/common.mk
index 9780c99..b6b3c5f 100644
--- a/common.mk
+++ b/common.mk
@@ -51,7 +51,12 @@
 endif
 endif
 
-CCACHE ?= $(shell which ccache) # Don't remove this comment (space is needed)
+# Only set CCACHE if it's pointing to something to avoid prefixing CROSS_COMPILE
+# with whitespace. TF-A will not build with whitespace first in CROSS_COMPILE.
+CCACHE_present := $(shell which ccache)
+ifneq ($(CCACHE_present),)
+CCACHE ?= $(CCACHE_present) # Don't remove this comment (space is needed)
+endif
 
 # QEMU shared folders settings
 #