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=2012-03-27.16; # UTC | 4 scriptversion=2013-05-30.07; # UTC |
5 | 5 |
6 # Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2009, 2010, | 6 # Copyright (C) 1999-2013 Free Software Foundation, Inc. |
7 # 2011, 2012 Free Software Foundation, Inc. | |
8 | 7 |
9 # This program is free software; you can redistribute it and/or modify | 8 # 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 | 9 # 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) | 10 # the Free Software Foundation; either version 2, or (at your option) |
12 # any later version. | 11 # any later version. |
13 | 12 |
14 # This program is distributed in the hope that it will be useful, | 13 # This program is distributed in the hope that it will be useful, |
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of | 14 # but WITHOUT ANY WARRANTY; without even the implied warranty of |
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
17 # GNU General Public License for more details. | 16 # GNU General Public License for more details. |
18 | 17 |
19 # You should have received a copy of the GNU General Public License | 18 # 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/>. | 19 # along with this program. If not, see <http://www.gnu.org/licenses/>. |
21 | 20 |
22 # As a special exception to the GNU General Public License, if you | 21 # As a special exception to the GNU General Public License, if you |
23 # distribute this file as part of a program that contains a | 22 # distribute this file as part of a program that contains a |
24 # configuration script generated by Autoconf, you may include it under | 23 # configuration script generated by Autoconf, you may include it under |
25 # the same distribution terms that you use for the rest of that program. | 24 # the same distribution terms that you use for the rest of that program. |
26 | 25 |
27 # Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>. | 26 # Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>. |
28 | 27 |
29 case $1 in | 28 case $1 in |
30 '') | 29 '') |
31 echo "$0: No command. Try '$0 --help' for more information." 1>&2 | 30 echo "$0: No command. Try '$0 --help' for more information." 1>&2 |
32 exit 1; | 31 exit 1; |
33 ;; | 32 ;; |
34 -h | --h*) | 33 -h | --h*) |
35 cat <<\EOF | 34 cat <<\EOF |
36 Usage: depcomp [--help] [--version] PROGRAM [ARGS] | 35 Usage: depcomp [--help] [--version] PROGRAM [ARGS] |
37 | 36 |
38 Run PROGRAMS ARGS to compile a file, generating dependencies | 37 Run PROGRAMS ARGS to compile a file, generating dependencies |
39 as side-effects. | 38 as side-effects. |
40 | 39 |
41 Environment variables: | 40 Environment variables: |
42 depmode Dependency tracking mode. | 41 depmode Dependency tracking mode. |
43 source Source file read by 'PROGRAMS ARGS'. | 42 source Source file read by 'PROGRAMS ARGS'. |
44 object Object file output by 'PROGRAMS ARGS'. | 43 object Object file output by 'PROGRAMS ARGS'. |
45 DEPDIR directory where to store dependencies. | 44 DEPDIR directory where to store dependencies. |
46 depfile Dependency file to output. | 45 depfile Dependency file to output. |
47 tmpdepfile Temporary file to use when outputting dependencies. | 46 tmpdepfile Temporary file to use when outputting dependencies. |
48 libtool Whether libtool is used (yes/no). | 47 libtool Whether libtool is used (yes/no). |
49 | 48 |
50 Report bugs to <bug-automake@gnu.org>. | 49 Report bugs to <bug-automake@gnu.org>. |
51 EOF | 50 EOF |
52 exit $? | 51 exit $? |
53 ;; | 52 ;; |
54 -v | --v*) | 53 -v | --v*) |
55 echo "depcomp $scriptversion" | 54 echo "depcomp $scriptversion" |
56 exit $? | 55 exit $? |
57 ;; | 56 ;; |
58 esac | 57 esac |
59 | 58 |
| 59 # Get the directory component of the given path, and save it in the |
| 60 # global variables '$dir'. Note that this directory component will |
| 61 # be either empty or ending with a '/' character. This is deliberate. |
| 62 set_dir_from () |
| 63 { |
| 64 case $1 in |
| 65 */*) dir=`echo "$1" | sed -e 's|/[^/]*$|/|'`;; |
| 66 *) dir=;; |
| 67 esac |
| 68 } |
| 69 |
| 70 # Get the suffix-stripped basename of the given path, and save it the |
| 71 # global variable '$base'. |
| 72 set_base_from () |
| 73 { |
| 74 base=`echo "$1" | sed -e 's|^.*/||' -e 's/\.[^.]*$//'` |
| 75 } |
| 76 |
| 77 # If no dependency file was actually created by the compiler invocation, |
| 78 # we still have to create a dummy depfile, to avoid errors with the |
| 79 # Makefile "include basename.Plo" scheme. |
| 80 make_dummy_depfile () |
| 81 { |
| 82 echo "#dummy" > "$depfile" |
| 83 } |
| 84 |
| 85 # Factor out some common post-processing of the generated depfile. |
| 86 # Requires the auxiliary global variable '$tmpdepfile' to be set. |
| 87 aix_post_process_depfile () |
| 88 { |
| 89 # If the compiler actually managed to produce a dependency file, |
| 90 # post-process it. |
| 91 if test -f "$tmpdepfile"; then |
| 92 # Each line is of the form 'foo.o: dependency.h'. |
| 93 # Do two passes, one to just change these to |
| 94 # $object: dependency.h |
| 95 # and one to simply output |
| 96 # dependency.h: |
| 97 # which is needed to avoid the deleted-header problem. |
| 98 { sed -e "s,^.*\.[$lower]*:,$object:," < "$tmpdepfile" |
| 99 sed -e "s,^.*\.[$lower]*:[$tab ]*,," -e 's,$,:,' < "$tmpdepfile" |
| 100 } > "$depfile" |
| 101 rm -f "$tmpdepfile" |
| 102 else |
| 103 make_dummy_depfile |
| 104 fi |
| 105 } |
| 106 |
60 # A tabulation character. | 107 # A tabulation character. |
61 tab=' ' | 108 tab=' ' |
62 # A newline character. | 109 # A newline character. |
63 nl=' | 110 nl=' |
64 ' | 111 ' |
| 112 # Character ranges might be problematic outside the C locale. |
| 113 # These definitions help. |
| 114 upper=ABCDEFGHIJKLMNOPQRSTUVWXYZ |
| 115 lower=abcdefghijklmnopqrstuvwxyz |
| 116 digits=0123456789 |
| 117 alpha=${upper}${lower} |
65 | 118 |
66 if test -z "$depmode" || test -z "$source" || test -z "$object"; then | 119 if test -z "$depmode" || test -z "$source" || test -z "$object"; then |
67 echo "depcomp: Variables source, object and depmode must be set" 1>&2 | 120 echo "depcomp: Variables source, object and depmode must be set" 1>&2 |
68 exit 1 | 121 exit 1 |
69 fi | 122 fi |
70 | 123 |
71 # Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po. | 124 # Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po. |
72 depfile=${depfile-`echo "$object" | | 125 depfile=${depfile-`echo "$object" | |
73 sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`} | 126 sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`} |
74 tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} | 127 tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} |
75 | 128 |
76 rm -f "$tmpdepfile" | 129 rm -f "$tmpdepfile" |
77 | 130 |
| 131 # Avoid interferences from the environment. |
| 132 gccflag= dashmflag= |
| 133 |
78 # Some modes work just like other modes, but use different flags. We | 134 # Some modes work just like other modes, but use different flags. We |
79 # parameterize here, but still list the modes in the big case below, | 135 # parameterize here, but still list the modes in the big case below, |
80 # to make depend.m4 easier to write. Note that we *cannot* use a case | 136 # to make depend.m4 easier to write. Note that we *cannot* use a case |
81 # here, because this file can only contain one case statement. | 137 # here, because this file can only contain one case statement. |
82 if test "$depmode" = hp; then | 138 if test "$depmode" = hp; then |
83 # HP compiler uses -M and no extra arg. | 139 # HP compiler uses -M and no extra arg. |
84 gccflag=-M | 140 gccflag=-M |
85 depmode=gcc | 141 depmode=gcc |
86 fi | 142 fi |
87 | 143 |
88 if test "$depmode" = dashXmstdout; then | 144 if test "$depmode" = dashXmstdout; then |
89 # This is just like dashmstdout with a different argument. | 145 # This is just like dashmstdout with a different argument. |
90 dashmflag=-xM | 146 dashmflag=-xM |
91 depmode=dashmstdout | 147 depmode=dashmstdout |
92 fi | 148 fi |
93 | 149 |
94 cygpath_u="cygpath -u -f -" | 150 cygpath_u="cygpath -u -f -" |
95 if test "$depmode" = msvcmsys; then | 151 if test "$depmode" = msvcmsys; then |
96 # This is just like msvisualcpp but w/o cygpath translation. | 152 # This is just like msvisualcpp but w/o cygpath translation. |
97 # Just convert the backslash-escaped backslashes to single forward | 153 # Just convert the backslash-escaped backslashes to single forward |
98 # slashes to satisfy depend.m4 | 154 # slashes to satisfy depend.m4 |
99 cygpath_u='sed s,\\\\,/,g' | 155 cygpath_u='sed s,\\\\,/,g' |
100 depmode=msvisualcpp | 156 depmode=msvisualcpp |
101 fi | 157 fi |
102 | 158 |
103 if test "$depmode" = msvc7msys; then | 159 if test "$depmode" = msvc7msys; then |
104 # This is just like msvc7 but w/o cygpath translation. | 160 # This is just like msvc7 but w/o cygpath translation. |
105 # Just convert the backslash-escaped backslashes to single forward | 161 # Just convert the backslash-escaped backslashes to single forward |
106 # slashes to satisfy depend.m4 | 162 # slashes to satisfy depend.m4 |
107 cygpath_u='sed s,\\\\,/,g' | 163 cygpath_u='sed s,\\\\,/,g' |
108 depmode=msvc7 | 164 depmode=msvc7 |
109 fi | 165 fi |
110 | 166 |
111 if test "$depmode" = xlc; then | 167 if test "$depmode" = xlc; then |
112 # IBM C/C++ Compilers xlc/xlC can output gcc-like dependency informations. | 168 # IBM C/C++ Compilers xlc/xlC can output gcc-like dependency information. |
113 gccflag=-qmakedep=gcc,-MF | 169 gccflag=-qmakedep=gcc,-MF |
114 depmode=gcc | 170 depmode=gcc |
115 fi | 171 fi |
116 | 172 |
117 case "$depmode" in | 173 case "$depmode" in |
118 gcc3) | 174 gcc3) |
119 ## gcc 3 implements dependency tracking that does exactly what | 175 ## gcc 3 implements dependency tracking that does exactly what |
120 ## we want. Yay! Note: for some reason libtool 1.4 doesn't like | 176 ## we want. Yay! Note: for some reason libtool 1.4 doesn't like |
121 ## it if -MD -MP comes after the -MF stuff. Hmm. | 177 ## it if -MD -MP comes after the -MF stuff. Hmm. |
122 ## Unfortunately, FreeBSD c89 acceptance of flags depends upon | 178 ## Unfortunately, FreeBSD c89 acceptance of flags depends upon |
123 ## the command line argument order; so add the flags where they | 179 ## the command line argument order; so add the flags where they |
124 ## appear in depend2.am. Note that the slowdown incurred here | 180 ## appear in depend2.am. Note that the slowdown incurred here |
125 ## affects only configure: in makefiles, %FASTDEP% shortcuts this. | 181 ## affects only configure: in makefiles, %FASTDEP% shortcuts this. |
126 for arg | 182 for arg |
127 do | 183 do |
128 case $arg in | 184 case $arg in |
129 -c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;; | 185 -c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;; |
130 *) set fnord "$@" "$arg" ;; | 186 *) set fnord "$@" "$arg" ;; |
131 esac | 187 esac |
132 shift # fnord | 188 shift # fnord |
133 shift # $arg | 189 shift # $arg |
134 done | 190 done |
135 "$@" | 191 "$@" |
136 stat=$? | 192 stat=$? |
137 if test $stat -eq 0; then : | 193 if test $stat -ne 0; then |
138 else | |
139 rm -f "$tmpdepfile" | 194 rm -f "$tmpdepfile" |
140 exit $stat | 195 exit $stat |
141 fi | 196 fi |
142 mv "$tmpdepfile" "$depfile" | 197 mv "$tmpdepfile" "$depfile" |
143 ;; | 198 ;; |
144 | 199 |
145 gcc) | 200 gcc) |
| 201 ## Note that this doesn't just cater to obsosete pre-3.x GCC compilers. |
| 202 ## but also to in-use compilers like IMB xlc/xlC and the HP C compiler. |
| 203 ## (see the conditional assignment to $gccflag above). |
146 ## There are various ways to get dependency output from gcc. Here's | 204 ## There are various ways to get dependency output from gcc. Here's |
147 ## why we pick this rather obscure method: | 205 ## why we pick this rather obscure method: |
148 ## - Don't want to use -MD because we'd like the dependencies to end | 206 ## - Don't want to use -MD because we'd like the dependencies to end |
149 ## up in a subdir. Having to rename by hand is ugly. | 207 ## up in a subdir. Having to rename by hand is ugly. |
150 ## (We might end up doing this anyway to support other compilers.) | 208 ## (We might end up doing this anyway to support other compilers.) |
151 ## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like | 209 ## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like |
152 ## -MM, not -M (despite what the docs say). | 210 ## -MM, not -M (despite what the docs say). Also, it might not be |
| 211 ## supported by the other compilers which use the 'gcc' depmode. |
153 ## - Using -M directly means running the compiler twice (even worse | 212 ## - Using -M directly means running the compiler twice (even worse |
154 ## than renaming). | 213 ## than renaming). |
155 if test -z "$gccflag"; then | 214 if test -z "$gccflag"; then |
156 gccflag=-MD, | 215 gccflag=-MD, |
157 fi | 216 fi |
158 "$@" -Wp,"$gccflag$tmpdepfile" | 217 "$@" -Wp,"$gccflag$tmpdepfile" |
159 stat=$? | 218 stat=$? |
160 if test $stat -eq 0; then : | 219 if test $stat -ne 0; then |
161 else | |
162 rm -f "$tmpdepfile" | 220 rm -f "$tmpdepfile" |
163 exit $stat | 221 exit $stat |
164 fi | 222 fi |
165 rm -f "$depfile" | 223 rm -f "$depfile" |
166 echo "$object : \\" > "$depfile" | 224 echo "$object : \\" > "$depfile" |
167 alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz | 225 # The second -e expression handles DOS-style file names with drive |
168 ## The second -e expression handles DOS-style file names with drive letters. | 226 # letters. |
169 sed -e 's/^[^:]*: / /' \ | 227 sed -e 's/^[^:]*: / /' \ |
170 -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" | 228 -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" |
171 ## This next piece of magic avoids the "deleted header file" problem. | 229 ## This next piece of magic avoids the "deleted header file" problem. |
172 ## The problem is that when a header file which appears in a .P file | 230 ## The problem is that when a header file which appears in a .P file |
173 ## is deleted, the dependency causes make to die (because there is | 231 ## is deleted, the dependency causes make to die (because there is |
174 ## typically no way to rebuild the header). We avoid this by adding | 232 ## typically no way to rebuild the header). We avoid this by adding |
175 ## dummy dependencies for each header file. Too bad gcc doesn't do | 233 ## dummy dependencies for each header file. Too bad gcc doesn't do |
176 ## this for us directly. | 234 ## this for us directly. |
177 tr ' ' "$nl" < "$tmpdepfile" | | |
178 ## Some versions of gcc put a space before the ':'. On the theory | 235 ## Some versions of gcc put a space before the ':'. On the theory |
179 ## that the space means something, we add a space to the output as | 236 ## that the space means something, we add a space to the output as |
180 ## well. hp depmode also adds that space, but also prefixes the VPATH | 237 ## 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. | 238 ## to the object. Take care to not repeat it in the output. |
182 ## Some versions of the HPUX 10.20 sed can't process this invocation | 239 ## Some versions of the HPUX 10.20 sed can't process this invocation |
183 ## correctly. Breaking it into two sed invocations is a workaround. | 240 ## correctly. Breaking it into two sed invocations is a workaround. |
184 sed -e 's/^\\$//' -e '/^$/d' -e "s|.*$object$||" -e '/:$/d' \ | 241 tr ' ' "$nl" < "$tmpdepfile" \ |
185 | sed -e 's/$/ :/' >> "$depfile" | 242 | sed -e 's/^\\$//' -e '/^$/d' -e "s|.*$object$||" -e '/:$/d' \ |
| 243 | sed -e 's/$/ :/' >> "$depfile" |
186 rm -f "$tmpdepfile" | 244 rm -f "$tmpdepfile" |
187 ;; | 245 ;; |
188 | 246 |
189 hp) | 247 hp) |
190 # This case exists only to let depend.m4 do its work. It works by | 248 # This case exists only to let depend.m4 do its work. It works by |
191 # looking at the text of this script. This case will never be run, | 249 # looking at the text of this script. This case will never be run, |
192 # since it is checked for above. | 250 # since it is checked for above. |
193 exit 1 | 251 exit 1 |
194 ;; | 252 ;; |
195 | 253 |
196 sgi) | 254 sgi) |
197 if test "$libtool" = yes; then | 255 if test "$libtool" = yes; then |
198 "$@" "-Wp,-MDupdate,$tmpdepfile" | 256 "$@" "-Wp,-MDupdate,$tmpdepfile" |
199 else | 257 else |
200 "$@" -MDupdate "$tmpdepfile" | 258 "$@" -MDupdate "$tmpdepfile" |
201 fi | 259 fi |
202 stat=$? | 260 stat=$? |
203 if test $stat -eq 0; then : | 261 if test $stat -ne 0; then |
204 else | |
205 rm -f "$tmpdepfile" | 262 rm -f "$tmpdepfile" |
206 exit $stat | 263 exit $stat |
207 fi | 264 fi |
208 rm -f "$depfile" | 265 rm -f "$depfile" |
209 | 266 |
210 if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files | 267 if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files |
211 echo "$object : \\" > "$depfile" | 268 echo "$object : \\" > "$depfile" |
212 | |
213 # Clip off the initial element (the dependent). Don't try to be | 269 # Clip off the initial element (the dependent). Don't try to be |
214 # clever and replace this with sed code, as IRIX sed won't handle | 270 # clever and replace this with sed code, as IRIX sed won't handle |
215 # lines with more than a fixed number of characters (4096 in | 271 # lines with more than a fixed number of characters (4096 in |
216 # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; | 272 # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; |
217 # the IRIX cc adds comments like '#:fec' to the end of the | 273 # the IRIX cc adds comments like '#:fec' to the end of the |
218 # dependency line. | 274 # dependency line. |
219 tr ' ' "$nl" < "$tmpdepfile" \ | 275 tr ' ' "$nl" < "$tmpdepfile" \ |
220 | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \ | 276 | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' \ |
221 tr "$nl" ' ' >> "$depfile" | 277 | tr "$nl" ' ' >> "$depfile" |
222 echo >> "$depfile" | 278 echo >> "$depfile" |
223 | |
224 # The second pass generates a dummy entry for each header file. | 279 # The second pass generates a dummy entry for each header file. |
225 tr ' ' "$nl" < "$tmpdepfile" \ | 280 tr ' ' "$nl" < "$tmpdepfile" \ |
226 | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ | 281 | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ |
227 >> "$depfile" | 282 >> "$depfile" |
228 else | 283 else |
229 # The sourcefile does not contain any dependencies, so just | 284 make_dummy_depfile |
230 # store a dummy comment line, to avoid errors with the Makefile | |
231 # "include basename.Plo" scheme. | |
232 echo "#dummy" > "$depfile" | |
233 fi | 285 fi |
234 rm -f "$tmpdepfile" | 286 rm -f "$tmpdepfile" |
235 ;; | 287 ;; |
236 | 288 |
237 xlc) | 289 xlc) |
238 # This case exists only to let depend.m4 do its work. It works by | 290 # 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, | 291 # looking at the text of this script. This case will never be run, |
240 # since it is checked for above. | 292 # since it is checked for above. |
241 exit 1 | 293 exit 1 |
242 ;; | 294 ;; |
243 | 295 |
244 aix) | 296 aix) |
245 # The C for AIX Compiler uses -M and outputs the dependencies | 297 # The C for AIX Compiler uses -M and outputs the dependencies |
246 # in a .u file. In older versions, this file always lives in the | 298 # in a .u file. In older versions, this file always lives in the |
247 # current directory. Also, the AIX compiler puts '$object:' at the | 299 # current directory. Also, the AIX compiler puts '$object:' at the |
248 # start of each line; $object doesn't have directory information. | 300 # start of each line; $object doesn't have directory information. |
249 # Version 6 uses the directory in both cases. | 301 # Version 6 uses the directory in both cases. |
250 dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` | 302 set_dir_from "$object" |
251 test "x$dir" = "x$object" && dir= | 303 set_base_from "$object" |
252 base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` | |
253 if test "$libtool" = yes; then | 304 if test "$libtool" = yes; then |
254 tmpdepfile1=$dir$base.u | 305 tmpdepfile1=$dir$base.u |
255 tmpdepfile2=$base.u | 306 tmpdepfile2=$base.u |
256 tmpdepfile3=$dir.libs/$base.u | 307 tmpdepfile3=$dir.libs/$base.u |
257 "$@" -Wc,-M | 308 "$@" -Wc,-M |
258 else | 309 else |
259 tmpdepfile1=$dir$base.u | 310 tmpdepfile1=$dir$base.u |
260 tmpdepfile2=$dir$base.u | 311 tmpdepfile2=$dir$base.u |
261 tmpdepfile3=$dir$base.u | 312 tmpdepfile3=$dir$base.u |
262 "$@" -M | 313 "$@" -M |
263 fi | 314 fi |
264 stat=$? | 315 stat=$? |
265 | 316 if test $stat -ne 0; then |
266 if test $stat -eq 0; then : | |
267 else | |
268 rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" | 317 rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" |
269 exit $stat | 318 exit $stat |
270 fi | 319 fi |
271 | 320 |
272 for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" | 321 for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" |
273 do | 322 do |
274 test -f "$tmpdepfile" && break | 323 test -f "$tmpdepfile" && break |
275 done | 324 done |
276 if test -f "$tmpdepfile"; then | 325 aix_post_process_depfile |
277 # Each line is of the form 'foo.o: dependent.h'. | |
278 # Do two passes, one to just change these to | |
279 # '$object: dependent.h' and one to simply 'dependent.h:'. | |
280 sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" | |
281 sed -e 's,^.*\.[a-z]*:['"$tab"' ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfi
le" | |
282 else | |
283 # The sourcefile does not contain any dependencies, so just | |
284 # store a dummy comment line, to avoid errors with the Makefile | |
285 # "include basename.Plo" scheme. | |
286 echo "#dummy" > "$depfile" | |
287 fi | |
288 rm -f "$tmpdepfile" | |
289 ;; | 326 ;; |
290 | 327 |
291 icc) | 328 tcc) |
292 # Intel's C compiler anf tcc (Tiny C Compiler) understand '-MD -MF file'. | 329 # tcc (Tiny C Compiler) understand '-MD -MF file' since version 0.9.26 |
293 # However on | 330 # FIXME: That version still under development at the moment of writing. |
294 # $CC -MD -MF foo.d -c -o sub/foo.o sub/foo.c | 331 # Make that this statement remains true also for stable, released |
295 # ICC 7.0 will fill foo.d with something like | 332 # versions. |
296 # foo.o: sub/foo.c | 333 # It will wrap lines (doesn't matter whether long or short) with a |
297 # foo.o: sub/foo.h | 334 # trailing '\', as in: |
298 # which is wrong. We want | 335 # |
299 # sub/foo.o: sub/foo.c | 336 # foo.o : \ |
300 # sub/foo.o: sub/foo.h | 337 # foo.c \ |
301 # sub/foo.c: | 338 # foo.h \ |
302 # sub/foo.h: | 339 # |
303 # ICC 7.1 will output | 340 # It will put a trailing '\' even on the last line, and will use leading |
304 # foo.o: sub/foo.c sub/foo.h | 341 # spaces rather than leading tabs (at least since its commit 0394caf7 |
305 # and will wrap long lines using '\': | 342 # "Emit spaces for -MD"). |
306 # foo.o: sub/foo.c ... \ | |
307 # sub/foo.h ... \ | |
308 # ... | |
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. | |
312 "$@" -MD -MF "$tmpdepfile" | 343 "$@" -MD -MF "$tmpdepfile" |
313 stat=$? | 344 stat=$? |
314 if test $stat -eq 0; then : | 345 if test $stat -ne 0; then |
315 else | |
316 rm -f "$tmpdepfile" | 346 rm -f "$tmpdepfile" |
317 exit $stat | 347 exit $stat |
318 fi | 348 fi |
319 rm -f "$depfile" | 349 rm -f "$depfile" |
320 # Each line is of the form 'foo.o: dependent.h', | 350 # Each non-empty line is of the form 'foo.o : \' or ' dep.h \'. |
321 # or 'foo.o: dep1.h dep2.h \', or ' dep3.h dep4.h \'. | 351 # We have to change lines of the first kind to '$object: \'. |
322 # Do two passes, one to just change these to | 352 sed -e "s|.*:|$object :|" < "$tmpdepfile" > "$depfile" |
323 # '$object: dependent.h' and one to simply 'dependent.h:'. | 353 # And for each line of the second kind, we have to emit a 'dep.h:' |
324 sed -e "s/^[ $tab][ $tab]*/ /" -e "s,^[^:]*:,$object :," \ | 354 # dummy dependency, to avoid the deleted-header problem. |
325 < "$tmpdepfile" > "$depfile" | 355 sed -n -e 's|^ *\(.*\) *\\$|\1:|p' < "$tmpdepfile" >> "$depfile" |
326 sed ' | |
327 s/[ '"$tab"'][ '"$tab"']*/ /g | |
328 s/^ *// | |
329 s/ *\\*$// | |
330 s/^[^:]*: *// | |
331 /^$/d | |
332 /:$/d | |
333 s/$/ :/ | |
334 ' < "$tmpdepfile" >> "$depfile" | |
335 rm -f "$tmpdepfile" | 356 rm -f "$tmpdepfile" |
336 ;; | 357 ;; |
337 | 358 |
| 359 ## The order of this option in the case statement is important, since the |
| 360 ## shell code in configure will try each of these formats in the order |
| 361 ## listed in this file. A plain '-MD' option would be understood by many |
| 362 ## compilers, so we must ensure this comes after the gcc and icc options. |
| 363 pgcc) |
| 364 # Portland's C compiler understands '-MD'. |
| 365 # Will always output deps to 'file.d' where file is the root name of the |
| 366 # source file under compilation, even if file resides in a subdirectory. |
| 367 # The object file name does not affect the name of the '.d' file. |
| 368 # pgcc 10.2 will output |
| 369 # foo.o: sub/foo.c sub/foo.h |
| 370 # and will wrap long lines using '\' : |
| 371 # foo.o: sub/foo.c ... \ |
| 372 # sub/foo.h ... \ |
| 373 # ... |
| 374 set_dir_from "$object" |
| 375 # Use the source, not the object, to determine the base name, since |
| 376 # that's sadly what pgcc will do too. |
| 377 set_base_from "$source" |
| 378 tmpdepfile=$base.d |
| 379 |
| 380 # For projects that build the same source file twice into different object |
| 381 # files, the pgcc approach of using the *source* file root name can cause |
| 382 # problems in parallel builds. Use a locking strategy to avoid stomping on |
| 383 # the same $tmpdepfile. |
| 384 lockdir=$base.d-lock |
| 385 trap " |
| 386 echo '$0: caught signal, cleaning up...' >&2 |
| 387 rmdir '$lockdir' |
| 388 exit 1 |
| 389 " 1 2 13 15 |
| 390 numtries=100 |
| 391 i=$numtries |
| 392 while test $i -gt 0; do |
| 393 # mkdir is a portable test-and-set. |
| 394 if mkdir "$lockdir" 2>/dev/null; then |
| 395 # This process acquired the lock. |
| 396 "$@" -MD |
| 397 stat=$? |
| 398 # Release the lock. |
| 399 rmdir "$lockdir" |
| 400 break |
| 401 else |
| 402 # If the lock is being held by a different process, wait |
| 403 # until the winning process is done or we timeout. |
| 404 while test -d "$lockdir" && test $i -gt 0; do |
| 405 sleep 1 |
| 406 i=`expr $i - 1` |
| 407 done |
| 408 fi |
| 409 i=`expr $i - 1` |
| 410 done |
| 411 trap - 1 2 13 15 |
| 412 if test $i -le 0; then |
| 413 echo "$0: failed to acquire lock after $numtries attempts" >&2 |
| 414 echo "$0: check lockdir '$lockdir'" >&2 |
| 415 exit 1 |
| 416 fi |
| 417 |
| 418 if test $stat -ne 0; then |
| 419 rm -f "$tmpdepfile" |
| 420 exit $stat |
| 421 fi |
| 422 rm -f "$depfile" |
| 423 # Each line is of the form `foo.o: dependent.h', |
| 424 # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'. |
| 425 # Do two passes, one to just change these to |
| 426 # `$object: dependent.h' and one to simply `dependent.h:'. |
| 427 sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" |
| 428 # Some versions of the HPUX 10.20 sed can't process this invocation |
| 429 # correctly. Breaking it into two sed invocations is a workaround. |
| 430 sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" \ |
| 431 | sed -e 's/$/ :/' >> "$depfile" |
| 432 rm -f "$tmpdepfile" |
| 433 ;; |
| 434 |
338 hp2) | 435 hp2) |
339 # The "hp" stanza above does not work with aCC (C++) and HP's ia64 | 436 # The "hp" stanza above does not work with aCC (C++) and HP's ia64 |
340 # compilers, which have integrated preprocessors. The correct option | 437 # compilers, which have integrated preprocessors. The correct option |
341 # to use with these is +Maked; it writes dependencies to a file named | 438 # to use with these is +Maked; it writes dependencies to a file named |
342 # 'foo.d', which lands next to the object file, wherever that | 439 # 'foo.d', which lands next to the object file, wherever that |
343 # happens to be. | 440 # happens to be. |
344 # Much of this is similar to the tru64 case; see comments there. | 441 # Much of this is similar to the tru64 case; see comments there. |
345 dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` | 442 set_dir_from "$object" |
346 test "x$dir" = "x$object" && dir= | 443 set_base_from "$object" |
347 base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` | |
348 if test "$libtool" = yes; then | 444 if test "$libtool" = yes; then |
349 tmpdepfile1=$dir$base.d | 445 tmpdepfile1=$dir$base.d |
350 tmpdepfile2=$dir.libs/$base.d | 446 tmpdepfile2=$dir.libs/$base.d |
351 "$@" -Wc,+Maked | 447 "$@" -Wc,+Maked |
352 else | 448 else |
353 tmpdepfile1=$dir$base.d | 449 tmpdepfile1=$dir$base.d |
354 tmpdepfile2=$dir$base.d | 450 tmpdepfile2=$dir$base.d |
355 "$@" +Maked | 451 "$@" +Maked |
356 fi | 452 fi |
357 stat=$? | 453 stat=$? |
358 if test $stat -eq 0; then : | 454 if test $stat -ne 0; then |
359 else | |
360 rm -f "$tmpdepfile1" "$tmpdepfile2" | 455 rm -f "$tmpdepfile1" "$tmpdepfile2" |
361 exit $stat | 456 exit $stat |
362 fi | 457 fi |
363 | 458 |
364 for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" | 459 for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" |
365 do | 460 do |
366 test -f "$tmpdepfile" && break | 461 test -f "$tmpdepfile" && break |
367 done | 462 done |
368 if test -f "$tmpdepfile"; then | 463 if test -f "$tmpdepfile"; then |
369 sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile" | 464 sed -e "s,^.*\.[$lower]*:,$object:," "$tmpdepfile" > "$depfile" |
370 # Add 'dependent.h:' lines. | 465 # Add 'dependent.h:' lines. |
371 sed -ne '2,${ | 466 sed -ne '2,${ |
372 » s/^ *// | 467 s/^ *// |
373 » s/ \\*$// | 468 s/ \\*$// |
374 » s/$/:/ | 469 s/$/:/ |
375 » p | 470 p |
376 » }' "$tmpdepfile" >> "$depfile" | 471 }' "$tmpdepfile" >> "$depfile" |
377 else | 472 else |
378 echo "#dummy" > "$depfile" | 473 make_dummy_depfile |
379 fi | 474 fi |
380 rm -f "$tmpdepfile" "$tmpdepfile2" | 475 rm -f "$tmpdepfile" "$tmpdepfile2" |
381 ;; | 476 ;; |
382 | 477 |
383 tru64) | 478 tru64) |
384 # The Tru64 compiler uses -MD to generate dependencies as a side | 479 # The Tru64 compiler uses -MD to generate dependencies as a side |
385 # effect. 'cc -MD -o foo.o ...' puts the dependencies into 'foo.o.d'. | 480 # effect. 'cc -MD -o foo.o ...' puts the dependencies into 'foo.o.d'. |
386 # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put | 481 # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put |
387 # dependencies in 'foo.d' instead, so we check for that too. | 482 # dependencies in 'foo.d' instead, so we check for that too. |
388 # Subdirectories are respected. | 483 # Subdirectories are respected. |
389 dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` | 484 set_dir_from "$object" |
390 test "x$dir" = "x$object" && dir= | 485 set_base_from "$object" |
391 base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` | |
392 | 486 |
393 if test "$libtool" = yes; then | 487 if test "$libtool" = yes; then |
394 # With Tru64 cc, shared objects can also be used to make a | 488 # Libtool generates 2 separate objects for the 2 libraries. These |
395 # static library. This mechanism is used in libtool 1.4 series to | 489 # two compilations output dependencies in $dir.libs/$base.o.d and |
396 # handle both shared and static libraries in a single compilation. | 490 # in $dir$base.o.d. We have to check for both files, because |
397 # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d. | 491 # one of the two compilations can be disabled. We should prefer |
398 # | 492 # $dir$base.o.d over $dir.libs/$base.o.d because the latter is |
399 # With libtool 1.5 this exception was removed, and libtool now | 493 # automatically cleaned when .libs/ is deleted, while ignoring |
400 # generates 2 separate objects for the 2 libraries. These two | 494 # the former would cause a distcleancheck panic. |
401 # compilations output dependencies in $dir.libs/$base.o.d and | 495 tmpdepfile1=$dir$base.o.d # libtool 1.5 |
402 # in $dir$base.o.d. We have to check for both files, because | 496 tmpdepfile2=$dir.libs/$base.o.d # Likewise. |
403 # one of the two compilations can be disabled. We should prefer | 497 tmpdepfile3=$dir.libs/$base.d # Compaq CCC V6.2-504 |
404 # $dir$base.o.d over $dir.libs/$base.o.d because the latter is | 498 "$@" -Wc,-MD |
405 # automatically cleaned when .libs/ is deleted, while ignoring | 499 else |
406 # the former would cause a distcleancheck panic. | 500 tmpdepfile1=$dir$base.d |
407 tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4 | 501 tmpdepfile2=$dir$base.d |
408 tmpdepfile2=$dir$base.o.d # libtool 1.5 | 502 tmpdepfile3=$dir$base.d |
409 tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5 | 503 "$@" -MD |
410 tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504 | 504 fi |
411 "$@" -Wc,-MD | |
412 else | |
413 tmpdepfile1=$dir$base.o.d | |
414 tmpdepfile2=$dir$base.d | |
415 tmpdepfile3=$dir$base.d | |
416 tmpdepfile4=$dir$base.d | |
417 "$@" -MD | |
418 fi | |
419 | 505 |
420 stat=$? | 506 stat=$? |
421 if test $stat -eq 0; then : | 507 if test $stat -ne 0; then |
422 else | 508 rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" |
423 rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" | 509 exit $stat |
424 exit $stat | 510 fi |
425 fi | |
426 | 511 |
427 for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" | 512 for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" |
428 do | 513 do |
429 test -f "$tmpdepfile" && break | 514 test -f "$tmpdepfile" && break |
430 done | 515 done |
431 if test -f "$tmpdepfile"; then | 516 # Same post-processing that is required for AIX mode. |
432 sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" | 517 aix_post_process_depfile |
433 sed -e 's,^.*\.[a-z]*:['"$tab"' ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$dep
file" | 518 ;; |
434 else | |
435 echo "#dummy" > "$depfile" | |
436 fi | |
437 rm -f "$tmpdepfile" | |
438 ;; | |
439 | 519 |
440 msvc7) | 520 msvc7) |
441 if test "$libtool" = yes; then | 521 if test "$libtool" = yes; then |
442 showIncludes=-Wc,-showIncludes | 522 showIncludes=-Wc,-showIncludes |
443 else | 523 else |
444 showIncludes=-showIncludes | 524 showIncludes=-showIncludes |
445 fi | 525 fi |
446 "$@" $showIncludes > "$tmpdepfile" | 526 "$@" $showIncludes > "$tmpdepfile" |
447 stat=$? | 527 stat=$? |
448 grep -v '^Note: including file: ' "$tmpdepfile" | 528 grep -v '^Note: including file: ' "$tmpdepfile" |
449 if test "$stat" = 0; then : | 529 if test $stat -ne 0; then |
450 else | |
451 rm -f "$tmpdepfile" | 530 rm -f "$tmpdepfile" |
452 exit $stat | 531 exit $stat |
453 fi | 532 fi |
454 rm -f "$depfile" | 533 rm -f "$depfile" |
455 echo "$object : \\" > "$depfile" | 534 echo "$object : \\" > "$depfile" |
456 # The first sed program below extracts the file names and escapes | 535 # The first sed program below extracts the file names and escapes |
457 # backslashes for cygpath. The second sed program outputs the file | 536 # backslashes for cygpath. The second sed program outputs the file |
458 # name when reading, but also accumulates all include files in the | 537 # 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 | 538 # hold buffer in order to output them again at the end. This only |
460 # works with sed implementations that can handle large buffers. | 539 # works with sed implementations that can handle large buffers. |
461 sed < "$tmpdepfile" -n ' | 540 sed < "$tmpdepfile" -n ' |
462 /^Note: including file: *\(.*\)/ { | 541 /^Note: including file: *\(.*\)/ { |
463 s//\1/ | 542 s//\1/ |
464 s/\\/\\\\/g | 543 s/\\/\\\\/g |
465 p | 544 p |
466 }' | $cygpath_u | sort -u | sed -n ' | 545 }' | $cygpath_u | sort -u | sed -n ' |
467 s/ /\\ /g | 546 s/ /\\ /g |
468 s/\(.*\)/'"$tab"'\1 \\/p | 547 s/\(.*\)/'"$tab"'\1 \\/p |
469 s/.\(.*\) \\/\1:/ | 548 s/.\(.*\) \\/\1:/ |
470 H | 549 H |
471 $ { | 550 $ { |
472 s/.*/'"$tab"'/ | 551 s/.*/'"$tab"'/ |
473 G | 552 G |
474 p | 553 p |
475 }' >> "$depfile" | 554 }' >> "$depfile" |
| 555 echo >> "$depfile" # make sure the fragment doesn't end with a backslash |
476 rm -f "$tmpdepfile" | 556 rm -f "$tmpdepfile" |
477 ;; | 557 ;; |
478 | 558 |
479 msvc7msys) | 559 msvc7msys) |
480 # This case exists only to let depend.m4 do its work. It works by | 560 # 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, | 561 # looking at the text of this script. This case will never be run, |
482 # since it is checked for above. | 562 # since it is checked for above. |
483 exit 1 | 563 exit 1 |
484 ;; | 564 ;; |
485 | 565 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
517 shift # $arg | 597 shift # $arg |
518 ;; | 598 ;; |
519 esac | 599 esac |
520 done | 600 done |
521 | 601 |
522 test -z "$dashmflag" && dashmflag=-M | 602 test -z "$dashmflag" && dashmflag=-M |
523 # Require at least two characters before searching for ':' | 603 # Require at least two characters before searching for ':' |
524 # in the target name. This is to cope with DOS-style filenames: | 604 # in the target name. This is to cope with DOS-style filenames: |
525 # a dependency such as 'c:/foo/bar' could be seen as target 'c' otherwise. | 605 # a dependency such as 'c:/foo/bar' could be seen as target 'c' otherwise. |
526 "$@" $dashmflag | | 606 "$@" $dashmflag | |
527 sed 's:^['"$tab"' ]*[^:'"$tab"' ][^:][^:]*\:['"$tab"' ]*:'"$object"'\: :' >
"$tmpdepfile" | 607 sed "s|^[$tab ]*[^:$tab ][^:][^:]*:[$tab ]*|$object: |" > "$tmpdepfile" |
528 rm -f "$depfile" | 608 rm -f "$depfile" |
529 cat < "$tmpdepfile" > "$depfile" | 609 cat < "$tmpdepfile" > "$depfile" |
530 tr ' ' "$nl" < "$tmpdepfile" | \ | 610 # Some versions of the HPUX 10.20 sed can't process this sed invocation |
531 ## Some versions of the HPUX 10.20 sed can't process this invocation | 611 # correctly. Breaking it into two sed invocations is a workaround. |
532 ## correctly. Breaking it into two sed invocations is a workaround. | 612 tr ' ' "$nl" < "$tmpdepfile" \ |
533 sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" | 613 | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \ |
| 614 | sed -e 's/$/ :/' >> "$depfile" |
534 rm -f "$tmpdepfile" | 615 rm -f "$tmpdepfile" |
535 ;; | 616 ;; |
536 | 617 |
537 dashXmstdout) | 618 dashXmstdout) |
538 # This case only exists to satisfy depend.m4. It is never actually | 619 # This case only exists to satisfy depend.m4. It is never actually |
539 # run, as this mode is specially recognized in the preamble. | 620 # run, as this mode is specially recognized in the preamble. |
540 exit 1 | 621 exit 1 |
541 ;; | 622 ;; |
542 | 623 |
543 makedepend) | 624 makedepend) |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
576 set fnord "$@" "$arg"; shift ;; | 657 set fnord "$@" "$arg"; shift ;; |
577 esac | 658 esac |
578 done | 659 done |
579 obj_suffix=`echo "$object" | sed 's/^.*\././'` | 660 obj_suffix=`echo "$object" | sed 's/^.*\././'` |
580 touch "$tmpdepfile" | 661 touch "$tmpdepfile" |
581 ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" | 662 ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" |
582 rm -f "$depfile" | 663 rm -f "$depfile" |
583 # makedepend may prepend the VPATH from the source file name to the object. | 664 # makedepend may prepend the VPATH from the source file name to the object. |
584 # No need to regex-escape $object, excess matching of '.' is harmless. | 665 # No need to regex-escape $object, excess matching of '.' is harmless. |
585 sed "s|^.*\($object *:\)|\1|" "$tmpdepfile" > "$depfile" | 666 sed "s|^.*\($object *:\)|\1|" "$tmpdepfile" > "$depfile" |
586 sed '1,2d' "$tmpdepfile" | tr ' ' "$nl" | \ | 667 # Some versions of the HPUX 10.20 sed can't process the last invocation |
587 ## Some versions of the HPUX 10.20 sed can't process this invocation | 668 # correctly. Breaking it into two sed invocations is a workaround. |
588 ## correctly. Breaking it into two sed invocations is a workaround. | 669 sed '1,2d' "$tmpdepfile" \ |
589 sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" | 670 | tr ' ' "$nl" \ |
| 671 | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \ |
| 672 | sed -e 's/$/ :/' >> "$depfile" |
590 rm -f "$tmpdepfile" "$tmpdepfile".bak | 673 rm -f "$tmpdepfile" "$tmpdepfile".bak |
591 ;; | 674 ;; |
592 | 675 |
593 cpp) | 676 cpp) |
594 # Important note: in order to support this mode, a compiler *must* | 677 # Important note: in order to support this mode, a compiler *must* |
595 # always write the preprocessed file to stdout. | 678 # always write the preprocessed file to stdout. |
596 "$@" || exit $? | 679 "$@" || exit $? |
597 | 680 |
598 # Remove the call to Libtool. | 681 # Remove the call to Libtool. |
599 if test "$libtool" = yes; then | 682 if test "$libtool" = yes; then |
(...skipping 15 matching lines...) Expand all Loading... |
615 shift | 698 shift |
616 ;; | 699 ;; |
617 *) | 700 *) |
618 set fnord "$@" "$arg" | 701 set fnord "$@" "$arg" |
619 shift # fnord | 702 shift # fnord |
620 shift # $arg | 703 shift # $arg |
621 ;; | 704 ;; |
622 esac | 705 esac |
623 done | 706 done |
624 | 707 |
625 "$@" -E | | 708 "$@" -E \ |
626 sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ | 709 | sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ |
627 -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' | | 710 -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ |
628 sed '$ s: \\$::' > "$tmpdepfile" | 711 | sed '$ s: \\$::' > "$tmpdepfile" |
629 rm -f "$depfile" | 712 rm -f "$depfile" |
630 echo "$object : \\" > "$depfile" | 713 echo "$object : \\" > "$depfile" |
631 cat < "$tmpdepfile" >> "$depfile" | 714 cat < "$tmpdepfile" >> "$depfile" |
632 sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" | 715 sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" |
633 rm -f "$tmpdepfile" | 716 rm -f "$tmpdepfile" |
634 ;; | 717 ;; |
635 | 718 |
636 msvisualcpp) | 719 msvisualcpp) |
637 # Important note: in order to support this mode, a compiler *must* | 720 # Important note: in order to support this mode, a compiler *must* |
638 # always write the preprocessed file to stdout. | 721 # always write the preprocessed file to stdout. |
(...skipping 11 matching lines...) Expand all Loading... |
650 for arg | 733 for arg |
651 do | 734 do |
652 case "$arg" in | 735 case "$arg" in |
653 -o) | 736 -o) |
654 shift | 737 shift |
655 ;; | 738 ;; |
656 $object) | 739 $object) |
657 shift | 740 shift |
658 ;; | 741 ;; |
659 "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") | 742 "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") |
660 » set fnord "$@" | 743 set fnord "$@" |
661 » shift | 744 shift |
662 » shift | 745 shift |
663 » ;; | 746 ;; |
664 *) | 747 *) |
665 » set fnord "$@" "$arg" | 748 set fnord "$@" "$arg" |
666 » shift | 749 shift |
667 » shift | 750 shift |
668 » ;; | 751 ;; |
669 esac | 752 esac |
670 done | 753 done |
671 "$@" -E 2>/dev/null | | 754 "$@" -E 2>/dev/null | |
672 sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$t
mpdepfile" | 755 sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$t
mpdepfile" |
673 rm -f "$depfile" | 756 rm -f "$depfile" |
674 echo "$object : \\" > "$depfile" | 757 echo "$object : \\" > "$depfile" |
675 sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::'"$tab"'\1 \\:p' >> "$
depfile" | 758 sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::'"$tab"'\1 \\:p' >> "$
depfile" |
676 echo "$tab" >> "$depfile" | 759 echo "$tab" >> "$depfile" |
677 sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile" | 760 sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile" |
678 rm -f "$tmpdepfile" | 761 rm -f "$tmpdepfile" |
(...skipping 20 matching lines...) Expand all Loading... |
699 | 782 |
700 # Local Variables: | 783 # Local Variables: |
701 # mode: shell-script | 784 # mode: shell-script |
702 # sh-indentation: 2 | 785 # sh-indentation: 2 |
703 # eval: (add-hook 'write-file-hooks 'time-stamp) | 786 # eval: (add-hook 'write-file-hooks 'time-stamp) |
704 # time-stamp-start: "scriptversion=" | 787 # time-stamp-start: "scriptversion=" |
705 # time-stamp-format: "%:y-%02m-%02d.%02H" | 788 # time-stamp-format: "%:y-%02m-%02d.%02H" |
706 # time-stamp-time-zone: "UTC" | 789 # time-stamp-time-zone: "UTC" |
707 # time-stamp-end: "; # UTC" | 790 # time-stamp-end: "; # UTC" |
708 # End: | 791 # End: |
OLD | NEW |