diff mbox series

[next,v4,1/6] Makefile: evaluate CCACHE and HOST{CC, CXX} at time of use

Message ID 20181114105557.12599-2-thomas.petazzoni@bootlin.com
State Superseded
Headers show
Series Per-package host/target directory support | expand

Commit Message

Thomas Petazzoni Nov. 14, 2018, 10:55 a.m. UTC
As we are going to move to per-package SDK, the location of CCACHE and
therefore the definitions of HOSTCC and HOSTCXX need to be evaluated
at the time of use and not at the time of assignment. Indeed, the
value of HOST_DIR changes from one package to the other.

Therefore, we need to change from := to =.

In addition, while doing A := $(something) $(A) is possible, doing A =
$(something) $(A) is not legal. So, instead of defining HOSTCC in
terms of the current HOSTCC variable, we re-use HOSTCC_NOCCACHE
instead.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
---
Changes since v2:
 - New patch
---
 Makefile | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Yann E. MORIN Nov. 15, 2018, 8:49 p.m. UTC | #1
Thomas, All,

On 2018-11-14 11:55 +0100, Thomas Petazzoni spake thusly:
> As we are going to move to per-package SDK, the location of CCACHE and
> therefore the definitions of HOSTCC and HOSTCXX need to be evaluated
> at the time of use and not at the time of assignment. Indeed, the
> value of HOST_DIR changes from one package to the other.
> 
> Therefore, we need to change from := to =.
> 
> In addition, while doing A := $(something) $(A) is possible, doing A =
> $(something) $(A) is not legal. So, instead of defining HOSTCC in
> terms of the current HOSTCC variable, we re-use HOSTCC_NOCCACHE
> instead.
> 
> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>

Acked-by: "Yann E. MORIN" <yann.morin.1998@free.fr>

Regards,
Yann E. MORIN.

> ---
> Changes since v2:
>  - New patch
> ---
>  Makefile | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/Makefile b/Makefile
> index 94adff3406..2819d44124 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -471,11 +471,11 @@ BR_PATH = "$(HOST_DIR)/bin:$(HOST_DIR)/sbin:$(PATH)"
>  TARGET_DIR_WARNING_FILE = $(BASE_TARGET_DIR)/THIS_IS_NOT_YOUR_ROOT_FILESYSTEM
>  
>  ifeq ($(BR2_CCACHE),y)
> -CCACHE := $(HOST_DIR)/bin/ccache
> +CCACHE = $(HOST_DIR)/bin/ccache
>  BR_CACHE_DIR ?= $(call qstrip,$(BR2_CCACHE_DIR))
>  export BR_CACHE_DIR
> -HOSTCC := $(CCACHE) $(HOSTCC)
> -HOSTCXX := $(CCACHE) $(HOSTCXX)
> +HOSTCC = $(CCACHE) $(HOSTCC_NOCCACHE)
> +HOSTCXX = $(CCACHE) $(HOSTCXX_NOCCACHE)
>  else
>  export BR_NO_CCACHE
>  endif
> -- 
> 2.19.1
>
diff mbox series

Patch

diff --git a/Makefile b/Makefile
index 94adff3406..2819d44124 100644
--- a/Makefile
+++ b/Makefile
@@ -471,11 +471,11 @@  BR_PATH = "$(HOST_DIR)/bin:$(HOST_DIR)/sbin:$(PATH)"
 TARGET_DIR_WARNING_FILE = $(BASE_TARGET_DIR)/THIS_IS_NOT_YOUR_ROOT_FILESYSTEM
 
 ifeq ($(BR2_CCACHE),y)
-CCACHE := $(HOST_DIR)/bin/ccache
+CCACHE = $(HOST_DIR)/bin/ccache
 BR_CACHE_DIR ?= $(call qstrip,$(BR2_CCACHE_DIR))
 export BR_CACHE_DIR
-HOSTCC := $(CCACHE) $(HOSTCC)
-HOSTCXX := $(CCACHE) $(HOSTCXX)
+HOSTCC = $(CCACHE) $(HOSTCC_NOCCACHE)
+HOSTCXX = $(CCACHE) $(HOSTCXX_NOCCACHE)
 else
 export BR_NO_CCACHE
 endif