Skip to contentSkip to conversation

ccache: allow for BR2_CCACHE_DIR environment override

PATCH New gustavo.zacarias at free-electrons.com 3 participants 3 messages Oct 15, 2015 – Oct 17, 2015 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ccache: allow for BR2_CCACHE_DIR environment override

From: Gustavo Zacarias <[email protected]>

Allow the BR2_CCACHE_DIR .config option to be overriden by the BR2_CCACHE_DIR env variable.
This is useful for big projects where in some cases the developers home directory might be a NFS mount (slow) and real production builds aren't.

Update documentation accordingly as well.

---
 Makefile                     | 6 ++++--
 docs/manual/common-usage.txt | 3 +++
 2 files changed, 7 insertions(+), 2 deletions(-)
Makefile +4 -2
index 181d446..5bf1538 100644
@@ -183,7 +183,9 @@ endif
 ifneq ($(BR2_DL_DIR),)
 DL_DIR := $(BR2_DL_DIR)
 endif
-
+ifneq ($(BR2_CCACHE_DIR),)
+BR_CACHE_DIR := $(BR2_CCACHE_DIR)
+endif
 
 # Need that early, before we scan packages
 # Avoids doing the $(or...) everytime
@@ -371,7 +373,7 @@ TARGET_DIR_WARNING_FILE = $(TARGET_DIR)/THIS_IS_NOT_YOUR_ROOT_FILESYSTEM
 
 ifeq ($(BR2_CCACHE),y)
 CCACHE := $(HOST_DIR)/usr/bin/ccache
-BR_CACHE_DIR = $(call qstrip,$(BR2_CCACHE_DIR))
+BR_CACHE_DIR ?= $(call qstrip,$(BR2_CCACHE_DIR))
 export BR_CACHE_DIR
 HOSTCC := $(CCACHE) $(HOSTCC)
 HOSTCXX := $(CCACHE) $(HOSTCXX)
docs/manual/common-usage.txt +3 -0
index 5b27b1f..51b6a3e 100644
@@ -84,6 +84,9 @@ to +make+ or set in the environment:
   configuration interface, so through the Buildroot +.config+ file; this
   is the recommended way of setting it.
   +
+* +BR2_CCACHE_DIR+ to override the directory where
+  Buildroot stores the cached files when using ccache.
+  +
 * +BR2_DL_DIR+ to override the directory in which
   Buildroot stores/retrieves downloaded files
   +
Signature · 1 line
2.4.9
#1 lore raw

PATCH 1/1 ccache: allow for BR2_CCACHE_DIR environment override

Quoted 10 lines · gustavo.zacarias at free-electrons.com

From: Gustavo Zacarias <[email protected]>

Allow the BR2_CCACHE_DIR .config option to be overriden by the BR2_CCACHE_DIR env variable.
This is useful for big projects where in some cases the developers home directory might be a NFS mount (slow) and real production builds aren't.

Update documentation accordingly as well.

I initially thought: why not set the default in the .config file based on the
environment. However, this approach is really a lot simpler, so:

One more remark below.

Quoted 34 lines
---
 Makefile                     | 6 ++++--
 docs/manual/common-usage.txt | 3 +++
 2 files changed, 7 insertions(+), 2 deletions(-)
Makefile +4 -2
index 181d446..5bf1538 100644
@@ -183,7 +183,9 @@ endif
 ifneq ($(BR2_DL_DIR),)
 DL_DIR := $(BR2_DL_DIR)
 endif
-
+ifneq ($(BR2_CCACHE_DIR),)
+BR_CACHE_DIR := $(BR2_CCACHE_DIR)
+endif
 
 # Need that early, before we scan packages
 # Avoids doing the $(or...) everytime
@@ -371,7 +373,7 @@ TARGET_DIR_WARNING_FILE = $(TARGET_DIR)/THIS_IS_NOT_YOUR_ROOT_FILESYSTEM
 
 ifeq ($(BR2_CCACHE),y)
 CCACHE := $(HOST_DIR)/usr/bin/ccache
-BR_CACHE_DIR = $(call qstrip,$(BR2_CCACHE_DIR))
+BR_CACHE_DIR ?= $(call qstrip,$(BR2_CCACHE_DIR))
 export BR_CACHE_DIR
 HOSTCC := $(CCACHE) $(HOSTCC)
 HOSTCXX := $(CCACHE) $(HOSTCXX)
docs/manual/common-usage.txt +0 -0
index 5b27b1f..51b6a3e 100644

docs/manual/common-usage.txt to +make+ or set in the environment: · line 89

Quoted 6 lines
docs/manual/common-usage.txt +3 -0
@@ -84,6 +84,9 @@ to +make+ or set in the environment:
   configuration interface, so through the Buildroot +.config+ file; this
   is the recommended way of setting it.
   +
+* +BR2_CCACHE_DIR+ to override the directory where
+  Buildroot stores the cached files when using ccache.
+  +

It could be useful to add this to ccache-support.txt as well.

Regards,
Arnout

Quoted 4 lines
docs/manual/common-usage.txt +0 -0
 * +BR2_DL_DIR+ to override the directory in which
   Buildroot stores/retrieves downloaded files
   +
Signature · 6 lines
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
#2 lore raw

PATCH 1/1 ccache: allow for BR2_CCACHE_DIR environment override

In reply to gustavo.zacarias at free-electrons.com

Dear gustavo.zacarias at free-electrons.com,

Quoted 7 lines · gustavo.zacarias at free-electrons.com

From: Gustavo Zacarias <[email protected]>

Allow the BR2_CCACHE_DIR .config option to be overriden by the BR2_CCACHE_DIR env variable.
This is useful for big projects where in some cases the developers home directory might be a NFS mount (slow) and real production builds aren't.

Quoted 7 lines

Update documentation accordingly as well.

---
 Makefile                     | 6 ++++--
 docs/manual/common-usage.txt | 3 +++
 2 files changed, 7 insertions(+), 2 deletions(-)

Applied, thanks.

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com