Erik Grinaker is sharing code with you

Bitbucket is a code hosting site. Unlimited public and private repositories. Free for small teams.

Don't show this again

erikg / Revelation

Revelation is a password manager for the GNOME desktop, released under the GNU GPL license. It stores all your accounts and passwords in a single, secure place, and gives you access to it through a user-friendly graphical interface.

Clone this repository (size: 2.0 MB): HTTPS / SSH
hg clone https://bitbucket.org/erikg/revelation
hg clone ssh://hg@bitbucket.org/erikg/revelation

Revelation / depcomp

commit
35864a73a048
parent
070d0062872f
branch
default
tags
revelation-0.4.3

bumped version number to 0.4.3

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