~ubuntu-branches/ubuntu/trusty/libdv/trusty

« back to all changes in this revision

Viewing changes to depcomp

  • Committer: Bazaar Package Importer
  • Author(s): Daniel Kobras
  • Date: 2004-07-19 12:19:44 UTC
  • mfrom: (1.2.1 upstream) (2.1.1 warty)
  • Revision ID: james.westby@ubuntu.com-20040719121944-17vuryc01yeyx8hf
Tags: 0.103-2
* debian/rules: Provide separate doc directory for libdv4-dev.
* debian/libdv4-dev.links: No longer symlink doc dir to the one
  from libdv4.
* debian/NEWS: Only install into libdv4-dev. Closes: #259694

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=2004-04-25.13
 
5
 
 
6
# Copyright (C) 1999, 2000, 2003, 2004 Free Software Foundation, Inc.
5
7
 
6
8
# This program is free software; you can redistribute it and/or modify
7
9
# it under the terms of the GNU General Public License as published by
25
27
 
26
28
# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>.
27
29
 
 
30
case $1 in
 
31
  '')
 
32
     echo "$0: No command.  Try \`$0 --help' for more information." 1>&2
 
33
     exit 1;
 
34
     ;;
 
35
  -h | --h*)
 
36
    cat <<\EOF
 
37
Usage: depcomp [--help] [--version] PROGRAM [ARGS]
 
38
 
 
39
Run PROGRAMS ARGS to compile a file, generating dependencies
 
40
as side-effects.
 
41
 
 
42
Environment variables:
 
43
  depmode     Dependency tracking mode.
 
44
  source      Source file read by `PROGRAMS ARGS'.
 
45
  object      Object file output by `PROGRAMS ARGS'.
 
46
  depfile     Dependency file to output.
 
47
  tmpdepfile  Temporary file to use when outputing dependencies.
 
48
  libtool     Whether libtool is used (yes/no).
 
49
 
 
50
Report bugs to <bug-automake@gnu.org>.
 
51
EOF
 
52
    exit 0
 
53
    ;;
 
54
  -v | --v*)
 
55
    echo "depcomp $scriptversion"
 
56
    exit 0
 
57
    ;;
 
58
esac
 
59
 
28
60
if test -z "$depmode" || test -z "$source" || test -z "$object"; then
29
61
  echo "depcomp: Variables source, object and depmode must be set" 1>&2
30
62
  exit 1
31
63
fi
32
64
# `libtool' can also be set to `yes' or `no'.
33
65
 
34
 
depfile=${depfile-`echo "$object" | sed 's,\([^/]*\)$,.deps/\1,;s/\.\([^.]*\)$/.P\1/'`}
 
66
if test -z "$depfile"; then
 
67
   base=`echo "$object" | sed -e 's,^.*/,,' -e 's,\.\([^.]*\)$,.P\1,'`
 
68
   dir=`echo "$object" | sed 's,/.*$,/,'`
 
69
   if test "$dir" = "$object"; then
 
70
      dir=
 
71
   fi
 
72
   # FIXME: should be _deps on DOS.
 
73
   depfile="$dir.deps/$base"
 
74
fi
 
75
 
35
76
tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
36
77
 
37
78
rm -f "$tmpdepfile"
163
204
 
164
205
aix)
165
206
  # The C for AIX Compiler uses -M and outputs the dependencies
166
 
  # in a .u file.  This file always lives in the current directory.
167
 
  # Also, the AIX compiler puts `$object:' at the start of each line;
168
 
  # $object doesn't have directory information.
169
 
  stripped=`echo "$object" | sed -e 's,^.*/,,' -e 's/\(.*\)\..*$/\1/'`
 
207
  # in a .u file.  In older versions, this file always lives in the
 
208
  # current directory.  Also, the AIX compiler puts `$object:' at the
 
209
  # start of each line; $object doesn't have directory information.
 
210
  # Version 6 uses the directory in both cases.
 
211
  stripped=`echo "$object" | sed 's/\(.*\)\..*$/\1/'`
170
212
  tmpdepfile="$stripped.u"
171
 
  outname="$stripped.o"
172
213
  if test "$libtool" = yes; then
173
214
    "$@" -Wc,-M
174
215
  else
175
216
    "$@" -M
176
217
  fi
177
 
 
178
218
  stat=$?
 
219
 
 
220
  if test -f "$tmpdepfile"; then :
 
221
  else
 
222
    stripped=`echo "$stripped" | sed 's,^.*/,,'`
 
223
    tmpdepfile="$stripped.u"
 
224
  fi
 
225
 
179
226
  if test $stat -eq 0; then :
180
227
  else
