From 083aeb9b30efc6bccd29153267b76a8bc73a1509 Mon Sep 17 00:00:00 2001 From: aoliva Date: Mon, 14 May 2001 19:57:52 +0000 Subject: [PATCH] * gcc_update (touch_files): Use a Makefile to touch files. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@42088 138bc75d-0d04-0410-961f-82ee72b054a4 --- contrib/ChangeLog | 4 ++++ contrib/gcc_update | 37 +++++++++++++++++-------------------- 2 files changed, 21 insertions(+), 20 deletions(-) diff --git a/contrib/ChangeLog b/contrib/ChangeLog index c37448a..edd26aa 100644 --- a/contrib/ChangeLog +++ b/contrib/ChangeLog @@ -1,3 +1,7 @@ +2001-05-14 Alexandre Oliva + + * gcc_update (touch_files): Use a Makefile to touch files. + 2001-05-03 Joseph S. Myers * texi2pod.pl: Add copyright and GPL notices. diff --git a/contrib/gcc_update b/contrib/gcc_update index 573b0bd..5960e37 100755 --- a/contrib/gcc_update +++ b/contrib/gcc_update @@ -98,31 +98,28 @@ 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 # dependencies and rules will be used. -- 2.7.4