comparison kdiff3/admin/depcomp @ 14:415083d043f3

KDiff3 version 0.9.70
author joachim99
date Mon, 06 Oct 2003 19:19:11 +0000
parents 53b8ecbce0cb
children 8febbfb1148c
comparison
equal deleted inserted replaced
13:266aeefa1b11 14:415083d043f3
15 15
16 # You should have received a copy of the GNU General Public License 16 # You should have received a copy of the GNU General Public License
17 # along with this program; if not, write to the Free Software 17 # along with this program; if not, write to the Free Software
18 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 18 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
19 # 02111-1307, USA. 19 # 02111-1307, USA.
20
21 # As a special exception to the GNU General Public License, if you
22 # distribute this file as part of a program that contains a
23 # configuration script generated by Autoconf, you may include it under
24 # the same distribution terms that you use for the rest of that program.
20 25
21 # Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>. 26 # Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>.
22 27
23 if test -z "$depmode" || test -z "$source" || test -z "$object"; then 28 if test -z "$depmode" || test -z "$source" || test -z "$object"; then
24 echo "depcomp: Variables source, object and depmode must be set" 1>&2 29 echo "depcomp: Variables source, object and depmode must be set" 1>&2
48 fi 53 fi
49 54
50 case "$depmode" in 55 case "$depmode" in
51 gcc3) 56 gcc3)
52 ## gcc 3 implements dependency tracking that does exactly what 57 ## gcc 3 implements dependency tracking that does exactly what
53 ## we want. Yay! 58 ## we want. Yay! Note: for some reason libtool 1.4 doesn't like
54 if "$@" -MT "$object" -MF "$tmpdepfile" -MD -MP; then : 59 ## it if -MD -MP comes after the -MF stuff. Hmm.
55 else 60 "$@" -MT "$object" -MD -MP -MF "$tmpdepfile"
56 stat=$? 61 stat=$?
62 if test $stat -eq 0; then :
63 else
57 rm -f "$tmpdepfile" 64 rm -f "$tmpdepfile"
58 exit $stat 65 exit $stat
59 fi 66 fi
60 mv "$tmpdepfile" "$depfile" 67 mv "$tmpdepfile" "$depfile"
61 ;; 68 ;;
71 ## - Using -M directly means running the compiler twice (even worse 78 ## - Using -M directly means running the compiler twice (even worse
72 ## than renaming). 79 ## than renaming).
73 if test -z "$gccflag"; then 80 if test -z "$gccflag"; then
74 gccflag=-MD, 81 gccflag=-MD,
75 fi 82 fi
76 if "$@" -Wp,"$gccflag$tmpdepfile"; then : 83 "$@" -Wp,"$gccflag$tmpdepfile"
77 else 84 stat=$?
78 stat=$? 85 if test $stat -eq 0; then :
86 else
79 rm -f "$tmpdepfile" 87 rm -f "$tmpdepfile"
80 exit $stat 88 exit $stat
81 fi 89 fi
82 rm -f "$depfile" 90 rm -f "$depfile"
83 echo "$object : \\" > "$depfile" 91 echo "$object : \\" > "$depfile"
124 rm -f "$depfile" 132 rm -f "$depfile"
125 133
126 if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files 134 if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files
127 echo "$object : \\" > "$depfile" 135 echo "$object : \\" > "$depfile"
128 136
129 # Clip off the initial element (the dependent). Don't try to be 137 # Clip off the initial element (the dependent). Don't try to be
130 # clever and replace this with sed code, as IRIX sed won't handle 138 # clever and replace this with sed code, as IRIX sed won't handle
131 # lines with more than a fixed number of characters (4096 in 139 # lines with more than a fixed number of characters (4096 in
132 # IRIX 6.2 sed, 8192 in IRIX 6.5). 140 # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines;
141 # the IRIX cc adds comments like `#:fec' to the end of the
142 # dependency line.
133 tr ' ' ' 143 tr ' ' '
134 ' < "$tmpdepfile" | sed 's/^[^\.]*\.o://' | tr ' 144 ' < "$tmpdepfile" \
145 | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
146 tr '
135 ' ' ' >> $depfile 147 ' ' ' >> $depfile
136 148 echo >> $depfile
149
150 # The second pass generates a dummy entry for each header file.
137 tr ' ' ' 151 tr ' ' '
138 ' < "$tmpdepfile" | \ 152 ' < "$tmpdepfile" \
139 ## Some versions of the HPUX 10.20 sed can't process this invocation 153 | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
140 ## correctly. Breaking it into two sed invocations is a workaround. 154 >> $depfile
141 sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
142 else 155 else
143 # The sourcefile does not contain any dependencies, so just 156 # The sourcefile does not contain any dependencies, so just
144 # store a dummy comment line, to avoid errors with the Makefile 157 # store a dummy comment line, to avoid errors with the Makefile
145 # "include basename.Plo" scheme. 158 # "include basename.Plo" scheme.
146 echo "#dummy" > "$depfile" 159 echo "#dummy" > "$depfile"
148 rm -f "$tmpdepfile" 161 rm -f "$tmpdepfile"
149 ;; 162 ;;
150 163
151 aix) 164 aix)
152 # The C for AIX Compiler uses -M and outputs the dependencies 165 # The C for AIX Compiler uses -M and outputs the dependencies
153 # in a .u file. 166 # in a .u file. This file always lives in the current directory.
154 tmpdepfile=`echo "$object" | sed 's/\(.*\)\..*$/\1.u/'` 167 # Also, the AIX compiler puts `$object:' at the start of each line;
168 # $object doesn't have directory information.
169 stripped=`echo "$object" | sed -e 's,^.*/,,' -e 's/\(.*\)\..*$/\1/'`
170 tmpdepfile="$stripped.u"
171 outname="$stripped.o"
155 if test "$libtool" = yes; then 172 if test "$libtool" = yes; then
156 "$@" -Wc,-M 173 "$@" -Wc,-M
157 else 174 else
158 "$@" -M 175 "$@" -M
159 fi 176 fi
164 rm -f "$tmpdepfile" 181 rm -f "$tmpdepfile"
165 exit $stat 182 exit $stat
166 fi 183 fi
167 184
168 if test -f "$tmpdepfile"; then 185 if test -f "$tmpdepfile"; then
169 echo "$object : \\" > "$depfile" 186 # Each line is of the form `foo.o: dependent.h'.
170 187 # Do two passes, one to just change these to
171 # Clip off the initial element (the dependent). Don't try to be 188 # `$object: dependent.h' and one to simply `dependent.h:'.
172 # clever and replace this with sed code, as IRIX sed won't handle 189 sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile"
173 # lines with more than a fixed number of characters (4096 in 190 sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile"
174 # IRIX 6.2 sed, 8192 in IRIX 6.5).
175 tr ' ' '
176 ' < "$tmpdepfile" | sed 's/^[^\.]*\.o://' | tr '
177 ' ' ' >> $depfile
178
179 tr ' ' '
180 ' < "$tmpdepfile" | \
181 ## Some versions of the HPUX 10.20 sed can't process this invocation
182 ## correctly. Breaking it into two sed invocations is a workaround.
183 sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
184 else 191 else
185 # The sourcefile does not contain any dependencies, so just 192 # The sourcefile does not contain any dependencies, so just
186 # store a dummy comment line, to avoid errors with the Makefile 193 # store a dummy comment line, to avoid errors with the Makefile
187 # "include basename.Plo" scheme. 194 # "include basename.Plo" scheme.
188 echo "#dummy" > "$depfile" 195 echo "#dummy" > "$depfile"
189 fi 196 fi
190 rm -f "$tmpdepfile" 197 rm -f "$tmpdepfile"
191 ;; 198 ;;
199
200 icc)
201 # Must come before tru64.
202
203 # Intel's C compiler understands `-MD -MF file'. However
204 # icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c
205 # will fill foo.d with something like
206 # foo.o: sub/foo.c
207 # foo.o: sub/foo.h
208 # which is wrong. We want:
209 # sub/foo.o: sub/foo.c
210 # sub/foo.o: sub/foo.h
211 # sub/foo.c:
212 # sub/foo.h:
213
214 "$@" -MD -MF "$tmpdepfile"
215 stat=$?
216 if test $stat -eq 0; then :
217 else
218 rm -f "$tmpdepfile"
219 exit $stat
220 fi
221 rm -f "$depfile"
222 # Each line is of the form `foo.o: dependent.h'.
223 # Do two passes, one to just change these to
224 # `$object: dependent.h' and one to simply `dependent.h:'.
225 sed -e "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
226 sed -e "s,^[^:]*: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile"
227 rm -f "$tmpdepfile"
228 ;;
229
230 tru64)
231 # The Tru64 AIX compiler uses -MD to generate dependencies as a side
232 # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'.
233 # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
234 # dependencies in `foo.d' instead, so we check for that too.
235 # Subdirectories are respected.
236
237 tmpdepfile1="$object.d"
238 tmpdepfile2=`echo "$object" | sed -e 's/.o$/.d/'`
239 if test "$libtool" = yes; then
240 "$@" -Wc,-MD
241 else
242 "$@" -MD
243 fi
244
245 stat=$?
246 if test $stat -eq 0; then :
247 else
248 rm -f "$tmpdepfile1" "$tmpdepfile2"
249 exit $stat
250 fi
251
252 if test -f "$tmpdepfile1"; then
253 tmpdepfile="$tmpdepfile1"
254 else
255 tmpdepfile="$tmpdepfile2"
256 fi
257 if test -f "$tmpdepfile"; then
258 sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
259 # That's a space and a tab in the [].
260 sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
261 else
262 echo "#dummy" > "$depfile"
263 fi
264 rm -f "$tmpdepfile"
265 ;;
192 266
193 #nosideeffect) 267 #nosideeffect)
194 # This comment above is used by automake to tell side-effect 268 # This comment above is used by automake to tell side-effect
195 # dependency tracking mechanisms from slower ones. 269 # dependency tracking mechanisms from slower ones.
196 270