1 #############################################################
3 # build ccache to make recompiles faster on the build system
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
12 CCACHE_TARGET_BINARY
:=usr
/bin
/ccache
14 $(DL_DIR
)/$(CCACHE_SOURCE
):
15 $(WGET
) -P
$(DL_DIR
) $(CCACHE_SITE
)/$(CCACHE_SOURCE
)
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
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
29 $(CCACHE_DIR1
)/.configured
: $(CCACHE_DIR1
)/.patched
30 mkdir
-p
$(CCACHE_DIR1
)
31 (cd
$(CCACHE_DIR1
); rm -rf config.cache
; \
33 $(CCACHE_DIR1
)/configure \
34 --target
=$(GNU_HOST_NAME
) \
35 --host
=$(GNU_HOST_NAME
) \
36 --build
=$(GNU_HOST_NAME
) \
39 touch
$(CCACHE_DIR1
)/.configured
41 $(CCACHE_DIR1
)/$(CCACHE_BINARY
): $(CCACHE_DIR1
)/.configured
42 $(MAKE
) CC
=$(HOSTCC
) -C
$(CCACHE_DIR1
)
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
++);
71 ifeq ($(GCC_2_95_TOOLCHAIN
),true
)
72 ccache
: gcc2_95
$(STAGING_DIR
)/$(CCACHE_TARGET_BINARY
)
74 ccache
: gcc3_3
$(STAGING_DIR
)/$(CCACHE_TARGET_BINARY
)
78 $(MAKE
) -C
$(CCACHE_DIR1
) uninstall
79 -$(MAKE
) -C
$(CCACHE_DIR1
) clean
87 #############################################################
89 # build ccache for use on the target system
91 #############################################################
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
97 $(CCACHE_DIR2
)/.patched
: $(CCACHE_DIR2
)/.unpacked
98 touch
$(CCACHE_DIR2
)/.patched
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
) \
111 --sbindir
=/usr
/sbin \
112 --libexecdir
=/usr
/lib \
114 --datadir=/usr
/share \
115 --localstatedir
=/var \
117 --infodir=/usr
/info \
120 touch
$(CCACHE_DIR2
)/.configured
122 $(CCACHE_DIR2
)/$(CCACHE_BINARY
): $(CCACHE_DIR2
)/.configured
123 $(MAKE
) -C
$(CCACHE_DIR2
)
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
++;)
137 ccache_target
: uclibc
$(TARGET_DIR
)/$(CCACHE_TARGET_BINARY
)
139 ccache_target-sources
: $(DL_DIR
)/$(CCACHE_SOURCE
)
142 $(MAKE
) DESTDIR
=$(TARGET_DIR
) -C
$(CCACHE_DIR2
) uninstall
143 -$(MAKE
) -C
$(CCACHE_DIR2
) clean
145 ccache_target-dirclean
:
146 rm -rf
$(CCACHE_DIR2
)
This page took 0.047157 seconds and 5 git commands to generate.