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