leo_sobral@2: #! /bin/sh
leo_sobral@2: # depcomp - compile a program generating dependencies as side-effects
leo_sobral@2:
leo_sobral@2: scriptversion=2004-04-25.13
leo_sobral@2:
leo_sobral@2: # Copyright (C) 1999, 2000, 2003, 2004 Free Software Foundation, Inc.
leo_sobral@2:
leo_sobral@2: # This program is free software; you can redistribute it and/or modify
leo_sobral@2: # it under the terms of the GNU General Public License as published by
leo_sobral@2: # the Free Software Foundation; either version 2, or (at your option)
leo_sobral@2: # any later version.
leo_sobral@2:
leo_sobral@2: # This program is distributed in the hope that it will be useful,
leo_sobral@2: # but WITHOUT ANY WARRANTY; without even the implied warranty of
leo_sobral@2: # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
leo_sobral@2: # GNU General Public License for more details.
leo_sobral@2:
leo_sobral@2: # You should have received a copy of the GNU General Public License
leo_sobral@2: # along with this program; if not, write to the Free Software
leo_sobral@2: # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
leo_sobral@2: # 02111-1307, USA.
leo_sobral@2:
leo_sobral@2: # As a special exception to the GNU General Public License, if you
leo_sobral@2: # distribute this file as part of a program that contains a
leo_sobral@2: # configuration script generated by Autoconf, you may include it under
leo_sobral@2: # the same distribution terms that you use for the rest of that program.
leo_sobral@2:
leo_sobral@2: # Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>.
leo_sobral@2:
leo_sobral@2: case $1 in
leo_sobral@2: '')
leo_sobral@2: echo "$0: No command. Try \`$0 --help' for more information." 1>&2
leo_sobral@2: exit 1;
leo_sobral@2: ;;
leo_sobral@2: -h | --h*)
leo_sobral@2: cat <<\EOF
leo_sobral@2: Usage: depcomp [--help] [--version] PROGRAM [ARGS]
leo_sobral@2:
leo_sobral@2: Run PROGRAMS ARGS to compile a file, generating dependencies
leo_sobral@2: as side-effects.
leo_sobral@2:
leo_sobral@2: Environment variables:
leo_sobral@2: depmode Dependency tracking mode.
leo_sobral@2: source Source file read by `PROGRAMS ARGS'.
leo_sobral@2: object Object file output by `PROGRAMS ARGS'.
leo_sobral@2: depfile Dependency file to output.
leo_sobral@2: tmpdepfile Temporary file to use when outputing dependencies.
leo_sobral@2: libtool Whether libtool is used (yes/no).
leo_sobral@2:
leo_sobral@2: Report bugs to <bug-automake@gnu.org>.
leo_sobral@2: EOF
leo_sobral@2: exit 0
leo_sobral@2: ;;
leo_sobral@2: -v | --v*)
leo_sobral@2: echo "depcomp $scriptversion"
leo_sobral@2: exit 0
leo_sobral@2: ;;
leo_sobral@2: esac
leo_sobral@2:
leo_sobral@2: if test -z "$depmode" || test -z "$source" || test -z "$object"; then
leo_sobral@2: echo "depcomp: Variables source, object and depmode must be set" 1>&2
leo_sobral@2: exit 1
leo_sobral@2: fi
leo_sobral@2: # `libtool' can also be set to `yes' or `no'.
leo_sobral@2:
leo_sobral@2: if test -z "$depfile"; then
leo_sobral@2: base=`echo "$object" | sed -e 's,^.*/,,' -e 's,\.\([^.]*\)$,.P\1,'`
leo_sobral@2: dir=`echo "$object" | sed 's,/.*$,/,'`
leo_sobral@2: if test "$dir" = "$object"; then
leo_sobral@2: dir=
leo_sobral@2: fi
leo_sobral@2: # FIXME: should be _deps on DOS.
leo_sobral@2: depfile="$dir.deps/$base"
leo_sobral@2: fi
leo_sobral@2:
leo_sobral@2: tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
leo_sobral@2:
leo_sobral@2: rm -f "$tmpdepfile"
leo_sobral@2:
leo_sobral@2: # Some modes work just like other modes, but use different flags. We
leo_sobral@2: # parameterize here, but still list the modes in the big case below,
leo_sobral@2: # to make depend.m4 easier to write. Note that we *cannot* use a case
leo_sobral@2: # here, because this file can only contain one case statement.
leo_sobral@2: if test "$depmode" = hp; then
leo_sobral@2: # HP compiler uses -M and no extra arg.
leo_sobral@2: gccflag=-M
leo_sobral@2: depmode=gcc
leo_sobral@2: fi
leo_sobral@2:
leo_sobral@2: if test "$depmode" = dashXmstdout; then
leo_sobral@2: # This is just like dashmstdout with a different argument.
leo_sobral@2: dashmflag=-xM
leo_sobral@2: depmode=dashmstdout
leo_sobral@2: fi
leo_sobral@2:
leo_sobral@2: case "$depmode" in
leo_sobral@2: gcc3)
leo_sobral@2: ## gcc 3 implements dependency tracking that does exactly what
leo_sobral@2: ## we want. Yay! Note: for some reason libtool 1.4 doesn't like
leo_sobral@2: ## it if -MD -MP comes after the -MF stuff. Hmm.
leo_sobral@2: "$@" -MT "$object" -MD -MP -MF "$tmpdepfile"
leo_sobral@2: stat=$?
leo_sobral@2: if test $stat -eq 0; then :
leo_sobral@2: else
leo_sobral@2: rm -f "$tmpdepfile"
leo_sobral@2: exit $stat
leo_sobral@2: fi
leo_sobral@2: mv "$tmpdepfile" "$depfile"
leo_sobral@2: ;;
leo_sobral@2:
leo_sobral@2: gcc)
leo_sobral@2: ## There are various ways to get dependency output from gcc. Here's
leo_sobral@2: ## why we pick this rather obscure method:
leo_sobral@2: ## - Don't want to use -MD because we'd like the dependencies to end
leo_sobral@2: ## up in a subdir. Having to rename by hand is ugly.
leo_sobral@2: ## (We might end up doing this anyway to support other compilers.)
leo_sobral@2: ## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
leo_sobral@2: ## -MM, not -M (despite what the docs say).
leo_sobral@2: ## - Using -M directly means running the compiler twice (even worse
leo_sobral@2: ## than renaming).
leo_sobral@2: if test -z "$gccflag"; then
leo_sobral@2: gccflag=-MD,
leo_sobral@2: fi
leo_sobral@2: "$@" -Wp,"$gccflag$tmpdepfile"
leo_sobral@2: stat=$?
leo_sobral@2: if test $stat -eq 0; then :
leo_sobral@2: else
leo_sobral@2: rm -f "$tmpdepfile"
leo_sobral@2: exit $stat
leo_sobral@2: fi
leo_sobral@2: rm -f "$depfile"
leo_sobral@2: echo "$object : \\" > "$depfile"
leo_sobral@2: alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
leo_sobral@2: ## The second -e expression handles DOS-style file names with drive letters.
leo_sobral@2: sed -e 's/^[^:]*: / /' \
leo_sobral@2: -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
leo_sobral@2: ## This next piece of magic avoids the `deleted header file' problem.
leo_sobral@2: ## The problem is that when a header file which appears in a .P file
leo_sobral@2: ## is deleted, the dependency causes make to die (because there is
leo_sobral@2: ## typically no way to rebuild the header). We avoid this by adding
leo_sobral@2: ## dummy dependencies for each header file. Too bad gcc doesn't do
leo_sobral@2: ## this for us directly.
leo_sobral@2: tr ' ' '
leo_sobral@2: ' < "$tmpdepfile" |
leo_sobral@2: ## Some versions of gcc put a space before the `:'. On the theory
leo_sobral@2: ## that the space means something, we add a space to the output as
leo_sobral@2: ## well.
leo_sobral@2: ## Some versions of the HPUX 10.20 sed can't process this invocation
leo_sobral@2: ## correctly. Breaking it into two sed invocations is a workaround.
leo_sobral@2: sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
leo_sobral@2: rm -f "$tmpdepfile"
leo_sobral@2: ;;
leo_sobral@2:
leo_sobral@2: hp)
leo_sobral@2: # This case exists only to let depend.m4 do its work. It works by
leo_sobral@2: # looking at the text of this script. This case will never be run,
leo_sobral@2: # since it is checked for above.
leo_sobral@2: exit 1
leo_sobral@2: ;;
leo_sobral@2:
leo_sobral@2: sgi)
leo_sobral@2: if test "$libtool" = yes; then
leo_sobral@2: "$@" "-Wp,-MDupdate,$tmpdepfile"
leo_sobral@2: else
leo_sobral@2: "$@" -MDupdate "$tmpdepfile"
leo_sobral@2: fi
leo_sobral@2: stat=$?
leo_sobral@2: if test $stat -eq 0; then :
leo_sobral@2: else
leo_sobral@2: rm -f "$tmpdepfile"
leo_sobral@2: exit $stat
leo_sobral@2: fi
leo_sobral@2: rm -f "$depfile"
leo_sobral@2:
leo_sobral@2: if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files
leo_sobral@2: echo "$object : \\" > "$depfile"
leo_sobral@2:
leo_sobral@2: # Clip off the initial element (the dependent). Don't try to be
leo_sobral@2: # clever and replace this with sed code, as IRIX sed won't handle
leo_sobral@2: # lines with more than a fixed number of characters (4096 in
leo_sobral@2: # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines;
leo_sobral@2: # the IRIX cc adds comments like `#:fec' to the end of the
leo_sobral@2: # dependency line.
leo_sobral@2: tr ' ' '
leo_sobral@2: ' < "$tmpdepfile" \
leo_sobral@2: | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
leo_sobral@2: tr '
leo_sobral@2: ' ' ' >> $depfile
leo_sobral@2: echo >> $depfile
leo_sobral@2:
leo_sobral@2: # The second pass generates a dummy entry for each header file.
leo_sobral@2: tr ' ' '
leo_sobral@2: ' < "$tmpdepfile" \
leo_sobral@2: | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
leo_sobral@2: >> $depfile
leo_sobral@2: else
leo_sobral@2: # The sourcefile does not contain any dependencies, so just
leo_sobral@2: # store a dummy comment line, to avoid errors with the Makefile
leo_sobral@2: # "include basename.Plo" scheme.
leo_sobral@2: echo "#dummy" > "$depfile"
leo_sobral@2: fi
leo_sobral@2: rm -f "$tmpdepfile"
leo_sobral@2: ;;
leo_sobral@2:
leo_sobral@2: aix)
leo_sobral@2: # The C for AIX Compiler uses -M and outputs the dependencies
leo_sobral@2: # in a .u file. In older versions, this file always lives in the
leo_sobral@2: # current directory. Also, the AIX compiler puts `$object:' at the
leo_sobral@2: # start of each line; $object doesn't have directory information.
leo_sobral@2: # Version 6 uses the directory in both cases.
leo_sobral@2: stripped=`echo "$object" | sed 's/\(.*\)\..*$/\1/'`
leo_sobral@2: tmpdepfile="$stripped.u"
leo_sobral@2: if test "$libtool" = yes; then
leo_sobral@2: "$@" -Wc,-M
leo_sobral@2: else
leo_sobral@2: "$@" -M
leo_sobral@2: fi
leo_sobral@2: stat=$?
leo_sobral@2:
leo_sobral@2: if test -f "$tmpdepfile"; then :
leo_sobral@2: else
leo_sobral@2: stripped=`echo "$stripped" | sed 's,^.*/,,'`
leo_sobral@2: tmpdepfile="$stripped.u"
leo_sobral@2: fi
leo_sobral@2:
leo_sobral@2: if test $stat -eq 0; then :
leo_sobral@2: else
leo_sobral@2: rm -f "$tmpdepfile"
leo_sobral@2: exit $stat
leo_sobral@2: fi
leo_sobral@2:
leo_sobral@2: if test -f "$tmpdepfile"; then
leo_sobral@2: outname="$stripped.o"
leo_sobral@2: # Each line is of the form `foo.o: dependent.h'.
leo_sobral@2: # Do two passes, one to just change these to
leo_sobral@2: # `$object: dependent.h' and one to simply `dependent.h:'.
leo_sobral@2: sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile"
leo_sobral@2: sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile"
leo_sobral@2: else
leo_sobral@2: # The sourcefile does not contain any dependencies, so just
leo_sobral@2: # store a dummy comment line, to avoid errors with the Makefile
leo_sobral@2: # "include basename.Plo" scheme.
leo_sobral@2: echo "#dummy" > "$depfile"
leo_sobral@2: fi
leo_sobral@2: rm -f "$tmpdepfile"
leo_sobral@2: ;;
leo_sobral@2:
leo_sobral@2: icc)
leo_sobral@2: # Intel's C compiler understands `-MD -MF file'. However on
leo_sobral@2: # icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c
leo_sobral@2: # ICC 7.0 will fill foo.d with something like
leo_sobral@2: # foo.o: sub/foo.c
leo_sobral@2: # foo.o: sub/foo.h
leo_sobral@2: # which is wrong. We want:
leo_sobral@2: # sub/foo.o: sub/foo.c
leo_sobral@2: # sub/foo.o: sub/foo.h
leo_sobral@2: # sub/foo.c:
leo_sobral@2: # sub/foo.h:
leo_sobral@2: # ICC 7.1 will output
leo_sobral@2: # foo.o: sub/foo.c sub/foo.h
leo_sobral@2: # and will wrap long lines using \ :
leo_sobral@2: # foo.o: sub/foo.c ... \
leo_sobral@2: # sub/foo.h ... \
leo_sobral@2: # ...
leo_sobral@2:
leo_sobral@2: "$@" -MD -MF "$tmpdepfile"
leo_sobral@2: stat=$?
leo_sobral@2: if test $stat -eq 0; then :
leo_sobral@2: else
leo_sobral@2: rm -f "$tmpdepfile"
leo_sobral@2: exit $stat
leo_sobral@2: fi
leo_sobral@2: rm -f "$depfile"
leo_sobral@2: # Each line is of the form `foo.o: dependent.h',
leo_sobral@2: # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'.
leo_sobral@2: # Do two passes, one to just change these to
leo_sobral@2: # `$object: dependent.h' and one to simply `dependent.h:'.
leo_sobral@2: sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
leo_sobral@2: # Some versions of the HPUX 10.20 sed can't process this invocation
leo_sobral@2: # correctly. Breaking it into two sed invocations is a workaround.
leo_sobral@2: sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" |
leo_sobral@2: sed -e 's/$/ :/' >> "$depfile"
leo_sobral@2: rm -f "$tmpdepfile"
leo_sobral@2: ;;
leo_sobral@2:
leo_sobral@2: tru64)
leo_sobral@2: # The Tru64 compiler uses -MD to generate dependencies as a side
leo_sobral@2: # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'.
leo_sobral@2: # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
leo_sobral@2: # dependencies in `foo.d' instead, so we check for that too.
leo_sobral@2: # Subdirectories are respected.
leo_sobral@2: dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
leo_sobral@2: test "x$dir" = "x$object" && dir=
leo_sobral@2: base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
leo_sobral@2:
leo_sobral@2: if test "$libtool" = yes; then
leo_sobral@2: # Dependencies are output in .lo.d with libtool 1.4.
leo_sobral@2: # They are output in .o.d with libtool 1.5.
leo_sobral@2: tmpdepfile1="$dir.libs/$base.lo.d"
leo_sobral@2: tmpdepfile2="$dir.libs/$base.o.d"
leo_sobral@2: tmpdepfile3="$dir.libs/$base.d"
leo_sobral@2: "$@" -Wc,-MD
leo_sobral@2: else
leo_sobral@2: tmpdepfile1="$dir$base.o.d"
leo_sobral@2: tmpdepfile2="$dir$base.d"
leo_sobral@2: tmpdepfile3="$dir$base.d"
leo_sobral@2: "$@" -MD
leo_sobral@2: fi
leo_sobral@2:
leo_sobral@2: stat=$?
leo_sobral@2: if test $stat -eq 0; then :
leo_sobral@2: else
leo_sobral@2: rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
leo_sobral@2: exit $stat
leo_sobral@2: fi
leo_sobral@2:
leo_sobral@2: if test -f "$tmpdepfile1"; then
leo_sobral@2: tmpdepfile="$tmpdepfile1"
leo_sobral@2: elif test -f "$tmpdepfile2"; then
leo_sobral@2: tmpdepfile="$tmpdepfile2"
leo_sobral@2: else
leo_sobral@2: tmpdepfile="$tmpdepfile3"
leo_sobral@2: fi
leo_sobral@2: if test -f "$tmpdepfile"; then
leo_sobral@2: sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
leo_sobral@2: # That's a tab and a space in the [].
leo_sobral@2: sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
leo_sobral@2: else
leo_sobral@2: echo "#dummy" > "$depfile"
leo_sobral@2: fi
leo_sobral@2: rm -f "$tmpdepfile"
leo_sobral@2: ;;
leo_sobral@2:
leo_sobral@2: #nosideeffect)
leo_sobral@2: # This comment above is used by automake to tell side-effect
leo_sobral@2: # dependency tracking mechanisms from slower ones.
leo_sobral@2:
leo_sobral@2: dashmstdout)
leo_sobral@2: # Important note: in order to support this mode, a compiler *must*
leo_sobral@2: # always write the preprocessed file to stdout, regardless of -o.
leo_sobral@2: "$@" || exit $?
leo_sobral@2:
leo_sobral@2: # Remove the call to Libtool.
leo_sobral@2: if test "$libtool" = yes; then
leo_sobral@2: while test $1 != '--mode=compile'; do
leo_sobral@2: shift
leo_sobral@2: done
leo_sobral@2: shift
leo_sobral@2: fi
leo_sobral@2:
leo_sobral@2: # Remove `-o $object'.
leo_sobral@2: IFS=" "
leo_sobral@2: for arg
leo_sobral@2: do
leo_sobral@2: case $arg in
leo_sobral@2: -o)
leo_sobral@2: shift
leo_sobral@2: ;;
leo_sobral@2: $object)
leo_sobral@2: shift
leo_sobral@2: ;;
leo_sobral@2: *)
leo_sobral@2: set fnord "$@" "$arg"
leo_sobral@2: shift # fnord
leo_sobral@2: shift # $arg
leo_sobral@2: ;;
leo_sobral@2: esac
leo_sobral@2: done
leo_sobral@2:
leo_sobral@2: test -z "$dashmflag" && dashmflag=-M
leo_sobral@2: # Require at least two characters before searching for `:'
leo_sobral@2: # in the target name. This is to cope with DOS-style filenames:
leo_sobral@2: # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise.
leo_sobral@2: "$@" $dashmflag |
leo_sobral@2: sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile"
leo_sobral@2: rm -f "$depfile"
leo_sobral@2: cat < "$tmpdepfile" > "$depfile"
leo_sobral@2: tr ' ' '
leo_sobral@2: ' < "$tmpdepfile" | \
leo_sobral@2: ## Some versions of the HPUX 10.20 sed can't process this invocation
leo_sobral@2: ## correctly. Breaking it into two sed invocations is a workaround.
leo_sobral@2: sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
leo_sobral@2: rm -f "$tmpdepfile"
leo_sobral@2: ;;
leo_sobral@2:
leo_sobral@2: dashXmstdout)
leo_sobral@2: # This case only exists to satisfy depend.m4. It is never actually
leo_sobral@2: # run, as this mode is specially recognized in the preamble.
leo_sobral@2: exit 1
leo_sobral@2: ;;
leo_sobral@2:
leo_sobral@2: makedepend)
leo_sobral@2: "$@" || exit $?
leo_sobral@2: # Remove any Libtool call
leo_sobral@2: if test "$libtool" = yes; then
leo_sobral@2: while test $1 != '--mode=compile'; do
leo_sobral@2: shift
leo_sobral@2: done
leo_sobral@2: shift
leo_sobral@2: fi
leo_sobral@2: # X makedepend
leo_sobral@2: shift
leo_sobral@2: cleared=no
leo_sobral@2: for arg in "$@"; do
leo_sobral@2: case $cleared in
leo_sobral@2: no)
leo_sobral@2: set ""; shift
leo_sobral@2: cleared=yes ;;
leo_sobral@2: esac
leo_sobral@2: case "$arg" in
leo_sobral@2: -D*|-I*)
leo_sobral@2: set fnord "$@" "$arg"; shift ;;
leo_sobral@2: # Strip any option that makedepend may not understand. Remove
leo_sobral@2: # the object too, otherwise makedepend will parse it as a source file.
leo_sobral@2: -*|$object)
leo_sobral@2: ;;
leo_sobral@2: *)
leo_sobral@2: set fnord "$@" "$arg"; shift ;;
leo_sobral@2: esac
leo_sobral@2: done
leo_sobral@2: obj_suffix="`echo $object | sed 's/^.*\././'`"
leo_sobral@2: touch "$tmpdepfile"
leo_sobral@2: ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
leo_sobral@2: rm -f "$depfile"
leo_sobral@2: cat < "$tmpdepfile" > "$depfile"
leo_sobral@2: sed '1,2d' "$tmpdepfile" | tr ' ' '
leo_sobral@2: ' | \
leo_sobral@2: ## Some versions of the HPUX 10.20 sed can't process this invocation
leo_sobral@2: ## correctly. Breaking it into two sed invocations is a workaround.
leo_sobral@2: sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
leo_sobral@2: rm -f "$tmpdepfile" "$tmpdepfile".bak
leo_sobral@2: ;;
leo_sobral@2:
leo_sobral@2: cpp)
leo_sobral@2: # Important note: in order to support this mode, a compiler *must*
leo_sobral@2: # always write the preprocessed file to stdout.
leo_sobral@2: "$@" || exit $?
leo_sobral@2:
leo_sobral@2: # Remove the call to Libtool.
leo_sobral@2: if test "$libtool" = yes; then
leo_sobral@2: while test $1 != '--mode=compile'; do
leo_sobral@2: shift
leo_sobral@2: done
leo_sobral@2: shift
leo_sobral@2: fi
leo_sobral@2:
leo_sobral@2: # Remove `-o $object'.
leo_sobral@2: IFS=" "
leo_sobral@2: for arg
leo_sobral@2: do
leo_sobral@2: case $arg in
leo_sobral@2: -o)
leo_sobral@2: shift
leo_sobral@2: ;;
leo_sobral@2: $object)
leo_sobral@2: shift
leo_sobral@2: ;;
leo_sobral@2: *)
leo_sobral@2: set fnord "$@" "$arg"
leo_sobral@2: shift # fnord
leo_sobral@2: shift # $arg
leo_sobral@2: ;;
leo_sobral@2: esac
leo_sobral@2: done
leo_sobral@2:
leo_sobral@2: "$@" -E |
leo_sobral@2: sed -n '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |
leo_sobral@2: sed '$ s: \\$::' > "$tmpdepfile"
leo_sobral@2: rm -f "$depfile"
leo_sobral@2: echo "$object : \\" > "$depfile"
leo_sobral@2: cat < "$tmpdepfile" >> "$depfile"
leo_sobral@2: sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile"
leo_sobral@2: rm -f "$tmpdepfile"
leo_sobral@2: ;;
leo_sobral@2:
leo_sobral@2: msvisualcpp)
leo_sobral@2: # Important note: in order to support this mode, a compiler *must*
leo_sobral@2: # always write the preprocessed file to stdout, regardless of -o,
leo_sobral@2: # because we must use -o when running libtool.
leo_sobral@2: "$@" || exit $?
leo_sobral@2: IFS=" "
leo_sobral@2: for arg
leo_sobral@2: do
leo_sobral@2: case "$arg" in
leo_sobral@2: "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
leo_sobral@2: set fnord "$@"
leo_sobral@2: shift
leo_sobral@2: shift
leo_sobral@2: ;;
leo_sobral@2: *)
leo_sobral@2: set fnord "$@" "$arg"
leo_sobral@2: shift
leo_sobral@2: shift
leo_sobral@2: ;;
leo_sobral@2: esac
leo_sobral@2: done
leo_sobral@2: "$@" -E |
leo_sobral@2: sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile"
leo_sobral@2: rm -f "$depfile"
leo_sobral@2: echo "$object : \\" > "$depfile"
leo_sobral@2: . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile"
leo_sobral@2: echo " " >> "$depfile"
leo_sobral@2: . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile"
leo_sobral@2: rm -f "$tmpdepfile"
leo_sobral@2: ;;
leo_sobral@2:
leo_sobral@2: none)
leo_sobral@2: exec "$@"
leo_sobral@2: ;;
leo_sobral@2:
leo_sobral@2: *)
leo_sobral@2: echo "Unknown depmode $depmode" 1>&2
leo_sobral@2: exit 1
leo_sobral@2: ;;
leo_sobral@2: esac
leo_sobral@2:
leo_sobral@2: exit 0
leo_sobral@2:
leo_sobral@2: # Local Variables:
leo_sobral@2: # mode: shell-script
leo_sobral@2: # sh-indentation: 2
leo_sobral@2: # eval: (add-hook 'write-file-hooks 'time-stamp)
leo_sobral@2: # time-stamp-start: "scriptversion="
leo_sobral@2: # time-stamp-format: "%:y-%02m-%02d.%02H"
leo_sobral@2: # time-stamp-end: "$"
leo_sobral@2: # End: