3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync# depcomp - compile a program generating dependencies as side-effects
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006 Free Software
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync# Foundation, Inc.
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync# This program is free software; you can redistribute it and/or modify
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync# it under the terms of the GNU General Public License as published by
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync# the Free Software Foundation; either version 2, or (at your option)
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync# any later version.
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync# This program is distributed in the hope that it will be useful,
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync# but WITHOUT ANY WARRANTY; without even the implied warranty of
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync# GNU General Public License for more details.
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync# You should have received a copy of the GNU General Public License
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync# along with this program; if not, write to the Free Software
930b5f872e89407f445d4000d4e4aaecaa6a0998vboxsync# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
930b5f872e89407f445d4000d4e4aaecaa6a0998vboxsync# 02110-1301, USA.
930b5f872e89407f445d4000d4e4aaecaa6a0998vboxsync# As a special exception to the GNU General Public License, if you
930b5f872e89407f445d4000d4e4aaecaa6a0998vboxsync# distribute this file as part of a program that contains a
930b5f872e89407f445d4000d4e4aaecaa6a0998vboxsync# configuration script generated by Autoconf, you may include it under
930b5f872e89407f445d4000d4e4aaecaa6a0998vboxsync# the same distribution terms that you use for the rest of that program.
930b5f872e89407f445d4000d4e4aaecaa6a0998vboxsync# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>.
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync echo "$0: No command. Try \`$0 --help' for more information." 1>&2
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsyncRun PROGRAMS ARGS to compile a file, generating dependencies
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync tmpdepfile Temporary file to use when outputing dependencies.
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsyncif test -z "$depmode" || test -z "$source" || test -z "$object"; then
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync echo "depcomp: Variables source, object and depmode must be set" 1>&2
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po.
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`}
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsynctmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync# Some modes work just like other modes, but use different flags. We
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync# parameterize here, but still list the modes in the big case below,
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync# to make depend.m4 easier to write. Note that we *cannot* use a case
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync# here, because this file can only contain one case statement.
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync # This is just like dashmstdout with a different argument.
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync## gcc 3 implements dependency tracking that does exactly what
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync## we want. Yay! Note: for some reason libtool 1.4 doesn't like
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync## it if -MD -MP comes after the -MF stuff. Hmm.
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync## Unfortunately, FreeBSD c89 acceptance of flags depends upon
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync## the command line argument order; so add the flags where they
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync## appear in depend2.am. Note that the slowdown incurred here
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync## affects only configure: in makefiles, %FASTDEP% shortcuts this.
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync -c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;;
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync if test $stat -eq 0; then :
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync## There are various ways to get dependency output from gcc. Here's
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync## why we pick this rather obscure method:
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync## - Don't want to use -MD because we'd like the dependencies to end
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync## up in a subdir. Having to rename by hand is ugly.
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync## (We might end up doing this anyway to support other compilers.)
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync## -MM, not -M (despite what the docs say).
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync## - Using -M directly means running the compiler twice (even worse
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync## than renaming).
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync if test $stat -eq 0; then :
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync## The second -e expression handles DOS-style file names with drive letters.
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync## This next piece of magic avoids the `deleted header file' problem.
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync## The problem is that when a header file which appears in a .P file
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync## is deleted, the dependency causes make to die (because there is
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync## typically no way to rebuild the header). We avoid this by adding
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync## dummy dependencies for each header file. Too bad gcc doesn't do
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync## this for us directly.
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync## Some versions of gcc put a space before the `:'. On the theory
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync## that the space means something, we add a space to the output as
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync## Some versions of the HPUX 10.20 sed can't process this invocation
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync## correctly. Breaking it into two sed invocations is a workaround.
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync # This case exists only to let depend.m4 do its work. It works by
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync # looking at the text of this script. This case will never be run,
stat=$?
exit $stat
echo >> $depfile
>> $depfile
aix)
stat=$?
exit $stat
icc)
stat=$?
exit $stat
hp2)
stat=$?
exit $stat
stat=$?
exit $stat
for arg
no)
-*|$object)
cpp)
for arg
for arg
sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile"
none)