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