This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

[PATCH] Use move-if-change in libstdc++-v3


Hi!

mknumeric_limits does not use move-if-change, which has the bad effect that
libstdc++-v3 is recompiled uselessly again and again if mknumeric_limit is
for some reason run again.
I experienced this e.g. when building gcc3 rpm: we first do make bootstrap,
then make install with different prefix= so that it gets installed into a
separate subtree. limitsNUMERIC.cc was newer because mknumeric_limits was
run during during make install, which caused libstdc++ to be linked again,
thus libjava be linked again (and for libjava it caused make install to
fail, since libtool was not too happy to see libgcj.la linked to the new
prefixed path and compiled during --mode=relink.
Ok to commit?

2001-08-09  Jakub Jelinek  <jakub@redhat.com>

	* include/Makefile.am (std_limits.h): Use move-if-change.
	* include/Makefile.in: Rebuilt.
	* move-if-change: New.
	* mknumeric_limits: Use move-if-change.

--- libstdc++-v3/include/Makefile.am.jj	Thu Jul 26 09:52:20 2001
+++ libstdc++-v3/include/Makefile.am	Wed Aug  8 17:09:58 2001
@@ -399,7 +399,8 @@ ${target_builddir}/std_limits.h: ${targe
 	CC="$(CC) -I${glibcpp_builddir} -I${target_builddir}/.." \
 	${glibcpp_srcdir}/mknumeric_limits \
 	${glibcpp_builddir} ${glibcpp_srcdir} @GLIBCPP_IS_CROSS_COMPILING@ ;\
-	mv ${glibcpp_builddir}/include/bits/std_limits.h ${target_builddir}
+	$(SHELL) $(glibcpp_srcdir}/move-if-change \
+	  ${glibcpp_builddir}/include/bits/std_limits.h ${target_builddir}/std_limits.h
 
 glibcpp_thread_h = @glibcpp_thread_h@
 uppercase = [ABCDEFGHIJKLMNOPQRSTUVWXYZ_]
--- libstdc++-v3/include/Makefile.in.jj	Thu Jul 26 09:52:20 2001
+++ libstdc++-v3/include/Makefile.in	Wed Aug  8 17:10:42 2001
@@ -591,7 +591,8 @@ ${target_builddir}/std_limits.h: ${targe
 	CC="$(CC) -I${glibcpp_builddir} -I${target_builddir}/.." \
 	${glibcpp_srcdir}/mknumeric_limits \
 	${glibcpp_builddir} ${glibcpp_srcdir} @GLIBCPP_IS_CROSS_COMPILING@ ;\
-	mv ${glibcpp_builddir}/include/bits/std_limits.h ${target_builddir}
+	$(SHELL) ${glibcpp_srcdir}/move-if-change \
+	  ${glibcpp_builddir}/include/bits/std_limits.h ${target_builddir}/std_limits.h
 
 ${thread_builddir}/gthr.h:
 	sed -e '/^#/s/\(${uppercase}${uppercase}*\)/_GLIBCPP_\1/g' \
--- libstdc++-v3/move-if-change.jj	Wed Aug  8 17:02:21 2001
+++ libstdc++-v3/move-if-change	Wed Dec 16 21:57:26 1998
@@ -0,0 +1,17 @@
+#!/bin/sh
+# Like mv $1 $2, but if the files are the same, just delete $1.
+# Status is 0 if $2 is changed, 1 otherwise.
+if
+test -r $2
+then
+if
+cmp -s $1 $2
+then
+echo $2 is unchanged
+rm -f $1
+else
+mv -f $1 $2
+fi
+else
+mv -f $1 $2
+fi
--- libstdc++-v3/mknumeric_limits.jj	Tue Aug  7 11:21:35 2001
+++ libstdc++-v3/mknumeric_limits	Wed Aug  8 17:12:46 2001
@@ -29,9 +29,7 @@ fi
 OUT_H="$BUILD_DIR/include/bits/std_limits.h"
 OUT_C="$BUILD_DIR/src/limitsMEMBERS.cc"
 
-if [ -f $OUT_C ]; then
-    rm -f $OUT_H $OUT_C $OUT_H-t $OUT_C-t
-fi
+rm -f $OUT_H $OUT_H-t $OUT_C-t
 
 SRC_DIR=$2
 if [ ! -d "$SRC_DIR" ]; then
@@ -43,7 +41,8 @@ XCOMPILE=$3
 if [ $XCOMPILE -eq 1 ]; then
   echo "using default values for cross compiles"
   cp $SRC_DIR/include/bits/limits_generic.h $OUT_H
-  cp $SRC_DIR/src/limits_generic.cc $OUT_C
+  cp $SRC_DIR/src/limits_generic.cc $OUT_C-t
+  /bin/sh $SRC_DIR/move-if-change $OUT_C-t $OUT_C
   exit 0;
 fi   
 
@@ -172,11 +171,13 @@ echo "$CC -I$BUILD_DIR -fno-exceptions \
     -o "$BUILD_DIR/src/gen-num-limits" "$SRC_DIR/src/gen-num-limits.cc"
 } || {
   echo "gen-num-limits failed to build, exiting."
+  rm -f $OUT_C
   exit 1
 }
 
 "$BUILD_DIR/src/gen-num-limits" >> $OUT_H-t || {
   echo "gen-num-limits failed to execute, exiting."
+  rm -f $OUT_C
   exit 1
 }
 
@@ -269,5 +270,5 @@ cat <<EOF >> $OUT_C-t
 
 EOF
 
-mv $OUT_C-t $OUT_C
+/bin/sh $SRC_DIR/move-if-change $OUT_C-t $OUT_C
 mv $OUT_H-t $OUT_H

	Jakub


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]