depcomp revision a747113422afaa29ce72d2c5ba7f0b7ea9ec2054
088fa5d9eaa83bf4b3d59a64c0519f42a143aaa9Alin Brici# depcomp - compile a program generating dependencies as side-effects
3f424ffdb194d6ff7ac053c5b3e53211a2de2d64Brendan Mmiller# Copyright (C) 1999-2012 Free Software Foundation, Inc.
3f424ffdb194d6ff7ac053c5b3e53211a2de2d64Brendan Mmiller# This program is free software; you can redistribute it and/or modify
3f424ffdb194d6ff7ac053c5b3e53211a2de2d64Brendan Mmiller# it under the terms of the GNU General Public License as published by
3f424ffdb194d6ff7ac053c5b3e53211a2de2d64Brendan Mmiller# the Free Software Foundation; either version 2, or (at your option)
3f424ffdb194d6ff7ac053c5b3e53211a2de2d64Brendan Mmiller# any later version.
3f424ffdb194d6ff7ac053c5b3e53211a2de2d64Brendan Mmiller# This program is distributed in the hope that it will be useful,
3f424ffdb194d6ff7ac053c5b3e53211a2de2d64Brendan Mmiller# but WITHOUT ANY WARRANTY; without even the implied warranty of
3f424ffdb194d6ff7ac053c5b3e53211a2de2d64Brendan Mmiller# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3f424ffdb194d6ff7ac053c5b3e53211a2de2d64Brendan Mmiller# GNU General Public License for more details.
3f424ffdb194d6ff7ac053c5b3e53211a2de2d64Brendan Mmiller# You should have received a copy of the GNU General Public License
3f424ffdb194d6ff7ac053c5b3e53211a2de2d64Brendan Mmiller# along with this program. If not, see <http://www.gnu.org/licenses/>.
3f424ffdb194d6ff7ac053c5b3e53211a2de2d64Brendan Mmiller# As a special exception to the GNU General Public License, if you
3f424ffdb194d6ff7ac053c5b3e53211a2de2d64Brendan Mmiller# distribute this file as part of a program that contains a
b84068e6021ec8a830c26c4494f6e335d1f9c0efBrendan Miller# configuration script generated by Autoconf, you may include it under
088fa5d9eaa83bf4b3d59a64c0519f42a143aaa9Alin Brici# the same distribution terms that you use for the rest of that program.
3f424ffdb194d6ff7ac053c5b3e53211a2de2d64Brendan Mmiller# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>.
3f424ffdb194d6ff7ac053c5b3e53211a2de2d64Brendan Mmiller echo "$0: No command. Try '$0 --help' for more information." 1>&2
3f424ffdb194d6ff7ac053c5b3e53211a2de2d64Brendan MmillerUsage: depcomp [--help] [--version] PROGRAM [ARGS]
3f424ffdb194d6ff7ac053c5b3e53211a2de2d64Brendan MmillerRun PROGRAMS ARGS to compile a file, generating dependencies
99054f32a1766b8a8f60509cb724359413171d1dBrendan Mmiller object Object file output by 'PROGRAMS ARGS'.
99054f32a1766b8a8f60509cb724359413171d1dBrendan Mmiller DEPDIR directory where to store dependencies.
99054f32a1766b8a8f60509cb724359413171d1dBrendan Mmiller tmpdepfile Temporary file to use when outputting dependencies.
3a666413480ef97101461705e1f47cbab0266301Brendan Mmiller# A tabulation character.
b84068e6021ec8a830c26c4494f6e335d1f9c0efBrendan Miller# A newline character.
ba208d3f0e9d48f3c841cdd627f200a7bb04cea8Brendan Mmillerif test -z "$depmode" || test -z "$source" || test -z "$object"; then
ba208d3f0e9d48f3c841cdd627f200a7bb04cea8Brendan Mmiller echo "depcomp: Variables source, object and depmode must be set" 1>&2
99054f32a1766b8a8f60509cb724359413171d1dBrendan Mmiller# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po.
99054f32a1766b8a8f60509cb724359413171d1dBrendan Mmiller sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`}
99054f32a1766b8a8f60509cb724359413171d1dBrendan Mmillertmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
3f424ffdb194d6ff7ac053c5b3e53211a2de2d64Brendan Mmiller# Some modes work just like other modes, but use different flags. We
3f424ffdb194d6ff7ac053c5b3e53211a2de2d64Brendan Mmiller# parameterize here, but still list the modes in the big case below,
3f424ffdb194d6ff7ac053c5b3e53211a2de2d64Brendan Mmiller# to make depend.m4 easier to write. Note that we *cannot* use a case
bfd9faff49961e9db7b92f310d59923fd6234372Brendan Mmiller# here, because this file can only contain one case statement.
99054f32a1766b8a8f60509cb724359413171d1dBrendan Mmiller # HP compiler uses -M and no extra arg.
99054f32a1766b8a8f60509cb724359413171d1dBrendan Mmiller # This is just like dashmstdout with a different argument.
99054f32a1766b8a8f60509cb724359413171d1dBrendan Mmiller # This is just like msvisualcpp but w/o cygpath translation.
99054f32a1766b8a8f60509cb724359413171d1dBrendan Mmiller # Just convert the backslash-escaped backslashes to single forward
99054f32a1766b8a8f60509cb724359413171d1dBrendan Mmiller # slashes to satisfy depend.m4
99054f32a1766b8a8f60509cb724359413171d1dBrendan Mmiller # This is just like msvc7 but w/o cygpath translation.
99054f32a1766b8a8f60509cb724359413171d1dBrendan Mmiller # Just convert the backslash-escaped backslashes to single forward
99054f32a1766b8a8f60509cb724359413171d1dBrendan Mmiller # slashes to satisfy depend.m4
bfd9faff49961e9db7b92f310d59923fd6234372Brendan Mmiller # IBM C/C++ Compilers xlc/xlC can output gcc-like dependency informations.
99054f32a1766b8a8f60509cb724359413171d1dBrendan Mmiller## gcc 3 implements dependency tracking that does exactly what
99054f32a1766b8a8f60509cb724359413171d1dBrendan Mmiller## we want. Yay! Note: for some reason libtool 1.4 doesn't like
99054f32a1766b8a8f60509cb724359413171d1dBrendan Mmiller## it if -MD -MP comes after the -MF stuff. Hmm.
bfd9faff49961e9db7b92f310d59923fd6234372Brendan Mmiller## Unfortunately, FreeBSD c89 acceptance of flags depends upon
bfd9faff49961e9db7b92f310d59923fd6234372Brendan Mmiller## the command line argument order; so add the flags where they
bfd9faff49961e9db7b92f310d59923fd6234372Brendan Mmiller## appear in depend2.am. Note that the slowdown incurred here
a20f25a11beaf0445cc53f4d56537cef3d26281eBrendan Mmiller## affects only configure: in makefiles, %FASTDEP% shortcuts this.
3f424ffdb194d6ff7ac053c5b3e53211a2de2d64Brendan Mmiller -c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;;
3f424ffdb194d6ff7ac053c5b3e53211a2de2d64Brendan Mmiller shift # fnord
stat=$?
exit $stat
gcc)
if test -z "$gccflag"; then
stat=$?
exit $stat
hp)
# This case exists only to let depend.m4 do its work. It works by
sgi)
"$@" "-Wp,-MDupdate,$tmpdepfile"
stat=$?
exit $stat
echo >> "$depfile"
>> "$depfile"
# "include basename.Plo" scheme.
xlc)
# This case exists only to let depend.m4 do its work. It works by
aix)
stat=$?
exit $stat
test -f "$tmpdepfile" && break
if test -f "$tmpdepfile"; then
# Each line is of the form 'foo.o: dependent.h'.
# '$object: dependent.h' and one to simply 'dependent.h:'.
# "include basename.Plo" scheme.
icc)
# ICC 7.0 will fill foo.d with something like
stat=$?
exit $stat
# Each line is of the form 'foo.o: dependent.h',
# '$object: dependent.h' and one to simply 'dependent.h:'.
hp2)
# 'foo.d', which lands next to the object file, wherever that
stat=$?
exit $stat
test -f "$tmpdepfile" && break
if test -f "$tmpdepfile"; then
# Add 'dependent.h:' lines.
# dependencies in 'foo.d' instead, so we check for that too.
# in $dir$base.o.d. We have to check for both files, because
stat=$?
exit $stat
test -f "$tmpdepfile" && break
if test -f "$tmpdepfile"; then
stat=$?
exit $stat
# This case exists only to let depend.m4 do its work. It works by
for arg
# This case only exists to satisfy depend.m4. It is never actually
for arg
no)
-arch)
-*|$object)
cpp)
for arg
for arg
# This case exists only to let depend.m4 do its work. It works by
none)