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