summaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authorAlexandre Oliva <aoliva@redhat.com>2001-05-14 19:57:52 +0000
committerAlexandre Oliva <aoliva@gcc.gnu.org>2001-05-14 19:57:52 +0000
commite8b073c1bd1c589eb6c92da2db2ce00e932d04d4 (patch)
tree6bf2a0f372c6b5799de834b1a6afd7c460f1fd7b /contrib
parentf327ea3ebe7002f966b19720d33c7b026b53143a (diff)
downloadgcc-e8b073c1bd1c589eb6c92da2db2ce00e932d04d4.tar.gz
* gcc_update (touch_files): Use a Makefile to touch files.
From-SVN: r42088
Diffstat (limited to 'contrib')
-rw-r--r--contrib/ChangeLog4
-rwxr-xr-xcontrib/gcc_update37
2 files changed, 21 insertions, 20 deletions
diff --git a/contrib/ChangeLog b/contrib/ChangeLog
index c37448acf8f..edd26aaaae5 100644
--- a/contrib/ChangeLog
+++ b/contrib/ChangeLog
@@ -1,3 +1,7 @@
+2001-05-14 Alexandre Oliva <aoliva@redhat.com>
+
+ * gcc_update (touch_files): Use a Makefile to touch files.
+
2001-05-03 Joseph S. Myers <jsm28@cam.ac.uk>
* texi2pod.pl: Add copyright and GPL notices.
diff --git a/contrib/gcc_update b/contrib/gcc_update
index 573b0bd6ff8..5960e373944 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.