[OpenWrt-Devel] [PATCH] build: improve ccache support

Roman Yeryomin roman at advem.lv
Tue Jun 2 08:32:00 EDT 2020

On 2020-06-01 23:51, Petr Štetiar wrote:
> Roman Yeryomin <roman at advem.lv> [2020-06-01 18:32:26]:
> Hi,
>> Set CCACHE_DIR to $(TOPDIR)/.ccache and CCACHE_BASEDIR to $(TOPDIR).
> this changes location of ccache directory (people would need to move 
> it,
> symlink back or override it) and with CCACHE_BASEDIR it probably also
> invalidates the current cache/hashes, doesn't it?

I'm not 100% sure but for me it makes more sense to make separate ccache 
dirs for each repo -- easier to manage and less corruption possibility.

> BTW you've missed following hardcoded patterns:
>  target/toolchain/Makefile:EXCLUDE_DIRS:=*/ccache
>  target/sdk/Makefile:EXCLUDE_DIRS:=*/ccache/*

Hmm, missed that, will look.

>> This allows to do clean and dirclean.
> Isn't it desired to remove potentially broken ccache as well with
> clean/dirclean? Do I want to remove my config, downloads, feeds etc. in 
> order
> to remove ccache?

IMO it's desired to ccache host tools, which are cleaned only with 
It's always possible to just rm -rf ./.ccache same as with ./tmp/
Of cause we can make another make target, like cacheclean but not sure 
if it's worth doing.

>> +++ b/include/host-build.mk
>> +  $(if $(CONFIG_CCACHE),$(1) : export 
>> CCACHE_COMPILERCHECK:=%compiler% -dumpmachine; %compiler% 
>> -dumpversion)
> you've missed to describe this change

This pattern was taken from package ccache, which looks sane to me. If 
you have other opinion, please share.

>>  distclean:
>>  	rm -rf bin build_dir .config* dl feeds key-build* logs package/feeds 
>> package/openwrt-packages staging_dir tmp
>> +	rm -rf $(TOPDIR)/.ccache
> Other CCACHE_DIR variable occurencies can be overriden, this is 
> hardcoded
> path.

OK, this should be rm -rf $(CCACHE_DIR) probably.

> Michael Jones <mike at meshplusplus.com> [2020-06-01 13:34:51]:
>> Having build behavior change based on a symlink is undesirable.
> `make CCACHE_DIR=/whatever` should work as well
>> Additionally, having the ccache directory be a configuration option 
>> allows
>> it to persist across clones of the git repository, if the .config file 
>> is
>> stored in git.
> BTW .config is .gitignored for a reason.
> Anyway, I don't think, that bloating the menu config with every Make 
> variable
> from now on is desired. System has sane defaults and is flexible enough 
> to
> allow fine tunning if needed.
> -- ynezz

openwrt-devel mailing list
openwrt-devel at lists.openwrt.org

More information about the openwrt-devel mailing list