depcomp revision a747113422afaa29ce72d2c5ba7f0b7ea9ec2054
1028add9f0e7a52f8e7b575d4ad2e1fab95ab687Felipe C. da S. Sanches# depcomp - compile a program generating dependencies as side-effects
1028add9f0e7a52f8e7b575d4ad2e1fab95ab687Felipe C. da S. Sanches# Copyright (C) 1999-2012 Free Software Foundation, Inc.
1028add9f0e7a52f8e7b575d4ad2e1fab95ab687Felipe C. da S. Sanches# This program is free software; you can redistribute it and/or modify
1028add9f0e7a52f8e7b575d4ad2e1fab95ab687Felipe C. da S. Sanches# it under the terms of the GNU General Public License as published by
1028add9f0e7a52f8e7b575d4ad2e1fab95ab687Felipe C. da S. Sanches# the Free Software Foundation; either version 2, or (at your option)
1028add9f0e7a52f8e7b575d4ad2e1fab95ab687Felipe C. da S. Sanches# any later version.
1028add9f0e7a52f8e7b575d4ad2e1fab95ab687Felipe C. da S. Sanches# This program is distributed in the hope that it will be useful,
1028add9f0e7a52f8e7b575d4ad2e1fab95ab687Felipe C. da S. Sanches# but WITHOUT ANY WARRANTY; without even the implied warranty of
1028add9f0e7a52f8e7b575d4ad2e1fab95ab687Felipe C. da S. Sanches# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1028add9f0e7a52f8e7b575d4ad2e1fab95ab687Felipe C. da S. Sanches# GNU General Public License for more details.
1028add9f0e7a52f8e7b575d4ad2e1fab95ab687Felipe C. da S. Sanches# You should have received a copy of the GNU General Public License
1028add9f0e7a52f8e7b575d4ad2e1fab95ab687Felipe C. da S. Sanches# along with this program. If not, see <http://www.gnu.org/licenses/>.
ea383d39842cfcecb33367b61805a8176128bc14Felipe C. da S. Sanches# As a special exception to the GNU General Public License, if you
1028add9f0e7a52f8e7b575d4ad2e1fab95ab687Felipe C. da S. Sanches# distribute this file as part of a program that contains a
1028add9f0e7a52f8e7b575d4ad2e1fab95ab687Felipe C. da S. Sanches# configuration script generated by Autoconf, you may include it under
1028add9f0e7a52f8e7b575d4ad2e1fab95ab687Felipe C. da S. Sanches# the same distribution terms that you use for the rest of that program.
1028add9f0e7a52f8e7b575d4ad2e1fab95ab687Felipe C. da S. Sanches# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>.
1028add9f0e7a52f8e7b575d4ad2e1fab95ab687Felipe C. da S. Sanches echo "$0: No command. Try '$0 --help' for more information." 1>&2
1028add9f0e7a52f8e7b575d4ad2e1fab95ab687Felipe C. da S. SanchesUsage: depcomp [--help] [--version] PROGRAM [ARGS]
1028add9f0e7a52f8e7b575d4ad2e1fab95ab687Felipe C. da S. SanchesRun PROGRAMS ARGS to compile a file, generating dependencies
ea383d39842cfcecb33367b61805a8176128bc14Felipe C. da S. Sanches source Source file read by 'PROGRAMS ARGS'.
ea383d39842cfcecb33367b61805a8176128bc14Felipe C. da S. Sanches object Object file output by 'PROGRAMS ARGS'.
ea383d39842cfcecb33367b61805a8176128bc14Felipe C. da S. Sanches DEPDIR directory where to store dependencies.
1028add9f0e7a52f8e7b575d4ad2e1fab95ab687Felipe C. da S. Sanches tmpdepfile Temporary file to use when outputting dependencies.
1028add9f0e7a52f8e7b575d4ad2e1fab95ab687Felipe C. da S. Sanches libtool Whether libtool is used (yes/no).
1028add9f0e7a52f8e7b575d4ad2e1fab95ab687Felipe C. da S. SanchesReport bugs to <bug-automake@gnu.org>.
1028add9f0e7a52f8e7b575d4ad2e1fab95ab687Felipe C. da S. Sanches# A tabulation character.
1028add9f0e7a52f8e7b575d4ad2e1fab95ab687Felipe C. da S. Sanches# A newline character.
1028add9f0e7a52f8e7b575d4ad2e1fab95ab687Felipe C. da S. Sanchesif test -z "$depmode" || test -z "$source" || test -z "$object"; then
1028add9f0e7a52f8e7b575d4ad2e1fab95ab687Felipe C. da S. Sanches echo "depcomp: Variables source, object and depmode must be set" 1>&2
1028add9f0e7a52f8e7b575d4ad2e1fab95ab687Felipe C. da S. Sanches# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po.
1028add9f0e7a52f8e7b575d4ad2e1fab95ab687Felipe C. da S. Sanches sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`}
b0f125f9099c0a8482539573d97f87bd0708d8e6Felipe C. da S. Sanchestmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
b0f125f9099c0a8482539573d97f87bd0708d8e6Felipe C. da S. Sanches# Some modes work just like other modes, but use different flags. We
1028add9f0e7a52f8e7b575d4ad2e1fab95ab687Felipe C. da S. Sanches# parameterize here, but still list the modes in the big case below,
1028add9f0e7a52f8e7b575d4ad2e1fab95ab687Felipe C. da S. Sanches# to make depend.m4 easier to write. Note that we *cannot* use a case
1028add9f0e7a52f8e7b575d4ad2e1fab95ab687Felipe C. da S. Sanches# here, because this file can only contain one case statement.
1028add9f0e7a52f8e7b575d4ad2e1fab95ab687Felipe C. da S. Sanches # HP compiler uses -M and no extra arg.
1028add9f0e7a52f8e7b575d4ad2e1fab95ab687Felipe C. da S. Sanchesif test "$depmode" = dashXmstdout; then
1028add9f0e7a52f8e7b575d4ad2e1fab95ab687Felipe C. da S. Sanches # This is just like dashmstdout with a different argument.
1028add9f0e7a52f8e7b575d4ad2e1fab95ab687Felipe C. da S. Sanches # This is just like msvisualcpp but w/o cygpath translation.
1028add9f0e7a52f8e7b575d4ad2e1fab95ab687Felipe C. da S. Sanches # Just convert the backslash-escaped backslashes to single forward
1028add9f0e7a52f8e7b575d4ad2e1fab95ab687Felipe C. da S. Sanches # slashes to satisfy depend.m4
1028add9f0e7a52f8e7b575d4ad2e1fab95ab687Felipe C. da S. Sanches # This is just like msvc7 but w/o cygpath translation.
b0f125f9099c0a8482539573d97f87bd0708d8e6Felipe C. da S. Sanches # Just convert the backslash-escaped backslashes to single forward
b0f125f9099c0a8482539573d97f87bd0708d8e6Felipe C. da S. Sanches # slashes to satisfy depend.m4
b0f125f9099c0a8482539573d97f87bd0708d8e6Felipe C. da S. Sanches # IBM C/C++ Compilers xlc/xlC can output gcc-like dependency informations.
b0f125f9099c0a8482539573d97f87bd0708d8e6Felipe C. da S. Sanches## gcc 3 implements dependency tracking that does exactly what
b0f125f9099c0a8482539573d97f87bd0708d8e6Felipe C. da S. Sanches## we want. Yay! Note: for some reason libtool 1.4 doesn't like
1028add9f0e7a52f8e7b575d4ad2e1fab95ab687Felipe C. da S. Sanches## it if -MD -MP comes after the -MF stuff. Hmm.
1028add9f0e7a52f8e7b575d4ad2e1fab95ab687Felipe C. da S. Sanches## Unfortunately, FreeBSD c89 acceptance of flags depends upon
1028add9f0e7a52f8e7b575d4ad2e1fab95ab687Felipe C. da S. Sanches## the command line argument order; so add the flags where they
b0f125f9099c0a8482539573d97f87bd0708d8e6Felipe C. da S. Sanches## appear in depend2.am. Note that the slowdown incurred here
b0f125f9099c0a8482539573d97f87bd0708d8e6Felipe C. da S. Sanches## affects only configure: in makefiles, %FASTDEP% shortcuts this.
1028add9f0e7a52f8e7b575d4ad2e1fab95ab687Felipe C. da S. Sanches -c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;;
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)