ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/utils/depcomp
(Generate patch)

Comparing deliantra/server/utils/depcomp (file contents):
Revision 1.1.1.1 by root, Fri Feb 3 07:14:47 2006 UTC vs.
Revision 1.2 by root, Tue Mar 6 19:02:36 2007 UTC

1#! /bin/sh 1#! /bin/sh
2# depcomp - compile a program generating dependencies as side-effects 2# depcomp - compile a program generating dependencies as side-effects
3 3
4scriptversion=2004-05-31.23 4scriptversion=2005-07-09.11
5 5
6# Copyright (C) 1999, 2000, 2003, 2004 Free Software Foundation, Inc. 6# Copyright (C) 1999, 2000, 2003, 2004, 2005 Free Software Foundation, Inc.
7 7
8# This program is free software; you can redistribute it and/or modify 8# This program is free software; you can redistribute it and/or modify
9# it under the terms of the GNU General Public License as published by 9# it under the terms of the GNU General Public License as published by
10# the Free Software Foundation; either version 2, or (at your option) 10# the Free Software Foundation; either version 2, or (at your option)
11# any later version. 11# any later version.
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16# GNU General Public License for more details. 16# GNU General Public License for more details.
17 17
18# You should have received a copy of the GNU General Public License 18# You should have received a copy of the GNU General Public License
19# along with this program; if not, write to the Free Software 19# along with this program; if not, write to the Free Software
20# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 20# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
21# 02111-1307, USA. 21# 02110-1301, USA.
22 22
23# As a special exception to the GNU General Public License, if you 23# As a special exception to the GNU General Public License, if you
24# distribute this file as part of a program that contains a 24# distribute this file as part of a program that contains a
25# configuration script generated by Autoconf, you may include it under 25# configuration script generated by Autoconf, you may include it under
26# the same distribution terms that you use for the rest of that program. 26# the same distribution terms that you use for the rest of that program.
48 tmpdepfile Temporary file to use when outputing dependencies. 48 tmpdepfile Temporary file to use when outputing dependencies.
49 libtool Whether libtool is used (yes/no). 49 libtool Whether libtool is used (yes/no).
50 50
51Report bugs to <bug-automake@gnu.org>. 51Report bugs to <bug-automake@gnu.org>.
52EOF 52EOF
53 exit 0 53 exit $?
54 ;; 54 ;;
55 -v | --v*) 55 -v | --v*)
56 echo "depcomp $scriptversion" 56 echo "depcomp $scriptversion"
57 exit 0 57 exit $?
58 ;; 58 ;;
59esac 59esac
60 60
61if test -z "$depmode" || test -z "$source" || test -z "$object"; then 61if test -z "$depmode" || test -z "$source" || test -z "$object"; then
62 echo "depcomp: Variables source, object and depmode must be set" 1>&2 62 echo "depcomp: Variables source, object and depmode must be set" 1>&2
285 dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` 285 dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
286 test "x$dir" = "x$object" && dir= 286 test "x$dir" = "x$object" && dir=
287 base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` 287 base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
288 288
289 if test "$libtool" = yes; then 289 if test "$libtool" = yes; then
290 # Dependencies are output in .lo.d with libtool 1.4. 290 # With Tru64 cc, shared objects can also be used to make a
291 # static library. This mecanism is used in libtool 1.4 series to
292 # handle both shared and static libraries in a single compilation.
291 # With libtool 1.5 they are output both in $dir.libs/$base.o.d 293 # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d.
292 # and in $dir.libs/$base.o.d and $dir$base.o.d. We process the 294 #
293 # latter, because the former will be cleaned when $dir.libs is 295 # With libtool 1.5 this exception was removed, and libtool now
294 # erased. 296 # generates 2 separate objects for the 2 libraries. These two
297 # compilations output dependencies in in $dir.libs/$base.o.d and
298 # in $dir$base.o.d. We have to check for both files, because
299 # one of the two compilations can be disabled. We should prefer
300 # $dir$base.o.d over $dir.libs/$base.o.d because the latter is
301 # automatically cleaned when .libs/ is deleted, while ignoring
302 # the former would cause a distcleancheck panic.
295 tmpdepfile1="$dir.libs/$base.lo.d" 303 tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4
296 tmpdepfile2="$dir$base.o.d" 304 tmpdepfile2=$dir$base.o.d # libtool 1.5
297 tmpdepfile3="$dir.libs/$base.d" 305 tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5
306 tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504
298 "$@" -Wc,-MD 307 "$@" -Wc,-MD
299 else 308 else
300 tmpdepfile1="$dir$base.o.d" 309 tmpdepfile1=$dir$base.o.d
301 tmpdepfile2="$dir$base.d" 310 tmpdepfile2=$dir$base.d
302 tmpdepfile3="$dir$base.d" 311 tmpdepfile3=$dir$base.d
312 tmpdepfile4=$dir$base.d
303 "$@" -MD 313 "$@" -MD
304 fi 314 fi
305 315
306 stat=$? 316 stat=$?
307 if test $stat -eq 0; then : 317 if test $stat -eq 0; then :
308 else 318 else
309 rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" 319 rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
310 exit $stat 320 exit $stat
311 fi 321 fi
312 322
323 for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
324 do
313 if test -f "$tmpdepfile1"; then 325 test -f "$tmpdepfile" && break
314 tmpdepfile="$tmpdepfile1" 326 done
315 elif test -f "$tmpdepfile2"; then
316 tmpdepfile="$tmpdepfile2"
317 else
318 tmpdepfile="$tmpdepfile3"
319 fi
320 if test -f "$tmpdepfile"; then 327 if test -f "$tmpdepfile"; then
321 sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" 328 sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
322 # That's a tab and a space in the []. 329 # That's a tab and a space in the [].
323 sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" 330 sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
324 else 331 else
458 ;; 465 ;;
459 esac 466 esac
460 done 467 done
461 468
462 "$@" -E | 469 "$@" -E |
463 sed -n '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' | 470 sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
471 -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |
464 sed '$ s: \\$::' > "$tmpdepfile" 472 sed '$ s: \\$::' > "$tmpdepfile"
465 rm -f "$depfile" 473 rm -f "$depfile"
466 echo "$object : \\" > "$depfile" 474 echo "$object : \\" > "$depfile"
467 cat < "$tmpdepfile" >> "$depfile" 475 cat < "$tmpdepfile" >> "$depfile"
468 sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" 476 sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile"

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines