Search
lxdream.org :: lxdream/depcomp
lxdream 0.9.1
released Jun 29
Download Now
filename depcomp
changeset 179:18dacd91aa73
author nkeynes
date Sat Aug 05 00:18:21 2006 +0000 (13 years ago)
permissions -rwxr-xr-x
last change Add error lines to tests with incomplete polys
Split clip tests to separate data file
Add tests for cmd bit 23 ("use list size field")
file annotate diff log raw
nkeynes@179
     1
#! /bin/sh
nkeynes@179
     2
nkeynes@179
     3
# depcomp - compile a program generating dependencies as side-effects
nkeynes@179
     4
# Copyright 1999, 2000, 2003 Free Software Foundation, Inc.
nkeynes@179
     5
nkeynes@179
     6
# This program is free software; you can redistribute it and/or modify
nkeynes@179
     7
# it under the terms of the GNU General Public License as published by
nkeynes@179
     8
# the Free Software Foundation; either version 2, or (at your option)
nkeynes@179
     9
# any later version.
nkeynes@179
    10
nkeynes@179
    11
# This program is distributed in the hope that it will be useful,
nkeynes@179
    12
# but WITHOUT ANY WARRANTY; without even the implied warranty of
nkeynes@179
    13
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
nkeynes@179
    14
# GNU General Public License for more details.
nkeynes@179
    15
nkeynes@179
    16
# You should have received a copy of the GNU General Public License
nkeynes@179
    17
# along with this program; if not, write to the Free Software
nkeynes@179
    18
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
nkeynes@179
    19
# 02111-1307, USA.
nkeynes@179
    20
nkeynes@179
    21
# As a special exception to the GNU General Public License, if you
nkeynes@179
    22
# distribute this file as part of a program that contains a
nkeynes@179
    23
# configuration script generated by Autoconf, you may include it under
nkeynes@179
    24
# the same distribution terms that you use for the rest of that program.
nkeynes@179
    25
nkeynes@179
    26
# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>.
nkeynes@179
    27
nkeynes@179
    28
if test -z "$depmode" || test -z "$source" || test -z "$object"; then
nkeynes@179
    29
  echo "depcomp: Variables source, object and depmode must be set" 1>&2
nkeynes@179
    30
  exit 1
nkeynes@179
    31
fi
nkeynes@179
    32
# `libtool' can also be set to `yes' or `no'.
nkeynes@179
    33
nkeynes@179
    34
if test -z "$depfile"; then
nkeynes@179
    35
   base=`echo "$object" | sed -e 's,^.*/,,' -e 's,\.\([^.]*\)$,.P\1,'`
nkeynes@179
    36
   dir=`echo "$object" | sed 's,/.*$,/,'`
nkeynes@179
    37
   if test "$dir" = "$object"; then
nkeynes@179
    38
      dir=
nkeynes@179
    39
   fi
nkeynes@179
    40
   # FIXME: should be _deps on DOS.
nkeynes@179
    41
   depfile="$dir.deps/$base"
nkeynes@179
    42
fi
nkeynes@179
    43
nkeynes@179
    44
tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
nkeynes@179
    45
nkeynes@179
    46
rm -f "$tmpdepfile"
nkeynes@179
    47
nkeynes@179
    48
# Some modes work just like other modes, but use different flags.  We
nkeynes@179
    49
# parameterize here, but still list the modes in the big case below,
nkeynes@179
    50
# to make depend.m4 easier to write.  Note that we *cannot* use a case
nkeynes@179
    51
# here, because this file can only contain one case statement.
nkeynes@179
    52
if test "$depmode" = hp; then
nkeynes@179
    53
  # HP compiler uses -M and no extra arg.
nkeynes@179
    54
  gccflag=-M
nkeynes@179
    55
  depmode=gcc
nkeynes@179
    56
fi
nkeynes@179
    57
nkeynes@179
    58
if test "$depmode" = dashXmstdout; then
nkeynes@179
    59
   # This is just like dashmstdout with a different argument.
