From 1b86fe3ea1c6d8c4ecb17e014678b850c2218752 Mon Sep 17 00:00:00 2001 From: Martine Lenders Date: Fri, 6 Dec 2024 12:28:22 +0100 Subject: [PATCH] =?UTF-8?q?doc/ccache:=20move=20to=20=E2=80=9CAdvanced=20b?= =?UTF-8?q?uild=20system=20tricks=E2=80=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- doc/doxygen/riot.doxyfile | 1 - .../src/advanced-build-system-tricks.md | 81 +++++++++++++++++++ doc/doxygen/src/ccache.md | 80 ------------------ 3 files changed, 81 insertions(+), 81 deletions(-) delete mode 100644 doc/doxygen/src/ccache.md diff --git a/doc/doxygen/riot.doxyfile b/doc/doxygen/riot.doxyfile index bde91b4612..186917079d 100644 --- a/doc/doxygen/riot.doxyfile +++ b/doc/doxygen/riot.doxyfile @@ -878,7 +878,6 @@ INPUT = ../../doc.txt \ src/build-in-docker.md \ ../../tests/README.md \ src/dev-best-practices.md \ - src/ccache.md \ src/comparing-build-sizes.md \ src/static-vs-dynamic-memory.md \ src/build-system-basics.md \ diff --git a/doc/doxygen/src/advanced-build-system-tricks.md b/doc/doxygen/src/advanced-build-system-tricks.md index 48ce587258..e794896bee 100644 --- a/doc/doxygen/src/advanced-build-system-tricks.md +++ b/doc/doxygen/src/advanced-build-system-tricks.md @@ -39,6 +39,87 @@ You can configure your own files that will be parsed by the build system main * Define your custom targets * Override default targets +Speed-up builds with ccache {#ccache} +=========================== + +[`ccache`](https://ccache.samba.org/) is a compiler cache. It speeds up recompilation by caching previous compilations and detecting when the same compilation is being done again. + +Usually, the initial build takes a little (5% - 20%) longer, but repeated builds are up to ten times faster. +Using `ccache` is safe, as `ccache` tries very hard to not mess up things and falls back to a normal compile if it cannot ensure correct output. + +There's one drawback: without further tweaking, `gcc` stops emitting colored output. + +Setup +----- + +- Install using the package manager of your distribution, e.g., on Ubuntu or Debian: + +~~~~~~~~~~~~~~~~~~~ +# sudo apt-get install ccache +~~~~~~~~~~~~~~~~~~~ + +- Set `CCACHE` variable to `ccache`: + +~~~~~~~~~~~~~~~~~~~ +# export CCACHE=ccache +~~~~~~~~~~~~~~~~~~~ + +- (Optionally) add the above export line to your `~/.profile` + +Result +------ + +Build without `ccache`: + +~~~~~~~~~~~~~~~~~~~ +[kaspar@booze default (master)]$ time BOARD=samr21-xpro make clean all +Building application "default" for "samr21-xpro" with MCU "samd21". + +[...] + + text data bss dec hex filename + 37016 180 6008 43204 a8c4 /home/kaspar/src/riot/examples/default/bin/samr21-xpro/default.elf + +real 0m12.321s +user 0m10.317s +sys 0m1.170s +[kaspar@booze default (master)]$ +~~~~~~~~~~~~~~~~~~~ + +First build with `ccache` enabled: + +~~~~~~~~~~~~~~~~~~~ +[kaspar@booze default (master)]$ time BOARD=samr21-xpro make clean all +Building application "default" for "samr21-xpro" with MCU "samd21". + +[...] + +text data bss dec hex filename +37016 180 6008 43204 a8c4 /home/kaspar/src/riot/examples/default/bin/samr21-xpro/default.elf + +real 0m15.462s +user 0m12.410s +sys 0m1.597s +[kaspar@booze default (master)]$ +~~~~~~~~~~~~~~~~~~~ + +Subsequent build with `ccache` enabled: + +~~~~~~~~~~~~~~~~~~~ +[kaspar@booze default (master)]$ time BOARD=samr21-xpro make clean all +Building application "default" for "samr21-xpro" with MCU "samd21". + +[...] + + text data bss dec hex filename + 37016 180 6008 43204 a8c4 /home/kaspar/src/riot/examples/default/bin/samr21-xpro/default.elf + +real 0m2.157s +user 0m1.213s +sys 0m0.327s +[kaspar@booze default (master)]$ +~~~~~~~~~~~~~~~~~~~ + Analyze dependency resolution {#analyze-depedency-resolution} ============================= diff --git a/doc/doxygen/src/ccache.md b/doc/doxygen/src/ccache.md deleted file mode 100644 index 139c6db5ce..0000000000 --- a/doc/doxygen/src/ccache.md +++ /dev/null @@ -1,80 +0,0 @@ -Introduction -============ - -[`ccache`](https://ccache.samba.org/) is a compiler cache. It speeds up recompilation by caching previous compilations and detecting when the same compilation is being done again. - -Usually, the initial build takes a little (5% - 20%) longer, but repeated builds are up to ten times faster. -Using `ccache` is safe, as `ccache` tries very hard to not mess up things and falls back to a normal compile if it cannot ensure correct output. - -There's one drawback: without further tweaking, `gcc` stops emitting colored output. - -Setup ------ - -- Install using the package manager of your distribution, e.g., on Ubuntu or Debian: - -~~~~~~~~~~~~~~~~~~~ -# sudo apt-get install ccache -~~~~~~~~~~~~~~~~~~~ - -- Set `CCACHE` variable to `ccache`: - -~~~~~~~~~~~~~~~~~~~ -# export CCACHE=ccache -~~~~~~~~~~~~~~~~~~~ - -- (Optionally) add the above export line to your `~/.profile` - -Result ------- - -Build without `ccache`: - -~~~~~~~~~~~~~~~~~~~ -[kaspar@booze default (master)]$ time BOARD=samr21-xpro make clean all -Building application "default" for "samr21-xpro" with MCU "samd21". - -[...] - - text data bss dec hex filename - 37016 180 6008 43204 a8c4 /home/kaspar/src/riot/examples/default/bin/samr21-xpro/default.elf - -real 0m12.321s -user 0m10.317s -sys 0m1.170s -[kaspar@booze default (master)]$ -~~~~~~~~~~~~~~~~~~~ - -First build with `ccache` enabled: - -~~~~~~~~~~~~~~~~~~~ -[kaspar@booze default (master)]$ time BOARD=samr21-xpro make clean all -Building application "default" for "samr21-xpro" with MCU "samd21". - -[...] - -text data bss dec hex filename -37016 180 6008 43204 a8c4 /home/kaspar/src/riot/examples/default/bin/samr21-xpro/default.elf - -real 0m15.462s -user 0m12.410s -sys 0m1.597s -[kaspar@booze default (master)]$ -~~~~~~~~~~~~~~~~~~~ - -Subsequent build with `ccache` enabled: - -~~~~~~~~~~~~~~~~~~~ -[kaspar@booze default (master)]$ time BOARD=samr21-xpro make clean all -Building application "default" for "samr21-xpro" with MCU "samd21". - -[...] - - text data bss dec hex filename - 37016 180 6008 43204 a8c4 /home/kaspar/src/riot/examples/default/bin/samr21-xpro/default.elf - -real 0m2.157s -user 0m1.213s -sys 0m0.327s -[kaspar@booze default (master)]$ -~~~~~~~~~~~~~~~~~~~