: 'Without arguments, this program clears the dependencies between'
: '.o files and included files in Makefile.'
: 'With arguments, it replaces the dependencies between the .o files'
: 'resulting from the argument files, and the included files in Makefile.'
: 'Makefile must contain a line with on it the pattern AUTOAUTOAUTO.'
: 'WARNING: a temporary file is created in the current directory.'
: 'It is however rather unlikely that this file already exists'
grep -s AUTOAUTOAUTO Makefile || {
    echo "Makefile has wrong format." 1>&2
    exit 1
}
for file do
	ofile=`echo $file | sed 's/.$/o/'`
	grep '^# *include.*"' $file | sed "s/.*\"\(.*\)\".*/$ofile:	\1/"
done | sort -u > @@**##$$
echo "Non-empty line." >> Makefile
ed - Makefile <<'!'
/AUTOAUTOAUTO/+,$d
w
q
!
cat @@**##$$ >> Makefile
rm -f @@**##$$
