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