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