nkeynes@179
    60
   dashmflag=-xM
nkeynes@179
    61
   depmode=dashmstdout
nkeynes@179
    62
fi
nkeynes@179
    63
nkeynes@179
    64
case "$depmode" in
nkeynes@179
    65
gcc3)
nkeynes@179
    66
## gcc 3 implements dependency tracking that does exactly what
nkeynes@179
    67
## we want.  Yay!  Note: for some reason libtool 1.4 doesn't like
nkeynes@179
    68
## it if -MD -MP comes after the -MF stuff.  Hmm.
nkeynes@179
    69
  "$@" -MT "$object" -MD -MP -MF "$tmpdepfile"
nkeynes@179
    70
  stat=$?
nkeynes@179
    71
  if test $stat -eq 0; then :
nkeynes@179
    72
  else
nkeynes@179
    73
    rm -f "$tmpdepfile"
nkeynes@179
    74
    exit $stat
nkeynes@179
    75
  fi
nkeynes@179
    76
  mv "$tmpdepfile" "$depfile"
nkeynes@179
    77
  ;;
nkeynes@179
    78
nkeynes@179
    79
gcc)
nkeynes@179
    80
## There are various ways to get dependency output from gcc.  Here's
nkeynes@179
    81
## why we pick this rather obscure method:
nkeynes@179
    82
## - Don't want to use -MD because we'd like the dependencies to end
nkeynes@179
    83
##   up in a subdir.  Having to rename by hand is ugly.
nkeynes@179
    84
##   (We might end up doing this anyway to support other compilers.)
nkeynes@179
    85
## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
nkeynes@179
    86
##   -MM, not -M (despite what the docs say).
nkeynes@179
    87
## - Using -M directly means running the compiler twice (even worse
nkeynes@179
    88
##   than renaming).
nkeynes@179
    89
  if test -z "$gccflag"; then
nkeynes@179
    90
    gccflag=-MD,
nkeynes@179
    91
  fi
nkeynes@179
    92
  "$@" -Wp,"$gccflag$tmpdepfile"
nkeynes@179
    93
  stat=$?
nkeynes@179
    94
  if test $stat -eq 0; then :
nkeynes@179
    95
  else
nkeynes@179
    96
    rm -f "$tmpdepfile"
nkeynes@179
    97
    exit $stat
nkeynes@179
    98
  fi
nkeynes@179
    99
  rm -f "$depfile"
nkeynes@179
   100
  echo "$object : \\" > "$depfile"
nkeynes@179
   101
  alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
nkeynes@179
   102
## The second -e expression handles DOS-style file names with drive letters.
nkeynes@179
   103
  sed -e 's/^[^:]*: / /' \
nkeynes@179
   104
      -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
nkeynes@179
   105
## This next piece of magic avoids the `deleted header file' problem.
nkeynes@179
   106
## The problem is that when a header file which appears in a .P file
nkeynes@179
   107
## is deleted, the dependency causes make to die (because there is
nkeynes@179
   108
## typically no way to rebuild the header).  We avoid this by adding
nkeynes@179
   109
## dummy dependencies for each header file.  Too bad gcc doesn't do
nkeynes@179
   110
## this for us directly.
nkeynes@179
   111
  tr ' ' '
nkeynes@179
   112
' < "$tmpdepfile" |
nkeynes@179
   113
## Some versions of gcc put a space before the `:'.  On the theory
nkeynes@179
   114
## that the space means something, we add a space to the output as
nkeynes@179
   115
## well.
nkeynes@179
   116
## Some versions of the HPUX 10.20 sed can't process this invocation
nkeynes@179
   117
## correctly.  Breaking it into two sed invocations is a workaround.
nkeynes@179
   118
    sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
nkeynes@179
   119
  rm -f "$tmpdepfile"
nkeynes@179
   120
  ;;
nkeynes@179
   121
nkeynes@179
   122
hp)
nkeynes@179
   123
  # This case exists only to let depend.m4 do its work.  It works by
