annotate depcomp @ 317:171fe09f33bf 1.0

Added autotools files for release
author lost
date Tue, 27 Jan 2009 05:52:38 +0000
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
317
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
1 #! /bin/sh
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
2 # depcomp - compile a program generating dependencies as side-effects
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
3
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
4 scriptversion=2007-03-29.01
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
5
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
6 # Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007 Free Software
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
7 # Foundation, Inc.
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
8
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
9 # This program is free software; you can redistribute it and/or modify
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
10 # it under the terms of the GNU General Public License as published by
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
11 # the Free Software Foundation; either version 2, or (at your option)
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
12 # any later version.
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
13
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
14 # This program is distributed in the hope that it will be useful,
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
17 # GNU General Public License for more details.
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
18
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
19 # You should have received a copy of the GNU General Public License
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
20 # along with this program; if not, write to the Free Software
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
21 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
22 # 02110-1301, USA.
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
23
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
24 # As a special exception to the GNU General Public License, if you
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
25 # distribute this file as part of a program that contains a
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
26 # configuration script generated by Autoconf, you may include it under
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
27 # the same distribution terms that you use for the rest of that program.
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
28
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
29 # Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>.
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
30
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
31 case $1 in
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
32 '')
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
33 echo "$0: No command. Try \`$0 --help' for more information." 1>&2
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
34 exit 1;
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
35 ;;
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
36 -h | --h*)
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
37 cat <<\EOF
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
38 Usage: depcomp [--help] [--version] PROGRAM [ARGS]
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
39
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
40 Run PROGRAMS ARGS to compile a file, generating dependencies
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
41 as side-effects.
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
42
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
43 Environment variables:
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
44 depmode Dependency tracking mode.
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
45 source Source file read by `PROGRAMS ARGS'.
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
46 object Object file output by `PROGRAMS ARGS'.
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
47 DEPDIR directory where to store dependencies.
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
48 depfile Dependency file to output.
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
49 tmpdepfile Temporary file to use when outputing dependencies.
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
50 libtool Whether libtool is used (yes/no).
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
51
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
52 Report bugs to <bug-automake@gnu.org>.
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
53 EOF
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
54 exit $?
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
55 ;;
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
56 -v | --v*)
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
57 echo "depcomp $scriptversion"
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
58 exit $?
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
59 ;;
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
60 esac
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
61
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
62 if test -z "$depmode" || test -z "$source" || test -z "$object"; then
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
63 echo "depcomp: Variables source, object and depmode must be set" 1>&2
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
64 exit 1
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
65 fi
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
66
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
67 # Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po.
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
68 depfile=${depfile-`echo "$object" |
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
69 sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`}
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
70 tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
71
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
72 rm -f "$tmpdepfile"
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
73
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
74 # Some modes work just like other modes, but use different flags. We
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
75 # parameterize here, but still list the modes in the big case below,
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
76 # to make depend.m4 easier to write. Note that we *cannot* use a case
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
77 # here, because this file can only contain one case statement.
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
78 if test "$depmode" = hp; then
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
79 # HP compiler uses -M and no extra arg.
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
80 gccflag=-M
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
81 depmode=gcc
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
82 fi
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
83
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
84 if test "$depmode" = dashXmstdout; then
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
85 # This is just like dashmstdout with a different argument.
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
86 dashmflag=-xM
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
87 depmode=dashmstdout
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
88 fi
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
89
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
90 case "$depmode" in
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
91 gcc3)
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
92 ## gcc 3 implements dependency tracking that does exactly what
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
93 ## we want. Yay! Note: for some reason libtool 1.4 doesn't like
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
94 ## it if -MD -MP comes after the -MF stuff. Hmm.
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
95 ## Unfortunately, FreeBSD c89 acceptance of flags depends upon
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
96 ## the command line argument order; so add the flags where they
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
97 ## appear in depend2.am. Note that the slowdown incurred here
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
98 ## affects only configure: in makefiles, %FASTDEP% shortcuts this.
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
99 for arg
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
100 do
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
101 case $arg in
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
102 -c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;;
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
103 *) set fnord "$@" "$arg" ;;
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
104 esac
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
105 shift # fnord
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
106 shift # $arg
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
107 done
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
108 "$@"
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
109 stat=$?
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
110 if test $stat -eq 0; then :
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
111 else
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
112 rm -f "$tmpdepfile"
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
113 exit $stat
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
114 fi
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
115 mv "$tmpdepfile" "$depfile"
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
116 ;;
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
117
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
118 gcc)
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
119 ## There are various ways to get dependency output from gcc. Here's
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
120 ## why we pick this rather obscure method:
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
121 ## - Don't want to use -MD because we'd like the dependencies to end
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
122 ## up in a subdir. Having to rename by hand is ugly.
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
123 ## (We might end up doing this anyway to support other compilers.)
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
124 ## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
125 ## -MM, not -M (despite what the docs say).
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
126 ## - Using -M directly means running the compiler twice (even worse
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
127 ## than renaming).
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
128 if test -z "$gccflag"; then
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
129 gccflag=-MD,
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
130 fi
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
131 "$@" -Wp,"$gccflag$tmpdepfile"
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
132 stat=$?
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
133 if test $stat -eq 0; then :
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
134 else
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
135 rm -f "$tmpdepfile"
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
136 exit $stat
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
137 fi
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
138 rm -f "$depfile"
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
139 echo "$object : \\" > "$depfile"
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
140 alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
141 ## The second -e expression handles DOS-style file names with drive letters.
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
142 sed -e 's/^[^:]*: / /' \
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
143 -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
144 ## This next piece of magic avoids the `deleted header file' problem.
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
145 ## The problem is that when a header file which appears in a .P file
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
146 ## is deleted, the dependency causes make to die (because there is
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
147 ## typically no way to rebuild the header). We avoid this by adding
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
148 ## dummy dependencies for each header file. Too bad gcc doesn't do
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
149 ## this for us directly.
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
150 tr ' ' '
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
151 ' < "$tmpdepfile" |
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
152 ## Some versions of gcc put a space before the `:'. On the theory
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
153 ## that the space means something, we add a space to the output as
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
154 ## well.
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
155 ## Some versions of the HPUX 10.20 sed can't process this invocation
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
156 ## correctly. Breaking it into two sed invocations is a workaround.
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
157 sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
158 rm -f "$tmpdepfile"
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
159 ;;
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
160
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
161 hp)
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
162 # This case exists only to let depend.m4 do its work. It works by
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
163 # looking at the text of this script. This case will never be run,
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
164 # since it is checked for above.
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
165 exit 1
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
166 ;;
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
167
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
168 sgi)
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
169 if test "$libtool" = yes; then
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
170 "$@" "-Wp,-MDupdate,$tmpdepfile"
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
171 else
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
172 "$@" -MDupdate "$tmpdepfile"
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
173 fi
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
174 stat=$?
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
175 if test $stat -eq 0; then :
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
176 else
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
177 rm -f "$tmpdepfile"
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
178 exit $stat
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
179 fi
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
180 rm -f "$depfile"
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
181
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
182 if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
183 echo "$object : \\" > "$depfile"
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
184
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
185 # Clip off the initial element (the dependent). Don't try to be
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
186 # clever and replace this with sed code, as IRIX sed won't handle
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
187 # lines with more than a fixed number of characters (4096 in
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
188 # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines;
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
189 # the IRIX cc adds comments like `#:fec' to the end of the
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
190 # dependency line.
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
191 tr ' ' '
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
192 ' < "$tmpdepfile" \
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
193 | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
194 tr '
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
195 ' ' ' >> $depfile
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
196 echo >> $depfile
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
197
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
198 # The second pass generates a dummy entry for each header file.
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
199 tr ' ' '
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
200 ' < "$tmpdepfile" \
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
201 | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
202 >> $depfile
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
203 else
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
204 # The sourcefile does not contain any dependencies, so just
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
205 # store a dummy comment line, to avoid errors with the Makefile
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
206 # "include basename.Plo" scheme.
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
207 echo "#dummy" > "$depfile"
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
208 fi
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
209 rm -f "$tmpdepfile"
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
210 ;;
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
211
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
212 aix)
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
213 # The C for AIX Compiler uses -M and outputs the dependencies
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
214 # in a .u file. In older versions, this file always lives in the
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
215 # current directory. Also, the AIX compiler puts `$object:' at the
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
216 # start of each line; $object doesn't have directory information.
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
217 # Version 6 uses the directory in both cases.
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
218 dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
219 test "x$dir" = "x$object" && dir=
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
220 base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
221 if test "$libtool" = yes; then
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
222 tmpdepfile1=$dir$base.u
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
223 tmpdepfile2=$base.u
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
224 tmpdepfile3=$dir.libs/$base.u
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
225 "$@" -Wc,-M
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
226 else
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
227 tmpdepfile1=$dir$base.u
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
228 tmpdepfile2=$dir$base.u
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
229 tmpdepfile3=$dir$base.u
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
230 "$@" -M
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
231 fi
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
232 stat=$?
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
233
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
234 if test $stat -eq 0; then :
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
235 else
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
236 rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
237 exit $stat
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
238 fi
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
239
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
240 for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
241 do
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
242 test -f "$tmpdepfile" && break
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
243 done
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
244 if test -f "$tmpdepfile"; then
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
245 # Each line is of the form `foo.o: dependent.h'.
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
246 # Do two passes, one to just change these to
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
247 # `$object: dependent.h' and one to simply `dependent.h:'.
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
248 sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
249 # That's a tab and a space in the [].
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
250 sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
251 else
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
252 # The sourcefile does not contain any dependencies, so just
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
253 # store a dummy comment line, to avoid errors with the Makefile
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
254 # "include basename.Plo" scheme.
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
255 echo "#dummy" > "$depfile"
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
256 fi
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
257 rm -f "$tmpdepfile"
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
258 ;;
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
259
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
260 icc)
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
261 # Intel's C compiler understands `-MD -MF file'. However on
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
262 # icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
263 # ICC 7.0 will fill foo.d with something like
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
264 # foo.o: sub/foo.c
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
265 # foo.o: sub/foo.h
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
266 # which is wrong. We want:
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
267 # sub/foo.o: sub/foo.c
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
268 # sub/foo.o: sub/foo.h
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
269 # sub/foo.c:
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
270 # sub/foo.h:
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
271 # ICC 7.1 will output
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
272 # foo.o: sub/foo.c sub/foo.h
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
273 # and will wrap long lines using \ :
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
274 # foo.o: sub/foo.c ... \
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
275 # sub/foo.h ... \
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
276 # ...
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
277
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
278 "$@" -MD -MF "$tmpdepfile"
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
279 stat=$?
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
280 if test $stat -eq 0; then :
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
281 else
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
282 rm -f "$tmpdepfile"
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
283 exit $stat
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
284 fi
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
285 rm -f "$depfile"
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
286 # Each line is of the form `foo.o: dependent.h',
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
287 # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'.
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
288 # Do two passes, one to just change these to
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
289 # `$object: dependent.h' and one to simply `dependent.h:'.
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
290 sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
291 # Some versions of the HPUX 10.20 sed can't process this invocation
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
292 # correctly. Breaking it into two sed invocations is a workaround.
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
293 sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" |
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
294 sed -e 's/$/ :/' >> "$depfile"
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
295 rm -f "$tmpdepfile"
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
296 ;;
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
297
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
298 hp2)
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
299 # The "hp" stanza above does not work with aCC (C++) and HP's ia64
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
300 # compilers, which have integrated preprocessors. The correct option
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
301 # to use with these is +Maked; it writes dependencies to a file named
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
302 # 'foo.d', which lands next to the object file, wherever that
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
303 # happens to be.
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
304 # Much of this is similar to the tru64 case; see comments there.
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
305 dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
306 test "x$dir" = "x$object" && dir=
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
307 base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
308 if test "$libtool" = yes; then
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
309 tmpdepfile1=$dir$base.d
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
310 tmpdepfile2=$dir.libs/$base.d
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
311 "$@" -Wc,+Maked
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
312 else
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
313 tmpdepfile1=$dir$base.d
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
314 tmpdepfile2=$dir$base.d
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
315 "$@" +Maked
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
316 fi
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
317 stat=$?
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
318 if test $stat -eq 0; then :
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
319 else
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
320 rm -f "$tmpdepfile1" "$tmpdepfile2"
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
321 exit $stat
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
322 fi
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
323
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
324 for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2"
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
325 do
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
326 test -f "$tmpdepfile" && break
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
327 done
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
328 if test -f "$tmpdepfile"; then
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
329 sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile"
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
330 # Add `dependent.h:' lines.
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
331 sed -ne '2,${; s/^ *//; s/ \\*$//; s/$/:/; p;}' "$tmpdepfile" >> "$depfile"
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
332 else
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
333 echo "#dummy" > "$depfile"
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
334 fi
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
335 rm -f "$tmpdepfile" "$tmpdepfile2"
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
336 ;;
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
337
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
338 tru64)
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
339 # The Tru64 compiler uses -MD to generate dependencies as a side
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
340 # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'.
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
341 # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
342 # dependencies in `foo.d' instead, so we check for that too.
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
343 # Subdirectories are respected.
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
344 dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
345 test "x$dir" = "x$object" && dir=
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
346 base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
347
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
348 if test "$libtool" = yes; then
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
349 # With Tru64 cc, shared objects can also be used to make a
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
350 # static library. This mechanism is used in libtool 1.4 series to
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
351 # handle both shared and static libraries in a single compilation.
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
352 # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d.
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
353 #
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
354 # With libtool 1.5 this exception was removed, and libtool now
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
355 # generates 2 separate objects for the 2 libraries. These two
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
356 # compilations output dependencies in $dir.libs/$base.o.d and
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
357 # in $dir$base.o.d. We have to check for both files, because
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
358 # one of the two compilations can be disabled. We should prefer
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
359 # $dir$base.o.d over $dir.libs/$base.o.d because the latter is
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
360 # automatically cleaned when .libs/ is deleted, while ignoring
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
361 # the former would cause a distcleancheck panic.
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
362 tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
363 tmpdepfile2=$dir$base.o.d # libtool 1.5
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
364 tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
365 tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
366 "$@" -Wc,-MD
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
367 else
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
368 tmpdepfile1=$dir$base.o.d
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
369 tmpdepfile2=$dir$base.d
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
370 tmpdepfile3=$dir$base.d
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
371 tmpdepfile4=$dir$base.d
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
372 "$@" -MD
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
373 fi
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
374
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
375 stat=$?
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
376 if test $stat -eq 0; then :
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
377 else
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
378 rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
379 exit $stat
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
380 fi
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
381
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
382 for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
383 do
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
384 test -f "$tmpdepfile" && break
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
385 done
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
386 if test -f "$tmpdepfile"; then
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
387 sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
388 # That's a tab and a space in the [].
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
389 sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
390 else
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
391 echo "#dummy" > "$depfile"
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
392 fi
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
393 rm -f "$tmpdepfile"
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
394 ;;
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
395
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
396 #nosideeffect)
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
397 # This comment above is used by automake to tell side-effect
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
398 # dependency tracking mechanisms from slower ones.
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
399
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
400 dashmstdout)
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
401 # Important note: in order to support this mode, a compiler *must*
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
402 # always write the preprocessed file to stdout, regardless of -o.
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
403 "$@" || exit $?
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
404
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
405 # Remove the call to Libtool.
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
406 if test "$libtool" = yes; then
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
407 while test $1 != '--mode=compile'; do
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
408 shift
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
409 done
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
410 shift
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
411 fi
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
412
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
413 # Remove `-o $object'.
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
414 IFS=" "
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
415 for arg
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
416 do
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
417 case $arg in
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
418 -o)
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
419 shift
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
420 ;;
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
421 $object)
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
422 shift
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
423 ;;
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
424 *)
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
425 set fnord "$@" "$arg"
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
426 shift # fnord
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
427 shift # $arg
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
428 ;;
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
429 esac
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
430 done
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
431
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
432 test -z "$dashmflag" && dashmflag=-M
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
433 # Require at least two characters before searching for `:'
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
434 # in the target name. This is to cope with DOS-style filenames:
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
435 # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise.
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
436 "$@" $dashmflag |
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
437 sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile"
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
438 rm -f "$depfile"
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
439 cat < "$tmpdepfile" > "$depfile"
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
440 tr ' ' '
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
441 ' < "$tmpdepfile" | \
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
442 ## Some versions of the HPUX 10.20 sed can't process this invocation
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
443 ## correctly. Breaking it into two sed invocations is a workaround.
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
444 sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
445 rm -f "$tmpdepfile"
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
446 ;;
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
447
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
448 dashXmstdout)
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
449 # This case only exists to satisfy depend.m4. It is never actually
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
450 # run, as this mode is specially recognized in the preamble.
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
451 exit 1
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
452 ;;
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
453
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
454 makedepend)
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
455 "$@" || exit $?
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
456 # Remove any Libtool call
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
457 if test "$libtool" = yes; then
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
458 while test $1 != '--mode=compile'; do
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
459 shift
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
460 done
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
461 shift
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
462 fi
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
463 # X makedepend
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
464 shift
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
465 cleared=no
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
466 for arg in "$@"; do
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
467 case $cleared in
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
468 no)
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
469 set ""; shift
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
470 cleared=yes ;;
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
471 esac
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
472 case "$arg" in
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
473 -D*|-I*)
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
474 set fnord "$@" "$arg"; shift ;;
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
475 # Strip any option that makedepend may not understand. Remove
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
476 # the object too, otherwise makedepend will parse it as a source file.
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
477 -*|$object)
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
478 ;;
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
479 *)
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
480 set fnord "$@" "$arg"; shift ;;
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
481 esac
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
482 done
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
483 obj_suffix="`echo $object | sed 's/^.*\././'`"
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
484 touch "$tmpdepfile"
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
485 ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
486 rm -f "$depfile"
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
487 cat < "$tmpdepfile" > "$depfile"
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
488 sed '1,2d' "$tmpdepfile" | tr ' ' '
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
489 ' | \
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
490 ## Some versions of the HPUX 10.20 sed can't process this invocation
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
491 ## correctly. Breaking it into two sed invocations is a workaround.
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
492 sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
493 rm -f "$tmpdepfile" "$tmpdepfile".bak
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
494 ;;
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
495
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
496 cpp)
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
497 # Important note: in order to support this mode, a compiler *must*
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
498 # always write the preprocessed file to stdout.
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
499 "$@" || exit $?
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
500
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
501 # Remove the call to Libtool.
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
502 if test "$libtool" = yes; then
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
503 while test $1 != '--mode=compile'; do
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
504 shift
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
505 done
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
506 shift
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
507 fi
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
508
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
509 # Remove `-o $object'.
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
510 IFS=" "
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
511 for arg
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
512 do
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
513 case $arg in
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
514 -o)
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
515 shift
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
516 ;;
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
517 $object)
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
518 shift
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
519 ;;
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
520 *)
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
521 set fnord "$@" "$arg"
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
522 shift # fnord
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
523 shift # $arg
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
524 ;;
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
525 esac
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
526 done
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
527
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
528 "$@" -E |
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
529 sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
530 -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
531 sed '$ s: \\$::' > "$tmpdepfile"
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
532 rm -f "$depfile"
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
533 echo "$object : \\" > "$depfile"
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
534 cat < "$tmpdepfile" >> "$depfile"
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
535 sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile"
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
536 rm -f "$tmpdepfile"
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
537 ;;
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
538
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
539 msvisualcpp)
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
540 # Important note: in order to support this mode, a compiler *must*
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
541 # always write the preprocessed file to stdout, regardless of -o,
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
542 # because we must use -o when running libtool.
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
543 "$@" || exit $?
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
544 IFS=" "
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
545 for arg
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
546 do
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
547 case "$arg" in
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
548 "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
549 set fnord "$@"
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
550 shift
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
551 shift
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
552 ;;
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
553 *)
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
554 set fnord "$@" "$arg"
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
555 shift
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
556 shift
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
557 ;;
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
558 esac
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
559 done
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
560 "$@" -E |
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
561 sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile"
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
562 rm -f "$depfile"
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
563 echo "$object : \\" > "$depfile"
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
564 . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile"
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
565 echo " " >> "$depfile"
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
566 . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile"
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
567 rm -f "$tmpdepfile"
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
568 ;;
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
569
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
570 none)
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
571 exec "$@"
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
572 ;;
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
573
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
574 *)
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
575 echo "Unknown depmode $depmode" 1>&2
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
576 exit 1
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
577 ;;
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
578 esac
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
579
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
580 exit 0
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
581
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
582 # Local Variables:
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
583 # mode: shell-script
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
584 # sh-indentation: 2
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
585 # eval: (add-hook 'write-file-hooks 'time-stamp)
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
586 # time-stamp-start: "scriptversion="
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
587 # time-stamp-format: "%:y-%02m-%02d.%02H"
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
588 # time-stamp-end: "$"
171fe09f33bf Added autotools files for release
lost
parents:
diff changeset
589 # End: