~ubuntu-branches/ubuntu/vivid/xdm/vivid

« back to all changes in this revision

Viewing changes to depcomp

  • Committer: Bazaar Package Importer
  • Author(s): Daniel Stone
  • Date: 2005-12-10 16:17:22 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20051210161722-uf9qjm9mq9dxaj8z
Tags: 1:0.99.4-0ubuntu1
New upstream release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#! /bin/sh
 
2
 
2
3
# depcomp - compile a program generating dependencies as side-effects
3
 
 
4
 
scriptversion=2004-04-25.13
5
 
 
6
 
# Copyright (C) 1999, 2000, 2003, 2004 Free Software Foundation, Inc.
 
4
# Copyright 1999, 2000, 2003 Free Software Foundation, Inc.
7
5
 
8
6
# This program is free software; you can redistribute it and/or modify
9
7
# it under the terms of the GNU General Public License as published by
27
25
 
28
26
# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>.
29
27
 
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
 
 
60
28
if test -z "$depmode" || test -z "$source" || test -z "$object"; then
61
29
  echo "depcomp: Variables source, object and depmode must be set" 1>&2
62
30
  exit 1
294
262
   base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
295
263
 
296
264
   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
265
      tmpdepfile1="$dir.libs/$base.lo.d"
300
 
      tmpdepfile2="$dir.libs/$base.o.d"
301
 
      tmpdepfile3="$dir.libs/$base.d"
 
266
      tmpdepfile2="$dir.libs/$base.d"
302
267
      "$@" -Wc,-MD
303
268
   else
304
269
      tmpdepfile1="$dir$base.o.d"
305
270
      tmpdepfile2="$dir$base.d"
306
 
      tmpdepfile3="$dir$base.d"
307
271
      "$@" -MD
308
272
   fi
309
273
 
310
274
   stat=$?
311
275
   if test $stat -eq 0; then :
312
276
   else
313
 
      rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
 
277
      rm -f "$tmpdepfile1" "$tmpdepfile2"
314
278
      exit $stat
315
279
   fi
316
280
 
317
281
   if test -f "$tmpdepfile1"; then
318
282
      tmpdepfile="$tmpdepfile1"
319
 
   elif test -f "$tmpdepfile2"; then
 
283
   else
320
284
      tmpdepfile="$tmpdepfile2"
321
 
   else
322
 
      tmpdepfile="$tmpdepfile3"
323
285
   fi
324
286
   if test -f "$tmpdepfile"; then
325
287
      sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
515
477
esac
516
478
 
517
479
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: