File: depcomp

package info (click to toggle)
ext3grep 0.10.2-6
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,028 kB
  • sloc: cpp: 9,384; sh: 3,467; makefile: 182
file content (117 lines) | stat: -rwxr-xr-x 2,851 bytes parent folder | download | duplicates (13)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
#! /bin/sh

# depcomp - compile a program generating dependencies as side-effects
# Copyright 1999, 2000, 2003 Free Software Foundation, Inc.

# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.

# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.

# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.

# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.

# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>.
# Completely stripped for own purposes by Carlo Wood.

if test -z "$depmode" || test -z "$source" || test -z "$object"; then
  echo "depcomp: Variables source, object and depmode must be set" 1>&2
  exit 1
fi
# `libtool' can also be set to `yes' or `no'.

if test -z "$depfile"; then
   base=`echo "$object" | sed -e 's,^.*/,,' -e 's,\.\([^.]*\)$,.P\1,'`
   dir=`echo "$object" | sed 's,/.*$,/,'`
   if test "$dir" = "$object"; then
      dir=
   fi
   # FIXME: should be _deps on DOS.
   depfile="$dir.deps/$base"
fi

tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}

rm -f "$tmpdepfile"

case "$depmode" in
pch)
  # First compile file without dependency tracking.
  "$@" || exit $?

  # Remove the call to libtool its parameters.
  if test "$libtool" = yes; then
    while test $1 != '--mode=compile'; do
      shift
    done
    shift
    if expr "$1" : "--" >/dev/null; then
      shift
    fi
  fi

  # Remove `-o $object' and `-include pch.h'.
  eatpch=
  IFS=" "
  for arg
  do
    case $arg in
    -o)
      shift
      ;;
    $object)
      shift
      ;;
    -include)
      shift
      eatpch=yes
      ;;
    *)
      if test x$eatpch = xyes; then
        if test "$arg" = "pch.h"; then
	  shift
	else
	  set fnord "$@" -include "$arg"
	  shift # fnord
	  shift # $arg
	fi
	eatpch=
      else
	set fnord "$@" "$arg"
	shift # fnord
	shift # $arg
      fi
      ;;
    esac
  done
  
  # Generate dependency file.
  "$@" -MT "$object" -M -MF "$tmpdepfile"
  stat=$?
  if test $stat -eq 0; then :
  else
    rm -f "$tmpdepfile"
    exit $stat
  fi
  mv "$tmpdepfile" "$depfile"
  ;;

*)
  echo "Unknown depmode $depmode" 1>&2
  exit 1
  ;;
esac

exit 0