#! /bin/sh
|
#! /bin/sh
|
#
|
#
|
# Check for accurate dependencies in gcc/Makefile.in.
|
# Check for accurate dependencies in gcc/Makefile.in.
|
#
|
#
|
# Copyright (C) 2008 Free Software Foundation, Inc.
|
# Copyright (C) 2008 Free Software Foundation, Inc.
|
# Written by Ralf Wildenhues <Ralf.Wildenhues@gmx.de>.
|
# Written by Ralf Wildenhues <Ralf.Wildenhues@gmx.de>.
|
#
|
#
|
# This script is Free Software, and it can be copied, distributed and
|
# This script is Free Software, and it can be copied, distributed and
|
# modified as defined in the GNU General Public License. A copy of
|
# modified as defined in the GNU General Public License. A copy of
|
# its license can be downloaded from http://www.gnu.org/copyleft/gpl.html
|
# its license can be downloaded from http://www.gnu.org/copyleft/gpl.html
|
#
|
#
|
# Start this script in an up to date build-tree/gcc directory.
|
# Start this script in an up to date build-tree/gcc directory.
|
# Using it in stage1 only works if the host compiler is GCC.
|
# Using it in stage1 only works if the host compiler is GCC.
|
|
|
# To continue an interrupted check, make sure there are no *.o.backup
|
# To continue an interrupted check, make sure there are no *.o.backup
|
# files lying around (i.e., move them back to their original name),
|
# files lying around (i.e., move them back to their original name),
|
# and set $start_after to the name of the last object that should be skipped.
|
# and set $start_after to the name of the last object that should be skipped.
|
start_after=
|
start_after=
|
|
|
# Skip some objects unconditionally; make sure each name in this list is
|
# Skip some objects unconditionally; make sure each name in this list is
|
# surrounded by spaces.
|
# surrounded by spaces.
|
skip=" crtbegin.o crtbeginS.o crtbeginT.o crtend.o crtendS.o crtfastmath.o crtprec64.o crtprec80.o crtprec32.o "
|
skip=" crtbegin.o crtbeginS.o crtbeginT.o crtend.o crtendS.o crtfastmath.o crtprec64.o crtprec80.o crtprec32.o "
|
|
|
# Files which show up as dependencies other than through unconditional #include.
|
# Files which show up as dependencies other than through unconditional #include.
|
# This is an egrep pattern.
|
# This is an egrep pattern.
|
hidden_dep_files='(BASE-VER|DATESTAMP|DEV-PHASE|Makefile|xcoffout\.h|basic-block\.h|bconfig\.h)$'
|
hidden_dep_files='(BASE-VER|DATESTAMP|DEV-PHASE|Makefile|xcoffout\.h|basic-block\.h|bconfig\.h)$'
|
|
|
: ${MAKE=make}
|
: ${MAKE=make}
|
: ${EGREP="grep -E"}
|
: ${EGREP="grep -E"}
|
|
|
# -------------------------------------------------------------------------
|
# -------------------------------------------------------------------------
|
# There should be no need for changes beyond this point.
|
# There should be no need for changes beyond this point.
|
|
|
set -e
|
set -e
|
st=0
|
st=0
|
|
|
if test -f c-common.o; then :; else
|
if test -f c-common.o; then :; else
|
echo "$0: rerun in an up to date build-tree/gcc directory" >&2
|
echo "$0: rerun in an up to date build-tree/gcc directory" >&2
|
exit 1
|
exit 1
|
fi
|
fi
|
|
|
for obj in *.o
|
for obj in *.o
|
do
|
do
|
if test -n "$start_after"; then
|
if test -n "$start_after"; then
|
if test $obj = $start_after; then
|
if test $obj = $start_after; then
|
start_after=
|
start_after=
|
fi
|
fi
|
continue
|
continue
|
fi
|
fi
|
case $skip in *\ $obj\ *) continue ;; esac
|
case $skip in *\ $obj\ *) continue ;; esac
|
|
|
mv -f $obj $obj.backup
|
mv -f $obj $obj.backup
|
${MAKE} $obj CFLAGS='-MM -MF depfile'
|
${MAKE} $obj CFLAGS='-MM -MF depfile'
|
mv -f $obj.backup $obj
|
mv -f $obj.backup $obj
|
${MAKE} -t
|
${MAKE} -t
|
LC_ALL=C ${MAKE} -d $obj >make-d-log
|
LC_ALL=C ${MAKE} -d $obj >make-d-log
|
hdrs=`cat depfile`
|
hdrs=`cat depfile`
|
for hdr in $hdrs; do
|
for hdr in $hdrs; do
|
case $hdr in
|
case $hdr in
|
*: | *.o | \\ | /* ) ;;
|
*: | *.o | \\ | /* ) ;;
|
*)
|
*)
|
echo $hdr ;;
|
echo $hdr ;;
|
esac
|
esac
|
done < depfile |
|
done < depfile |
|
LC_ALL=C sort -u > hdrs
|
LC_ALL=C sort -u > hdrs
|
|
|
|
|
sed -n '/.*Prerequisite..\([^ ]*\). is newer than target .'"$obj"'.*/s//\1/p' \
|
sed -n '/.*Prerequisite..\([^ ]*\). is newer than target .'"$obj"'.*/s//\1/p' \
|
< make-d-log |
|
< make-d-log |
|
LC_ALL=C sort -u > not-up-to-date
|
LC_ALL=C sort -u > not-up-to-date
|
if test -s not-up-to-date; then
|
if test -s not-up-to-date; then
|
st=1
|
st=1
|
echo "$0: error: prerequisites for $obj are not up to date:" >&2
|
echo "$0: error: prerequisites for $obj are not up to date:" >&2
|
cat not-up-to-date >&2
|
cat not-up-to-date >&2
|
fi
|
fi
|
sed -n '/.*Prerequisite..\([^ ]*\). is older than target .'"$obj"'.*/s//\1/p' \
|
sed -n '/.*Prerequisite..\([^ ]*\). is older than target .'"$obj"'.*/s//\1/p' \
|
< make-d-log |
|
< make-d-log |
|
LC_ALL=C sort -u > deps
|
LC_ALL=C sort -u > deps
|
missing_deps=`LC_ALL=C join -v 1 hdrs deps`
|
missing_deps=`LC_ALL=C join -v 1 hdrs deps`
|
unneeded_deps=`LC_ALL=C join -v 2 hdrs deps | $EGREP -v "$hidden_dep_files" || :`
|
unneeded_deps=`LC_ALL=C join -v 2 hdrs deps | $EGREP -v "$hidden_dep_files" || :`
|
if test -n "$missing_deps"; then
|
if test -n "$missing_deps"; then
|
st=1
|
st=1
|
echo "missing deps for $obj:"
|
echo "missing deps for $obj:"
|
echo "$missing_deps" | sed 's/^/ /'
|
echo "$missing_deps" | sed 's/^/ /'
|
fi
|
fi
|
if test -n "$unneeded_deps"; then
|
if test -n "$unneeded_deps"; then
|
# unneeded dependencies are not a big problem, so they cause no failure.
|
# unneeded dependencies are not a big problem, so they cause no failure.
|
echo "unneeded deps for $obj:"
|
echo "unneeded deps for $obj:"
|
echo "$unneeded_deps" | sed 's/^/ /'
|
echo "$unneeded_deps" | sed 's/^/ /'
|
fi
|
fi
|
done
|
done
|
exit $st
|
exit $st
|
|
|
# vi:sw=2:
|
# vi:sw=2:
|
|
|