181
228
    rm -f "$tmpdepfile"
183
230
  fi
184
231
 
185
232
  if test -f "$tmpdepfile"; then
 
233
    outname="$stripped.o"
186
234
    # Each line is of the form `foo.o: dependent.h'.
187
235
    # Do two passes, one to just change these to
188
236
    # `$object: dependent.h' and one to simply `dependent.h:'.
197
245
  rm -f "$tmpdepfile"
198
246
  ;;
199
247
 
 
248
icc)
 
249
  # Intel's C compiler understands `-MD -MF file'.  However on
 
250
  #    icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c
 
251
  # ICC 7.0 will fill foo.d with something like
 
252
  #    foo.o: sub/foo.c
 
253
  #    foo.o: sub/foo.h
 
254
  # which is wrong.  We want:
 
255
  #    sub/foo.o: sub/foo.c
 
256
  #    sub/foo.o: sub/foo.h
 
257
  #    sub/foo.c:
 
258
  #    sub/foo.h:
 
259
  # ICC 7.1 will output
 
260
  #    foo.o: sub/foo.c sub/foo.h
 
261
  # and will wrap long lines using \ :
 
262
  #    foo.o: sub/foo.c ... \
 
263
  #     sub/foo.h ... \
 
264
  #     ...
 
265
 
 
266
  "$@" -MD -MF "$tmpdepfile"
 
267
  stat=$?
 
268
  if test $stat -eq 0; then :
 
269
  else
 
270
    rm -f "$tmpdepfile"
 
271
    exit $stat
 
272
  fi
 
273
  rm -f "$depfile"
 
274
  # Each line is of the form `foo.o: dependent.h',
 
275
  # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'.
 
276
  # Do two passes, one to just change these to
 
277
  # `$object: dependent.h' and one to simply `dependent.h:'.
 
278
  sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
 
279
  # Some versions of the HPUX 10.20 sed can't process this invocation
 
280
  # correctly.  Breaking it into two sed invocations is a workaround.
 
281
  sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" |
 
282
    sed -e 's/$/ :/' >> "$depfile"
 
283
  rm -f "$tmpdepfile"
 
284
  ;;
 
285
 
200
286
tru64)
201
 
   # The Tru64 AIX compiler uses -MD to generate dependencies as a side
 
287
   # The Tru64 compiler uses -MD to generate dependencies as a side
202
288
   # effect.  `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'.
203
 
   # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put 
 
289
   # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
204
290
   # dependencies in `foo.d' instead, so we check for that too.
205
291
   # Subdirectories are respected.
 
292
   dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
 
293
   test "x$dir" = "x$object" && dir=
 
294
   base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
206
295
 
207
 
   tmpdepfile1="$object.d"
208
 
   tmpdepfile2=`echo "$object" | sed -e 's/.o$/.d/'` 
209
296
   if test "$libtool" = yes; then
 
297
      # Dependencies are output in .lo.d with libtool 1.4.
 
298
      # They are output in .o.d with libtool 1.5.
 
299
      tmpdepfile1="$dir.libs/$base.lo.d"
 
300
      tmpdepfile2="$dir.libs/$base.o.d"
 
301
      tmpdepfile3="$dir.libs/$base.d"
210
302
      "$@" -Wc,-MD
211
303
   else
 
304
      tmpdepfile1="$dir$base.o.d"
 
305
      tmpdepfile2="$dir$base.d"
 
306
      tmpdepfile3="$dir$base.d"
212
307
      "$@" -MD
213
308
   fi
214
309
 
215
310
   stat=$?
216
311
   if test $stat -eq 0; then :
217
312
   else
218
 
      rm -f "$tmpdepfile1" "$tmpdepfile2"
 
313
      rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
219
314
      exit $stat
220
315
   fi
221
316
 
222
317
   if test -f "$tmpdepfile1"; then
223
318
      tmpdepfile="$tmpdepfile1"
224
 
   else
 
319
   elif test -f "$tmpdepfile2"; then
225
320
      tmpdepfile="$tmpdepfile2"
 
321
   else
 
322
      tmpdepfile="$tmpdepfile3"
226
323
   fi
227
324
   if test -f "$tmpdepfile"; then
228
325
      sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
229
 
      # That's a space and a tab in the [].
230
 
      sed -e 's,^.*\.[a-z]*:[   ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
 
326
      # That's a tab and a space in the [].
 
327
      sed -e 's,^.*\.[a-z]*:[    ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
231
328
   else
232
329
      echo "#dummy" > "$depfile"
233
330
   fi
240
337
 
241
338
dashmstdout)
242
339
  # Important note: in order to support this mode, a compiler *must*
