depcomp
branchSDL-1.2
changeset 611 b39ee38ead19
parent 285 b3f70e3d7246
equal deleted inserted replaced
609:e14e00a2754d 611:b39ee38ead19
     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 
     4 scriptversion=2006-10-15.18
     4 scriptversion=2012-07-12.20; # UTC
     5 
     5 
     6 # Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006 Free Software
     6 # Copyright (C) 1999-2012 Free Software Foundation, Inc.
     7 # Foundation, Inc.
       
     8 
     7 
     9 # 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
    10 # 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
    11 # the Free Software Foundation; either version 2, or (at your option)
    10 # the Free Software Foundation; either version 2, or (at your option)
    12 # any later version.
    11 # any later version.
    15 # but WITHOUT ANY WARRANTY; without even the implied warranty of
    14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
    16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    17 # GNU General Public License for more details.
    16 # GNU General Public License for more details.
    18 
    17 
    19 # 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
    20 # along with this program; if not, write to the Free Software
    19 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
    21 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
       
    22 # 02110-1301, USA.
       
    23 
    20 
    24 # As a special exception to the GNU General Public License, if you
    21 # As a special exception to the GNU General Public License, if you
    25 # distribute this file as part of a program that contains a
    22 # distribute this file as part of a program that contains a
    26 # configuration script generated by Autoconf, you may include it under
    23 # configuration script generated by Autoconf, you may include it under
    27 # the same distribution terms that you use for the rest of that program.
    24 # the same distribution terms that you use for the rest of that program.
    28 
    25 
    29 # Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>.
    26 # Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>.
    30 
    27 
    31 case $1 in
    28 case $1 in
    32   '')
    29   '')
    33      echo "$0: No command.  Try \`$0 --help' for more information." 1>&2
    30      echo "$0: No command.  Try '$0 --help' for more information." 1>&2
    34      exit 1;
    31      exit 1;
    35      ;;
    32      ;;
    36   -h | --h*)
    33   -h | --h*)
    37     cat <<\EOF
    34     cat <<\EOF
    38 Usage: depcomp [--help] [--version] PROGRAM [ARGS]
    35 Usage: depcomp [--help] [--version] PROGRAM [ARGS]
    40 Run PROGRAMS ARGS to compile a file, generating dependencies
    37 Run PROGRAMS ARGS to compile a file, generating dependencies
    41 as side-effects.
    38 as side-effects.
    42 
    39 
    43 Environment variables:
    40 Environment variables:
    44   depmode     Dependency tracking mode.
    41   depmode     Dependency tracking mode.
    45   source      Source file read by `PROGRAMS ARGS'.
    42   source      Source file read by 'PROGRAMS ARGS'.
    46   object      Object file output by `PROGRAMS ARGS'.
    43   object      Object file output by 'PROGRAMS ARGS'.
    47   DEPDIR      directory where to store dependencies.
    44   DEPDIR      directory where to store dependencies.
    48   depfile     Dependency file to output.
    45   depfile     Dependency file to output.
    49   tmpdepfile  Temporary file to use when outputing dependencies.
    46   tmpdepfile  Temporary file to use when outputting dependencies.
    50   libtool     Whether libtool is used (yes/no).
    47   libtool     Whether libtool is used (yes/no).
    51 
    48 
    52 Report bugs to <bug-automake@gnu.org>.
    49 Report bugs to <bug-automake@gnu.org>.
    53 EOF
    50 EOF
    54     exit $?
    51     exit $?
    57     echo "depcomp $scriptversion"
    54     echo "depcomp $scriptversion"
    58     exit $?
    55     exit $?
    59     ;;
    56     ;;
    60 esac
    57 esac
    61 
    58 
       
    59 # A tabulation character.
       
    60 tab='	'
       
    61 # A newline character.
       
    62 nl='
       
    63 '
       
    64 
    62 if test -z "$depmode" || test -z "$source" || test -z "$object"; then
    65 if test -z "$depmode" || test -z "$source" || test -z "$object"; then
    63   echo "depcomp: Variables source, object and depmode must be set" 1>&2
    66   echo "depcomp: Variables source, object and depmode must be set" 1>&2
    64   exit 1
    67   exit 1
    65 fi
    68 fi
    66 
    69 
    83 
    86 
    84 if test "$depmode" = dashXmstdout; then
    87 if test "$depmode" = dashXmstdout; then
    85    # This is just like dashmstdout with a different argument.
    88    # This is just like dashmstdout with a different argument.
    86    dashmflag=-xM
    89    dashmflag=-xM
    87    depmode=dashmstdout
    90    depmode=dashmstdout
       
    91 fi
       
    92 
       
    93 cygpath_u="cygpath -u -f -"
       
    94 if test "$depmode" = msvcmsys; then
       
    95    # This is just like msvisualcpp but w/o cygpath translation.
       
    96    # Just convert the backslash-escaped backslashes to single forward
       
    97    # slashes to satisfy depend.m4
       
    98    cygpath_u='sed s,\\\\,/,g'
       
    99    depmode=msvisualcpp
       
   100 fi
       
   101 
       
   102 if test "$depmode" = msvc7msys; then
       
   103    # This is just like msvc7 but w/o cygpath translation.
       
   104    # Just convert the backslash-escaped backslashes to single forward
       
   105    # slashes to satisfy depend.m4
       
   106    cygpath_u='sed s,\\\\,/,g'
       
   107    depmode=msvc7
       
   108 fi
       
   109 
       
   110 if test "$depmode" = xlc; then
       
   111    # IBM C/C++ Compilers xlc/xlC can output gcc-like dependency informations.
       
   112    gccflag=-qmakedep=gcc,-MF
       
   113    depmode=gcc
    88 fi
   114 fi
    89 
   115 
    90 case "$depmode" in
   116 case "$depmode" in
    91 gcc3)
   117 gcc3)
    92 ## gcc 3 implements dependency tracking that does exactly what
   118 ## gcc 3 implements dependency tracking that does exactly what
   139   echo "$object : \\" > "$depfile"
   165   echo "$object : \\" > "$depfile"
   140   alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
   166   alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
   141 ## The second -e expression handles DOS-style file names with drive letters.
   167 ## The second -e expression handles DOS-style file names with drive letters.
   142   sed -e 's/^[^:]*: / /' \
   168   sed -e 's/^[^:]*: / /' \
   143       -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
   169       -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
   144 ## This next piece of magic avoids the `deleted header file' problem.
   170 ## This next piece of magic avoids the "deleted header file" problem.
   145 ## The problem is that when a header file which appears in a .P file
   171 ## The problem is that when a header file which appears in a .P file
   146 ## is deleted, the dependency causes make to die (because there is
   172 ## is deleted, the dependency causes make to die (because there is
   147 ## typically no way to rebuild the header).  We avoid this by adding
   173 ## typically no way to rebuild the header).  We avoid this by adding
   148 ## dummy dependencies for each header file.  Too bad gcc doesn't do
   174 ## dummy dependencies for each header file.  Too bad gcc doesn't do
   149 ## this for us directly.
   175 ## this for us directly.
   150   tr ' ' '
   176   tr ' ' "$nl" < "$tmpdepfile" |
   151 ' < "$tmpdepfile" |
   177 ## Some versions of gcc put a space before the ':'.  On the theory
   152 ## Some versions of gcc put a space before the `:'.  On the theory
       
   153 ## that the space means something, we add a space to the output as
   178 ## that the space means something, we add a space to the output as
   154 ## well.
   179 ## well.  hp depmode also adds that space, but also prefixes the VPATH
       
   180 ## to the object.  Take care to not repeat it in the output.
   155 ## Some versions of the HPUX 10.20 sed can't process this invocation
   181 ## Some versions of the HPUX 10.20 sed can't process this invocation
   156 ## correctly.  Breaking it into two sed invocations is a workaround.
   182 ## correctly.  Breaking it into two sed invocations is a workaround.
   157     sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
   183     sed -e 's/^\\$//' -e '/^$/d' -e "s|.*$object$||" -e '/:$/d' \
       
   184       | sed -e 's/$/ :/' >> "$depfile"
   158   rm -f "$tmpdepfile"
   185   rm -f "$tmpdepfile"
   159   ;;
   186   ;;
   160 
   187 
   161 hp)
   188 hp)
   162   # This case exists only to let depend.m4 do its work.  It works by
   189   # This case exists only to let depend.m4 do its work.  It works by
   184 
   211 
   185     # Clip off the initial element (the dependent).  Don't try to be
   212     # Clip off the initial element (the dependent).  Don't try to be
   186     # clever and replace this with sed code, as IRIX sed won't handle
   213     # clever and replace this with sed code, as IRIX sed won't handle
   187     # lines with more than a fixed number of characters (4096 in
   214     # lines with more than a fixed number of characters (4096 in
   188     # IRIX 6.2 sed, 8192 in IRIX 6.5).  We also remove comment lines;
   215     # IRIX 6.2 sed, 8192 in IRIX 6.5).  We also remove comment lines;
   189     # the IRIX cc adds comments like `#:fec' to the end of the
   216     # the IRIX cc adds comments like '#:fec' to the end of the
   190     # dependency line.
   217     # dependency line.
   191     tr ' ' '
   218     tr ' ' "$nl" < "$tmpdepfile" \
   192 ' < "$tmpdepfile" \
       
   193     | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
   219     | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
   194     tr '
   220     tr "$nl" ' ' >> "$depfile"
   195 ' ' ' >> $depfile
   221     echo >> "$depfile"
   196     echo >> $depfile
       
   197 
   222 
   198     # The second pass generates a dummy entry for each header file.
   223     # The second pass generates a dummy entry for each header file.
   199     tr ' ' '
   224     tr ' ' "$nl" < "$tmpdepfile" \
   200 ' < "$tmpdepfile" \
       
   201    | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
   225    | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
   202    >> $depfile
   226    >> "$depfile"
   203   else
   227   else
   204     # The sourcefile does not contain any dependencies, so just
   228     # The sourcefile does not contain any dependencies, so just
   205     # store a dummy comment line, to avoid errors with the Makefile
   229     # store a dummy comment line, to avoid errors with the Makefile
   206     # "include basename.Plo" scheme.
   230     # "include basename.Plo" scheme.
   207     echo "#dummy" > "$depfile"
   231     echo "#dummy" > "$depfile"
   208   fi
   232   fi
   209   rm -f "$tmpdepfile"
   233   rm -f "$tmpdepfile"
   210   ;;
   234   ;;
   211 
   235 
       
   236 xlc)
       
   237   # This case exists only to let depend.m4 do its work.  It works by
       
   238   # looking at the text of this script.  This case will never be run,
       
   239   # since it is checked for above.
       
   240   exit 1
       
   241   ;;
       
   242 
   212 aix)
   243 aix)
   213   # The C for AIX Compiler uses -M and outputs the dependencies
   244   # The C for AIX Compiler uses -M and outputs the dependencies
   214   # in a .u file.  In older versions, this file always lives in the
   245   # in a .u file.  In older versions, this file always lives in the
   215   # current directory.  Also, the AIX compiler puts `$object:' at the
   246   # current directory.  Also, the AIX compiler puts '$object:' at the
   216   # start of each line; $object doesn't have directory information.
   247   # start of each line; $object doesn't have directory information.
   217   # Version 6 uses the directory in both cases.
   248   # Version 6 uses the directory in both cases.
   218   stripped=`echo "$object" | sed 's/\(.*\)\..*$/\1/'`
   249   dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
   219   tmpdepfile="$stripped.u"
   250   test "x$dir" = "x$object" && dir=
       
   251   base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
   220   if test "$libtool" = yes; then
   252   if test "$libtool" = yes; then
       
   253     tmpdepfile1=$dir$base.u
       
   254     tmpdepfile2=$base.u
       
   255     tmpdepfile3=$dir.libs/$base.u
   221     "$@" -Wc,-M
   256     "$@" -Wc,-M
   222   else
   257   else
       
   258     tmpdepfile1=$dir$base.u
       
   259     tmpdepfile2=$dir$base.u
       
   260     tmpdepfile3=$dir$base.u
   223     "$@" -M
   261     "$@" -M
   224   fi
   262   fi
   225   stat=$?
   263   stat=$?
   226 
   264 
   227   if test -f "$tmpdepfile"; then :
       
   228   else
       
   229     stripped=`echo "$stripped" | sed 's,^.*/,,'`
       
   230     tmpdepfile="$stripped.u"
       
   231   fi
       
   232 
       
   233   if test $stat -eq 0; then :
   265   if test $stat -eq 0; then :
   234   else
   266   else
   235     rm -f "$tmpdepfile"
   267     rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
   236     exit $stat
   268     exit $stat
   237   fi
   269   fi
   238 
   270 
       
   271   for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
       
   272   do
       
   273     test -f "$tmpdepfile" && break
       
   274   done
   239   if test -f "$tmpdepfile"; then
   275   if test -f "$tmpdepfile"; then
   240     outname="$stripped.o"
   276     # Each line is of the form 'foo.o: dependent.h'.
   241     # Each line is of the form `foo.o: dependent.h'.
       
   242     # Do two passes, one to just change these to
   277     # Do two passes, one to just change these to
   243     # `$object: dependent.h' and one to simply `dependent.h:'.
   278     # '$object: dependent.h' and one to simply 'dependent.h:'.
   244     sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile"
   279     sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
   245     sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile"
   280     sed -e 's,^.*\.[a-z]*:['"$tab"' ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
   246   else
   281   else
   247     # The sourcefile does not contain any dependencies, so just
   282     # The sourcefile does not contain any dependencies, so just
   248     # store a dummy comment line, to avoid errors with the Makefile
   283     # store a dummy comment line, to avoid errors with the Makefile
   249     # "include basename.Plo" scheme.
   284     # "include basename.Plo" scheme.
   250     echo "#dummy" > "$depfile"
   285     echo "#dummy" > "$depfile"
   251   fi
   286   fi
   252   rm -f "$tmpdepfile"
   287   rm -f "$tmpdepfile"
   253   ;;
   288   ;;
   254 
   289 
   255 icc)
   290 icc)
   256   # Intel's C compiler understands `-MD -MF file'.  However on
   291   # Intel's C compiler anf tcc (Tiny C Compiler) understand '-MD -MF file'.
   257   #    icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c
   292   # However on
       
   293   #    $CC -MD -MF foo.d -c -o sub/foo.o sub/foo.c
   258   # ICC 7.0 will fill foo.d with something like
   294   # ICC 7.0 will fill foo.d with something like
   259   #    foo.o: sub/foo.c
   295   #    foo.o: sub/foo.c
   260   #    foo.o: sub/foo.h
   296   #    foo.o: sub/foo.h
   261   # which is wrong.  We want:
   297   # which is wrong.  We want
   262   #    sub/foo.o: sub/foo.c
   298   #    sub/foo.o: sub/foo.c
   263   #    sub/foo.o: sub/foo.h
   299   #    sub/foo.o: sub/foo.h
   264   #    sub/foo.c:
   300   #    sub/foo.c:
   265   #    sub/foo.h:
   301   #    sub/foo.h:
   266   # ICC 7.1 will output
   302   # ICC 7.1 will output
   267   #    foo.o: sub/foo.c sub/foo.h
   303   #    foo.o: sub/foo.c sub/foo.h
   268   # and will wrap long lines using \ :
   304   # and will wrap long lines using '\':
   269   #    foo.o: sub/foo.c ... \
   305   #    foo.o: sub/foo.c ... \
   270   #     sub/foo.h ... \
   306   #     sub/foo.h ... \
   271   #     ...
   307   #     ...
   272 
   308   # tcc 0.9.26 (FIXME still under development at the moment of writing)
       
   309   # will emit a similar output, but also prepend the continuation lines
       
   310   # with horizontal tabulation characters.
   273   "$@" -MD -MF "$tmpdepfile"
   311   "$@" -MD -MF "$tmpdepfile"
   274   stat=$?
   312   stat=$?
   275   if test $stat -eq 0; then :
   313   if test $stat -eq 0; then :
   276   else
   314   else
       
   315     rm -f "$tmpdepfile"
       
   316     exit $stat
       
   317   fi
       
   318   rm -f "$depfile"
       
   319   # Each line is of the form 'foo.o: dependent.h',
       
   320   # or 'foo.o: dep1.h dep2.h \', or ' dep3.h dep4.h \'.
       
   321   # Do two passes, one to just change these to
       
   322   # '$object: dependent.h' and one to simply 'dependent.h:'.
       
   323   sed -e "s/^[ $tab][ $tab]*/  /" -e "s,^[^:]*:,$object :," \
       
   324     < "$tmpdepfile" > "$depfile"
       
   325   sed '
       
   326     s/[ '"$tab"'][ '"$tab"']*/ /g
       
   327     s/^ *//
       
   328     s/ *\\*$//
       
   329     s/^[^:]*: *//
       
   330     /^$/d
       
   331     /:$/d
       
   332     s/$/ :/
       
   333   ' < "$tmpdepfile" >> "$depfile"
       
   334   rm -f "$tmpdepfile"
       
   335   ;;
       
   336 
       
   337 ## The order of this option in the case statement is important, since the
       
   338 ## shell code in configure will try each of these formats in the order
       
   339 ## listed in this file.  A plain '-MD' option would be understood by many
       
   340 ## compilers, so we must ensure this comes after the gcc and icc options.
       
   341 pgcc)
       
   342   # Portland's C compiler understands '-MD'.
       
   343   # Will always output deps to 'file.d' where file is the root name of the
       
   344   # source file under compilation, even if file resides in a subdirectory.
       
   345   # The object file name does not affect the name of the '.d' file.
       
   346   # pgcc 10.2 will output
       
   347   #    foo.o: sub/foo.c sub/foo.h
       
   348   # and will wrap long lines using '\' :
       
   349   #    foo.o: sub/foo.c ... \
       
   350   #     sub/foo.h ... \
       
   351   #     ...
       
   352   dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
       
   353   test "x$dir" = "x$object" && dir=
       
   354   # Use the source, not the object, to determine the base name, since
       
   355   # that's sadly what pgcc will do too.
       
   356   base=`echo "$source" | sed -e 's|^.*/||' -e 's/\.[-_a-zA-Z0-9]*$//'`
       
   357   tmpdepfile="$base.d"
       
   358 
       
   359   # For projects that build the same source file twice into different object
       
   360   # files, the pgcc approach of using the *source* file root name can cause
       
   361   # problems in parallel builds.  Use a locking strategy to avoid stomping on
       
   362   # the same $tmpdepfile.
       
   363   lockdir="$base.d-lock"
       
   364   trap "echo '$0: caught signal, cleaning up...' >&2; rm -rf $lockdir" 1 2 13 15
       
   365   numtries=100
       
   366   i=$numtries
       
   367   while test $i -gt 0 ; do
       
   368     # mkdir is a portable test-and-set.
       
   369     if mkdir $lockdir 2>/dev/null; then
       
   370       # This process acquired the lock.
       
   371       "$@" -MD
       
   372       stat=$?
       
   373       # Release the lock.
       
   374       rm -rf $lockdir
       
   375       break
       
   376     else
       
   377       ## the lock is being held by a different process,
       
   378       ## wait until the winning process is done or we timeout
       
   379       while test -d $lockdir && test $i -gt 0; do
       
   380         sleep 1
       
   381         i=`expr $i - 1`
       
   382       done
       
   383     fi
       
   384     i=`expr $i - 1`
       
   385   done
       
   386   trap - 1 2 13 15
       
   387   if test $i -le 0; then
       
   388     echo "$0: failed to acquire lock after $numtries attempts" >&2
       
   389     echo "$0: check lockdir '$lockdir'" >&2
       
   390     exit 1
       
   391   fi
       
   392 
       
   393   if test $stat -ne 0; then
   277     rm -f "$tmpdepfile"
   394     rm -f "$tmpdepfile"
   278     exit $stat
   395     exit $stat
   279   fi
   396   fi
   280   rm -f "$depfile"
   397   rm -f "$depfile"
   281   # Each line is of the form `foo.o: dependent.h',
   398   # Each line is of the form `foo.o: dependent.h',
   320   do
   437   do
   321     test -f "$tmpdepfile" && break
   438     test -f "$tmpdepfile" && break
   322   done
   439   done
   323   if test -f "$tmpdepfile"; then
   440   if test -f "$tmpdepfile"; then
   324     sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile"
   441     sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile"
   325     # Add `dependent.h:' lines.
   442     # Add 'dependent.h:' lines.
   326     sed -ne '2,${; s/^ *//; s/ \\*$//; s/$/:/; p;}' "$tmpdepfile" >> "$depfile"
   443     sed -ne '2,${
       
   444 	       s/^ *//
       
   445 	       s/ \\*$//
       
   446 	       s/$/:/
       
   447 	       p
       
   448 	     }' "$tmpdepfile" >> "$depfile"
   327   else
   449   else
   328     echo "#dummy" > "$depfile"
   450     echo "#dummy" > "$depfile"
   329   fi
   451   fi
   330   rm -f "$tmpdepfile" "$tmpdepfile2"
   452   rm -f "$tmpdepfile" "$tmpdepfile2"
   331   ;;
   453   ;;
   332 
   454 
   333 tru64)
   455 tru64)
   334    # The Tru64 compiler uses -MD to generate dependencies as a side
   456    # The Tru64 compiler uses -MD to generate dependencies as a side
   335    # effect.  `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'.
   457    # effect.  'cc -MD -o foo.o ...' puts the dependencies into 'foo.o.d'.
   336    # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
   458    # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
   337    # dependencies in `foo.d' instead, so we check for that too.
   459    # dependencies in 'foo.d' instead, so we check for that too.
   338    # Subdirectories are respected.
   460    # Subdirectories are respected.
   339    dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
   461    dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
   340    test "x$dir" = "x$object" && dir=
   462    test "x$dir" = "x$object" && dir=
   341    base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
   463    base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
   342 
   464 
   378    do
   500    do
   379      test -f "$tmpdepfile" && break
   501      test -f "$tmpdepfile" && break
   380    done
   502    done
   381    if test -f "$tmpdepfile"; then
   503    if test -f "$tmpdepfile"; then
   382       sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
   504       sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
   383       # That's a tab and a space in the [].
   505       sed -e 's,^.*\.[a-z]*:['"$tab"' ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
   384       sed -e 's,^.*\.[a-z]*:[	 ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
       
   385    else
   506    else
   386       echo "#dummy" > "$depfile"
   507       echo "#dummy" > "$depfile"
   387    fi
   508    fi
   388    rm -f "$tmpdepfile"
   509    rm -f "$tmpdepfile"
   389    ;;
   510    ;;
   390 
   511 
       
   512 msvc7)
       
   513   if test "$libtool" = yes; then
       
   514     showIncludes=-Wc,-showIncludes
       
   515   else
       
   516     showIncludes=-showIncludes
       
   517   fi
       
   518   "$@" $showIncludes > "$tmpdepfile"
       
   519   stat=$?
       
   520   grep -v '^Note: including file: ' "$tmpdepfile"
       
   521   if test "$stat" = 0; then :
       
   522   else
       
   523     rm -f "$tmpdepfile"
       
   524     exit $stat
       
   525   fi
       
   526   rm -f "$depfile"
       
   527   echo "$object : \\" > "$depfile"
       
   528   # The first sed program below extracts the file names and escapes
       
   529   # backslashes for cygpath.  The second sed program outputs the file
       
   530   # name when reading, but also accumulates all include files in the
       
   531   # hold buffer in order to output them again at the end.  This only
       
   532   # works with sed implementations that can handle large buffers.
       
   533   sed < "$tmpdepfile" -n '
       
   534 /^Note: including file:  *\(.*\)/ {
       
   535   s//\1/
       
   536   s/\\/\\\\/g
       
   537   p
       
   538 }' | $cygpath_u | sort -u | sed -n '
       
   539 s/ /\\ /g
       
   540 s/\(.*\)/'"$tab"'\1 \\/p
       
   541 s/.\(.*\) \\/\1:/
       
   542 H
       
   543 $ {
       
   544   s/.*/'"$tab"'/
       
   545   G
       
   546   p
       
   547 }' >> "$depfile"
       
   548   rm -f "$tmpdepfile"
       
   549   ;;
       
   550 
       
   551 msvc7msys)
       
   552   # This case exists only to let depend.m4 do its work.  It works by
       
   553   # looking at the text of this script.  This case will never be run,
       
   554   # since it is checked for above.
       
   555   exit 1
       
   556   ;;
       
   557 
   391 #nosideeffect)
   558 #nosideeffect)
   392   # This comment above is used by automake to tell side-effect
   559   # This comment above is used by automake to tell side-effect
   393   # dependency tracking mechanisms from slower ones.
   560   # dependency tracking mechanisms from slower ones.
   394 
   561 
   395 dashmstdout)
   562 dashmstdout)
   397   # always write the preprocessed file to stdout, regardless of -o.
   564   # always write the preprocessed file to stdout, regardless of -o.
   398   "$@" || exit $?
   565   "$@" || exit $?
   399 
   566 
   400   # Remove the call to Libtool.
   567   # Remove the call to Libtool.
   401   if test "$libtool" = yes; then
   568   if test "$libtool" = yes; then
   402     while test $1 != '--mode=compile'; do
   569     while test "X$1" != 'X--mode=compile'; do
   403       shift
   570       shift
   404     done
   571     done
   405     shift
   572     shift
   406   fi
   573   fi
   407 
   574 
   408   # Remove `-o $object'.
   575   # Remove '-o $object'.
   409   IFS=" "
   576   IFS=" "
   410   for arg
   577   for arg
   411   do
   578   do
   412     case $arg in
   579     case $arg in
   413     -o)
   580     -o)
   423       ;;
   590       ;;
   424     esac
   591     esac
   425   done
   592   done
   426 
   593 
   427   test -z "$dashmflag" && dashmflag=-M
   594   test -z "$dashmflag" && dashmflag=-M
   428   # Require at least two characters before searching for `:'
   595   # Require at least two characters before searching for ':'
   429   # in the target name.  This is to cope with DOS-style filenames:
   596   # in the target name.  This is to cope with DOS-style filenames:
   430   # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise.
   597   # a dependency such as 'c:/foo/bar' could be seen as target 'c' otherwise.
   431   "$@" $dashmflag |
   598   "$@" $dashmflag |
   432     sed 's:^[  ]*[^: ][^:][^:]*\:[    ]*:'"$object"'\: :' > "$tmpdepfile"
   599     sed 's:^['"$tab"' ]*[^:'"$tab"' ][^:][^:]*\:['"$tab"' ]*:'"$object"'\: :' > "$tmpdepfile"
   433   rm -f "$depfile"
   600   rm -f "$depfile"
   434   cat < "$tmpdepfile" > "$depfile"
   601   cat < "$tmpdepfile" > "$depfile"
   435   tr ' ' '
   602   tr ' ' "$nl" < "$tmpdepfile" | \
   436 ' < "$tmpdepfile" | \
       
   437 ## Some versions of the HPUX 10.20 sed can't process this invocation
   603 ## Some versions of the HPUX 10.20 sed can't process this invocation
   438 ## correctly.  Breaking it into two sed invocations is a workaround.
   604 ## correctly.  Breaking it into two sed invocations is a workaround.
   439     sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
   605     sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
   440   rm -f "$tmpdepfile"
   606   rm -f "$tmpdepfile"
   441   ;;
   607   ;;
   448 
   614 
   449 makedepend)
   615 makedepend)
   450   "$@" || exit $?
   616   "$@" || exit $?
   451   # Remove any Libtool call
   617   # Remove any Libtool call
   452   if test "$libtool" = yes; then
   618   if test "$libtool" = yes; then
   453     while test $1 != '--mode=compile'; do
   619     while test "X$1" != 'X--mode=compile'; do
   454       shift
   620       shift
   455     done
   621     done
   456     shift
   622     shift
   457   fi
   623   fi
   458   # X makedepend
   624   # X makedepend
   459   shift
   625   shift
   460   cleared=no
   626   cleared=no eat=no
   461   for arg in "$@"; do
   627   for arg
       
   628   do
   462     case $cleared in
   629     case $cleared in
   463     no)
   630     no)
   464       set ""; shift
   631       set ""; shift
   465       cleared=yes ;;
   632       cleared=yes ;;
   466     esac
   633     esac
       
   634     if test $eat = yes; then
       
   635       eat=no
       
   636       continue
       
   637     fi
   467     case "$arg" in
   638     case "$arg" in
   468     -D*|-I*)
   639     -D*|-I*)
   469       set fnord "$@" "$arg"; shift ;;
   640       set fnord "$@" "$arg"; shift ;;
   470     # Strip any option that makedepend may not understand.  Remove
   641     # Strip any option that makedepend may not understand.  Remove
   471     # the object too, otherwise makedepend will parse it as a source file.
   642     # the object too, otherwise makedepend will parse it as a source file.
       
   643     -arch)
       
   644       eat=yes ;;
   472     -*|$object)
   645     -*|$object)
   473       ;;
   646       ;;
   474     *)
   647     *)
   475       set fnord "$@" "$arg"; shift ;;
   648       set fnord "$@" "$arg"; shift ;;
   476     esac
   649     esac
   477   done
   650   done
   478   obj_suffix="`echo $object | sed 's/^.*\././'`"
   651   obj_suffix=`echo "$object" | sed 's/^.*\././'`
   479   touch "$tmpdepfile"
   652   touch "$tmpdepfile"
   480   ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
   653   ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
   481   rm -f "$depfile"
   654   rm -f "$depfile"
   482   cat < "$tmpdepfile" > "$depfile"
   655   # makedepend may prepend the VPATH from the source file name to the object.
   483   sed '1,2d' "$tmpdepfile" | tr ' ' '
   656   # No need to regex-escape $object, excess matching of '.' is harmless.
   484 ' | \
   657   sed "s|^.*\($object *:\)|\1|" "$tmpdepfile" > "$depfile"
       
   658   sed '1,2d' "$tmpdepfile" | tr ' ' "$nl" | \
   485 ## Some versions of the HPUX 10.20 sed can't process this invocation
   659 ## Some versions of the HPUX 10.20 sed can't process this invocation
   486 ## correctly.  Breaking it into two sed invocations is a workaround.
   660 ## correctly.  Breaking it into two sed invocations is a workaround.
   487     sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
   661     sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
   488   rm -f "$tmpdepfile" "$tmpdepfile".bak
   662   rm -f "$tmpdepfile" "$tmpdepfile".bak
   489   ;;
   663   ;;
   493   # always write the preprocessed file to stdout.
   667   # always write the preprocessed file to stdout.
   494   "$@" || exit $?
   668   "$@" || exit $?
   495 
   669 
   496   # Remove the call to Libtool.
   670   # Remove the call to Libtool.
   497   if test "$libtool" = yes; then
   671   if test "$libtool" = yes; then
   498     while test $1 != '--mode=compile'; do
   672     while test "X$1" != 'X--mode=compile'; do
   499       shift
   673       shift
   500     done
   674     done
   501     shift
   675     shift
   502   fi
   676   fi
   503 
   677 
   504   # Remove `-o $object'.
   678   # Remove '-o $object'.
   505   IFS=" "
   679   IFS=" "
   506   for arg
   680   for arg
   507   do
   681   do
   508     case $arg in
   682     case $arg in
   509     -o)
   683     -o)
   531   rm -f "$tmpdepfile"
   705   rm -f "$tmpdepfile"
   532   ;;
   706   ;;
   533 
   707 
   534 msvisualcpp)
   708 msvisualcpp)
   535   # Important note: in order to support this mode, a compiler *must*
   709   # Important note: in order to support this mode, a compiler *must*
   536   # always write the preprocessed file to stdout, regardless of -o,
   710   # always write the preprocessed file to stdout.
   537   # because we must use -o when running libtool.
       
   538   "$@" || exit $?
   711   "$@" || exit $?
       
   712 
       
   713   # Remove the call to Libtool.
       
   714   if test "$libtool" = yes; then
       
   715     while test "X$1" != 'X--mode=compile'; do
       
   716       shift
       
   717     done
       
   718     shift
       
   719   fi
       
   720 
   539   IFS=" "
   721   IFS=" "
   540   for arg
   722   for arg
   541   do
   723   do
   542     case "$arg" in
   724     case "$arg" in
       
   725     -o)
       
   726       shift
       
   727       ;;
       
   728     $object)
       
   729       shift
       
   730       ;;
   543     "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
   731     "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
   544 	set fnord "$@"
   732 	set fnord "$@"
   545 	shift
   733 	shift
   546 	shift
   734 	shift
   547 	;;
   735 	;;
   550 	shift
   738 	shift
   551 	shift
   739 	shift
   552 	;;
   740 	;;
   553     esac
   741     esac
   554   done
   742   done
   555   "$@" -E |
   743   "$@" -E 2>/dev/null |
   556   sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile"
   744   sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile"
   557   rm -f "$depfile"
   745   rm -f "$depfile"
   558   echo "$object : \\" > "$depfile"
   746   echo "$object : \\" > "$depfile"
   559   . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::	\1 \\:p' >> "$depfile"
   747   sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::'"$tab"'\1 \\:p' >> "$depfile"
   560   echo "	" >> "$depfile"
   748   echo "$tab" >> "$depfile"
   561   . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile"
   749   sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile"
   562   rm -f "$tmpdepfile"
   750   rm -f "$tmpdepfile"
       
   751   ;;
       
   752 
       
   753 msvcmsys)
       
   754   # This case exists only to let depend.m4 do its work.  It works by
       
   755   # looking at the text of this script.  This case will never be run,
       
   756   # since it is checked for above.
       
   757   exit 1
   563   ;;
   758   ;;
   564 
   759 
   565 none)
   760 none)
   566   exec "$@"
   761   exec "$@"
   567   ;;
   762   ;;
   578 # mode: shell-script
   773 # mode: shell-script
   579 # sh-indentation: 2
   774 # sh-indentation: 2
   580 # eval: (add-hook 'write-file-hooks 'time-stamp)
   775 # eval: (add-hook 'write-file-hooks 'time-stamp)
   581 # time-stamp-start: "scriptversion="
   776 # time-stamp-start: "scriptversion="
   582 # time-stamp-format: "%:y-%02m-%02d.%02H"
   777 # time-stamp-format: "%:y-%02m-%02d.%02H"
   583 # time-stamp-end: "$"
   778 # time-stamp-time-zone: "UTC"
       
   779 # time-stamp-end: "; # UTC"
   584 # End:
   780 # End: