lemon-project-template-glpk

annotate deps/glpk/depcomp @ 9:33de93886c88

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