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