annotate kdiff3/admin/depcomp @ 69:8febbfb1148c

KDiff3 0.9.89
author joachim99
date Mon, 10 Apr 2006 08:40:51 +0000
parents 415083d043f3
children 1184fc843210
rev   line source
joachim99@2 1 #! /bin/sh
joachim99@69 2 # depcomp - compile a program generating dependencies as side-effects
joachim99@2 3
joachim99@69 4 scriptversion=2005-05-14.22
joachim99@69 5
joachim99@69 6 # Copyright (C) 1999, 2000, 2003, 2004, 2005 Free Software Foundation, Inc.
joachim99@2 7
joachim99@2 8 # This program is free software; you can redistribute it and/or modify
joachim99@2 9 # it under the terms of the GNU General Public License as published by
joachim99@2 10 # the Free Software Foundation; either version 2, or (at your option)
joachim99@2 11 # any later version.
joachim99@2 12
joachim99@2 13 # This program is distributed in the hope that it will be useful,
joachim99@2 14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
joachim99@2 15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
joachim99@2 16 # GNU General Public License for more details.
joachim99@2 17
joachim99@2 18 # You should have received a copy of the GNU General Public License
joachim99@2 19 # along with this program; if not, write to the Free Software
joachim99@69 20 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
joachim99@69 21 # 02110-1301, USA.
joachim99@2 22
joachim99@14 23 # As a special exception to the GNU General Public License, if you
joachim99@14 24 # distribute this file as part of a program that contains a
joachim99@14 25 # configuration script generated by Autoconf, you may include it under
joachim99@14 26 # the same distribution terms that you use for the rest of that program.
joachim99@14 27
joachim99@2 28 # Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>.
joachim99@2 29
joachim99@69 30 case $1 in
joachim99@69 31 '')
joachim99@69 32 echo "$0: No command. Try \`$0 --help' for more information." 1>&2
joachim99@69 33 exit 1;
joachim99@69 34 ;;
joachim99@69 35 -h | --h*)
joachim99@69 36 cat <<\EOF
joachim99@69 37 Usage: depcomp [--help] [--version] PROGRAM [ARGS]
joachim99@69 38
joachim99@69 39 Run PROGRAMS ARGS to compile a file, generating dependencies
joachim99@69 40 as side-effects.
joachim99@69 41
joachim99@69 42 Environment variables:
joachim99@69 43 depmode Dependency tracking mode.
joachim99@69 44 source Source file read by `PROGRAMS ARGS'.
joachim99@69 45 object Object file output by `PROGRAMS ARGS'.
joachim99@69 46 DEPDIR directory where to store dependencies.
joachim99@69 47 depfile Dependency file to output.
joachim99@69 48 tmpdepfile Temporary file to use when outputing dependencies.
joachim99@69 49 libtool Whether libtool is used (yes/no).
joachim99@69 50
joachim99@69 51 Report bugs to <bug-automake@gnu.org>.
joachim99@69 52 EOF
joachim99@69 53 exit $?
joachim99@69 54 ;;
joachim99@69 55 -v | --v*)
joachim99@69 56 echo "depcomp $scriptversion"
joachim99@69 57 exit $?
joachim99@69 58 ;;
joachim99@69 59 esac
joachim99@69 60
joachim99@2 61 if test -z "$depmode" || test -z "$source" || test -z "$object"; then
joachim99@2 62 echo "depcomp: Variables source, object and depmode must be set" 1>&2
joachim99@2 63 exit 1
joachim99@2 64 fi
joachim99@2 65
joachim99@69 66 # Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po.
joachim99@69 67 depfile=${depfile-`echo "$object" |
joachim99@69 68 sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`}
joachim99@2 69 tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
joachim99@2 70
joachim99@2 71 rm -f "$tmpdepfile"
joachim99@2 72
joachim99@2 73 # Some modes work just like other modes, but use different flags. We
joachim99@2 74 # parameterize here, but still list the modes in the big case below,
joachim99@2 75 # to make depend.m4 easier to write. Note that we *cannot* use a case
joachim99@2 76 # here, because this file can only contain one case statement.
joachim99@2 77 if test "$depmode" = hp; then
joachim99@2 78 # HP compiler uses -M and no extra arg.
joachim99@2 79 gccflag=-M
joachim99@2 80 depmode=gcc
joachim99@2 81 fi
joachim99@2 82
joachim99@2 83 if test "$depmode" = dashXmstdout; then
joachim99@2 84 # This is just like dashmstdout with a different argument.
joachim99@2 85 dashmflag=-xM
joachim99@2 86 depmode=dashmstdout
joachim99@2 87 fi
joachim99@2 88
joachim99@2 89 case "$depmode" in
joachim99@2 90 gcc3)
joachim99@2 91 ## gcc 3 implements dependency tracking that does exactly what
joachim99@14 92 ## we want. Yay! Note: for some reason libtool 1.4 doesn't like
joachim99@14 93 ## it if -MD -MP comes after the -MF stuff. Hmm.
joachim99@14 94 "$@" -MT "$object" -MD -MP -MF "$tmpdepfile"
joachim99@14 95 stat=$?
joachim99@14 96 if test $stat -eq 0; then :
joachim99@2 97 else
joachim99@2 98 rm -f "$tmpdepfile"
joachim99@2 99 exit $stat
joachim99@2 100 fi
joachim99@2 101 mv "$tmpdepfile" "$depfile"
joachim99@2 102 ;;
joachim99@2 103
joachim99@2 104 gcc)
joachim99@2 105 ## There are various ways to get dependency output from gcc. Here's
joachim99@2 106 ## why we pick this rather obscure method:
joachim99@2 107 ## - Don't want to use -MD because we'd like the dependencies to end
joachim99@2 108 ## up in a subdir. Having to rename by hand is ugly.
joachim99@2 109 ## (We might end up doing this anyway to support other compilers.)
joachim99@2 110 ## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
joachim99@2 111 ## -MM, not -M (despite what the docs say).
joachim99@2 112 ## - Using -M directly means running the compiler twice (even worse
joachim99@2 113 ## than renaming).
joachim99@2 114 if test -z "$gccflag"; then
joachim99@2 115 gccflag=-MD,
joachim99@2 116 fi
joachim99@14 117 "$@" -Wp,"$gccflag$tmpdepfile"
joachim99@14 118 stat=$?
joachim99@14 119 if test $stat -eq 0; then :
joachim99@2 120 else
joachim99@2 121 rm -f "$tmpdepfile"
joachim99@2 122 exit $stat
joachim99@2 123 fi
joachim99@2 124 rm -f "$depfile"
joachim99@2 125 echo "$object : \\" > "$depfile"
joachim99@2 126 alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
joachim99@2 127 ## The second -e expression handles DOS-style file names with drive letters.
joachim99@2 128 sed -e 's/^[^:]*: / /' \
joachim99@2 129 -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
joachim99@2 130 ## This next piece of magic avoids the `deleted header file' problem.
joachim99@2 131 ## The problem is that when a header file which appears in a .P file
joachim99@2 132 ## is deleted, the dependency causes make to die (because there is
joachim99@2 133 ## typically no way to rebuild the header). We avoid this by adding
joachim99@2 134 ## dummy dependencies for each header file. Too bad gcc doesn't do
joachim99@2 135 ## this for us directly.
joachim99@2 136 tr ' ' '
joachim99@2 137 ' < "$tmpdepfile" |
joachim99@2 138 ## Some versions of gcc put a space before the `:'. On the theory
joachim99@2 139 ## that the space means something, we add a space to the output as
joachim99@2 140 ## well.
joachim99@2 141 ## Some versions of the HPUX 10.20 sed can't process this invocation
joachim99@2 142 ## correctly. Breaking it into two sed invocations is a workaround.
joachim99@2 143 sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
joachim99@2 144 rm -f "$tmpdepfile"
joachim99@2 145 ;;
joachim99@2 146
joachim99@2 147 hp)
joachim99@2 148 # This case exists only to let depend.m4 do its work. It works by
joachim99@2 149 # looking at the text of this script. This case will never be run,
joachim99@2 150 # since it is checked for above.
joachim99@2 151 exit 1
joachim99@2 152 ;;
joachim99@2 153
joachim99@2 154 sgi)
joachim99@2 155 if test "$libtool" = yes; then
joachim99@2 156 "$@" "-Wp,-MDupdate,$tmpdepfile"
joachim99@2 157 else
joachim99@2 158 "$@" -MDupdate "$tmpdepfile"
joachim99@2 159 fi
joachim99@2 160 stat=$?
joachim99@2 161 if test $stat -eq 0; then :
joachim99@2 162 else
joachim99@2 163 rm -f "$tmpdepfile"
joachim99@2 164 exit $stat
joachim99@2 165 fi
joachim99@2 166 rm -f "$depfile"
joachim99@2 167
joachim99@2 168 if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files
joachim99@2 169 echo "$object : \\" > "$depfile"
joachim99@2 170
joachim99@14 171 # Clip off the initial element (the dependent). Don't try to be
joachim99@2 172 # clever and replace this with sed code, as IRIX sed won't handle
joachim99@2 173 # lines with more than a fixed number of characters (4096 in
joachim99@14 174 # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines;
joachim99@14 175 # the IRIX cc adds comments like `#:fec' to the end of the
joachim99@14 176 # dependency line.
joachim99@2 177 tr ' ' '
joachim99@14 178 ' < "$tmpdepfile" \
joachim99@14 179 | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
joachim99@14 180 tr '
joachim99@2 181 ' ' ' >> $depfile
joachim99@14 182 echo >> $depfile
joachim99@2 183
joachim99@14 184 # The second pass generates a dummy entry for each header file.
joachim99@2 185 tr ' ' '
joachim99@14 186 ' < "$tmpdepfile" \
joachim99@14 187 | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
joachim99@14 188 >> $depfile
joachim99@2 189 else
joachim99@2 190 # The sourcefile does not contain any dependencies, so just
joachim99@2 191 # store a dummy comment line, to avoid errors with the Makefile
joachim99@2 192 # "include basename.Plo" scheme.
joachim99@2 193 echo "#dummy" > "$depfile"
joachim99@2 194 fi
joachim99@2 195 rm -f "$tmpdepfile"
joachim99@2 196 ;;
joachim99@2 197
joachim99@2 198 aix)
joachim99@2 199 # The C for AIX Compiler uses -M and outputs the dependencies
joachim99@69 200 # in a .u file. In older versions, this file always lives in the
joachim99@69 201 # current directory. Also, the AIX compiler puts `$object:' at the
joachim99@69 202 # start of each line; $object doesn't have directory information.
joachim99@69 203 # Version 6 uses the directory in both cases.
joachim99@69 204 stripped=`echo "$object" | sed 's/\(.*\)\..*$/\1/'`
joachim99@14 205 tmpdepfile="$stripped.u"
joachim99@2 206 if test "$libtool" = yes; then
joachim99@2 207 "$@" -Wc,-M
joachim99@2 208 else
joachim99@2 209 "$@" -M
joachim99@2 210 fi
joachim99@69 211 stat=$?
joachim99@2 212
joachim99@69 213 if test -f "$tmpdepfile"; then :
joachim99@69 214 else
joachim99@69 215 stripped=`echo "$stripped" | sed 's,^.*/,,'`
joachim99@69 216 tmpdepfile="$stripped.u"
joachim99@69 217 fi
joachim99@69 218
joachim99@2 219 if test $stat -eq 0; then :
joachim99@2 220 else
joachim99@2 221 rm -f "$tmpdepfile"
joachim99@2 222 exit $stat
joachim99@2 223 fi
joachim99@2 224
joachim99@2 225 if test -f "$tmpdepfile"; then
joachim99@69 226 outname="$stripped.o"
joachim99@14 227 # Each line is of the form `foo.o: dependent.h'.
joachim99@14 228 # Do two passes, one to just change these to
joachim99@14 229 # `$object: dependent.h' and one to simply `dependent.h:'.
joachim99@14 230 sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile"
joachim99@14 231 sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile"
joachim99@2 232 else
joachim99@2 233 # The sourcefile does not contain any dependencies, so just
joachim99@2 234 # store a dummy comment line, to avoid errors with the Makefile
joachim99@2 235 # "include basename.Plo" scheme.
joachim99@2 236 echo "#dummy" > "$depfile"
joachim99@2 237 fi
joachim99@2 238 rm -f "$tmpdepfile"
joachim99@2 239 ;;
joachim99@2 240
joachim99@14 241 icc)
joachim99@69 242 # Intel's C compiler understands `-MD -MF file'. However on
joachim99@14 243 # icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c
joachim99@69 244 # ICC 7.0 will fill foo.d with something like
joachim99@14 245 # foo.o: sub/foo.c
joachim99@14 246 # foo.o: sub/foo.h
joachim99@14 247 # which is wrong. We want:
joachim99@14 248 # sub/foo.o: sub/foo.c
joachim99@14 249 # sub/foo.o: sub/foo.h
joachim99@14 250 # sub/foo.c:
joachim99@14 251 # sub/foo.h:
joachim99@69 252 # ICC 7.1 will output
joachim99@69 253 # foo.o: sub/foo.c sub/foo.h
joachim99@69 254 # and will wrap long lines using \ :
joachim99@69 255 # foo.o: sub/foo.c ... \
joachim99@69 256 # sub/foo.h ... \
joachim99@69 257 # ...
joachim99@14 258
joachim99@14 259 "$@" -MD -MF "$tmpdepfile"
joachim99@14 260 stat=$?
joachim99@14 261 if test $stat -eq 0; then :
joachim99@14 262 else
joachim99@14 263 rm -f "$tmpdepfile"
joachim99@14 264 exit $stat
joachim99@14 265 fi
joachim99@14 266 rm -f "$depfile"
joachim99@69 267 # Each line is of the form `foo.o: dependent.h',
joachim99@69 268 # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'.
joachim99@14 269 # Do two passes, one to just change these to
joachim99@14 270 # `$object: dependent.h' and one to simply `dependent.h:'.
joachim99@69 271 sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
joachim99@69 272 # Some versions of the HPUX 10.20 sed can't process this invocation
joachim99@69 273 # correctly. Breaking it into two sed invocations is a workaround.
joachim99@69 274 sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" |
joachim99@69 275 sed -e 's/$/ :/' >> "$depfile"
joachim99@14 276 rm -f "$tmpdepfile"
joachim99@14 277 ;;
joachim99@14 278
joachim99@14 279 tru64)
joachim99@69 280 # The Tru64 compiler uses -MD to generate dependencies as a side
joachim99@14 281 # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'.
joachim99@69 282 # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
joachim99@14 283 # dependencies in `foo.d' instead, so we check for that too.
joachim99@14 284 # Subdirectories are respected.
joachim99@69 285 dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
joachim99@69 286 test "x$dir" = "x$object" && dir=
joachim99@69 287 base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
joachim99@14 288
joachim99@14 289 if test "$libtool" = yes; then
joachim99@69 290 # With Tru64 cc, shared objects can also be used to make a
joachim99@69 291 # static library. This mecanism is used in libtool 1.4 series to
joachim99@69 292 # handle both shared and static libraries in a single compilation.
joachim99@69 293 # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d.
joachim99@69 294 #
joachim99@69 295 # With libtool 1.5 this exception was removed, and libtool now
joachim99@69 296 # generates 2 separate objects for the 2 libraries. These two
joachim99@69 297 # compilations output dependencies in in $dir.libs/$base.o.d and
joachim99@69 298 # in $dir$base.o.d. We have to check for both files, because
joachim99@69 299 # one of the two compilations can be disabled. We should prefer
joachim99@69 300 # $dir$base.o.d over $dir.libs/$base.o.d because the latter is
joachim99@69 301 # automatically cleaned when .libs/ is deleted, while ignoring
joachim99@69 302 # the former would cause a distcleancheck panic.
joachim99@69 303 tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4
joachim99@69 304 tmpdepfile2=$dir$base.o.d # libtool 1.5
joachim99@69 305 tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5
joachim99@69 306 tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504
joachim99@14 307 "$@" -Wc,-MD
joachim99@14 308 else
joachim99@69 309 tmpdepfile1=$dir$base.o.d
joachim99@69 310 tmpdepfile2=$dir$base.d
joachim99@69 311 tmpdepfile3=$dir$base.d
joachim99@69 312 tmpdepfile4=$dir$base.d
joachim99@14 313 "$@" -MD
joachim99@14 314 fi
joachim99@14 315
joachim99@14 316 stat=$?
joachim99@14 317 if test $stat -eq 0; then :
joachim99@14 318 else
joachim99@69 319 rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
joachim99@14 320 exit $stat
joachim99@14 321 fi
joachim99@14 322
joachim99@69 323 for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
joachim99@69 324 do
joachim99@69 325 test -f "$tmpdepfile" && break
joachim99@69 326 done
joachim99@14 327 if test -f "$tmpdepfile"; then
joachim99@14 328 sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
joachim99@69 329 # That's a tab and a space in the [].
joachim99@69 330 sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
joachim99@14 331 else
joachim99@14 332 echo "#dummy" > "$depfile"
joachim99@14 333 fi
joachim99@14 334 rm -f "$tmpdepfile"
joachim99@14 335 ;;
joachim99@14 336
joachim99@2 337 #nosideeffect)
joachim99@2 338 # This comment above is used by automake to tell side-effect
joachim99@2 339 # dependency tracking mechanisms from slower ones.
joachim99@2 340
joachim99@2 341 dashmstdout)
joachim99@2 342 # Important note: in order to support this mode, a compiler *must*
joachim99@69 343 # always write the preprocessed file to stdout, regardless of -o.
joachim99@69 344 "$@" || exit $?
joachim99@69 345
joachim99@69 346 # Remove the call to Libtool.
joachim99@69 347 if test "$libtool" = yes; then
joachim99@69 348 while test $1 != '--mode=compile'; do
joachim99@69 349 shift
joachim99@69 350 done
joachim99@69 351 shift
joachim99@69 352 fi
joachim99@69 353
joachim99@69 354 # Remove `-o $object'.
joachim99@69 355 IFS=" "
joachim99@69 356 for arg
joachim99@69 357 do
joachim99@69 358 case $arg in
joachim99@69 359 -o)
joachim99@69 360 shift
joachim99@69 361 ;;
joachim99@69 362 $object)
joachim99@69 363 shift
joachim99@69 364 ;;
joachim99@69 365 *)
joachim99@69 366 set fnord "$@" "$arg"
joachim99@69 367 shift # fnord
joachim99@69 368 shift # $arg
joachim99@2 369 ;;
joachim99@2 370 esac
joachim99@69 371 done
joachim99@69 372
joachim99@69 373 test -z "$dashmflag" && dashmflag=-M
joachim99@69 374 # Require at least two characters before searching for `:'
joachim99@69 375 # in the target name. This is to cope with DOS-style filenames:
joachim99@69 376 # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise.
joachim99@69 377 "$@" $dashmflag |
joachim99@69 378 sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile"
joachim99@2 379 rm -f "$depfile"
joachim99@2 380 cat < "$tmpdepfile" > "$depfile"
joachim99@2 381 tr ' ' '
joachim99@2 382 ' < "$tmpdepfile" | \
joachim99@2 383 ## Some versions of the HPUX 10.20 sed can't process this invocation
joachim99@2 384 ## correctly. Breaking it into two sed invocations is a workaround.
joachim99@2 385 sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
joachim99@2 386 rm -f "$tmpdepfile"
joachim99@2 387 ;;
joachim99@2 388
joachim99@2 389 dashXmstdout)
joachim99@2 390 # This case only exists to satisfy depend.m4. It is never actually
joachim99@2 391 # run, as this mode is specially recognized in the preamble.
joachim99@2 392 exit 1
joachim99@2 393 ;;
joachim99@2 394
joachim99@2 395 makedepend)
joachim99@69 396 "$@" || exit $?
joachim99@69 397 # Remove any Libtool call
joachim99@69 398 if test "$libtool" = yes; then
joachim99@69 399 while test $1 != '--mode=compile'; do
joachim99@69 400 shift
joachim99@69 401 done
joachim99@69 402 shift
joachim99@69 403 fi
joachim99@2 404 # X makedepend
joachim99@69 405 shift
joachim99@69 406 cleared=no
joachim99@69 407 for arg in "$@"; do
joachim99@69 408 case $cleared in
joachim99@69 409 no)
joachim99@69 410 set ""; shift
joachim99@69 411 cleared=yes ;;
joachim99@69 412 esac
joachim99@69 413 case "$arg" in
joachim99@69 414 -D*|-I*)
joachim99@69 415 set fnord "$@" "$arg"; shift ;;
joachim99@69 416 # Strip any option that makedepend may not understand. Remove
joachim99@69 417 # the object too, otherwise makedepend will parse it as a source file.
joachim99@69 418 -*|$object)
joachim99@69 419 ;;
joachim99@69 420 *)
joachim99@69 421 set fnord "$@" "$arg"; shift ;;
joachim99@69 422 esac
joachim99@69 423 done
joachim99@69 424 obj_suffix="`echo $object | sed 's/^.*\././'`"
joachim99@69 425 touch "$tmpdepfile"
joachim99@69 426 ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
joachim99@2 427 rm -f "$depfile"
joachim99@2 428 cat < "$tmpdepfile" > "$depfile"
joachim99@69 429 sed '1,2d' "$tmpdepfile" | tr ' ' '
joachim99@2 430 ' | \
joachim99@2 431 ## Some versions of the HPUX 10.20 sed can't process this invocation
joachim99@2 432 ## correctly. Breaking it into two sed invocations is a workaround.
joachim99@2 433 sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
joachim99@2 434 rm -f "$tmpdepfile" "$tmpdepfile".bak
joachim99@2 435 ;;
joachim99@2 436
joachim99@2 437 cpp)
joachim99@2 438 # Important note: in order to support this mode, a compiler *must*
joachim99@69 439 # always write the preprocessed file to stdout.
joachim99@69 440 "$@" || exit $?
joachim99@69 441
joachim99@69 442 # Remove the call to Libtool.
joachim99@69 443 if test "$libtool" = yes; then
joachim99@69 444 while test $1 != '--mode=compile'; do
joachim99@69 445 shift
joachim99@69 446 done
joachim99@69 447 shift
joachim99@69 448 fi
joachim99@69 449
joachim99@69 450 # Remove `-o $object'.
joachim99@69 451 IFS=" "
joachim99@69 452 for arg
joachim99@69 453 do
joachim99@69 454 case $arg in
joachim99@69 455 -o)
joachim99@69 456 shift
joachim99@69 457 ;;
joachim99@69 458 $object)
joachim99@69 459 shift
joachim99@69 460 ;;
joachim99@69 461 *)
joachim99@69 462 set fnord "$@" "$arg"
joachim99@69 463 shift # fnord
joachim99@69 464 shift # $arg
joachim99@2 465 ;;
joachim99@2 466 esac
joachim99@69 467 done
joachim99@69 468
joachim99@69 469 "$@" -E |
joachim99@2 470 sed -n '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |
joachim99@2 471 sed '$ s: \\$::' > "$tmpdepfile"
joachim99@2 472 rm -f "$depfile"
joachim99@2 473 echo "$object : \\" > "$depfile"
joachim99@2 474 cat < "$tmpdepfile" >> "$depfile"
joachim99@2 475 sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile"
joachim99@2 476 rm -f "$tmpdepfile"
joachim99@2 477 ;;
joachim99@2 478
joachim99@2 479 msvisualcpp)
joachim99@2 480 # Important note: in order to support this mode, a compiler *must*
joachim99@69 481 # always write the preprocessed file to stdout, regardless of -o,
joachim99@2 482 # because we must use -o when running libtool.
joachim99@69 483 "$@" || exit $?
joachim99@69 484 IFS=" "
joachim99@69 485 for arg
joachim99@69 486 do
joachim99@69 487 case "$arg" in
joachim99@69 488 "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
joachim99@69 489 set fnord "$@"
joachim99@69 490 shift
joachim99@69 491 shift
joachim99@69 492 ;;
joachim99@69 493 *)
joachim99@2 494 set fnord "$@" "$arg"
joachim99@69 495 shift
joachim99@69 496 shift
joachim99@69 497 ;;
joachim99@2 498 esac
joachim99@69 499 done
joachim99@69 500 "$@" -E |
joachim99@69 501 sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile"
joachim99@2 502 rm -f "$depfile"
joachim99@2 503 echo "$object : \\" > "$depfile"
joachim99@2 504 . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile"
joachim99@2 505 echo " " >> "$depfile"
joachim99@2 506 . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile"
joachim99@2 507 rm -f "$tmpdepfile"
joachim99@2 508 ;;
joachim99@2 509
joachim99@2 510 none)
joachim99@2 511 exec "$@"
joachim99@2 512 ;;
joachim99@2 513
joachim99@2 514 *)
joachim99@2 515 echo "Unknown depmode $depmode" 1>&2
joachim99@2 516 exit 1
joachim99@2 517 ;;
joachim99@2 518 esac
joachim99@2 519
joachim99@2 520 exit 0
joachim99@69 521
joachim99@69 522 # Local Variables:
joachim99@69 523 # mode: shell-script
joachim99@69 524 # sh-indentation: 2
joachim99@69 525 # eval: (add-hook 'write-file-hooks 'time-stamp)
joachim99@69 526 # time-stamp-start: "scriptversion="
joachim99@69 527 # time-stamp-format: "%:y-%02m-%02d.%02H"
joachim99@69 528 # time-stamp-end: "$"
joachim99@69 529 # End: