board/csky: fixup gdb instructions in readme.txt
[buildroot-gz.git] / package / ccache / ccache.mk
blob6a20ee8ab7844f9a141568d7e7b416568d49c50f
1 ################################################################################
3 # ccache
5 ################################################################################
7 CCACHE_VERSION = 3.3.4
8 CCACHE_SITE = https://www.samba.org/ftp/ccache
9 CCACHE_SOURCE = ccache-$(CCACHE_VERSION).tar.xz
10 CCACHE_LICENSE = GPLv3+, others
11 CCACHE_LICENSE_FILES = LICENSE.txt GPL-3.0.txt
13 # Force ccache to use its internal zlib. The problem is that without
14 # this, ccache would link against the zlib of the build system, but we
15 # might build and install a different version of zlib in $(O)/host
16 # afterwards, which ccache will pick up. This might break if there is
17 # a version mismatch. A solution would be to add host-zlib has a
18 # dependency of ccache, but it would require tuning the zlib .mk file
19 # to use HOSTCC_NOCCACHE as the compiler. Instead, we take the easy
20 # path: tell ccache to use its internal copy of zlib, so that ccache
21 # has zero dependency besides the C library.
22 HOST_CCACHE_CONF_OPTS += --with-bundled-zlib
24 # Patch host-ccache as follows:
25 # - Use BR_CACHE_DIR instead of CCACHE_DIR, because CCACHE_DIR
26 # is already used by autotargets for the ccache package.
27 # BR_CACHE_DIR is exported by Makefile based on config option
28 # BR2_CCACHE_DIR.
29 # - Change hard-coded last-ditch default to match path in .config, to avoid
30 # the need to specify BR_CACHE_DIR when invoking ccache directly.
31 define HOST_CCACHE_PATCH_CONFIGURATION
32 sed -i 's,getenv("CCACHE_DIR"),getenv("BR_CACHE_DIR"),' $(@D)/ccache.c
33 sed -i 's,"%s/.ccache","$(BR_CACHE_DIR)",' $(@D)/conf.c
34 endef
36 HOST_CCACHE_POST_PATCH_HOOKS += HOST_CCACHE_PATCH_CONFIGURATION
38 define HOST_CCACHE_MAKE_CACHE_DIR
39 mkdir -p $(BR_CACHE_DIR)
40 endef
42 HOST_CCACHE_POST_INSTALL_HOOKS += HOST_CCACHE_MAKE_CACHE_DIR
44 # Provide capability to do initial ccache setup (e.g. increase default size)
45 BR_CCACHE_INITIAL_SETUP = $(call qstrip,$(BR2_CCACHE_INITIAL_SETUP))
46 ifneq ($(BR_CCACHE_INITIAL_SETUP),)
47 define HOST_CCACHE_DO_INITIAL_SETUP
48 @$(call MESSAGE,"Applying initial settings")
49 $(CCACHE) $(BR_CCACHE_INITIAL_SETUP)
50 $(CCACHE) -s
51 endef
53 HOST_CCACHE_POST_INSTALL_HOOKS += HOST_CCACHE_DO_INITIAL_SETUP
54 endif
56 $(eval $(host-autotools-package))
58 ifeq ($(BR2_CCACHE),y)
59 ccache-stats: host-ccache
60 $(Q)$(CCACHE) -s
62 ccache-options: host-ccache
63 ifeq ($(CCACHE_OPTIONS),)
64 $(Q)echo "Usage: make ccache-options CCACHE_OPTIONS=\"opts\""
65 $(Q)echo "where 'opts' corresponds to one or more valid ccache options" \
66 "(see ccache help text below)"
67 $(Q)echo
68 endif
69 $(Q)$(CCACHE) $(CCACHE_OPTIONS)
70 endif