annotate GEMBASSY-1.0.3/depcomp @ 0:8300eb051bea draft

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