243
 
  # always write the proprocessed file to stdout, regardless of -o,
244
 
  # because we must use -o when running libtool.
 
340
  # always write the preprocessed file to stdout, regardless of -o.
 
341
  "$@" || exit $?
 
342
 
 
343
  # Remove the call to Libtool.
 
344
  if test "$libtool" = yes; then
 
345
    while test $1 != '--mode=compile'; do
 
346
      shift
 
347
    done
 
348
    shift
 
349
  fi
 
350
 
 
351
  # Remove `-o $object'.
 
352
  IFS=" "
 
353
  for arg
 
354
  do
 
355
    case $arg in
 
356
    -o)
 
357
      shift
 
358
      ;;
 
359
    $object)
 
360
      shift
 
361
      ;;
 
362
    *)
 
363
      set fnord "$@" "$arg"
 
364
      shift # fnord
 
365
      shift # $arg
 
366
      ;;
 
367
    esac
 
368
  done
 
369
 
245
370
  test -z "$dashmflag" && dashmflag=-M
246
 
  ( IFS=" "
247
 
    case " $* " in
248
 
    *" --mode=compile "*) # this is libtool, let us make it quiet
249
 
      for arg
250
 
      do # cycle over the arguments
251
 
        case "$arg" in
252
 
        "--mode=compile")
253
 
          # insert --quiet before "--mode=compile"
254
 
          set fnord "$@" --quiet
255
 
          shift # fnord
256
 
          ;;
257
 
        esac
258
 
        set fnord "$@" "$arg"
259
 
        shift # fnord
260
 
        shift # "$arg"
261
 
      done
262
 
      ;;
263
 
    esac
264
 
    "$@" $dashmflag | sed 's:^[^:]*\:[  ]*:'"$object"'\: :' > "$tmpdepfile"
265
 
  ) &
266
 
  proc=$!
267
 
  "$@"
268
 
  stat=$?
269
 
  wait "$proc"
270
 
  if test "$stat" != 0; then exit $stat; fi
 
371
  # Require at least two characters before searching for `:'
 
372
  # in the target name.  This is to cope with DOS-style filenames:
 
373
  # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise.
 
374
  "$@" $dashmflag |
 
375
    sed 's:^[  ]*[^: ][^:][^:]*\:[    ]*:'"$object"'\: :' > "$tmpdepfile"
271
376
  rm -f "$depfile"
272
377
  cat < "$tmpdepfile" > "$depfile"
273
378
  tr ' ' '
285
390
  ;;
286
391
 
287
392
makedepend)
 
393
  "$@" || exit $?
 
394
  # Remove any Libtool call
 
395
  if test "$libtool" = yes; then
 
396
    while test $1 != '--mode=compile'; do
 
397
      shift
 
398
    done
 
399
    shift
 
400
  fi
288
401
  # X makedepend
289
 
  (
290
 
    shift
291
 
    cleared=no
292
 
    for arg in "$@"; do
293
 
      case $cleared in no)
294
 
        set ""; shift
295
 
        cleared=yes
296
 
      esac
297
 
      case "$arg" in
298
 
        -D*|-I*)
299
 
          set fnord "$@" "$arg"; shift;;
300
 
        -*)
301
 
          ;;
302
 
        *)
303
 
          set fnord "$@" "$arg"; shift;;
304
 
      esac
305
 
    done
306
 
    obj_suffix="`echo $object | sed 's/^.*\././'`"
307
 
    touch "$tmpdepfile"
308
 
    ${MAKEDEPEND-makedepend} 2>/dev/null -o"$obj_suffix" -f"$tmpdepfile" "$@"
309
 
  ) &
310
 
  proc=$!
311
 
  "$@"
312
 
  stat=$?
313
 
  wait "$proc"
314
 
  if test "$stat" != 0; then exit $stat; fi
 
402
  shift
 
403
  cleared=no
 
404
  for arg in "$@"; do
 
405
    case $cleared in
 
406
    no)
 
407
      set ""; shift
 
408
      cleared=yes ;;
 
409
    esac
 
410
    case "$arg" in
 
411
    -D*|-I*)
 
412
      set fnord "$@" "$arg"; shift ;;
 
413
    # Strip any option that makedepend may not understand.  Remove
 
414
    # the object too, otherwise makedepend will parse it as a source file.
 
415
    -*|$object)
 
416
      ;;
 
417
    *)
 
418
      set fnord "$@" "$arg"; shift ;;
 
419
    esac
 
420
  done
 
421
  obj_suffix="`echo $object | sed 's/^.*\././'`"
 
422
  touch "$tmpdepfile"
 
423
  ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
315
424
  rm -f "$depfile"
