2003-10-16 03:05:02 +02:00
|
|
|
#############################################################
|
|
|
|
#
|
|
|
|
# build ccache to make recompiles faster on the build system
|
|
|
|
#
|
|
|
|
#############################################################
|
2005-06-24 00:09:12 +02:00
|
|
|
CCACHE_VER:=2.4
|
2006-04-14 21:33:48 +02:00
|
|
|
CCACHE_SITE:=http://samba.org/ftp/ccache
|
2004-10-08 17:46:00 +02:00
|
|
|
CCACHE_SOURCE:=ccache-$(CCACHE_VER).tar.gz
|
2009-09-23 01:30:00 +02:00
|
|
|
CCACHE_DIR1:=$(TOOLCHAIN_DIR)/ccache-$(CCACHE_VER)
|
2004-10-08 17:46:00 +02:00
|
|
|
CCACHE_DIR2:=$(BUILD_DIR)/ccache-$(CCACHE_VER)
|
2006-10-01 17:17:52 +02:00
|
|
|
CCACHE_CAT:=$(ZCAT)
|
2003-10-16 03:05:02 +02:00
|
|
|
CCACHE_BINARY:=ccache
|
|
|
|
CCACHE_TARGET_BINARY:=usr/bin/ccache
|
|
|
|
|
|
|
|
$(DL_DIR)/$(CCACHE_SOURCE):
|
2009-01-16 12:47:05 +01:00
|
|
|
$(call DOWNLOAD,$(CCACHE_SITE),$(CCACHE_SOURCE))
|
2003-10-16 03:05:02 +02:00
|
|
|
|
2004-04-09 11:36:26 +02:00
|
|
|
$(CCACHE_DIR1)/.unpacked: $(DL_DIR)/$(CCACHE_SOURCE)
|
2009-09-23 01:30:00 +02:00
|
|
|
$(CCACHE_CAT) $(DL_DIR)/$(CCACHE_SOURCE) | tar -C $(TOOLCHAIN_DIR) $(TAR_OPTIONS) -
|
2007-06-23 15:49:33 +02:00
|
|
|
touch $@
|
2003-10-16 03:05:02 +02:00
|
|
|
|
2004-04-09 11:36:26 +02:00
|
|
|
$(CCACHE_DIR1)/.patched: $(CCACHE_DIR1)/.unpacked
|
2004-09-03 02:49:43 +02:00
|
|
|
# WARNING - this will break if the toolchain is moved.
|
|
|
|
# Should probably patch things to use a relative path.
|
2007-06-23 15:49:33 +02:00
|
|
|
$(SED) "s,getenv(\"CCACHE_PATH\"),\"$(STAGING_DIR)/usr/bin-ccache\",g" \
|
2004-04-09 11:36:26 +02:00
|
|
|
$(CCACHE_DIR1)/execute.c
|
2008-10-06 21:14:41 +02:00
|
|
|
# WARNING - this will break if the toolchain build dir is deleted
|
|
|
|
# when using the default cache dir location.
|
|
|
|
$(SED) "s,getenv(\"CCACHE_DIR\"),\"$(BR2_CCACHE_DIR)\",g" \
|
2004-04-09 11:36:26 +02:00
|
|
|
$(CCACHE_DIR1)/ccache.c
|
2004-04-16 03:39:25 +02:00
|
|
|
mkdir -p $(CCACHE_DIR1)/cache
|
2008-12-05 16:27:26 +01:00
|
|
|
$(CONFIG_UPDATE) $(@D)
|
2007-06-23 15:49:33 +02:00
|
|
|
touch $@
|
2003-10-16 03:05:02 +02:00
|
|
|
|
2004-04-09 11:36:26 +02:00
|
|
|
$(CCACHE_DIR1)/.configured: $(CCACHE_DIR1)/.patched
|
|
|
|
mkdir -p $(CCACHE_DIR1)
|
|
|
|
(cd $(CCACHE_DIR1); rm -rf config.cache; \
|
2006-03-10 09:30:15 +01:00
|
|
|
CC="$(HOSTCC)" \
|
2009-10-01 21:24:42 +02:00
|
|
|
$(CCACHE_DIR1)/configure $(QUIET) \
|
2004-04-09 11:36:26 +02:00
|
|
|
--target=$(GNU_HOST_NAME) \
|
|
|
|
--host=$(GNU_HOST_NAME) \
|
|
|
|
--build=$(GNU_HOST_NAME) \
|
|
|
|
--prefix=/usr \
|
2008-10-26 10:14:02 +01:00
|
|
|
$(QUIET) \
|
2007-08-21 21:20:18 +02:00
|
|
|
)
|
2007-06-23 15:49:33 +02:00
|
|
|
touch $@
|
2004-04-09 11:36:26 +02:00
|
|
|
|
|
|
|
$(CCACHE_DIR1)/$(CCACHE_BINARY): $(CCACHE_DIR1)/.configured
|
2006-03-10 09:30:15 +01:00
|
|
|
$(MAKE) CC="$(HOSTCC)" -C $(CCACHE_DIR1)
|
2004-04-09 11:36:26 +02:00
|
|
|
|
|
|
|
$(STAGING_DIR)/$(CCACHE_TARGET_BINARY): $(CCACHE_DIR1)/$(CCACHE_BINARY)
|
2007-06-22 21:01:48 +02:00
|
|
|
mkdir -p $(STAGING_DIR)/usr/bin
|
2004-04-09 11:36:26 +02:00
|
|
|
cp $(CCACHE_DIR1)/ccache $(STAGING_DIR)/usr/bin
|
2004-09-03 02:49:43 +02:00
|
|
|
# Keep the actual toolchain binaries in a directory at the same level.
|
|
|
|
# Otherwise, relative paths for include dirs break.
|
2007-08-21 21:20:18 +02:00
|
|
|
mkdir -p $(STAGING_DIR)/usr/bin-ccache
|
2007-06-23 15:49:33 +02:00
|
|
|
(cd $(STAGING_DIR)/usr/bin-ccache; \
|
2004-09-10 20:58:11 +02:00
|
|
|
ln -fs $(REAL_GNU_TARGET_NAME)-gcc $(GNU_TARGET_NAME)-gcc; \
|
|
|
|
ln -fs $(REAL_GNU_TARGET_NAME)-gcc $(GNU_TARGET_NAME)-cc; \
|
2007-08-28 23:42:44 +02:00
|
|
|
ln -fs $(REAL_GNU_TARGET_NAME)-gcc $(REAL_GNU_TARGET_NAME)-cc; \
|
|
|
|
)
|
2007-06-22 21:01:48 +02:00
|
|
|
[ -f $(STAGING_DIR)/usr/bin/$(REAL_GNU_TARGET_NAME)-gcc ] && \
|
2007-08-28 23:42:44 +02:00
|
|
|
mv $(STAGING_DIR)/usr/bin/$(REAL_GNU_TARGET_NAME)-gcc \
|
|
|
|
$(STAGING_DIR)/usr/bin-ccache/
|
2007-06-22 21:01:48 +02:00
|
|
|
(cd $(STAGING_DIR)/usr/bin; \
|
|
|
|
ln -fs ccache $(GNU_TARGET_NAME)-cc; \
|
|
|
|
ln -fs ccache $(GNU_TARGET_NAME)-gcc; \
|
|
|
|
ln -fs ccache $(REAL_GNU_TARGET_NAME)-cc; \
|
2007-08-28 23:42:44 +02:00
|
|
|
ln -fs ccache $(REAL_GNU_TARGET_NAME)-gcc; \
|
|
|
|
)
|
2004-10-19 21:20:38 +02:00
|
|
|
ifeq ($(BR2_INSTALL_LIBSTDCPP),y)
|
2007-06-22 21:01:48 +02:00
|
|
|
[ -f $(STAGING_DIR)/usr/bin/$(REAL_GNU_TARGET_NAME)-c++ ] && \
|
2007-08-28 23:42:44 +02:00
|
|
|
mv $(STAGING_DIR)/usr/bin/$(REAL_GNU_TARGET_NAME)-c++ \
|
|
|
|
$(STAGING_DIR)/usr/bin-ccache/
|
2007-06-22 21:01:48 +02:00
|
|
|
[ -f $(STAGING_DIR)/usr/bin/$(REAL_GNU_TARGET_NAME)-g++ ] && \
|
2007-08-28 23:42:44 +02:00
|
|
|
mv $(STAGING_DIR)/usr/bin/$(REAL_GNU_TARGET_NAME)-g++ \
|
|
|
|
$(STAGING_DIR)/usr/bin-ccache/
|
2007-06-22 21:01:48 +02:00
|
|
|
(cd $(STAGING_DIR)/usr/bin; \
|
|
|
|
ln -fs ccache $(GNU_TARGET_NAME)-c++; \
|
|
|
|
ln -fs ccache $(GNU_TARGET_NAME)-g++;\
|
|
|
|
ln -fs ccache $(REAL_GNU_TARGET_NAME)-c++; \
|
2007-08-28 23:42:44 +02:00
|
|
|
ln -fs ccache $(REAL_GNU_TARGET_NAME)-g++; \
|
|
|
|
)
|
2007-06-23 15:49:33 +02:00
|
|
|
(cd $(STAGING_DIR)/usr/bin-ccache; \
|
2004-09-10 20:58:11 +02:00
|
|
|
ln -fs $(REAL_GNU_TARGET_NAME)-c++ $(GNU_TARGET_NAME)-c++; \
|
2007-08-28 23:42:44 +02:00
|
|
|
ln -fs $(REAL_GNU_TARGET_NAME)-g++ $(GNU_TARGET_NAME)-g++; \
|
|
|
|
)
|
2004-04-13 22:47:35 +02:00
|
|
|
endif
|
2004-04-09 11:36:26 +02:00
|
|
|
|
2004-09-03 02:49:43 +02:00
|
|
|
ccache: gcc $(STAGING_DIR)/$(CCACHE_TARGET_BINARY)
|
2004-04-09 11:36:26 +02:00
|
|
|
|
|
|
|
ccache-clean:
|
2007-08-22 14:35:41 +02:00
|
|
|
rm -rf $(STAGING_DIR)/usr/bin/$(GNU_TARGET_NAME)-cc
|
|
|
|
rm -rf $(STAGING_DIR)/usr/bin/$(GNU_TARGET_NAME)-gcc
|
|
|
|
rm -rf $(STAGING_DIR)/usr/bin/$(REAL_GNU_TARGET_NAME)-cc
|
|
|
|
rm -rf $(STAGING_DIR)/usr/bin/$(REAL_GNU_TARGET_NAME)-gcc
|
2007-08-22 11:56:41 +02:00
|
|
|
if [ -f $(STAGING_DIR)/usr/bin-ccache/$(REAL_GNU_TARGET_NAME)-gcc ]; then \
|
2007-08-28 23:42:44 +02:00
|
|
|
mv $(STAGING_DIR)/usr/bin-ccache/$(REAL_GNU_TARGET_NAME)-gcc \
|
|
|
|
$(STAGING_DIR)/usr/bin/; \
|
2007-06-22 21:01:48 +02:00
|
|
|
(cd $(STAGING_DIR)/usr/bin; \
|
2007-08-28 23:42:44 +02:00
|
|
|
ln -fs $(REAL_GNU_TARGET_NAME)-gcc \
|
|
|
|
$(REAL_GNU_TARGET_NAME)-cc; \
|
|
|
|
ln -fs $(REAL_GNU_TARGET_NAME)-gcc \
|
|
|
|
$(GNU_TARGET_NAME)-cc; \
|
|
|
|
ln -fs $(REAL_GNU_TARGET_NAME)-gcc \
|
|
|
|
$(GNU_TARGET_NAME)-gcc; \
|
|
|
|
); \
|
2007-08-21 21:20:18 +02:00
|
|
|
fi
|
2007-08-22 11:56:41 +02:00
|
|
|
if [ -f $(STAGING_DIR)/usr/bin-ccache/$(REAL_GNU_TARGET_NAME)-c++ ]; then \
|
2007-06-22 21:01:48 +02:00
|
|
|
rm -f $(STAGING_DIR)/usr/bin/$(REAL_GNU_TARGET_NAME)-c++; \
|
2007-08-28 23:42:44 +02:00
|
|
|
mv $(STAGING_DIR)/usr/bin-ccache/$(REAL_GNU_TARGET_NAME)-c++ \
|
|
|
|
$(STAGING_DIR)/usr/bin/; \
|
2007-08-21 21:20:18 +02:00
|
|
|
fi
|
2007-08-22 11:56:41 +02:00
|
|
|
if [ -f $(STAGING_DIR)/usr/bin-ccache/$(REAL_GNU_TARGET_NAME)-g++ ]; then \
|
2007-06-22 21:01:48 +02:00
|
|
|
rm -f $(STAGING_DIR)/usr/bin/$(REAL_GNU_TARGET_NAME)-g++; \
|
2007-08-28 23:42:44 +02:00
|
|
|
mv $(STAGING_DIR)/usr/bin-ccache/$(REAL_GNU_TARGET_NAME)-g++ \
|
|
|
|
$(STAGING_DIR)/usr/bin/; \
|
2007-08-21 21:20:18 +02:00
|
|
|
fi
|
2007-08-22 14:35:41 +02:00
|
|
|
rm -rf $(STAGING_DIR)/usr/bin-ccache/*
|
2007-06-22 21:01:48 +02:00
|
|
|
(cd $(STAGING_DIR)/usr/bin; \
|
2007-02-03 01:52:39 +01:00
|
|
|
ln -fs $(REAL_GNU_TARGET_NAME)-g++ $(GNU_TARGET_NAME)-c++; \
|
2007-08-28 23:42:44 +02:00
|
|
|
ln -fs $(REAL_GNU_TARGET_NAME)-g++ $(GNU_TARGET_NAME)-g++; \
|
|
|
|
ln -fs $(REAL_GNU_TARGET_NAME)-g++ $(REAL_GNU_TARGET_NAME)-c++; \
|
|
|
|
)
|
2004-04-09 11:36:26 +02:00
|
|
|
-$(MAKE) -C $(CCACHE_DIR1) clean
|
|
|
|
|
|
|
|
ccache-dirclean:
|
|
|
|
rm -rf $(CCACHE_DIR1)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#############################################################
|
|
|
|
#
|
|
|
|
# build ccache for use on the target system
|
|
|
|
#
|
|
|
|
#############################################################
|
|
|
|
|
|
|
|
$(CCACHE_DIR2)/.unpacked: $(DL_DIR)/$(CCACHE_SOURCE)
|
2004-10-11 16:01:07 +02:00
|
|
|
$(CCACHE_CAT) $(DL_DIR)/$(CCACHE_SOURCE) | tar -C $(BUILD_DIR) $(TAR_OPTIONS) -
|
2007-06-23 15:49:33 +02:00
|
|
|
touch $@
|
2004-04-09 11:36:26 +02:00
|
|
|
|
|
|
|
$(CCACHE_DIR2)/.patched: $(CCACHE_DIR2)/.unpacked
|
2007-06-23 15:49:33 +02:00
|
|
|
touch $@
|
2004-04-09 11:36:26 +02:00
|
|
|
|
|
|
|
$(CCACHE_DIR2)/.configured: $(CCACHE_DIR2)/.patched
|
2003-10-16 03:05:02 +02:00
|
|
|
mkdir -p $(CCACHE_DIR2)
|
|
|
|
(cd $(CCACHE_DIR2); rm -rf config.cache; \
|
|
|
|
$(TARGET_CONFIGURE_OPTS) \
|
2009-10-01 21:24:42 +02:00
|
|
|
$(CCACHE_DIR2)/configure $(QUIET) \
|
2003-10-16 03:05:02 +02:00
|
|
|
--target=$(GNU_TARGET_NAME) \
|
|
|
|
--host=$(GNU_TARGET_NAME) \
|
|
|
|
--build=$(GNU_HOST_NAME) \
|
|
|
|
--prefix=/usr \
|
|
|
|
--sysconfdir=/etc \
|
|
|
|
$(DISABLE_NLS) \
|
2008-10-26 10:14:02 +01:00
|
|
|
$(QUIET) \
|
2007-08-21 21:20:18 +02:00
|
|
|
)
|
2007-06-23 15:49:33 +02:00
|
|
|
touch $@
|
2003-10-16 03:05:02 +02:00
|
|
|
|
|
|
|
$(CCACHE_DIR2)/$(CCACHE_BINARY): $(CCACHE_DIR2)/.configured
|
2004-12-24 07:39:42 +01:00
|
|
|
$(MAKE) -C $(CCACHE_DIR2) CFLAGS="$(TARGET_CFLAGS)"
|
2003-10-16 03:05:02 +02:00
|
|
|
|
|
|
|
$(TARGET_DIR)/$(CCACHE_TARGET_BINARY): $(CCACHE_DIR2)/$(CCACHE_BINARY)
|
|
|
|
$(MAKE) DESTDIR=$(TARGET_DIR) -C $(CCACHE_DIR2) install
|
|
|
|
# put a bunch of symlinks into /bin, since that is earlier
|
|
|
|
# in the default PATH than /usr/bin where gcc lives
|
|
|
|
(cd $(TARGET_DIR)/bin; \
|
2004-09-03 02:49:43 +02:00
|
|
|
ln -fs /usr/bin/ccache cc; \
|
|
|
|
ln -fs /usr/bin/ccache gcc; \
|
|
|
|
ln -fs /usr/bin/ccache c++; \
|
2007-08-28 23:42:44 +02:00
|
|
|
ln -fs /usr/bin/ccache g++; \
|
|
|
|
)
|
2003-10-16 03:05:02 +02:00
|
|
|
|
|
|
|
ccache_target: uclibc $(TARGET_DIR)/$(CCACHE_TARGET_BINARY)
|
|
|
|
|
2003-11-12 10:31:12 +01:00
|
|
|
ccache_target-sources: $(DL_DIR)/$(CCACHE_SOURCE)
|
|
|
|
|
2003-10-16 03:05:02 +02:00
|
|
|
ccache_target-clean:
|
2008-08-04 21:08:01 +02:00
|
|
|
rm -f $(TARGET_DIR)/$(CCACHE_TARGET_BINARY) \
|
|
|
|
$(addprefix $(TARGET_DIR)/bin/,cc gcc c++ g++)
|
2003-10-16 03:05:02 +02:00
|
|
|
-$(MAKE) -C $(CCACHE_DIR2) clean
|
|
|
|
|
|
|
|
ccache_target-dirclean:
|
|
|
|
rm -rf $(CCACHE_DIR2)
|
2005-02-10 04:06:39 +01:00
|
|
|
#############################################################
|
|
|
|
#
|
|
|
|
# Toplevel Makefile options
|
|
|
|
#
|
|
|
|
#############################################################
|
2008-12-08 09:15:42 +01:00
|
|
|
ifeq ($(BR2_CCACHE),y)
|
2005-02-10 04:06:39 +01:00
|
|
|
TARGETS+=ccache
|
|
|
|
endif
|
2008-12-08 09:15:42 +01:00
|
|
|
ifeq ($(BR2_PACKAGE_CCACHE_TARGET),y)
|
2005-02-10 04:06:39 +01:00
|
|
|
TARGETS+=ccache_target
|
|
|
|
endif
|