OLD | NEW |
1 #! /bin/sh | 1 #! /bin/sh |
2 # depcomp - compile a program generating dependencies as side-effects | 2 # depcomp - compile a program generating dependencies as side-effects |
3 | 3 |
4 scriptversion=2009-04-28.21; # UTC | 4 scriptversion=2012-03-27.16; # UTC |
5 | 5 |
6 # Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2009 Free | 6 # Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2009, 2010, |
7 # Software Foundation, Inc. | 7 # 2011, 2012 Free Software Foundation, Inc. |
8 | 8 |
9 # This program is free software; you can redistribute it and/or modify | 9 # This program is free software; you can redistribute it and/or modify |
10 # it under the terms of the GNU General Public License as published by | 10 # it under the terms of the GNU General Public License as published by |
11 # the Free Software Foundation; either version 2, or (at your option) | 11 # the Free Software Foundation; either version 2, or (at your option) |
12 # any later version. | 12 # any later version. |
13 | 13 |
14 # This program is distributed in the hope that it will be useful, | 14 # This program is distributed in the hope that it will be useful, |
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of | 15 # but WITHOUT ANY WARRANTY; without even the implied warranty of |
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
17 # GNU General Public License for more details. | 17 # GNU General Public License for more details. |
18 | 18 |
19 # You should have received a copy of the GNU General Public License | 19 # You should have received a copy of the GNU General Public License |
20 # along with this program. If not, see <http://www.gnu.org/licenses/>. | 20 # along with this program. If not, see <http://www.gnu.org/licenses/>. |
21 | 21 |
22 # As a special exception to the GNU General Public License, if you | 22 # As a special exception to the GNU General Public License, if you |
23 # distribute this file as part of a program that contains a | 23 # distribute this file as part of a program that contains a |
24 # configuration script generated by Autoconf, you may include it under | 24 # configuration script generated by Autoconf, you may include it under |
25 # the same distribution terms that you use for the rest of that program. | 25 # the same distribution terms that you use for the rest of that program. |
26 | 26 |
27 # Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>. | 27 # Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>. |
28 | 28 |
29 case $1 in | 29 case $1 in |
30 '') | 30 '') |
31 echo "$0: No command. Try \`$0 --help' for more information." 1>&2 | 31 echo "$0: No command. Try '$0 --help' for more information." 1>&2 |
32 exit 1; | 32 exit 1; |
33 ;; | 33 ;; |
34 -h | --h*) | 34 -h | --h*) |
35 cat <<\EOF | 35 cat <<\EOF |
36 Usage: depcomp [--help] [--version] PROGRAM [ARGS] | 36 Usage: depcomp [--help] [--version] PROGRAM [ARGS] |
37 | 37 |
38 Run PROGRAMS ARGS to compile a file, generating dependencies | 38 Run PROGRAMS ARGS to compile a file, generating dependencies |
39 as side-effects. | 39 as side-effects. |
40 | 40 |
41 Environment variables: | 41 Environment variables: |
42 depmode Dependency tracking mode. | 42 depmode Dependency tracking mode. |
43 source Source file read by `PROGRAMS ARGS'. | 43 source Source file read by 'PROGRAMS ARGS'. |
44 object Object file output by `PROGRAMS ARGS'. | 44 object Object file output by 'PROGRAMS ARGS'. |
45 DEPDIR directory where to store dependencies. | 45 DEPDIR directory where to store dependencies. |
46 depfile Dependency file to output. | 46 depfile Dependency file to output. |
47 tmpdepfile Temporary file to use when outputing dependencies. | 47 tmpdepfile Temporary file to use when outputting dependencies. |
48 libtool Whether libtool is used (yes/no). | 48 libtool Whether libtool is used (yes/no). |
49 | 49 |
50 Report bugs to <bug-automake@gnu.org>. | 50 Report bugs to <bug-automake@gnu.org>. |
51 EOF | 51 EOF |
52 exit $? | 52 exit $? |
53 ;; | 53 ;; |
54 -v | --v*) | 54 -v | --v*) |
55 echo "depcomp $scriptversion" | 55 echo "depcomp $scriptversion" |
56 exit $? | 56 exit $? |
57 ;; | 57 ;; |
58 esac | 58 esac |
59 | 59 |
| 60 # A tabulation character. |
| 61 tab=' ' |
| 62 # A newline character. |
| 63 nl=' |
| 64 ' |
| 65 |
60 if test -z "$depmode" || test -z "$source" || test -z "$object"; then | 66 if test -z "$depmode" || test -z "$source" || test -z "$object"; then |
61 echo "depcomp: Variables source, object and depmode must be set" 1>&2 | 67 echo "depcomp: Variables source, object and depmode must be set" 1>&2 |
62 exit 1 | 68 exit 1 |
63 fi | 69 fi |
64 | 70 |
65 # Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po. | 71 # Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po. |
66 depfile=${depfile-`echo "$object" | | 72 depfile=${depfile-`echo "$object" | |
67 sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`} | 73 sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`} |
68 tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} | 74 tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} |
69 | 75 |
(...skipping 13 matching lines...) Expand all Loading... |
83 # This is just like dashmstdout with a different argument. | 89 # This is just like dashmstdout with a different argument. |
84 dashmflag=-xM | 90 dashmflag=-xM |
85 depmode=dashmstdout | 91 depmode=dashmstdout |
86 fi | 92 fi |
87 | 93 |
88 cygpath_u="cygpath -u -f -" | 94 cygpath_u="cygpath -u -f -" |
89 if test "$depmode" = msvcmsys; then | 95 if test "$depmode" = msvcmsys; then |
90 # This is just like msvisualcpp but w/o cygpath translation. | 96 # This is just like msvisualcpp but w/o cygpath translation. |
91 # Just convert the backslash-escaped backslashes to single forward | 97 # Just convert the backslash-escaped backslashes to single forward |
92 # slashes to satisfy depend.m4 | 98 # slashes to satisfy depend.m4 |
93 cygpath_u="sed s,\\\\\\\\,/,g" | 99 cygpath_u='sed s,\\\\,/,g' |
94 depmode=msvisualcpp | 100 depmode=msvisualcpp |
95 fi | 101 fi |
96 | 102 |
| 103 if test "$depmode" = msvc7msys; then |
| 104 # This is just like msvc7 but w/o cygpath translation. |
| 105 # Just convert the backslash-escaped backslashes to single forward |
| 106 # slashes to satisfy depend.m4 |
| 107 cygpath_u='sed s,\\\\,/,g' |
| 108 depmode=msvc7 |
| 109 fi |
| 110 |
| 111 if test "$depmode" = xlc; then |
| 112 # IBM C/C++ Compilers xlc/xlC can output gcc-like dependency informations. |
| 113 gccflag=-qmakedep=gcc,-MF |
| 114 depmode=gcc |
| 115 fi |
| 116 |
97 case "$depmode" in | 117 case "$depmode" in |
98 gcc3) | 118 gcc3) |
99 ## gcc 3 implements dependency tracking that does exactly what | 119 ## gcc 3 implements dependency tracking that does exactly what |
100 ## we want. Yay! Note: for some reason libtool 1.4 doesn't like | 120 ## we want. Yay! Note: for some reason libtool 1.4 doesn't like |
101 ## it if -MD -MP comes after the -MF stuff. Hmm. | 121 ## it if -MD -MP comes after the -MF stuff. Hmm. |
102 ## Unfortunately, FreeBSD c89 acceptance of flags depends upon | 122 ## Unfortunately, FreeBSD c89 acceptance of flags depends upon |
103 ## the command line argument order; so add the flags where they | 123 ## the command line argument order; so add the flags where they |
104 ## appear in depend2.am. Note that the slowdown incurred here | 124 ## appear in depend2.am. Note that the slowdown incurred here |
105 ## affects only configure: in makefiles, %FASTDEP% shortcuts this. | 125 ## affects only configure: in makefiles, %FASTDEP% shortcuts this. |
106 for arg | 126 for arg |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 else | 161 else |
142 rm -f "$tmpdepfile" | 162 rm -f "$tmpdepfile" |
143 exit $stat | 163 exit $stat |
144 fi | 164 fi |
145 rm -f "$depfile" | 165 rm -f "$depfile" |
146 echo "$object : \\" > "$depfile" | 166 echo "$object : \\" > "$depfile" |
147 alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz | 167 alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz |
148 ## The second -e expression handles DOS-style file names with drive letters. | 168 ## The second -e expression handles DOS-style file names with drive letters. |
149 sed -e 's/^[^:]*: / /' \ | 169 sed -e 's/^[^:]*: / /' \ |
150 -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" | 170 -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" |
151 ## This next piece of magic avoids the `deleted header file' problem. | 171 ## This next piece of magic avoids the "deleted header file" problem. |
152 ## The problem is that when a header file which appears in a .P file | 172 ## The problem is that when a header file which appears in a .P file |
153 ## is deleted, the dependency causes make to die (because there is | 173 ## is deleted, the dependency causes make to die (because there is |
154 ## typically no way to rebuild the header). We avoid this by adding | 174 ## typically no way to rebuild the header). We avoid this by adding |
155 ## dummy dependencies for each header file. Too bad gcc doesn't do | 175 ## dummy dependencies for each header file. Too bad gcc doesn't do |
156 ## this for us directly. | 176 ## this for us directly. |
157 tr ' ' ' | 177 tr ' ' "$nl" < "$tmpdepfile" | |
158 ' < "$tmpdepfile" | | 178 ## Some versions of gcc put a space before the ':'. On the theory |
159 ## Some versions of gcc put a space before the `:'. On the theory | |
160 ## that the space means something, we add a space to the output as | 179 ## that the space means something, we add a space to the output as |
161 ## well. | 180 ## well. hp depmode also adds that space, but also prefixes the VPATH |
| 181 ## to the object. Take care to not repeat it in the output. |
162 ## Some versions of the HPUX 10.20 sed can't process this invocation | 182 ## Some versions of the HPUX 10.20 sed can't process this invocation |
163 ## correctly. Breaking it into two sed invocations is a workaround. | 183 ## correctly. Breaking it into two sed invocations is a workaround. |
164 sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" | 184 sed -e 's/^\\$//' -e '/^$/d' -e "s|.*$object$||" -e '/:$/d' \ |
| 185 | sed -e 's/$/ :/' >> "$depfile" |
165 rm -f "$tmpdepfile" | 186 rm -f "$tmpdepfile" |
166 ;; | 187 ;; |
167 | 188 |
168 hp) | 189 hp) |
169 # This case exists only to let depend.m4 do its work. It works by | 190 # This case exists only to let depend.m4 do its work. It works by |
170 # looking at the text of this script. This case will never be run, | 191 # looking at the text of this script. This case will never be run, |
171 # since it is checked for above. | 192 # since it is checked for above. |
172 exit 1 | 193 exit 1 |
173 ;; | 194 ;; |
174 | 195 |
(...skipping 11 matching lines...) Expand all Loading... |
186 fi | 207 fi |
187 rm -f "$depfile" | 208 rm -f "$depfile" |
188 | 209 |
189 if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files | 210 if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files |
190 echo "$object : \\" > "$depfile" | 211 echo "$object : \\" > "$depfile" |
191 | 212 |
192 # Clip off the initial element (the dependent). Don't try to be | 213 # Clip off the initial element (the dependent). Don't try to be |
193 # clever and replace this with sed code, as IRIX sed won't handle | 214 # clever and replace this with sed code, as IRIX sed won't handle |
194 # lines with more than a fixed number of characters (4096 in | 215 # lines with more than a fixed number of characters (4096 in |
195 # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; | 216 # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; |
196 # the IRIX cc adds comments like `#:fec' to the end of the | 217 # the IRIX cc adds comments like '#:fec' to the end of the |
197 # dependency line. | 218 # dependency line. |
198 tr ' ' ' | 219 tr ' ' "$nl" < "$tmpdepfile" \ |
199 ' < "$tmpdepfile" \ | |
200 | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \ | 220 | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \ |
201 tr ' | 221 tr "$nl" ' ' >> "$depfile" |
202 ' ' ' >> "$depfile" | |
203 echo >> "$depfile" | 222 echo >> "$depfile" |
204 | 223 |
205 # The second pass generates a dummy entry for each header file. | 224 # The second pass generates a dummy entry for each header file. |
206 tr ' ' ' | 225 tr ' ' "$nl" < "$tmpdepfile" \ |
207 ' < "$tmpdepfile" \ | |
208 | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ | 226 | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ |
209 >> "$depfile" | 227 >> "$depfile" |
210 else | 228 else |
211 # The sourcefile does not contain any dependencies, so just | 229 # The sourcefile does not contain any dependencies, so just |
212 # store a dummy comment line, to avoid errors with the Makefile | 230 # store a dummy comment line, to avoid errors with the Makefile |
213 # "include basename.Plo" scheme. | 231 # "include basename.Plo" scheme. |
214 echo "#dummy" > "$depfile" | 232 echo "#dummy" > "$depfile" |
215 fi | 233 fi |
216 rm -f "$tmpdepfile" | 234 rm -f "$tmpdepfile" |
217 ;; | 235 ;; |
218 | 236 |
| 237 xlc) |
| 238 # This case exists only to let depend.m4 do its work. It works by |
| 239 # looking at the text of this script. This case will never be run, |
| 240 # since it is checked for above. |
| 241 exit 1 |
| 242 ;; |
| 243 |
219 aix) | 244 aix) |
220 # The C for AIX Compiler uses -M and outputs the dependencies | 245 # The C for AIX Compiler uses -M and outputs the dependencies |
221 # in a .u file. In older versions, this file always lives in the | 246 # in a .u file. In older versions, this file always lives in the |
222 # current directory. Also, the AIX compiler puts `$object:' at the | 247 # current directory. Also, the AIX compiler puts '$object:' at the |
223 # start of each line; $object doesn't have directory information. | 248 # start of each line; $object doesn't have directory information. |
224 # Version 6 uses the directory in both cases. | 249 # Version 6 uses the directory in both cases. |
225 dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` | 250 dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` |
226 test "x$dir" = "x$object" && dir= | 251 test "x$dir" = "x$object" && dir= |
227 base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` | 252 base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` |
228 if test "$libtool" = yes; then | 253 if test "$libtool" = yes; then |
229 tmpdepfile1=$dir$base.u | 254 tmpdepfile1=$dir$base.u |
230 tmpdepfile2=$base.u | 255 tmpdepfile2=$base.u |
231 tmpdepfile3=$dir.libs/$base.u | 256 tmpdepfile3=$dir.libs/$base.u |
232 "$@" -Wc,-M | 257 "$@" -Wc,-M |
233 else | 258 else |
234 tmpdepfile1=$dir$base.u | 259 tmpdepfile1=$dir$base.u |
235 tmpdepfile2=$dir$base.u | 260 tmpdepfile2=$dir$base.u |
236 tmpdepfile3=$dir$base.u | 261 tmpdepfile3=$dir$base.u |
237 "$@" -M | 262 "$@" -M |
238 fi | 263 fi |
239 stat=$? | 264 stat=$? |
240 | 265 |
241 if test $stat -eq 0; then : | 266 if test $stat -eq 0; then : |
242 else | 267 else |
243 rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" | 268 rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" |
244 exit $stat | 269 exit $stat |
245 fi | 270 fi |
246 | 271 |
247 for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" | 272 for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" |
248 do | 273 do |
249 test -f "$tmpdepfile" && break | 274 test -f "$tmpdepfile" && break |
250 done | 275 done |
251 if test -f "$tmpdepfile"; then | 276 if test -f "$tmpdepfile"; then |
252 # Each line is of the form `foo.o: dependent.h'. | 277 # Each line is of the form 'foo.o: dependent.h'. |
253 # Do two passes, one to just change these to | 278 # Do two passes, one to just change these to |
254 # `$object: dependent.h' and one to simply `dependent.h:'. | 279 # '$object: dependent.h' and one to simply 'dependent.h:'. |
255 sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" | 280 sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" |
256 # That's a tab and a space in the []. | 281 sed -e 's,^.*\.[a-z]*:['"$tab"' ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfi
le" |
257 sed -e 's,^.*\.[a-z]*:[» ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" | |
258 else | 282 else |
259 # The sourcefile does not contain any dependencies, so just | 283 # The sourcefile does not contain any dependencies, so just |
260 # store a dummy comment line, to avoid errors with the Makefile | 284 # store a dummy comment line, to avoid errors with the Makefile |
261 # "include basename.Plo" scheme. | 285 # "include basename.Plo" scheme. |
262 echo "#dummy" > "$depfile" | 286 echo "#dummy" > "$depfile" |
263 fi | 287 fi |
264 rm -f "$tmpdepfile" | 288 rm -f "$tmpdepfile" |
265 ;; | 289 ;; |
266 | 290 |
267 icc) | 291 icc) |
268 # Intel's C compiler understands `-MD -MF file'. However on | 292 # Intel's C compiler anf tcc (Tiny C Compiler) understand '-MD -MF file'. |
269 # icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c | 293 # However on |
| 294 # $CC -MD -MF foo.d -c -o sub/foo.o sub/foo.c |
270 # ICC 7.0 will fill foo.d with something like | 295 # ICC 7.0 will fill foo.d with something like |
271 # foo.o: sub/foo.c | 296 # foo.o: sub/foo.c |
272 # foo.o: sub/foo.h | 297 # foo.o: sub/foo.h |
273 # which is wrong. We want: | 298 # which is wrong. We want |
274 # sub/foo.o: sub/foo.c | 299 # sub/foo.o: sub/foo.c |
275 # sub/foo.o: sub/foo.h | 300 # sub/foo.o: sub/foo.h |
276 # sub/foo.c: | 301 # sub/foo.c: |
277 # sub/foo.h: | 302 # sub/foo.h: |
278 # ICC 7.1 will output | 303 # ICC 7.1 will output |
279 # foo.o: sub/foo.c sub/foo.h | 304 # foo.o: sub/foo.c sub/foo.h |
280 # and will wrap long lines using \ : | 305 # and will wrap long lines using '\': |
281 # foo.o: sub/foo.c ... \ | 306 # foo.o: sub/foo.c ... \ |
282 # sub/foo.h ... \ | 307 # sub/foo.h ... \ |
283 # ... | 308 # ... |
284 | 309 # tcc 0.9.26 (FIXME still under development at the moment of writing) |
| 310 # will emit a similar output, but also prepend the continuation lines |
| 311 # with horizontal tabulation characters. |
285 "$@" -MD -MF "$tmpdepfile" | 312 "$@" -MD -MF "$tmpdepfile" |
286 stat=$? | 313 stat=$? |
287 if test $stat -eq 0; then : | 314 if test $stat -eq 0; then : |
288 else | 315 else |
289 rm -f "$tmpdepfile" | 316 rm -f "$tmpdepfile" |
290 exit $stat | 317 exit $stat |
291 fi | 318 fi |
292 rm -f "$depfile" | 319 rm -f "$depfile" |
293 # Each line is of the form `foo.o: dependent.h', | 320 # Each line is of the form 'foo.o: dependent.h', |
294 # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'. | 321 # or 'foo.o: dep1.h dep2.h \', or ' dep3.h dep4.h \'. |
295 # Do two passes, one to just change these to | 322 # Do two passes, one to just change these to |
296 # `$object: dependent.h' and one to simply `dependent.h:'. | 323 # '$object: dependent.h' and one to simply 'dependent.h:'. |
297 sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" | 324 sed -e "s/^[ $tab][ $tab]*/ /" -e "s,^[^:]*:,$object :," \ |
298 # Some versions of the HPUX 10.20 sed can't process this invocation | 325 < "$tmpdepfile" > "$depfile" |
299 # correctly. Breaking it into two sed invocations is a workaround. | 326 sed ' |
300 sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" | | 327 s/[ '"$tab"'][ '"$tab"']*/ /g |
301 sed -e 's/$/ :/' >> "$depfile" | 328 s/^ *// |
| 329 s/ *\\*$// |
| 330 s/^[^:]*: *// |
| 331 /^$/d |
| 332 /:$/d |
| 333 s/$/ :/ |
| 334 ' < "$tmpdepfile" >> "$depfile" |
302 rm -f "$tmpdepfile" | 335 rm -f "$tmpdepfile" |
303 ;; | 336 ;; |
304 | 337 |
305 hp2) | 338 hp2) |
306 # The "hp" stanza above does not work with aCC (C++) and HP's ia64 | 339 # The "hp" stanza above does not work with aCC (C++) and HP's ia64 |
307 # compilers, which have integrated preprocessors. The correct option | 340 # compilers, which have integrated preprocessors. The correct option |
308 # to use with these is +Maked; it writes dependencies to a file named | 341 # to use with these is +Maked; it writes dependencies to a file named |
309 # 'foo.d', which lands next to the object file, wherever that | 342 # 'foo.d', which lands next to the object file, wherever that |
310 # happens to be. | 343 # happens to be. |
311 # Much of this is similar to the tru64 case; see comments there. | 344 # Much of this is similar to the tru64 case; see comments there. |
(...skipping 15 matching lines...) Expand all Loading... |
327 rm -f "$tmpdepfile1" "$tmpdepfile2" | 360 rm -f "$tmpdepfile1" "$tmpdepfile2" |
328 exit $stat | 361 exit $stat |
329 fi | 362 fi |
330 | 363 |
331 for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" | 364 for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" |
332 do | 365 do |
333 test -f "$tmpdepfile" && break | 366 test -f "$tmpdepfile" && break |
334 done | 367 done |
335 if test -f "$tmpdepfile"; then | 368 if test -f "$tmpdepfile"; then |
336 sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile" | 369 sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile" |
337 # Add `dependent.h:' lines. | 370 # Add 'dependent.h:' lines. |
338 sed -ne '2,${ | 371 sed -ne '2,${ |
339 s/^ *// | 372 s/^ *// |
340 s/ \\*$// | 373 s/ \\*$// |
341 s/$/:/ | 374 s/$/:/ |
342 p | 375 p |
343 }' "$tmpdepfile" >> "$depfile" | 376 }' "$tmpdepfile" >> "$depfile" |
344 else | 377 else |
345 echo "#dummy" > "$depfile" | 378 echo "#dummy" > "$depfile" |
346 fi | 379 fi |
347 rm -f "$tmpdepfile" "$tmpdepfile2" | 380 rm -f "$tmpdepfile" "$tmpdepfile2" |
348 ;; | 381 ;; |
349 | 382 |
350 tru64) | 383 tru64) |
351 # The Tru64 compiler uses -MD to generate dependencies as a side | 384 # The Tru64 compiler uses -MD to generate dependencies as a side |
352 # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'. | 385 # effect. 'cc -MD -o foo.o ...' puts the dependencies into 'foo.o.d'. |
353 # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put | 386 # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put |
354 # dependencies in `foo.d' instead, so we check for that too. | 387 # dependencies in 'foo.d' instead, so we check for that too. |
355 # Subdirectories are respected. | 388 # Subdirectories are respected. |
356 dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` | 389 dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` |
357 test "x$dir" = "x$object" && dir= | 390 test "x$dir" = "x$object" && dir= |
358 base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` | 391 base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` |
359 | 392 |
360 if test "$libtool" = yes; then | 393 if test "$libtool" = yes; then |
361 # With Tru64 cc, shared objects can also be used to make a | 394 # With Tru64 cc, shared objects can also be used to make a |
362 # static library. This mechanism is used in libtool 1.4 series to | 395 # static library. This mechanism is used in libtool 1.4 series to |
363 # handle both shared and static libraries in a single compilation. | 396 # handle both shared and static libraries in a single compilation. |
364 # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d. | 397 # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d. |
(...skipping 25 matching lines...) Expand all Loading... |
390 rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" | 423 rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" |
391 exit $stat | 424 exit $stat |
392 fi | 425 fi |
393 | 426 |
394 for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" | 427 for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" |
395 do | 428 do |
396 test -f "$tmpdepfile" && break | 429 test -f "$tmpdepfile" && break |
397 done | 430 done |
398 if test -f "$tmpdepfile"; then | 431 if test -f "$tmpdepfile"; then |
399 sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" | 432 sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" |
400 # That's a tab and a space in the []. | 433 sed -e 's,^.*\.[a-z]*:['"$tab"' ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$dep
file" |
401 sed -e 's,^.*\.[a-z]*:[» ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" | |
402 else | 434 else |
403 echo "#dummy" > "$depfile" | 435 echo "#dummy" > "$depfile" |
404 fi | 436 fi |
405 rm -f "$tmpdepfile" | 437 rm -f "$tmpdepfile" |
406 ;; | 438 ;; |
407 | 439 |
| 440 msvc7) |
| 441 if test "$libtool" = yes; then |
| 442 showIncludes=-Wc,-showIncludes |
| 443 else |
| 444 showIncludes=-showIncludes |
| 445 fi |
| 446 "$@" $showIncludes > "$tmpdepfile" |
| 447 stat=$? |
| 448 grep -v '^Note: including file: ' "$tmpdepfile" |
| 449 if test "$stat" = 0; then : |
| 450 else |
| 451 rm -f "$tmpdepfile" |
| 452 exit $stat |
| 453 fi |
| 454 rm -f "$depfile" |
| 455 echo "$object : \\" > "$depfile" |
| 456 # The first sed program below extracts the file names and escapes |
| 457 # backslashes for cygpath. The second sed program outputs the file |
| 458 # name when reading, but also accumulates all include files in the |
| 459 # hold buffer in order to output them again at the end. This only |
| 460 # works with sed implementations that can handle large buffers. |
| 461 sed < "$tmpdepfile" -n ' |
| 462 /^Note: including file: *\(.*\)/ { |
| 463 s//\1/ |
| 464 s/\\/\\\\/g |
| 465 p |
| 466 }' | $cygpath_u | sort -u | sed -n ' |
| 467 s/ /\\ /g |
| 468 s/\(.*\)/'"$tab"'\1 \\/p |
| 469 s/.\(.*\) \\/\1:/ |
| 470 H |
| 471 $ { |
| 472 s/.*/'"$tab"'/ |
| 473 G |
| 474 p |
| 475 }' >> "$depfile" |
| 476 rm -f "$tmpdepfile" |
| 477 ;; |
| 478 |
| 479 msvc7msys) |
| 480 # This case exists only to let depend.m4 do its work. It works by |
| 481 # looking at the text of this script. This case will never be run, |
| 482 # since it is checked for above. |
| 483 exit 1 |
| 484 ;; |
| 485 |
408 #nosideeffect) | 486 #nosideeffect) |
409 # This comment above is used by automake to tell side-effect | 487 # This comment above is used by automake to tell side-effect |
410 # dependency tracking mechanisms from slower ones. | 488 # dependency tracking mechanisms from slower ones. |
411 | 489 |
412 dashmstdout) | 490 dashmstdout) |
413 # Important note: in order to support this mode, a compiler *must* | 491 # Important note: in order to support this mode, a compiler *must* |
414 # always write the preprocessed file to stdout, regardless of -o. | 492 # always write the preprocessed file to stdout, regardless of -o. |
415 "$@" || exit $? | 493 "$@" || exit $? |
416 | 494 |
417 # Remove the call to Libtool. | 495 # Remove the call to Libtool. |
418 if test "$libtool" = yes; then | 496 if test "$libtool" = yes; then |
419 while test "X$1" != 'X--mode=compile'; do | 497 while test "X$1" != 'X--mode=compile'; do |
420 shift | 498 shift |
421 done | 499 done |
422 shift | 500 shift |
423 fi | 501 fi |
424 | 502 |
425 # Remove `-o $object'. | 503 # Remove '-o $object'. |
426 IFS=" " | 504 IFS=" " |
427 for arg | 505 for arg |
428 do | 506 do |
429 case $arg in | 507 case $arg in |
430 -o) | 508 -o) |
431 shift | 509 shift |
432 ;; | 510 ;; |
433 $object) | 511 $object) |
434 shift | 512 shift |
435 ;; | 513 ;; |
436 *) | 514 *) |
437 set fnord "$@" "$arg" | 515 set fnord "$@" "$arg" |
438 shift # fnord | 516 shift # fnord |
439 shift # $arg | 517 shift # $arg |
440 ;; | 518 ;; |
441 esac | 519 esac |
442 done | 520 done |
443 | 521 |
444 test -z "$dashmflag" && dashmflag=-M | 522 test -z "$dashmflag" && dashmflag=-M |
445 # Require at least two characters before searching for `:' | 523 # Require at least two characters before searching for ':' |
446 # in the target name. This is to cope with DOS-style filenames: | 524 # in the target name. This is to cope with DOS-style filenames: |
447 # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise. | 525 # a dependency such as 'c:/foo/bar' could be seen as target 'c' otherwise. |
448 "$@" $dashmflag | | 526 "$@" $dashmflag | |
449 sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile" | 527 sed 's:^['"$tab"' ]*[^:'"$tab"' ][^:][^:]*\:['"$tab"' ]*:'"$object"'\: :' >
"$tmpdepfile" |
450 rm -f "$depfile" | 528 rm -f "$depfile" |
451 cat < "$tmpdepfile" > "$depfile" | 529 cat < "$tmpdepfile" > "$depfile" |
452 tr ' ' ' | 530 tr ' ' "$nl" < "$tmpdepfile" | \ |
453 ' < "$tmpdepfile" | \ | |
454 ## Some versions of the HPUX 10.20 sed can't process this invocation | 531 ## Some versions of the HPUX 10.20 sed can't process this invocation |
455 ## correctly. Breaking it into two sed invocations is a workaround. | 532 ## correctly. Breaking it into two sed invocations is a workaround. |
456 sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" | 533 sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" |
457 rm -f "$tmpdepfile" | 534 rm -f "$tmpdepfile" |
458 ;; | 535 ;; |
459 | 536 |
460 dashXmstdout) | 537 dashXmstdout) |
461 # This case only exists to satisfy depend.m4. It is never actually | 538 # This case only exists to satisfy depend.m4. It is never actually |
462 # run, as this mode is specially recognized in the preamble. | 539 # run, as this mode is specially recognized in the preamble. |
463 exit 1 | 540 exit 1 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
496 -*|$object) | 573 -*|$object) |
497 ;; | 574 ;; |
498 *) | 575 *) |
499 set fnord "$@" "$arg"; shift ;; | 576 set fnord "$@" "$arg"; shift ;; |
500 esac | 577 esac |
501 done | 578 done |
502 obj_suffix=`echo "$object" | sed 's/^.*\././'` | 579 obj_suffix=`echo "$object" | sed 's/^.*\././'` |
503 touch "$tmpdepfile" | 580 touch "$tmpdepfile" |
504 ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" | 581 ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" |
505 rm -f "$depfile" | 582 rm -f "$depfile" |
506 cat < "$tmpdepfile" > "$depfile" | 583 # makedepend may prepend the VPATH from the source file name to the object. |
507 sed '1,2d' "$tmpdepfile" | tr ' ' ' | 584 # No need to regex-escape $object, excess matching of '.' is harmless. |
508 ' | \ | 585 sed "s|^.*\($object *:\)|\1|" "$tmpdepfile" > "$depfile" |
| 586 sed '1,2d' "$tmpdepfile" | tr ' ' "$nl" | \ |
509 ## Some versions of the HPUX 10.20 sed can't process this invocation | 587 ## Some versions of the HPUX 10.20 sed can't process this invocation |
510 ## correctly. Breaking it into two sed invocations is a workaround. | 588 ## correctly. Breaking it into two sed invocations is a workaround. |
511 sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" | 589 sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" |
512 rm -f "$tmpdepfile" "$tmpdepfile".bak | 590 rm -f "$tmpdepfile" "$tmpdepfile".bak |
513 ;; | 591 ;; |
514 | 592 |
515 cpp) | 593 cpp) |
516 # Important note: in order to support this mode, a compiler *must* | 594 # Important note: in order to support this mode, a compiler *must* |
517 # always write the preprocessed file to stdout. | 595 # always write the preprocessed file to stdout. |
518 "$@" || exit $? | 596 "$@" || exit $? |
519 | 597 |
520 # Remove the call to Libtool. | 598 # Remove the call to Libtool. |
521 if test "$libtool" = yes; then | 599 if test "$libtool" = yes; then |
522 while test "X$1" != 'X--mode=compile'; do | 600 while test "X$1" != 'X--mode=compile'; do |
523 shift | 601 shift |
524 done | 602 done |
525 shift | 603 shift |
526 fi | 604 fi |
527 | 605 |
528 # Remove `-o $object'. | 606 # Remove '-o $object'. |
529 IFS=" " | 607 IFS=" " |
530 for arg | 608 for arg |
531 do | 609 do |
532 case $arg in | 610 case $arg in |
533 -o) | 611 -o) |
534 shift | 612 shift |
535 ;; | 613 ;; |
536 $object) | 614 $object) |
537 shift | 615 shift |
538 ;; | 616 ;; |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
587 set fnord "$@" "$arg" | 665 set fnord "$@" "$arg" |
588 shift | 666 shift |
589 shift | 667 shift |
590 ;; | 668 ;; |
591 esac | 669 esac |
592 done | 670 done |
593 "$@" -E 2>/dev/null | | 671 "$@" -E 2>/dev/null | |
594 sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$t
mpdepfile" | 672 sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$t
mpdepfile" |
595 rm -f "$depfile" | 673 rm -f "$depfile" |
596 echo "$object : \\" > "$depfile" | 674 echo "$object : \\" > "$depfile" |
597 sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::» \1 \\:p' >> "$de
pfile" | 675 sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::'"$tab"'\1 \\:p' >> "$
depfile" |
598 echo "» " >> "$depfile" | 676 echo "$tab" >> "$depfile" |
599 sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile" | 677 sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile" |
600 rm -f "$tmpdepfile" | 678 rm -f "$tmpdepfile" |
601 ;; | 679 ;; |
602 | 680 |
603 msvcmsys) | 681 msvcmsys) |
604 # This case exists only to let depend.m4 do its work. It works by | 682 # This case exists only to let depend.m4 do its work. It works by |
605 # looking at the text of this script. This case will never be run, | 683 # looking at the text of this script. This case will never be run, |
606 # since it is checked for above. | 684 # since it is checked for above. |
607 exit 1 | 685 exit 1 |
608 ;; | 686 ;; |
(...skipping 12 matching lines...) Expand all Loading... |
621 | 699 |
622 # Local Variables: | 700 # Local Variables: |
623 # mode: shell-script | 701 # mode: shell-script |
624 # sh-indentation: 2 | 702 # sh-indentation: 2 |
625 # eval: (add-hook 'write-file-hooks 'time-stamp) | 703 # eval: (add-hook 'write-file-hooks 'time-stamp) |
626 # time-stamp-start: "scriptversion=" | 704 # time-stamp-start: "scriptversion=" |
627 # time-stamp-format: "%:y-%02m-%02d.%02H" | 705 # time-stamp-format: "%:y-%02m-%02d.%02H" |
628 # time-stamp-time-zone: "UTC" | 706 # time-stamp-time-zone: "UTC" |
629 # time-stamp-end: "; # UTC" | 707 # time-stamp-end: "; # UTC" |
630 # End: | 708 # End: |
OLD | NEW |