1 #############################################################
3 # build ccache to make recompiles faster on the build system
5 #############################################################
7 CCACHE_SITE
:=http
://ccache.samba.org
/ftp
/ccache
8 CCACHE_SOURCE
:=ccache-
$(CCACHE_VER
).
tar.gz
9 CCACHE_DIR1
:=$(TOOL_BUILD_DIR
)/ccache-
$(CCACHE_VER
)
10 CCACHE_DIR2
:=$(BUILD_DIR
)/ccache-
$(CCACHE_VER
)
13 CCACHE_TARGET_BINARY
:=usr
/bin
/ccache
15 $(DL_DIR
)/$(CCACHE_SOURCE
):
16 $(WGET
) -P
$(DL_DIR
) $(CCACHE_SITE
)/$(CCACHE_SOURCE
)
18 $(CCACHE_DIR1
)/.unpacked
: $(DL_DIR
)/$(CCACHE_SOURCE
)
19 $(CCACHE_CAT
) $(DL_DIR
)/$(CCACHE_SOURCE
) |
tar -C
$(TOOL_BUILD_DIR
) $(TAR_OPTIONS
) -
20 touch
$(CCACHE_DIR1
)/.unpacked
22 $(CCACHE_DIR1
)/.patched
: $(CCACHE_DIR1
)/.unpacked
23 # WARNING - this will break if the toolchain is moved.
24 # Should probably patch things to use a relative path.
25 $(SED
) "s,getenv(\"CCACHE_PATH\"),\"$(STAGING_DIR)/bin-ccache\",g" \
26 $(CCACHE_DIR1
)/execute.c
27 # WARNING - this will break if the toolchain build dir is deleted.
28 $(SED
) "s,getenv(\"CCACHE_DIR\"),\"$(CCACHE_DIR1)/cache\",g" \
29 $(CCACHE_DIR1
)/ccache.c
30 mkdir
-p
$(CCACHE_DIR1
)/cache
31 touch
$(CCACHE_DIR1
)/.patched
33 $(CCACHE_DIR1
)/.configured
: $(CCACHE_DIR1
)/.patched
34 mkdir
-p
$(CCACHE_DIR1
)
35 (cd
$(CCACHE_DIR1
); rm -rf config.cache
; \
37 $(CCACHE_DIR1
)/configure \
38 --target
=$(GNU_HOST_NAME
) \
39 --host
=$(GNU_HOST_NAME
) \
40 --build
=$(GNU_HOST_NAME
) \
43 touch
$(CCACHE_DIR1
)/.configured
45 $(CCACHE_DIR1
)/$(CCACHE_BINARY
): $(CCACHE_DIR1
)/.configured
46 $(MAKE
) CC
=$(HOSTCC
) -C
$(CCACHE_DIR1
)
48 $(STAGING_DIR
)/$(CCACHE_TARGET_BINARY
): $(CCACHE_DIR1
)/$(CCACHE_BINARY
)
49 mkdir
-p
$(STAGING_DIR
)/usr
/bin
;
50 cp
$(CCACHE_DIR1
)/ccache
$(STAGING_DIR
)/usr
/bin
51 # Keep the actual toolchain binaries in a directory at the same level.
52 # Otherwise, relative paths for include dirs break.
53 mkdir
-p
$(STAGING_DIR
)/bin-ccache
;
54 (cd
$(STAGING_DIR
)/bin-ccache
; \
55 ln
-fs
$(REAL_GNU_TARGET_NAME
)-gcc
$(GNU_TARGET_NAME
)-gcc
; \
56 ln
-fs
$(REAL_GNU_TARGET_NAME
)-gcc
$(GNU_TARGET_NAME
)-cc; \
57 ln
-fs
$(REAL_GNU_TARGET_NAME
)-gcc
$(REAL_GNU_TARGET_NAME
)-cc);
58 [ -f
$(STAGING_DIR
)/bin
/$(REAL_GNU_TARGET_NAME
)-gcc
] && \
59 mv
$(STAGING_DIR
)/bin
/$(REAL_GNU_TARGET_NAME
)-gcc
$(STAGING_DIR
)/bin-ccache
/
60 (cd
$(STAGING_DIR
)/bin
; \
61 ln
-fs ..
/usr
/bin
/ccache
$(GNU_TARGET_NAME
)-cc; \
62 ln
-fs ..
/usr
/bin
/ccache
$(GNU_TARGET_NAME
)-gcc
; \
63 ln
-fs ..
/usr
/bin
/ccache
$(REAL_GNU_TARGET_NAME
)-cc; \
64 ln
-fs ..
/usr
/bin
/ccache
$(REAL_GNU_TARGET_NAME
)-gcc
);
65 ifeq ($(BR2_INSTALL_LIBSTDCPP
),y
)
66 [ -f
$(STAGING_DIR
)/bin
/$(REAL_GNU_TARGET_NAME
)-c
++ ] && \
67 mv
$(STAGING_DIR
)/bin
/$(REAL_GNU_TARGET_NAME
)-c
++ $(STAGING_DIR
)/bin-ccache
/
68 [ -f
$(STAGING_DIR
)/bin
/$(REAL_GNU_TARGET_NAME
)-g
++ ] && \
69 mv
$(STAGING_DIR
)/bin
/$(REAL_GNU_TARGET_NAME
)-g
++ $(STAGING_DIR
)/bin-ccache
/
70 (cd
$(STAGING_DIR
)/bin
; \
71 ln
-fs ..
/usr
/bin
/ccache
$(GNU_TARGET_NAME
)-c
++; \
72 ln
-fs ..
/usr
/bin
/ccache
$(GNU_TARGET_NAME
)-g
++;\
73 ln
-fs ..
/usr
/bin
/ccache
$(REAL_GNU_TARGET_NAME
)-c
++; \
74 ln
-fs ..
/usr
/bin
/ccache
$(REAL_GNU_TARGET_NAME
)-g
++);
75 (cd
$(STAGING_DIR
)/bin-ccache
; \
76 ln
-fs
$(REAL_GNU_TARGET_NAME
)-c
++ $(GNU_TARGET_NAME
)-c
++; \
77 ln
-fs
$(REAL_GNU_TARGET_NAME
)-g
++ $(GNU_TARGET_NAME
)-g
++);
80 ccache
: gcc
$(STAGING_DIR
)/$(CCACHE_TARGET_BINARY
)
83 $(MAKE
) -C
$(CCACHE_DIR1
) uninstall
84 -$(MAKE
) -C
$(CCACHE_DIR1
) clean
92 #############################################################
94 # build ccache for use on the target system
96 #############################################################
98 $(CCACHE_DIR2
)/.unpacked
: $(DL_DIR
)/$(CCACHE_SOURCE
)
99 $(CCACHE_CAT
) $(DL_DIR
)/$(CCACHE_SOURCE
) |
tar -C
$(BUILD_DIR
) $(TAR_OPTIONS
) -
100 touch
$(CCACHE_DIR2
)/.unpacked
102 $(CCACHE_DIR2
)/.patched
: $(CCACHE_DIR2
)/.unpacked
103 touch
$(CCACHE_DIR2
)/.patched
105 $(CCACHE_DIR2
)/.configured
: $(CCACHE_DIR2
)/.patched
106 mkdir
-p
$(CCACHE_DIR2
)
107 (cd
$(CCACHE_DIR2
); rm -rf config.cache
; \
108 $(TARGET_CONFIGURE_OPTS
) \
109 $(CCACHE_DIR2
)/configure \
110 --target
=$(GNU_TARGET_NAME
) \
111 --host
=$(GNU_TARGET_NAME
) \
112 --build
=$(GNU_HOST_NAME
) \
116 --sbindir
=/usr
/sbin \
117 --libexecdir
=/usr
/lib \
119 --datadir=/usr
/share \
120 --localstatedir
=/var \
122 --infodir=/usr
/info \
125 touch
$(CCACHE_DIR2
)/.configured
127 $(CCACHE_DIR2
)/$(CCACHE_BINARY
): $(CCACHE_DIR2
)/.configured
128 $(MAKE
) -C
$(CCACHE_DIR2
) CFLAGS
="$(TARGET_CFLAGS)"
130 $(TARGET_DIR
)/$(CCACHE_TARGET_BINARY
): $(CCACHE_DIR2
)/$(CCACHE_BINARY
)
131 $(MAKE
) DESTDIR
=$(TARGET_DIR
) -C
$(CCACHE_DIR2
) install
132 rm -rf
$(TARGET_DIR
)/share
/locale
$(TARGET_DIR
)/usr
/info \
133 $(TARGET_DIR
)/usr
/man
$(TARGET_DIR
)/usr
/share
/doc
134 # put a bunch of symlinks into /bin, since that is earlier
135 # in the default PATH than /usr/bin where gcc lives
136 (cd
$(TARGET_DIR
)/bin
; \
137 ln
-fs
/usr
/bin
/ccache
cc; \
138 ln
-fs
/usr
/bin
/ccache gcc
; \
139 ln
-fs
/usr
/bin
/ccache c
++; \
140 ln
-fs
/usr
/bin
/ccache g
++;)
142 ccache_target
: uclibc
$(TARGET_DIR
)/$(CCACHE_TARGET_BINARY
)
144 ccache_target-sources
: $(DL_DIR
)/$(CCACHE_SOURCE
)
147 rm -f
$(TARGET_DIR
)/$(CCACHE_TARGET_BINARY
)
148 -$(MAKE
) -C
$(CCACHE_DIR2
) clean
150 ccache_target-toolclean
:
151 rm -rf
$(CCACHE_DIR2
)
This page took 0.046969 seconds and 5 git commands to generate.