Commit e8b073c1 by Alexandre Oliva Committed by Alexandre Oliva

* gcc_update (touch_files): Use a Makefile to touch files.

From-SVN: r42088
parent f327ea3e
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> 2001-05-03 Joseph S. Myers <jsm28@cam.ac.uk>
* texi2pod.pl: Add copyright and GPL notices. * texi2pod.pl: Add copyright and GPL notices.
......
...@@ -98,31 +98,28 @@ EOF ...@@ -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 # This function touches generated files such that the ``end'' user does
# not have to rebuild them. # not have to rebuild them.
touch_files () { touch_files () {
files_and_dependencies | while read f deps; do rm -f Makefile.$$
if test -f $f && is_out_of_date "$f" $deps; then echo 'all: \' > Makefile.$$
echo Touching "$f"... files_and_dependencies | sed 's, .*, \\,' >> Makefile.$$
touch $f echo '; @true' >> Makefile.$$
if is_out_of_date "$f" $deps; then files_and_dependencies | sed 's, ,: ,' >> Makefile.$$
# Hmm, it may have got the same timestamp as one of files_and_dependencies | sed 's, .*, \\,' >> Makefile.$$
# its touched dependencies. Wait a second and retry. echo ':' >> Makefile.$$
sleep 1 echo ' @for f in $?; do test ! -f $$f && exit 0; done; \' >> Makefile.$$
echo Touching "$f" once more... echo ' echo Touching $@...; \' >> Makefile.$$
touch $f echo ' echo Touching $@... 1>&2; \' >> Makefile.$$
fi echo ' touch $@' >> Makefile.$$
fi files_and_dependencies | sed 's,[^ ]* ,,;s,$, :,' >> Makefile.$$
done 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 # Whenever we update the tree or install a patch, we may be modifying
# this script. By re-execing it, we ensure that the appropriate # this script. By re-execing it, we ensure that the appropriate
# dependencies and rules will be used. # dependencies and rules will be used.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment