~ubuntu-branches/ubuntu/raring/libcddb/raring

« back to all changes in this revision

Viewing changes to depcomp

  • Committer: Bazaar Package Importer
  • Author(s): Julien Lavergne
  • Date: 2010-01-17 18:24:43 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20100117182443-lnkwqi0fvdc5c4jg
Tags: 1.3.2-0ubuntu1
* New upstream release.
 - Fix a crash on aqualung (LP: #316056)
* debian/control:
 - Build-depends on libcdio-dev (>= 0.76).
 - Add Section libs.
 - Use ${binary:Version} instead of ${Source-Version} substvar.
 - Add missing ${misc:Depends}.
 - Build-depends on debhelper (>= 5.0.0).
* debian/rules:
 - Update SONAME minor version.
 - Don't ignore error on distclean.
 - Use debian/compat instead of using export DH_COMPAT.
* debian/*.install:
 - Remove unused /usr/lib/include/* location.
* debian/libcddb2.postinst & libcddb2.postrm:
 - Remove, it's automatically handle by debhelper.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#! /bin/sh
2
 
 
3
2
# depcomp - compile a program generating dependencies as side-effects
4
 
# Copyright 1999, 2000 Free Software Foundation, Inc.
 
3
 
 
4
scriptversion=2007-03-29.01
 
5
 
 
6
# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007 Free Software
 
7
# Foundation, Inc.
5
8
 
6
9
# This program is free software; you can redistribute it and/or modify
7
10
# it under the terms of the GNU General Public License as published by
15
18
 
16
19
# You should have received a copy of the GNU General Public License
17
20
# along with this program; if not, write to the Free Software
18
 
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
19
 
# 02111-1307, USA.
 
21
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
 
22
# 02110-1301, USA.
20
23
 
21
24
# As a special exception to the GNU General Public License, if you
22
25
# distribute this file as part of a program that contains a
25
28
 
26
29
# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>.
27
30
 
 
31
case $1 in
 
32
  '')
 
33
     echo "$0: No command.  Try \`$0 --help' for more information." 1>&2
 
34
     exit 1;
 
35
     ;;
 
36
  -h | --h*)
 
37
    cat <<\EOF
 
38
Usage: depcomp [--help] [--version] PROGRAM [ARGS]
 
39
 
 
40
Run PROGRAMS ARGS to compile a file, generating dependencies
 
41
as side-effects.
 
42
 
 
43
Environment variables:
 
44
  depmode     Dependency tracking mode.
 
45
  source      Source file read by `PROGRAMS ARGS'.
 
46
  object      Object file output by `PROGRAMS ARGS'.
 
47
  DEPDIR      directory where to store dependencies.
 
48
  depfile     Dependency file to output.
 
49
  tmpdepfile  Temporary file to use when outputing dependencies.
 
50
  libtool     Whether libtool is used (yes/no).
 
51
 
 
52
Report bugs to <bug-automake@gnu.org>.
 
53
EOF
 
54
    exit $?
 
55
    ;;
 
56
  -v | --v*)
 
57
    echo "depcomp $scriptversion"
 
58
    exit $?
 
59
    ;;
 
60
esac
 
61
 
28
62
if test -z "$depmode" || test -z "$source" || test -z "$object"; then
29
63
  echo "depcomp: Variables source, object and depmode must be set" 1>&2
30
64
  exit 1
31
65
fi
32
 
# `libtool' can also be set to `yes' or `no'.
33
 
 
34
 
if test -z "$depfile"; then
35
 
   base=`echo "$object" | sed -e 's,^.*/,,' -e 's,\.\([^.]*\)$,.P\1,'`
36
 
   dir=`echo "$object" | sed 's,/.*$,/,'`
37
 
   if test "$dir" = "$object"; then
38
 
      dir=
39
 
   fi
40
 
   # FIXME: should be _deps on DOS.
41
 
   depfile="$dir.deps/$base"
42
 
fi
43
 
 
 
66
 
 
67
# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po.
 
68
depfile=${depfile-`echo "$object" |
 
69
  sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`}
44
70
tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
45
71
 
46
72
rm -f "$tmpdepfile"
66
92
## gcc 3 implements dependency tracking that does exactly what
67
93
## we want.  Yay!  Note: for some reason libtool 1.4 doesn't like
68
94
## it if -MD -MP comes after the -MF stuff.  Hmm.
69
 
  "$@" -MT "$object" -MD -MP -MF "$tmpdepfile"
 
95
## Unfortunately, FreeBSD c89 acceptance of flags depends upon
 
96
## the command line argument order; so add the flags where they
 
97
## appear in depend2.am.  Note that the slowdown incurred here
 
98
## affects only configure: in makefiles, %FASTDEP% shortcuts this.
 
99
  for arg
 
100
  do
 
101
    case $arg in
 
102
    -c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;;
 
103
    *)  set fnord "$@" "$arg" ;;
 
104
    esac
 
105
    shift # fnord
 
106
    shift # $arg
 
107
  done
 
108
  "$@"
70
109
  stat=$?
71
110
  if test $stat -eq 0; then :
72
111
  else
172
211
 
173
212
aix)
174
213
  # The C for AIX Compiler uses -M and outputs the dependencies
175
 
  # in a .u file.  This file always lives in the current directory.
176
 
  # Also, the AIX compiler puts `$object:' at the start of each line;
177
 
  # $object doesn't have directory information.
178
 
  stripped=`echo "$object" | sed -e 's,^.*/,,' -e 's/\(.*\)\..*$/\1/'`
179
 
  tmpdepfile="$stripped.u"
180
 
  outname="$stripped.o"
 
214
  # in a .u file.  In older versions, this file always lives in the
 
215
  # current directory.  Also, the AIX compiler puts `$object:' at the
 
216
  # start of each line; $object doesn't have directory information.
 
217
  # Version 6 uses the directory in both cases.
 
218
  dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
 
219
  test "x$dir" = "x$object" && dir=
 
220
  base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
181
221
  if test "$libtool" = yes; then
 
222
    tmpdepfile1=$dir$base.u
 
223
    tmpdepfile2=$base.u
 
224
    tmpdepfile3=$dir.libs/$base.u
182
225
    "$@" -Wc,-M
183
226
  else
 
227
    tmpdepfile1=$dir$base.u
 
228
    tmpdepfile2=$dir$base.u
 
229
    tmpdepfile3=$dir$base.u
184
230
    "$@" -M
185
231
  fi
186
 
 
187
232
  stat=$?
 
233
 
188
234
  if test $stat -eq 0; then :
189
235
  else
190
 
    rm -f "$tmpdepfile"
 
236
    rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
191
237
    exit $stat
192
238
  fi
193
239
 
 
240
  for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
 
241
  do
 
242
    test -f "$tmpdepfile" && break
 
243
  done
194
244
  if test -f "$tmpdepfile"; then
195
245
    # Each line is of the form `foo.o: dependent.h'.
196
246
    # Do two passes, one to just change these to
197
247
    # `$object: dependent.h' and one to simply `dependent.h:'.
198
 
    sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile"
199
 
    sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile"
 
248
    sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
 
249
    # That's a tab and a space in the [].
 
250
    sed -e 's,^.*\.[a-z]*:[      ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
200
251
  else
201
252
    # The sourcefile does not contain any dependencies, so just
202
253
    # store a dummy comment line, to avoid errors with the Makefile
206
257
  rm -f "$tmpdepfile"
207
258
  ;;
208
259
 
 
260
icc)
 
261
  # Intel's C compiler understands `-MD -MF file'.  However on
 
262
  #    icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c
 
263
  # ICC 7.0 will fill foo.d with something like
 
264
  #    foo.o: sub/foo.c
 
265
  #    foo.o: sub/foo.h
 
266
  # which is wrong.  We want:
 
267
  #    sub/foo.o: sub/foo.c
 
268
  #    sub/foo.o: sub/foo.h
 
269
  #    sub/foo.c:
 
270
  #    sub/foo.h:
 
271
  # ICC 7.1 will output
 
272
  #    foo.o: sub/foo.c sub/foo.h
 
273
  # and will wrap long lines using \ :
 
274
  #    foo.o: sub/foo.c ... \
 
275
  #     sub/foo.h ... \
 
276
  #     ...
 
277
 
 
278
  "$@" -MD -MF "$tmpdepfile"
 
279
  stat=$?
 
280
  if test $stat -eq 0; then :
 
281
  else
 
282
    rm -f "$tmpdepfile"
 
283
    exit $stat
 
284
  fi
 
285
  rm -f "$depfile"
 
286
  # Each line is of the form `foo.o: dependent.h',
 
287
  # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'.
 
288
  # Do two passes, one to just change these to
 
289
  # `$object: dependent.h' and one to simply `dependent.h:'.
 
290
  sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
 
291
  # Some versions of the HPUX 10.20 sed can't process this invocation
 
292
  # correctly.  Breaking it into two sed invocations is a workaround.
 
293
  sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" |
 
294
    sed -e 's/$/ :/' >> "$depfile"
 
295
  rm -f "$tmpdepfile"
 
296
  ;;
 
297
 
 
298
hp2)
 
299
  # The "hp" stanza above does not work with aCC (C++) and HP's ia64
 
300
  # compilers, which have integrated preprocessors.  The correct option
 
301
  # to use with these is +Maked; it writes dependencies to a file named
 
302
  # 'foo.d', which lands next to the object file, wherever that
 
303
  # happens to be.
 
304
  # Much of this is similar to the tru64 case; see comments there.
 
305
  dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
 
306
  test "x$dir" = "x$object" && dir=
 
307
  base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
 
308
  if test "$libtool" = yes; then
 
309
    tmpdepfile1=$dir$base.d
 
310
    tmpdepfile2=$dir.libs/$base.d
 
311
    "$@" -Wc,+Maked
 
312
  else
 
313
    tmpdepfile1=$dir$base.d
 
314
    tmpdepfile2=$dir$base.d
 
315
    "$@" +Maked
 
316
  fi
 
317
  stat=$?
 
318
  if test $stat -eq 0; then :
 
319
  else
 
320
     rm -f "$tmpdepfile1" "$tmpdepfile2"
 
321
     exit $stat
 
322
  fi
 
323
 
 
324
  for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2"
 
325
  do
 
326
    test -f "$tmpdepfile" && break
 
327
  done
 
328
  if test -f "$tmpdepfile"; then
 
329
    sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile"
 
330
    # Add `dependent.h:' lines.
 
331
    sed -ne '2,${; s/^ *//; s/ \\*$//; s/$/:/; p;}' "$tmpdepfile" >> "$depfile"
 
332
  else
 
333
    echo "#dummy" > "$depfile"
 
334
  fi
 
335
  rm -f "$tmpdepfile" "$tmpdepfile2"
 
336
  ;;
 
337
 
209
338
tru64)
210
339
   # The Tru64 compiler uses -MD to generate dependencies as a side
211
340
   # effect.  `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'.
217
346
   base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
218
347
 
219
348
   if test "$libtool" = yes; then
220
 
      tmpdepfile1="$dir.libs/$base.lo.d"
221
 
      tmpdepfile2="$dir.libs/$base.d"
 
349
      # With Tru64 cc, shared objects can also be used to make a
 
350
      # static library.  This mechanism is used in libtool 1.4 series to
 
351
      # handle both shared and static libraries in a single compilation.
 
352
      # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d.
 
353
      #
 
354
      # With libtool 1.5 this exception was removed, and libtool now
 
355
      # generates 2 separate objects for the 2 libraries.  These two
 
356
      # compilations output dependencies in $dir.libs/$base.o.d and
 
357
      # in $dir$base.o.d.  We have to check for both files, because
 
358
      # one of the two compilations can be disabled.  We should prefer
 
359
      # $dir$base.o.d over $dir.libs/$base.o.d because the latter is
 
360
      # automatically cleaned when .libs/ is deleted, while ignoring
 
361
      # the former would cause a distcleancheck panic.
 
362
      tmpdepfile1=$dir.libs/$base.lo.d   # libtool 1.4
 
363
      tmpdepfile2=$dir$base.o.d          # libtool 1.5
 
364
      tmpdepfile3=$dir.libs/$base.o.d    # libtool 1.5
 
365
      tmpdepfile4=$dir.libs/$base.d      # Compaq CCC V6.2-504
222
366
      "$@" -Wc,-MD
223
367
   else
224
 
      tmpdepfile1="$dir$base.o.d"
225
 
      tmpdepfile2="$dir$base.d"
 
368
      tmpdepfile1=$dir$base.o.d
 
369
      tmpdepfile2=$dir$base.d
 
370
      tmpdepfile3=$dir$base.d
 
371
      tmpdepfile4=$dir$base.d
226
372
      "$@" -MD
227
373
   fi
228
374
 
229
375
   stat=$?
230
376
   if test $stat -eq 0; then :
231
377
   else
232
 
      rm -f "$tmpdepfile1" "$tmpdepfile2"
 
378
      rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
233
379
      exit $stat
