bump version to 2.8
[openwrt.git] / obsolete-buildroot / make / ccache.mk
1 #############################################################
2 #
3 # build ccache to make recompiles faster on the build system
4 #
5 #############################################################
6 CCACHE_SITE:=http://ccache.samba.org/ftp/ccache
7 CCACHE_SOURCE:=ccache-2.3.tar.gz
8 CCACHE_DIR1:=$(TOOL_BUILD_DIR)/ccache-2.3
9 CCACHE_DIR2:=$(BUILD_DIR)/ccache-2.3
10 CCACHE_CAT:=zcat
11 CCACHE_BINARY:=ccache
12 CCACHE_TARGET_BINARY:=usr/bin/ccache
13
14 $(DL_DIR)/$(CCACHE_SOURCE):
15 $(WGET) -P $(DL_DIR) $(CCACHE_SITE)/$(CCACHE_SOURCE)
16
17 $(CCACHE_DIR1)/.unpacked: $(DL_DIR)/$(CCACHE_SOURCE)
18 $(CCACHE_CAT) $(DL_DIR)/$(CCACHE_SOURCE) | tar -C $(TOOL_BUILD_DIR) -xvf -
19 touch $(CCACHE_DIR1)/.unpacked
20
21 $(CCACHE_DIR1)/.patched: $(CCACHE_DIR1)/.unpacked
22 $(SED) "s,getenv(\"CCACHE_PATH\"),\"$(STAGING_DIR)/usr/bin\",g" \
23 $(CCACHE_DIR1)/execute.c
24 $(SED) "s,getenv(\"CCACHE_DIR\"),\"$(CCACHE_DIR1)/cache\",g" \
25 $(CCACHE_DIR1)/ccache.c
26 mkdir -p $(CCACHE_DIR1)/cache
27 touch $(CCACHE_DIR1)/.patched
28
29 $(CCACHE_DIR1)/.configured: $(CCACHE_DIR1)/.patched
30 mkdir -p $(CCACHE_DIR1)
31 (cd $(CCACHE_DIR1); rm -rf config.cache; \
32 CC=$(HOSTCC) \
33 $(CCACHE_DIR1)/configure \
34 --target=$(GNU_HOST_NAME) \
35 --host=$(GNU_HOST_NAME) \
36 --build=$(GNU_HOST_NAME) \
37 --prefix=/usr \
38 );
39 touch $(CCACHE_DIR1)/.configured
40
41 $(CCACHE_DIR1)/$(CCACHE_BINARY): $(CCACHE_DIR1)/.configured
42 $(MAKE) CC=$(HOSTCC) -C $(CCACHE_DIR1)
43
44 $(STAGING_DIR)/$(CCACHE_TARGET_BINARY): $(CCACHE_DIR1)/$(CCACHE_BINARY)
45 mkdir -p $(STAGING_DIR)/usr/bin;
46 mkdir -p $(TOOL_BUILD_DIR)/.ccache;
47 cp $(CCACHE_DIR1)/ccache $(STAGING_DIR)/usr/bin
48 (cd $(STAGING_DIR)/usr/bin; \
49 ln -fs $(OPTIMIZE_FOR_CPU)-linux-uclibc-gcc $(OPTIMIZE_FOR_CPU)-linux-gcc; \
50 ln -fs $(OPTIMIZE_FOR_CPU)-linux-uclibc-gcc $(OPTIMIZE_FOR_CPU)-linux-cc; \
51 ln -fs $(OPTIMIZE_FOR_CPU)-linux-uclibc-gcc $(OPTIMIZE_FOR_CPU)-linux-uclibc-cc);
52 [ -f $(STAGING_DIR)/bin/$(OPTIMIZE_FOR_CPU)-linux-uclibc-gcc ] && \
53 mv $(STAGING_DIR)/bin/$(OPTIMIZE_FOR_CPU)-linux-uclibc-gcc $(STAGING_DIR)/usr/bin/
54 (cd $(STAGING_DIR)/bin; \
55 ln -fs ../usr/bin/ccache $(OPTIMIZE_FOR_CPU)-linux-cc; \
56 ln -fs ../usr/bin/ccache $(OPTIMIZE_FOR_CPU)-linux-gcc; \
57 ln -fs ../usr/bin/ccache $(OPTIMIZE_FOR_CPU)-linux-uclibc-cc; \
58 ln -fs ../usr/bin/ccache $(OPTIMIZE_FOR_CPU)-linux-uclibc-gcc);
59 ifeq ($(INSTALL_LIBSTDCPP),true)
60 [ -f $(STAGING_DIR)/bin/$(OPTIMIZE_FOR_CPU)-linux-uclibc-c++ ] && \
61 mv $(STAGING_DIR)/bin/$(OPTIMIZE_FOR_CPU)-linux-uclibc-c++ $(STAGING_DIR)/usr/bin/
62 [ -f $(STAGING_DIR)/bin/$(OPTIMIZE_FOR_CPU)-linux-uclibc-g++ ] && \
63 mv $(STAGING_DIR)/bin/$(OPTIMIZE_FOR_CPU)-linux-uclibc-g++ $(STAGING_DIR)/usr/bin/
64 (cd $(STAGING_DIR)/bin; \
65 ln -fs ../usr/bin/ccache $(OPTIMIZE_FOR_CPU)-linux-c++; \
66 ln -fs ../usr/bin/ccache $(OPTIMIZE_FOR_CPU)-linux-g++;\
67 ln -fs ../usr/bin/ccache $(OPTIMIZE_FOR_CPU)-linux-uclibc-c++; \
68 ln -fs ../usr/bin/ccache $(OPTIMIZE_FOR_CPU)-linux-uclibc-g++);
69 endif
70
71 ifeq ($(GCC_2_95_TOOLCHAIN),true)
72 ccache: gcc2_95 $(STAGING_DIR)/$(CCACHE_TARGET_BINARY)
73 else
74 ccache: gcc3_3 $(STAGING_DIR)/$(CCACHE_TARGET_BINARY)
75 endif
76
77 ccache-clean:
78 $(MAKE) -C $(CCACHE_DIR1) uninstall
79 -$(MAKE) -C $(CCACHE_DIR1) clean
80
81 ccache-dirclean:
82 rm -rf $(CCACHE_DIR1)
83
84
85
86
87 #############################################################
88 #
89 # build ccache for use on the target system
90 #
91 #############################################################
92
93 $(CCACHE_DIR2)/.unpacked: $(DL_DIR)/$(CCACHE_SOURCE)
94 $(CCACHE_CAT) $(DL_DIR)/$(CCACHE_SOURCE) | tar -C $(BUILD_DIR) -xvf -
95 touch $(CCACHE_DIR2)/.unpacked
96
97 $(CCACHE_DIR2)/.patched: $(CCACHE_DIR2)/.unpacked
98 touch $(CCACHE_DIR2)/.patched
99
100 $(CCACHE_DIR2)/.configured: $(CCACHE_DIR2)/.patched
101 mkdir -p $(CCACHE_DIR2)
102 (cd $(CCACHE_DIR2); rm -rf config.cache; \
103 $(TARGET_CONFIGURE_OPTS) \
104 $(CCACHE_DIR2)/configure \
105 --target=$(GNU_TARGET_NAME) \
106 --host=$(GNU_TARGET_NAME) \
107 --build=$(GNU_HOST_NAME) \
108 --prefix=/usr \
109 --exec-prefix=/usr \
110 --bindir=/usr/bin \
111 --sbindir=/usr/sbin \
112 --libexecdir=/usr/lib \
113 --sysconfdir=/etc \
114 --datadir=/usr/share \
115 --localstatedir=/var \
116 --mandir=/usr/man \
117 --infodir=/usr/info \
118 $(DISABLE_NLS) \
119 );
120 touch $(CCACHE_DIR2)/.configured
121
122 $(CCACHE_DIR2)/$(CCACHE_BINARY): $(CCACHE_DIR2)/.configured
123 $(MAKE) -C $(CCACHE_DIR2)
124
125 $(TARGET_DIR)/$(CCACHE_TARGET_BINARY): $(CCACHE_DIR2)/$(CCACHE_BINARY)
126 $(MAKE) DESTDIR=$(TARGET_DIR) -C $(CCACHE_DIR2) install
127 rm -rf $(TARGET_DIR)/share/locale $(TARGET_DIR)/usr/info \
128 $(TARGET_DIR)/usr/man $(TARGET_DIR)/usr/share/doc
129 # put a bunch of symlinks into /bin, since that is earlier
130 # in the default PATH than /usr/bin where gcc lives
131 (cd $(TARGET_DIR)/bin; \
132 ln -fs /usr/bin/ccache cc; \
133 ln -fs /usr/bin/ccache gcc; \
134 ln -fs /usr/bin/ccache c++; \
135 ln -fs /usr/bin/ccache g++;)
136
137 ccache_target: uclibc $(TARGET_DIR)/$(CCACHE_TARGET_BINARY)
138
139 ccache_target-sources: $(DL_DIR)/$(CCACHE_SOURCE)
140
141 ccache_target-clean:
142 $(MAKE) DESTDIR=$(TARGET_DIR) -C $(CCACHE_DIR2) uninstall
143 -$(MAKE) -C $(CCACHE_DIR2) clean
144
145 ccache_target-dirclean:
146 rm -rf $(CCACHE_DIR2)
147
This page took 0.070322 seconds and 5 git commands to generate.