ccache.mk 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. #############################################################
  2. #
  3. # ccache
  4. #
  5. #############################################################
  6. CCACHE_VERSION = 3.1.7
  7. CCACHE_SITE = http://samba.org/ftp/ccache
  8. CCACHE_SOURCE = ccache-$(CCACHE_VERSION).tar.bz2
  9. # When ccache is being built for the host, ccache is not yet
  10. # available, so we have to use the special C compiler without the
  11. # cache.
  12. HOST_CCACHE_CONF_ENV = \
  13. CC="$(HOSTCC_NOCCACHE)"
  14. # Force ccache to use its internal zlib. The problem is that without
  15. # this, ccache would link against the zlib of the build system, but we
  16. # might build and install a different version of zlib in $(O)/host
  17. # afterwards, which ccache will pick up. This might break if there is
  18. # a version mismatch. A solution would be to add host-zlib has a
  19. # dependency of ccache, but it would require tuning the zlib .mk file
  20. # to use HOSTCC_NOCCACHE as the compiler. Instead, we take the easy
  21. # path: tell ccache to use its internal copy of zlib, so that ccache
  22. # has zero dependency besides the C library.
  23. HOST_CCACHE_CONF_OPT += ccache_cv_zlib_1_2_3=no
  24. # We directly hardcode configuration into the binary, as it is much
  25. # easier to handle than passing an environment variable. Our
  26. # configuration is:
  27. # - the cache location
  28. # - the fact that ccache shouldn't use the compiler binary mtime to
  29. # - detect a change in the compiler, because in the context of
  30. # - Buildroot, that completely defeats the purpose of ccache. Of
  31. # - course, that leaves the user responsible for purging its cache
  32. # - when the compiler changes.
  33. define HOST_CCACHE_FIX_CCACHE_DIR
  34. sed -i 's,getenv("CCACHE_DIR"),"$(CCACHE_CACHE_DIR)",' $(@D)/ccache.c
  35. sed -i 's,getenv("CCACHE_COMPILERCHECK"),"none",' $(@D)/ccache.c
  36. endef
  37. HOST_CCACHE_POST_CONFIGURE_HOOKS += \
  38. HOST_CCACHE_FIX_CCACHE_DIR
  39. $(eval $(call AUTOTARGETS))
  40. $(eval $(call AUTOTARGETS,host))
  41. ifeq ($(BR2_CCACHE),y)
  42. ccache-stats: host-ccache
  43. $(Q)$(CCACHE) -s
  44. endif