234
380
   fi
235
381
 
236
 
   if test -f "$tmpdepfile1"; then
237
 
      tmpdepfile="$tmpdepfile1"
238
 
   else
239
 
      tmpdepfile="$tmpdepfile2"
240
 
   fi
 
382
   for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
 
383
   do
 
384
     test -f "$tmpdepfile" && break
 
385
   done
241
386
   if test -f "$tmpdepfile"; then
242
387
      sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
243
 
      # That's a space and a tab in the [].
244
 
      sed -e 's,^.*\.[a-z]*:[   ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
 
388
      # That's a tab and a space in the [].
 
389
      sed -e 's,^.*\.[a-z]*:[    ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
245
390
   else
246
391
      echo "#dummy" > "$depfile"
247
392
   fi
254
399
 
255
400
dashmstdout)
256
401
  # Important note: in order to support this mode, a compiler *must*
257
 
  # always write the proprocessed file to stdout, regardless of -o.
 
402
  # always write the preprocessed file to stdout, regardless of -o.
258
403
  "$@" || exit $?
259
404
 
260
405
  # Remove the call to Libtool.
265
410
    shift
266
411
  fi
267
412
 
268
 
  # Remove `-o $object'.  We will use -o /dev/null later,
269
 
  # however we can't do the remplacement now because
270
 
  # `-o $object' might simply not be used
 
413
  # Remove `-o $object'.
271
414
  IFS=" "
272
415
  for arg
273
416
  do
287
430
  done
288
431
 
289
432
  test -z "$dashmflag" && dashmflag=-M
290
 
  "$@" -o /dev/null $dashmflag | sed 's:^[^:]*\:[       ]*:'"$object"'\: :' > "$tmpdepfile"
 
433
  # Require at least two characters before searching for `:'
 
434
  # in the target name.  This is to cope with DOS-style filenames:
 
435
  # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise.
 
436
  "$@" $dashmflag |
 
437
    sed 's:^[  ]*[^: ][^:][^:]*\:[    ]*:'"$object"'\: :' > "$tmpdepfile"
291
438
  rm -f "$depfile"
292
439
  cat < "$tmpdepfile" > "$depfile"
293
440
  tr ' ' '
306
453
 
307
454
makedepend)
308
455
  "$@" || exit $?
 
456
  # Remove any Libtool call
 
457
  if test "$libtool" = yes; then
 
458
    while test $1 != '--mode=compile'; do
 
459
      shift
 
460
    done
 
461
    shift
 
462
  fi
309
463
  # X makedepend
310
464
  shift
311
465
  cleared=no
318
472
    case "$arg" in
319
473
    -D*|-I*)
320
474
      set fnord "$@" "$arg"; shift ;;
321
 
    -*)
 
475
    # Strip any option that makedepend may not understand.  Remove
 
476
    # the object too, otherwise makedepend will parse it as a source file.
 
477
    -*|$object)
322
478
      ;;
323
479
    *)
324
480
      set fnord "$@" "$arg"; shift ;;
339
495
 
340
496
cpp)
341
497
  # Important note: in order to support this mode, a compiler *must*
342
 
  # always write the proprocessed file to stdout.
 
498
  # always write the preprocessed file to stdout.
343
499
  "$@" || exit $?
344
500
 
345
501
  # Remove the call to Libtool.
370
526
  done
371
527
 
372
528
  "$@" -E |
373
 
    sed -n '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |
 
529
    sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
 
530
       -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |
374
531
    sed '$ s: \\$::' > "$tmpdepfile"
375
532
  rm -f "$depfile"
376
533
  echo "$object : \\" > "$depfile"
381
538
 
382
539
msvisualcpp)
383
540
  # Important note: in order to support this mode, a compiler *must*
384
 
  # always write the proprocessed file to stdout, regardless of -o,
 
541
  # always write the preprocessed file to stdout, regardless of -o,
385
542
  # because we must use -o when running libtool.
386
543
  "$@" || exit $?
387
544
  IFS=" "
421
578
esac
422
579
 
423
580
exit 0
 
581
 
 
582
# Local Variables:
 
583
# mode: shell-script
 
584
# sh-indentation: 2
 
585
# eval: (add-hook 'write-file-hooks 'time-stamp)
 
586
# time-stamp-start: "scriptversion="
 
587
# time-stamp-format: "%:y-%02m-%02d.%02H"
 
588
# time-stamp-end: "$"
 
589
# End: