3 # Check for accurate dependencies in gcc/Makefile.in.
5 # Copyright (C) 2008 Free Software Foundation, Inc.
6 # Written by Ralf Wildenhues <Ralf.Wildenhues@gmx.de>.
8 # This script is Free Software, and it can be copied, distributed and
9 # modified as defined in the GNU General Public License. A copy of
10 # its license can be downloaded from http://www.gnu.org/copyleft/gpl.html
12 # Start this script in an up to date build-tree/gcc directory.
13 # Using it in stage1 only works if the host compiler is GCC.
15 # To continue an interrupted check, make sure there are no *.o.backup
16 # files lying around (i.e., move them back to their original name),
17 # and set $start_after to the name of the last object that should be skipped.
20 # Skip some objects unconditionally; make sure each name in this list is
21 # surrounded by spaces.
22 skip
=" crtbegin.o crtbeginS.o crtbeginT.o crtend.o crtendS.o crtfastmath.o crtprec64.o crtprec80.o crtprec32.o ecrti.o ecrtn.o ncrti.o ncrtn.o "
24 # Files which show up as dependencies other than through unconditional #include.
25 # This is an egrep pattern.
26 hidden_dep_files
='(BASE-VER|DATESTAMP|DEV-PHASE|Makefile|xcoffout\.h|basic-block\.h|bconfig\.h)$'
31 # -------------------------------------------------------------------------
32 # There should be no need for changes beyond this point.
37 if test -f c-family
/c-common.o
; then :; else
38 echo "$0: rerun in an up to date build-tree/gcc directory" >&2
44 if test -n "$start_after"; then
45 if test $obj = $start_after; then
50 case $skip in *\
$obj\
*) continue ;; esac
52 mv -f $obj $obj.backup
53 ${MAKE} $obj CFLAGS
='-MM -MF depfile'
54 mv -f $obj.backup
$obj
56 LC_ALL
=C
${MAKE} -d $obj >make-d-log
60 *: |
*.o |
\\ |
/* ) ;;
65 LC_ALL
=C
sort -u > hdrs
68 sed -n '/.*Prerequisite..\([^ ]*\). is newer than target .'"$obj"'.*/s//\1/p' \
70 LC_ALL
=C
sort -u > not-up-to-date
71 if test -s not-up-to-date
; then
73 echo "$0: error: prerequisites for $obj are not up to date:" >&2
74 cat not-up-to-date
>&2
76 sed -n '/.*Prerequisite..\([^ ]*\). is older than target .'"$obj"'.*/s//\1/p' \
78 LC_ALL
=C
sort -u > deps
79 missing_deps
=`LC_ALL=C join -v 1 hdrs deps`
80 unneeded_deps
=`LC_ALL=C join -v 2 hdrs deps | $EGREP -v "$hidden_dep_files" || :`
81 if test -n "$missing_deps"; then
83 echo "missing deps for $obj:"
84 echo "$missing_deps" |
sed 's/^/ /'
86 if test -n "$unneeded_deps"; then
87 # unneeded dependencies are not a big problem, so they cause no failure.
88 echo "unneeded deps for $obj:"
89 echo "$unneeded_deps" |
sed 's/^/ /'