You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by ac...@apache.org on 2022/10/10 19:12:32 UTC

[incubator-nuttx] branch master updated: Added Kconfig option for ccache.

This is an automated email from the ASF dual-hosted git repository.

acassis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git


The following commit(s) were added to refs/heads/master by this push:
     new 63d00a5fb1 Added Kconfig option for ccache.
63d00a5fb1 is described below

commit 63d00a5fb108da05ee6d31d5d87b5a362efccaeb
Author: Fotis Panagiotopoulos <f....@amco.gr>
AuthorDate: Mon Oct 10 16:42:36 2022 +0300

    Added Kconfig option for ccache.
---
 Kconfig         |  8 ++++++++
 tools/Config.mk | 12 +++++++++---
 2 files changed, 17 insertions(+), 3 deletions(-)

diff --git a/Kconfig b/Kconfig
index 13368e9f59..7013829954 100644
--- a/Kconfig
+++ b/Kconfig
@@ -1999,6 +1999,14 @@ config DEBUG_LINK_MAP
 		and debugging magic section games, and for seeing which
 		pieces of code get eliminated with DEBUG_OPT_UNUSED_SECTIONS.
 
+config CCACHE
+	bool "Use ccache"
+	default n
+	---help---
+		If enabled, ccache will be used during the build.
+		Build artifacts will be cached to a local storage, considerably
+		reducing build times.
+
 endmenu # Build Setup
 
 menu "System Type"
diff --git a/tools/Config.mk b/tools/Config.mk
index 8148b3a044..c9f7f1d47b 100644
--- a/tools/Config.mk
+++ b/tools/Config.mk
@@ -53,6 +53,12 @@ MODULECC ?= $(CC)
 MODULELD ?= $(LD)
 MODULESTRIP ?= $(STRIP)
 
+# ccache configuration.
+
+ifeq ($(CONFIG_CCACHE),y)
+  CCACHE ?= ccache
+endif
+
 # Define HOSTCC on the make command line if it differs from these defaults
 # Define HOSTCFLAGS with -g on the make command line to build debug versions
 
@@ -273,7 +279,7 @@ endef
 
 define COMPILE
 	@echo "CC: $1"
-	$(Q) $(CC) -c $(CFLAGS) $($(strip $1)_CFLAGS) $1 -o $2
+	$(Q) $(CCACHE) $(CC) -c $(CFLAGS) $($(strip $1)_CFLAGS) $1 -o $2
 endef
 
 # COMPILEXX - Default macro to compile one C++ file
@@ -291,7 +297,7 @@ endef
 
 define COMPILEXX
 	@echo "CXX: $1"
-	$(Q) $(CXX) -c $(CXXFLAGS) $($(strip $1)_CXXFLAGS) $1 -o $2
+	$(Q) $(CCACHE) $(CXX) -c $(CXXFLAGS) $($(strip $1)_CXXFLAGS) $1 -o $2
 endef
 
 # COMPILERUST - Default macro to compile one Rust file
@@ -352,7 +358,7 @@ endef
 
 define ASSEMBLE
 	@echo "AS: $1"
-	$(Q) $(CC) -c $(AFLAGS) $1 $($(strip $1)_AFLAGS) -o $2
+	$(Q) $(CCACHE) $(CC) -c $(AFLAGS) $1 $($(strip $1)_AFLAGS) -o $2
 endef
 
 # INSTALL_LIB - Install a library $1 into target $2