316
425
  cat < "$tmpdepfile" > "$depfile"
317
 
  tail +3 "$tmpdepfile" | tr ' ' '
 
426
  sed '1,2d' "$tmpdepfile" | tr ' ' '
318
427
' | \
319
428
## Some versions of the HPUX 10.20 sed can't process this invocation
320
429
## correctly.  Breaking it into two sed invocations is a workaround.
324
433
 
325
434
cpp)
326
435
  # Important note: in order to support this mode, a compiler *must*
327
 
  # always write the proprocessed file to stdout, regardless of -o,
328
 
  # because we must use -o when running libtool.
329
 
  ( IFS=" "
330
 
    case " $* " in
331
 
    *" --mode=compile "*)
332
 
      for arg
333
 
      do # cycle over the arguments
334
 
        case $arg in
335
 
        "--mode=compile")
336
 
          # insert --quiet before "--mode=compile"
337
 
          set fnord "$@" --quiet
338
 
          shift # fnord
339
 
          ;;
340
 
        esac
341
 
        set fnord "$@" "$arg"
342
 
        shift # fnord
343
 
        shift # "$arg"
344
 
      done
 
436
  # always write the preprocessed file to stdout.
 
437
  "$@" || exit $?
 
438
 
 
439
  # Remove the call to Libtool.
 
440
  if test "$libtool" = yes; then
 
441
    while test $1 != '--mode=compile'; do
 
442
      shift
 
443
    done
 
444
    shift
 
445
  fi
 
446
 
 
447
  # Remove `-o $object'.
 
448
  IFS=" "
 
449
  for arg
 
450
  do
 
451
    case $arg in
 
452
    -o)
 
453
      shift
 
454
      ;;
 
455
    $object)
 
456
      shift
 
457
      ;;
 
458
    *)
 
459
      set fnord "$@" "$arg"
 
460
      shift # fnord
 
461
      shift # $arg
345
462
      ;;
346
463
    esac
347
 
    "$@" -E |
 
464
  done
 
465
 
 
466
  "$@" -E |
348
467
    sed -n '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |
349
468
    sed '$ s: \\$::' > "$tmpdepfile"
350
 
  ) &
351
 
  proc=$!
352
 
  "$@"
353
 
  stat=$?
354
 
  wait "$proc"
355
 
  if test "$stat" != 0; then exit $stat; fi
356
469
  rm -f "$depfile"
357
470
  echo "$object : \\" > "$depfile"
358
471
  cat < "$tmpdepfile" >> "$depfile"
362
475
 
363
476
msvisualcpp)
364
477
  # Important note: in order to support this mode, a compiler *must*
365
 
  # always write the proprocessed file to stdout, regardless of -o,
 
478
  # always write the preprocessed file to stdout, regardless of -o,
366
479
  # because we must use -o when running libtool.
367
 
  ( IFS=" "
368
 
    case " $* " in
369
 
    *" --mode=compile "*)
370
 
      for arg
371
 
      do # cycle over the arguments
372
 
        case $arg in
373
 
        "--mode=compile")
374
 
          # insert --quiet before "--mode=compile"
375
 
          set fnord "$@" --quiet
376
 
          shift # fnord
377
 
          ;;
378
 
        esac
 
480
  "$@" || exit $?
 
481
  IFS=" "
 
482
  for arg
 
483
  do
 
484
    case "$arg" in
 
485
    "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
 
486
        set fnord "$@"
 
487
        shift
 
488
        shift
 
489
        ;;
 
490
    *)
379
491
        set fnord "$@" "$arg"
380
 
        shift # fnord
381
 
        shift # "$arg"
382
 
      done
383
 
      ;;
 
492
        shift
 
493
        shift
 
494
        ;;
384
495
    esac
385
 
    "$@" -E |
386
 
    sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile"
387
 
  ) &
388
 
  proc=$!
389
 
  "$@"
390
 
  stat=$?
391
 
  wait "$proc"
392
 
  if test "$stat" != 0; then exit $stat; fi
 
496
  done
 
497
  "$@" -E |
 
498
  sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile"
393
499
  rm -f "$depfile"
394
500
  echo "$object : \\" > "$depfile"
395
501
  . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::    \1 \\:p' >> "$depfile"
409
515
esac
410
516
 
411
517
exit 0
 
518
 
 
519
# Local Variables:
 
520
# mode: shell-script
 
521
# sh-indentation: 2
 
522
# eval: (add-hook 'write-file-hooks 'time-stamp)
 
523
# time-stamp-start: "scriptversion="
 
524
# time-stamp-format: "%:y-%02m-%02d.%02H"
 
525
# time-stamp-end: "$"
 
526
# End: