~ubuntu-branches/ubuntu/maverick/avr-libc/maverick

« back to all changes in this revision

Viewing changes to depcomp

  • Committer: Bazaar Package Importer
  • Author(s): Hakan Ardo
  • Date: 2009-10-31 11:52:10 UTC
  • mfrom: (1.1.8 upstream) (4.1.2 squeeze)
  • Revision ID: james.westby@ubuntu.com-20091031115210-x0mlijnegkce86fk
Tags: 1:1.6.7-1
* New upstream relese (closes: #544030)
* Added lintian overrides (closes: #553265)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#! /bin/sh
2
2
# depcomp - compile a program generating dependencies as side-effects
3
3
 
4
 
scriptversion=2005-07-09.11
 
4
scriptversion=2004-05-31.23
5
5
 
6
 
# Copyright (C) 1999, 2000, 2003, 2004, 2005 Free Software Foundation, Inc.
 
6
# Copyright (C) 1999, 2000, 2003, 2004 Free Software Foundation, Inc.
7
7
 
8
8
# This program is free software; you can redistribute it and/or modify
9
9
# it under the terms of the GNU General Public License as published by
17
17
 
18
18
# You should have received a copy of the GNU General Public License
19
19
# along with this program; if not, write to the Free Software
20
 
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
21
 
# 02110-1301, USA.
 
20
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 
21
# 02111-1307, USA.
22
22
 
23
23
# As a special exception to the GNU General Public License, if you
24
24
# distribute this file as part of a program that contains a
50
50
 
51
51
Report bugs to <bug-automake@gnu.org>.
52
52
EOF
53
 
    exit $?
 
53
    exit 0
54
54
    ;;
55
55
  -v | --v*)
56
56
    echo "depcomp $scriptversion"
57
 
    exit $?
 
57
    exit 0
58
58
    ;;
59
59
esac
60
60
 
287
287
   base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
288
288
 
289
289
   if test "$libtool" = yes; then
290
 
      # With Tru64 cc, shared objects can also be used to make a
291
 
      # static library.  This mecanism is used in libtool 1.4 series to
292
 
      # handle both shared and static libraries in a single compilation.
293
 
      # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d.
294
 
      #
295
 
      # With libtool 1.5 this exception was removed, and libtool now
296
 
      # generates 2 separate objects for the 2 libraries.  These two
297
 
      # compilations output dependencies in in $dir.libs/$base.o.d and
298
 
      # in $dir$base.o.d.  We have to check for both files, because
299
 
      # one of the two compilations can be disabled.  We should prefer
300
 
      # $dir$base.o.d over $dir.libs/$base.o.d because the latter is
301
 
      # automatically cleaned when .libs/ is deleted, while ignoring
302
 
      # the former would cause a distcleancheck panic.
303
 
      tmpdepfile1=$dir.libs/$base.lo.d   # libtool 1.4
304
 
      tmpdepfile2=$dir$base.o.d          # libtool 1.5
305
 
      tmpdepfile3=$dir.libs/$base.o.d    # libtool 1.5
306
 
      tmpdepfile4=$dir.libs/$base.d      # Compaq CCC V6.2-504
 
290
      # Dependencies are output in .lo.d with libtool 1.4.
 
291
      # With libtool 1.5 they are output both in $dir.libs/$base.o.d
 
292
      # and in $dir.libs/$base.o.d and $dir$base.o.d.  We process the
 
293
      # latter, because the former will be cleaned when $dir.libs is
 
294
      # erased.
 
295
      tmpdepfile1="$dir.libs/$base.lo.d"
 
296
      tmpdepfile2="$dir$base.o.d"
 
297
      tmpdepfile3="$dir.libs/$base.d"
307
298
      "$@" -Wc,-MD
308
299
   else
309
 
      tmpdepfile1=$dir$base.o.d
310
 
      tmpdepfile2=$dir$base.d
311
 
      tmpdepfile3=$dir$base.d
312
 
      tmpdepfile4=$dir$base.d
 
300
      tmpdepfile1="$dir$base.o.d"
 
301
      tmpdepfile2="$dir$base.d"
 
302
      tmpdepfile3="$dir$base.d"
313
303
      "$@" -MD
314
304
   fi
315
305
 
316
306
   stat=$?
317
307
   if test $stat -eq 0; then :
318
308
   else
319
 
      rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
 
309
      rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
320
310
      exit $stat
321
311
   fi
322
312
 
323
 
   for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
324
 
   do
325
 
     test -f "$tmpdepfile" && break
326
 
   done
 
313
   if test -f "$tmpdepfile1"; then
 
314
      tmpdepfile="$tmpdepfile1"
 
315
   elif test -f "$tmpdepfile2"; then
 
316
      tmpdepfile="$tmpdepfile2"
 
317
   else
 
318
      tmpdepfile="$tmpdepfile3"
 
319
   fi
327
320
   if test -f "$tmpdepfile"; then
328
321
      sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
329
322
      # That's a tab and a space in the [].
467
460
  done
468
461
 
469
462
  "$@" -E |
470
 
    sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
471
 
       -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |
 
463
    sed -n '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |
472
464
    sed '$ s: \\$::' > "$tmpdepfile"
473
465
  rm -f "$depfile"
474
466
  echo "$object : \\" > "$depfile"