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