nkeynes@179
   124
  # looking at the text of this script.  This case will never be run,
nkeynes@179
   125
  # since it is checked for above.
nkeynes@179
   126
  exit 1
nkeynes@179
   127
  ;;
nkeynes@179
   128
nkeynes@179
   129
sgi)
nkeynes@179
   130
  if test "$libtool" = yes; then
nkeynes@179
   131
    "$@" "-Wp,-MDupdate,$tmpdepfile"
nkeynes@179
   132
  else
nkeynes@179
   133
    "$@" -MDupdate "$tmpdepfile"
nkeynes@179
   134
  fi
nkeynes@179
   135
  stat=$?
nkeynes@179
   136
  if test $stat -eq 0; then :
nkeynes@179
   137
  else
nkeynes@179
   138
    rm -f "$tmpdepfile"
nkeynes@179
   139
    exit $stat
nkeynes@179
   140
  fi
nkeynes@179
   141
  rm -f "$depfile"
nkeynes@179
   142
nkeynes@179
   143
  if test -f "$tmpdepfile"; then  # yes, the sourcefile depend on other files
nkeynes@179
   144
    echo "$object : \\" > "$depfile"
nkeynes@179
   145
nkeynes@179
   146
    # Clip off the initial element (the dependent).  Don't try to be
nkeynes@179
   147
    # clever and replace this with sed code, as IRIX sed won't handle
nkeynes@179
   148
    # lines with more than a fixed number of characters (4096 in
nkeynes@179
   149
    # IRIX 6.2 sed, 8192 in IRIX 6.5).  We also remove comment lines;
nkeynes@179
   150
    # the IRIX cc adds comments like `#:fec' to the end of the
nkeynes@179
   151
    # dependency line.
nkeynes@179
   152
    tr ' ' '
nkeynes@179
   153
' < "$tmpdepfile" \
nkeynes@179
   154
    | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
nkeynes@179
   155
    tr '
nkeynes@179
   156
' ' ' >> $depfile
nkeynes@179
   157
    echo >> $depfile
nkeynes@179
   158
nkeynes@179
   159
    # The second pass generates a dummy entry for each header file.
nkeynes@179
   160
    tr ' ' '
nkeynes@179
   161
' < "$tmpdepfile" \
nkeynes@179
   162
   | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
nkeynes@179
   163
   >> $depfile
nkeynes@179
   164
  else
nkeynes@179
   165
    # The sourcefile does not contain any dependencies, so just
nkeynes@179
   166
    # store a dummy comment line, to avoid errors with the Makefile
nkeynes@179
   167
    # "include basename.Plo" scheme.
nkeynes@179
   168
    echo "#dummy" > "$depfile"
nkeynes@179
   169
  fi
nkeynes@179
   170
  rm -f "$tmpdepfile"
nkeynes@179
   171
  ;;
nkeynes@179
   172
nkeynes@179
   173
aix)
nkeynes@179
   174
  # The C for AIX Compiler uses -M and outputs the dependencies
nkeynes@179
   175
  # in a .u file.  In older versions, this file always lives in the
nkeynes@179
   176
  # current directory.  Also, the AIX compiler puts `$object:' at the
nkeynes@179
   177
  # start of each line; $object doesn't have directory information.
nkeynes@179
   178
  # Version 6 uses the directory in both cases.
nkeynes@179
   179
  stripped=`echo "$object" | sed 's/\(.*\)\..*$/\1/'`
nkeynes@179
   180
  tmpdepfile="$stripped.u"
nkeynes@179
   181
  if test "$libtool" = yes; then
nkeynes@179
   182
    "$@" -Wc,-M
nkeynes@179
   183
  else
nkeynes@179
   184
    "$@" -M
nkeynes@179
   185
  fi
nkeynes@179
   186
  stat=$?
nkeynes@179
   187
nkeynes@179
   188
  if test -f "$tmpdepfile"; then :
nkeynes@179
   189
  else
nkeynes@179
   190
    stripped=`echo "$stripped" | sed 's,^.*/,,'`
nkeynes@179
   191
    tmpdepfile="$stripped.u"
nkeynes@179
   192
  fi
nkeynes@179
   193
nkeynes@179
   194
  if test $stat -eq 0; then :
nkeynes@179
   195
  else
nkeynes@179
   196
    rm -f "$tmpdepfile"
nkeynes@179
   197
    exit $stat
nkeynes@179
   198
  fi
nkeynes@179
   199
nkeynes@179
   200
  if test -f "$tmpdepfile"; then
nkeynes@179
   201
    outname="$stripped.o"
nkeynes@179
   202
    # Each line is of the form `foo.o: dependent.h'.
nkeynes@179
   203
    # Do two passes, one to just change these to
nkeynes@179
   204
    # `$object: dependent.h' and one to simply `dependent.h:'.
nkeynes@179
   205
    sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile"
nkeynes@179
   206
    sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile"
nkeynes@179
   207
  else
nkeynes@179
   208
    # The sourcefile does not contain any dependencies, so just
nkeynes@179
   209
    # store a dummy comment line, to avoid errors with the Makefile
nkeynes@179
   210
    # "include basename.Plo" scheme.
nkeynes@179
   211
    echo "#dummy" > "$depfile"
nkeynes@179
   212
  fi
nkeynes@179
   213
  rm -f "$tmpdepfile"
nkeynes@179
   214
  ;;
nkeynes@179
   215
nkeynes@179
   216
icc)
nkeynes@179
   217
  # Intel's C compiler understands `-MD -MF file'.  However on
nkeynes@179
   218
  #    icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c
nkeynes@179
   219
  # ICC 7.0 will fill foo.d with something like
nkeynes@179
   220
  #    foo.o: sub/foo.c
nkeynes@179
   221
  #    foo.o: sub/foo.h
nkeynes@179
   222
  # which is wrong.  We want:
nkeynes@179
   223
  #    sub/foo.o: sub/foo.c
nkeynes@179
   224
  #    sub/foo.o: sub/foo.h
nkeynes@179
   225
  #    sub/foo.c:
nkeynes@179
   226
  #    sub/foo.h:
nkeynes@179
   227
  # ICC 7.1 will output
nkeynes@179
   228
  #    foo.o: sub/foo.c sub/foo.h
nkeynes@179
   229
  # and will wrap long lines using \ :
nkeynes@179
   230
  #    foo.o: sub/foo.c ... \
nkeynes@179
   231
  #     sub/foo.h ... \
nkeynes@179
   232
  #     ...
nkeynes@179
   233
nkeynes@179
   234
  "$@" -MD -MF "$tmpdepfile"
nkeynes@179
   235
  stat=$?
nkeynes@179
   236
  if test $stat -eq 0; then :
nkeynes@179
   237
  else
nkeynes@179
   238
    rm -f "$tmpdepfile"
nkeynes@179
   239
    exit $stat
nkeynes@179
   240
  fi
nkeynes@179
   241
  rm -f "$depfile"
nkeynes@179
   242
  # Each line is of the form `foo.o: dependent.h',
nkeynes@179
   243
  # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'.
nkeynes@179
   244
  # Do two passes, one to just change these to
nkeynes@179
   245
  # `$object: dependent.h' and one to simply `dependent.h:'.
nkeynes@179
   246
  sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
nkeynes@179
   247
  # Some versions of the HPUX 10.20 sed can't process this invocation
nkeynes@179
   248
  # correctly.  Breaking it into two sed invocations is a workaround.
nkeynes@179
   249
  sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" |
nkeynes@179
   250
    sed -e 's/$/ :/' >> "$depfile"
nkeynes@179
   251
  rm -f "$tmpdepfile"
nkeynes@179
   252
  ;;
nkeynes@179
   253
nkeynes@179
   254
tru64)
nkeynes@179
   255
   # The Tru64 compiler uses -MD to generate dependencies as a side
