Makefile: set HOST*_NOCCACHE variables only if unset
Set HOSTCC_NOCCACHE and HOSTCXX_NOCCACHE only if they are not set. This allows recursive calls to "make" to work as intended in the presence of ccache. Such recursive calls to "make" can for example happen if one calls "make legal-info" from within a post-build script, to integrate some results of the legal-info output into the root filesystem. Without guarding these variables, a recursive invocation of make would re-define HOSTCC_NOCCACHE := $(HOSTCC) and HOSTCXX_NOCCACHE := $(HOSTCXX) at a point in time when HOSTCC and HOSTCXX already point to ccache. It used to work by "accident" untilca6a2907c2
("make: support: use `command -v' instead of `which'"), due to how "which" was behaving when invoked with multiple arguments. After switching to "command -v", which behaves different with multiple arguments, this HOSTCC_NOCCACHE redefinition problem surfaced. Even thoughca6a2907c2
has since then been reverted for other reasons, it does make sense to guard the definition of HOSTCC_NOCCACHE and HOSTCXX_NOCCACHE to not rely on a side-effect of using "which". Signed-off-by: Markus Mayer <mmayer@broadcom.com> Reviewed-by: Petr Vorel <petr.vorel@gmail.com> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com> (cherry picked from commitc5912e7db3
) Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
This commit is contained in:
parent
2d4a00623e
commit
7a6bcea2b1
4
Makefile
4
Makefile
@ -286,12 +286,16 @@ ifndef HOSTCC
|
||||
HOSTCC := gcc
|
||||
HOSTCC := $(shell which $(HOSTCC) || type -p $(HOSTCC) || echo gcc)
|
||||
endif
|
||||
ifndef HOSTCC_NOCCACHE
|
||||
HOSTCC_NOCCACHE := $(HOSTCC)
|
||||
endif
|
||||
ifndef HOSTCXX
|
||||
HOSTCXX := g++
|
||||
HOSTCXX := $(shell which $(HOSTCXX) || type -p $(HOSTCXX) || echo g++)
|
||||
endif
|
||||
ifndef HOSTCXX_NOCCACHE
|
||||
HOSTCXX_NOCCACHE := $(HOSTCXX)
|
||||
endif
|
||||
ifndef HOSTCPP
|
||||
HOSTCPP := cpp
|
||||
endif
|
||||
|
Loading…
Reference in New Issue
Block a user