[tools] add ccache wrapper
[openwrt.git] / tools / ccache / Makefile
1
2 # Copyright (C) 2006-2012 OpenWrt.org
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6 #
7 include $(TOPDIR)/rules.mk
8 include $(INCLUDE_DIR)/target.mk
9
10 PKG_NAME:=ccache
11 PKG_VERSION:=3.1.7
12
13 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
14 PKG_SOURCE_URL:=http://samba.org/ftp/ccache/
15 PKG_MD5SUM:=80a698c22d0b06b19c88ac58e8d8b632
16 PKG_CAT:=zcat
17
18 include $(INCLUDE_DIR)/host-build.mk
19
20 define Host/Install/ccache
21         $(INSTALL_DIR) $(STAGING_DIR_HOST)/bin/
22         $(CP) ./files/* $(STAGING_DIR_HOST)/bin/
23 endef
24
25 ifneq ($(strip $(shell which ccache >/dev/null && echo found)),found)
26   define Host/Compile
27         $(MAKE) CC="$(HOSTCC_NOCACHE)" -C $(HOST_BUILD_DIR)
28   endef
29
30   define Host/Clean
31         -$(MAKE) -C $(HOST_BUILD_DIR) uninstall
32         $(call Host/Clean/Default)
33   endef
34   define Host/Install
35         $(call Host/Install/Default)
36         $(call Host/Install/ccache)
37   endef
38 else
39   define Host/Prepare
40   endef
41   define Host/Configure
42   endef
43   define Host/Compile
44   endef
45   define Host/Install
46         $(call Host/Install/ccache)
47   endef
48   define Host/Clean
49   endef
50   define Download
51   endef
52 endif
53
54 $(eval $(call HostBuild))