nkeynes@179
   256
   # effect.  `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'.
nkeynes@179
   257
   # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
nkeynes@179
   258
   # dependencies in `foo.d' instead, so we check for that too.
nkeynes@179
   259
   # Subdirectories are respected.
nkeynes@179
   260
   dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
nkeynes@179
   261
   test "x$dir" = "x$object" && dir=
nkeynes@179
   262
   base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
nkeynes@179
   263
nkeynes@179
   264
   if test "$libtool" = yes; then
nkeynes@179
   265
      tmpdepfile1="$dir.libs/$base.lo.d"
nkeynes@179
   266
      tmpdepfile2="$dir.libs/$base.d"
nkeynes@179
   267
      "$@" -Wc,-MD
nkeynes@179
   268
   else
nkeynes@179
   269
      tmpdepfile1="$dir$base.o.d"
nkeynes@179
   270
      tmpdepfile2="$dir$base.d"
nkeynes@179
   271
      "$@" -MD
nkeynes@179
   272
   fi
nkeynes@179
   273
nkeynes@179
   274
   stat=$?
nkeynes@179
   275
   if test $stat -eq 0; then :
nkeynes@179
   276
   else
nkeynes@179
   277
      rm -f "$tmpdepfile1" "$tmpdepfile2"
nkeynes@179
   278
      exit $stat
nkeynes@179
   279
   fi
nkeynes@179
   280
nkeynes@179
   281
   if test -f "$tmpdepfile1"; then
nkeynes@179
   282
      tmpdepfile="$tmpdepfile1"
nkeynes@179
   283
   else
nkeynes@179
   284
      tmpdepfile="$tmpdepfile2"
nkeynes@179
   285
   fi
nkeynes@179
   286
   if test -f "$tmpdepfile"; then
nkeynes@179
   287
      sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
nkeynes@179
   288
      # That's a tab and a space in the [].
nkeynes@179
   289
      sed -e 's,^.*\.[a-z]*:[	 ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
nkeynes@179
   290
   else
nkeynes@179
   291
      echo "#dummy" > "$depfile"
nkeynes@179
   292
   fi
nkeynes@179
   293
   rm -f "$tmpdepfile"
nkeynes@179
   294
   ;;
nkeynes@179
   295
nkeynes@179
   296
#nosideeffect)
nkeynes@179
   297
  # This comment above is used by automake to tell side-effect
nkeynes@179
   298
  # dependency tracking mechanisms from slower ones.
nkeynes@179
   299
nkeynes@179
   300
dashmstdout)
nkeynes@179
   301
  # Important note: in order to support this mode, a compiler *must*
nkeynes@179
   302
  # always write the preprocessed file to stdout, regardless of -o.
nkeynes@179
   303
  "$@" || exit $?
nkeynes@179
   304
nkeynes@179
   305
  # Remove the call to Libtool.
nkeynes@179
   306
  if test "$libtool" = yes; then
nkeynes@179
   307
    while test $1 != '--mode=compile'; do
nkeynes@179
   308
      shift
nkeynes@179
   309
    done
nkeynes@179
   310
    shift
nkeynes@179
   311
  fi
nkeynes@179
   312
nkeynes@179
   313
  # Remove `-o $object'.
nkeynes@179
   314
  IFS=" "
nkeynes@179
   315
  for arg
nkeynes@179
   316
  do
nkeynes@179
   317
    case $arg in
nkeynes@179
   318
    -o)
nkeynes@179
   319
      shift
nkeynes@179
   320
      ;;
nkeynes@179
   321
    $object)
nkeynes@179
   322
      shift
nkeynes@179
   323
      ;;
nkeynes@179
   324
    *)
nkeynes@179
   325
      set fnord "$@" "$arg"
nkeynes@179
   326
      shift # fnord
nkeynes@179
   327
      shift # $arg
nkeynes@179
   328
      ;;
nkeynes@179
   329
    esac
nkeynes@179
   330
  done
