(svn r10171) -Add: simple support for ccache (--with-ccache).
authorrubidium
Sat, 16 Jun 2007 21:57:30 +0000
changeset 7414 54c0982e17ab
parent 7413 eadff82c1b45
child 7415 36ea2aa930eb
(svn r10171) -Add: simple support for ccache (--with-ccache).
Makefile.lang.in
Makefile.src.in
config.lib
--- a/Makefile.lang.in	Sat Jun 16 12:03:36 2007 +0000
+++ b/Makefile.lang.in	Sat Jun 16 21:57:30 2007 +0000
@@ -75,7 +75,7 @@
 
 clean:
 	$(E) '$(STAGE) Cleaning up language files'
-	$(Q)rm -f strgen.o table/strings.h $(STRGEN) $(LANGS) $(LANGS:%=$(BIN_DIR)/lang/%) lang/english.* $(ENDIAN_TARGETS)
+	$(Q)rm -f strgen.o string.o table/strings.h $(STRGEN) $(LANGS) $(LANGS:%=$(BIN_DIR)/lang/%) lang/english.* $(ENDIAN_TARGETS)
 
 mrproper: clean
 
--- a/Makefile.src.in	Sat Jun 16 12:03:36 2007 +0000
+++ b/Makefile.src.in	Sat Jun 16 21:57:30 2007 +0000
@@ -292,7 +292,7 @@
 
 clean:
 	$(E) '$(STAGE) Cleaning up object files'
-	$(Q)rm -f $(DEPS) $(OBJS) $(TTD) $(TTD:%=$(BIN_DIR)/%) $(CONFIG_CACHE_COMPILER) $(CONFIG_CACHE_LINKER) $(CONFIG_CACHE_ENDIAN) $(CONFIG_CACHE_SOURCE) $(ENDIAN_TARGETS) rev.o
+	$(Q)rm -f $(DEPS) $(OBJS) $(TTD) $(TTD:%=$(BIN_DIR)/%) $(CONFIG_CACHE_COMPILER) $(CONFIG_CACHE_LINKER) $(CONFIG_CACHE_ENDIAN) $(CONFIG_CACHE_SOURCE) $(ENDIAN_TARGETS) rev.o rev.cpp
 
 mrproper: clean
 	$(Q)rm -f rev.cpp
--- a/config.lib	Sat Jun 16 12:03:36 2007 +0000
+++ b/config.lib	Sat Jun 16 21:57:30 2007 +0000
@@ -45,6 +45,7 @@
 	enable_osx_g5="0"
 	enable_unicode="1"
 	with_distcc="1"
+	with_ccache="1"
 	with_osx_sysroot="1"
 	with_application_bundle="1"
 	with_sdl="1"
@@ -62,7 +63,7 @@
 	with_fontconfig="1"
 	with_psp_config="1"
 
-	save_params_array="build host cc_build cc_host cxx_build cxx_host windres strip awk lipo os revision endian config_log prefix_dir binary_dir data_dir icon_dir personal_dir install_dir custom_lang_dir second_data_dir enable_install enable_debug enable_profiling enable_dedicated enable_network enable_static enable_translator enable_assert enable_strip with_distcc with_osx_sysroot enable_universal enable_osx_g5 enable_unicode with_application_bundle with_sdl with_cocoa with_zlib with_png with_makedepend with_direct_music with_sort with_iconv with_midi with_midi_arg with_libtimidity with_freetype with_fontconfig with_psp_config CC CXX CFLAGS LDFLAGS"
+	save_params_array="build host cc_build cc_host cxx_build cxx_host windres strip awk lipo os revision endian config_log prefix_dir binary_dir data_dir icon_dir personal_dir install_dir custom_lang_dir second_data_dir enable_install enable_debug enable_profiling enable_dedicated enable_network enable_static enable_translator enable_assert enable_strip with_distcc with_ccache with_osx_sysroot enable_universal enable_osx_g5 enable_unicode with_application_bundle with_sdl with_cocoa with_zlib with_png with_makedepend with_direct_music with_sort with_iconv with_midi with_midi_arg with_libtimidity with_freetype with_fontconfig with_psp_config CC CXX CFLAGS LDFLAGS"
 }
 
 detect_params() {
@@ -240,6 +241,10 @@
 			--with-distcc)                with_distcc="2";;
 			--with-distcc=*)              with_distcc="$optarg";;
 
+			--without-ccache)             with_ccache="0";;
+			--with-ccache)                with_ccache="2";;
+			--with-ccache=*)              with_ccache="$optarg";;
+
 			--without-osx-sysroot)        with_osx_sysroot="0";;
 			--with-osx-sysroot)           with_osx_sysroot="2";;
 			--with-osx-sysroot=*)         with_osx_sysroot="$optarg";;
@@ -546,6 +551,35 @@
 		log 1 "checking distcc... $distcc"
 	fi
 
+	if [ "$with_ccache" = "0" ]; then
+		log 1 "checking ccache... no"
+	elif [ "$with_ccache" = "1" ]; then
+		with_ccache="0"
+
+		log 1 "checking ccache... no (only used when forced)"
+	elif [ "$with_ccache" = "2" ]; then
+		ccache="ccache"
+	else
+		ccache="$with_ccache"
+	fi
+	if [ "$with_ccache" != "0" ]; then
+		res="`$ccache --version 2>/dev/null | head -n 1 | cut -b 0-6`"
+		if [ "$res" != "ccache" ]; then
+			ccache=""
+			log 1 "checking ccache... no"
+			if [ "$with_ccache" = "2" ]; then
+				log 1 "configure: error: no ccache detected, but was forced to be used"
+				exit 1
+			fi
+			if [ "$with_ccache" != "1" ]; then
+				log 1 "configure: error: '$with_ccache' doesn't seem a ccache to me"
+				exit 1
+			fi
+		fi
+
+		log 1 "checking ccache... $ccache"
+	fi
+
 	if [ "$os" != "OSX" ] && [ "$with_osx_sysroot" != "0" ]; then
 		if [ "$with_osx_sysroot" = "1" ]; then
 			with_osx_sysroot="0"
@@ -1030,6 +1064,11 @@
 		log 1 " NOTICE: remind yourself to use 'make -jN' to make use of distcc"
 		log 1 ""
 	fi
+
+	if [ "$with_ccache" != "0" ]; then
+		cc_host="$ccache $cc_host"
+		cxx_host="$ccache $cxx_host"
+	fi
 }
 
 check_compiler() {