This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: gcc_update bug
On May 14, 2001, Alexandre Oliva <aoliva@redhat.com> wrote:
> How about this (untested):
Tested now. It fails. Here's a new version that works for me. Ok to
install in mainline and branch?
Index: contrib/ChangeLog
from Alexandre Oliva <aoliva@redhat.com>
* gcc_update (touch_files): Use a Makefile to touch files.
Index: contrib/gcc_update
===================================================================
RCS file: /cvs/gcc/egcs/contrib/gcc_update,v
retrieving revision 1.21
diff -u -p -d -r1.21 gcc_update
--- contrib/gcc_update 2001/01/13 21:17:07 1.21
+++ contrib/gcc_update 2001/05/14 04:04:56
@@ -98,30 +98,27 @@ EOF
}
-# This function checks whether its first argument is newer than all
-# the other arguments. It returns success (0) otherwise.
-is_out_of_date () {
- test `ls -1dt ${1+"$@"} | sed 1q` != "$1"
-}
-
-
# This function touches generated files such that the ``end'' user does
# not have to rebuild them.
touch_files () {
- files_and_dependencies | while read f deps; do
- if test -f $f && is_out_of_date "$f" $deps; then
- echo Touching "$f"...
- touch $f
- if is_out_of_date "$f" $deps; then
- # Hmm, it may have got the same timestamp as one of
- # its touched dependencies. Wait a second and retry.
- sleep 1
- echo Touching "$f" once more...
- touch $f
- fi
- fi
- done
+ rm -f Makefile.$$
+ echo 'all: \' > Makefile.$$
+ files_and_dependencies | sed 's, .*, \\,' >> Makefile.$$
+ echo '; @true' >> Makefile.$$
+ files_and_dependencies | sed 's, ,: ,' >> Makefile.$$
+ files_and_dependencies | sed 's, .*, \\,' >> Makefile.$$
+ echo ':' >> Makefile.$$
+ echo ' @for f in $?; do test ! -f $$f && exit 0; done; \' >> Makefile.$$
+ echo ' echo Touching $@...; \' >> Makefile.$$
+ echo ' echo Touching $@... 1>&2; \' >> Makefile.$$
+ echo ' touch $@' >> Makefile.$$
+ files_and_dependencies | sed 's,[^ ]* ,,;s,$, :,' >> Makefile.$$
+ while ${MAKE-make} -f Makefile.$$ all | grep . > /dev/null; do
+ sleep 1
+ done 2>&1
+ rm -f Makefile.$$
}
+
# Whenever we update the tree or install a patch, we may be modifying
# this script. By re-execing it, we ensure that the appropriate
--
Alexandre Oliva Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer aoliva@{cygnus.com, redhat.com}
CS PhD student at IC-Unicamp oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist *Please* write to mailing lists, not to me