nkeynes@179
   331
nkeynes@179
   332
  test -z "$dashmflag" && dashmflag=-M
nkeynes@179
   333
  # Require at least two characters before searching for `:'
nkeynes@179
   334
  # in the target name.  This is to cope with DOS-style filenames:
nkeynes@179
   335
  # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise.
nkeynes@179
   336
  "$@" $dashmflag |
nkeynes@179
   337
    sed 's:^[  ]*[^: ][^:][^:]*\:[    ]*:'"$object"'\: :' > "$tmpdepfile"
nkeynes@179
   338
  rm -f "$depfile"
nkeynes@179
   339
  cat < "$tmpdepfile" > "$depfile"
nkeynes@179
   340
  tr ' ' '
nkeynes@179
   341
' < "$tmpdepfile" | \
nkeynes@179
   342
## Some versions of the HPUX 10.20 sed can't process this invocation
nkeynes@179
   343
## correctly.  Breaking it into two sed invocations is a workaround.
nkeynes@179
   344
    sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
nkeynes@179
   345
  rm -f "$tmpdepfile"
nkeynes@179
   346
  ;;
nkeynes@179
   347
nkeynes@179
   348
dashXmstdout)
nkeynes@179
   349
  # This case only exists to satisfy depend.m4.  It is never actually
nkeynes@179
   350
  # run, as this mode is specially recognized in the preamble.
nkeynes@179
   351
  exit 1
nkeynes@179
   352
  ;;
nkeynes@179
   353
nkeynes@179
   354
makedepend)
nkeynes@179
   355
  "$@" || exit $?
nkeynes@179
   356
  # Remove any Libtool call
nkeynes@179
   357
  if test "$libtool" = yes; then
nkeynes@179
   358
    while test $1 != '--mode=compile'; do
nkeynes@179
   359
      shift
nkeynes@179
   360
    done
nkeynes@179
   361
    shift
nkeynes@179
   362
  fi
nkeynes@179
   363
  # X makedepend
nkeynes@179
   364
  shift
nkeynes@179
   365
  cleared=no
nkeynes@179
   366
  for arg in "$@"; do
nkeynes@179
   367
    case $cleared in
nkeynes@179
   368
    no)
nkeynes@179
   369
      set ""; shift
nkeynes@179
   370
      cleared=yes ;;
nkeynes@179
   371
    esac
nkeynes@179
   372
    case "$arg" in
nkeynes@179
   373
    -D*|-I*)
nkeynes@179
   374
      set fnord "$@" "$arg"; shift ;;
nkeynes@179
   375
    # Strip any option that makedepend may not understand.  Remove
nkeynes@179
   376
    # the object too, otherwise makedepend will parse it as a source file.
nkeynes@179
   377
    -*|$object)
nkeynes@179
   378
      ;;
nkeynes@179
   379
    *)
nkeynes@179
   380
      set fnord "$@" "$arg"; shift ;;
nkeynes@179
   381
    esac
nkeynes@179
   382
  done
nkeynes@179
   383
  obj_suffix="`echo $object | sed 's/^.*\././'`"
nkeynes@179
   384
  touch "$tmpdepfile"
nkeynes@179
   385
  ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
nkeynes@179
   386
  rm -f "$depfile"
nkeynes@179
   387
  cat < "$tmpdepfile" > "$depfile"
nkeynes@179
   388
  sed '1,2d' "$tmpdepfile" | tr ' ' '
nkeynes@179
   389
' | \
nkeynes@179
   390
## Some versions of the HPUX 10.20 sed can't process this invocation
nkeynes@179
   391
## correctly.  Breaking it into two sed invocations is a workaround.
nkeynes@179
   392
    sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
nkeynes@179
   393
  rm -f "$tmpdepfile" "$tmpdepfile".bak
nkeynes@179
   394
  ;;
nkeynes@179
   395
nkeynes@179
   396
cpp)
nkeynes@179
   397
  # Important note: in order to support this mode, a compiler *must*
nkeynes@179
   398
  # always write the preprocessed file to stdout.
nkeynes@179
   399
  "$@" || exit $?
nkeynes@179
   400
nkeynes@179
   401
  # Remove the call to Libtool.
nkeynes@179
   402
  if test "$libtool" = yes; then
nkeynes@179
   403
    while test $1 != '--mode=compile'; do
nkeynes@179
   404
      shift
nkeynes@179
   405
    done
nkeynes@179
   406
    shift
nkeynes@179
   407
  fi
nkeynes@179
   408
nkeynes@179
   409
  # Remove `-o $object'.
nkeynes@179
   410
  IFS=" "
nkeynes@179
   411
  for arg
nkeynes@179
   412
  do
nkeynes@179
   413
    case $arg in
nkeynes@179
   414
    -o)
nkeynes@179
   415
      shift
nkeynes@179
   416
      ;;
nkeynes@179
   417
    $object)
nkeynes@179
   418
      shift
nkeynes@179
   419
      ;;
nkeynes@179
   420
    *)
nkeynes@179
   421
      set fnord "$@" "$arg"
nkeynes@179
   422
      shift # fnord
nkeynes@179
   423
      shift # $arg
nkeynes@179
   424
      ;;
nkeynes@179
   425
    esac
nkeynes@179
   426
  done
nkeynes@179
   427
nkeynes@179
   428
  "$@" -E |
nkeynes@179
   429
    sed -n '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |
nkeynes@179
   430
    sed '$ s: \\$::' > "$tmpdepfile"
nkeynes@179
   431
  rm -f "$depfile"
nkeynes@179
   432
  echo "$object : \\" > "$depfile"
nkeynes@179
   433
  cat < "$tmpdepfile" >> "$depfile"
nkeynes@179
   434
  sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile"
nkeynes@179
   435
  rm -f "$tmpdepfile"
nkeynes@179
   436
  ;;
nkeynes@179
   437
nkeynes@179
   438
msvisualcpp)
nkeynes@179
   439
  # Important note: in order to support this mode, a compiler *must*
nkeynes@179
   440
  # always write the preprocessed file to stdout, regardless of -o,
nkeynes@179
   441
  # because we must use -o when running libtool.
nkeynes@179
   442
  "$@" || exit $?
nkeynes@179
   443
  IFS=" "
nkeynes@179
   444
  for arg
nkeynes@179
   445
  do
nkeynes@179
   446
    case "$arg" in
nkeynes@179
   447
    "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
nkeynes@179
   448
	set fnord "$@"
nkeynes@179
   449
	shift
nkeynes@179
   450
	shift
nkeynes@179
   451
	;;
nkeynes@179
   452
    *)
nkeynes@179
   453
	set fnord "$@" "$arg"
nkeynes@179
   454
	shift
nkeynes@179
   455
	shift
nkeynes@179
   456
	;;
nkeynes@179
   457
    esac
nkeynes@179
   458
  done
nkeynes@179
   459
  "$@" -E |
nkeynes@179
   460
  sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile"
nkeynes@179
   461
  rm -f "$depfile"
nkeynes@179
   462
  echo "$object : \\" > "$depfile"
nkeynes@179
   463
  . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::	\1 \\:p' >> "$depfile"
nkeynes@179
   464
  echo "	" >> "$depfile"
nkeynes@179
   465
  . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile"
nkeynes@179
   466
  rm -f "$tmpdepfile"
nkeynes@179
   467
  ;;
nkeynes@179
   468
nkeynes@179
   469
none)
nkeynes@179
   470
  exec "$@"
nkeynes@179
   471
  ;;
nkeynes@179
   472
nkeynes@179
   473
*)
nkeynes@179
   474
  echo "Unknown depmode $depmode" 1>&2
nkeynes@179
   475
  exit 1
nkeynes@179
   476
  ;;
nkeynes@179
   477
esac
nkeynes@179
   478
nkeynes@179
   479
exit 0
.