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