1*5ddc57e5SXin Li#! /bin/sh 2*5ddc57e5SXin Li# depcomp - compile a program generating dependencies as side-effects 3*5ddc57e5SXin Li 4*5ddc57e5SXin Liscriptversion=2013-05-30.07; # UTC 5*5ddc57e5SXin Li 6*5ddc57e5SXin Li# Copyright (C) 1999-2014 Free Software Foundation, Inc. 7*5ddc57e5SXin Li 8*5ddc57e5SXin Li# This program is free software; you can redistribute it and/or modify 9*5ddc57e5SXin Li# it under the terms of the GNU General Public License as published by 10*5ddc57e5SXin Li# the Free Software Foundation; either version 2, or (at your option) 11*5ddc57e5SXin Li# any later version. 12*5ddc57e5SXin Li 13*5ddc57e5SXin Li# This program is distributed in the hope that it will be useful, 14*5ddc57e5SXin Li# but WITHOUT ANY WARRANTY; without even the implied warranty of 15*5ddc57e5SXin Li# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16*5ddc57e5SXin Li# GNU General Public License for more details. 17*5ddc57e5SXin Li 18*5ddc57e5SXin Li# You should have received a copy of the GNU General Public License 19*5ddc57e5SXin Li# along with this program. If not, see <http://www.gnu.org/licenses/>. 20*5ddc57e5SXin Li 21*5ddc57e5SXin Li# As a special exception to the GNU General Public License, if you 22*5ddc57e5SXin Li# distribute this file as part of a program that contains a 23*5ddc57e5SXin Li# configuration script generated by Autoconf, you may include it under 24*5ddc57e5SXin Li# the same distribution terms that you use for the rest of that program. 25*5ddc57e5SXin Li 26*5ddc57e5SXin Li# Originally written by Alexandre Oliva <[email protected]>. 27*5ddc57e5SXin Li 28*5ddc57e5SXin Licase $1 in 29*5ddc57e5SXin Li '') 30*5ddc57e5SXin Li echo "$0: No command. Try '$0 --help' for more information." 1>&2 31*5ddc57e5SXin Li exit 1; 32*5ddc57e5SXin Li ;; 33*5ddc57e5SXin Li -h | --h*) 34*5ddc57e5SXin Li cat <<\EOF 35*5ddc57e5SXin LiUsage: depcomp [--help] [--version] PROGRAM [ARGS] 36*5ddc57e5SXin Li 37*5ddc57e5SXin LiRun PROGRAMS ARGS to compile a file, generating dependencies 38*5ddc57e5SXin Lias side-effects. 39*5ddc57e5SXin Li 40*5ddc57e5SXin LiEnvironment variables: 41*5ddc57e5SXin Li depmode Dependency tracking mode. 42*5ddc57e5SXin Li source Source file read by 'PROGRAMS ARGS'. 43*5ddc57e5SXin Li object Object file output by 'PROGRAMS ARGS'. 44*5ddc57e5SXin Li DEPDIR directory where to store dependencies. 45*5ddc57e5SXin Li depfile Dependency file to output. 46*5ddc57e5SXin Li tmpdepfile Temporary file to use when outputting dependencies. 47*5ddc57e5SXin Li libtool Whether libtool is used (yes/no). 48*5ddc57e5SXin Li 49*5ddc57e5SXin LiReport bugs to <bug-automake@gnu.org>. 50*5ddc57e5SXin LiEOF 51*5ddc57e5SXin Li exit $? 52*5ddc57e5SXin Li ;; 53*5ddc57e5SXin Li -v | --v*) 54*5ddc57e5SXin Li echo "depcomp $scriptversion" 55*5ddc57e5SXin Li exit $? 56*5ddc57e5SXin Li ;; 57*5ddc57e5SXin Liesac 58*5ddc57e5SXin Li 59*5ddc57e5SXin Li# Get the directory component of the given path, and save it in the 60*5ddc57e5SXin Li# global variables '$dir'. Note that this directory component will 61*5ddc57e5SXin Li# be either empty or ending with a '/' character. This is deliberate. 62*5ddc57e5SXin Liset_dir_from () 63*5ddc57e5SXin Li{ 64*5ddc57e5SXin Li case $1 in 65*5ddc57e5SXin Li */*) dir=`echo "$1" | sed -e 's|/[^/]*$|/|'`;; 66*5ddc57e5SXin Li *) dir=;; 67*5ddc57e5SXin Li esac 68*5ddc57e5SXin Li} 69*5ddc57e5SXin Li 70*5ddc57e5SXin Li# Get the suffix-stripped basename of the given path, and save it the 71*5ddc57e5SXin Li# global variable '$base'. 72*5ddc57e5SXin Liset_base_from () 73*5ddc57e5SXin Li{ 74*5ddc57e5SXin Li base=`echo "$1" | sed -e 's|^.*/||' -e 's/\.[^.]*$//'` 75*5ddc57e5SXin Li} 76*5ddc57e5SXin Li 77*5ddc57e5SXin Li# If no dependency file was actually created by the compiler invocation, 78*5ddc57e5SXin Li# we still have to create a dummy depfile, to avoid errors with the 79*5ddc57e5SXin Li# Makefile "include basename.Plo" scheme. 80*5ddc57e5SXin Limake_dummy_depfile () 81*5ddc57e5SXin Li{ 82*5ddc57e5SXin Li echo "#dummy" > "$depfile" 83*5ddc57e5SXin Li} 84*5ddc57e5SXin Li 85*5ddc57e5SXin Li# Factor out some common post-processing of the generated depfile. 86*5ddc57e5SXin Li# Requires the auxiliary global variable '$tmpdepfile' to be set. 87*5ddc57e5SXin Liaix_post_process_depfile () 88*5ddc57e5SXin Li{ 89*5ddc57e5SXin Li # If the compiler actually managed to produce a dependency file, 90*5ddc57e5SXin Li # post-process it. 91*5ddc57e5SXin Li if test -f "$tmpdepfile"; then 92*5ddc57e5SXin Li # Each line is of the form 'foo.o: dependency.h'. 93*5ddc57e5SXin Li # Do two passes, one to just change these to 94*5ddc57e5SXin Li # $object: dependency.h 95*5ddc57e5SXin Li # and one to simply output 96*5ddc57e5SXin Li # dependency.h: 97*5ddc57e5SXin Li # which is needed to avoid the deleted-header problem. 98*5ddc57e5SXin Li { sed -e "s,^.*\.[$lower]*:,$object:," < "$tmpdepfile" 99*5ddc57e5SXin Li sed -e "s,^.*\.[$lower]*:[$tab ]*,," -e 's,$,:,' < "$tmpdepfile" 100*5ddc57e5SXin Li } > "$depfile" 101*5ddc57e5SXin Li rm -f "$tmpdepfile" 102*5ddc57e5SXin Li else 103*5ddc57e5SXin Li make_dummy_depfile 104*5ddc57e5SXin Li fi 105*5ddc57e5SXin Li} 106*5ddc57e5SXin Li 107*5ddc57e5SXin Li# A tabulation character. 108*5ddc57e5SXin Litab=' ' 109*5ddc57e5SXin Li# A newline character. 110*5ddc57e5SXin Linl=' 111*5ddc57e5SXin Li' 112*5ddc57e5SXin Li# Character ranges might be problematic outside the C locale. 113*5ddc57e5SXin Li# These definitions help. 114*5ddc57e5SXin Liupper=ABCDEFGHIJKLMNOPQRSTUVWXYZ 115*5ddc57e5SXin Lilower=abcdefghijklmnopqrstuvwxyz 116*5ddc57e5SXin Lidigits=0123456789 117*5ddc57e5SXin Lialpha=${upper}${lower} 118*5ddc57e5SXin Li 119*5ddc57e5SXin Liif test -z "$depmode" || test -z "$source" || test -z "$object"; then 120*5ddc57e5SXin Li echo "depcomp: Variables source, object and depmode must be set" 1>&2 121*5ddc57e5SXin Li exit 1 122*5ddc57e5SXin Lifi 123*5ddc57e5SXin Li 124*5ddc57e5SXin Li# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po. 125*5ddc57e5SXin Lidepfile=${depfile-`echo "$object" | 126*5ddc57e5SXin Li sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`} 127*5ddc57e5SXin Litmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} 128*5ddc57e5SXin Li 129*5ddc57e5SXin Lirm -f "$tmpdepfile" 130*5ddc57e5SXin Li 131*5ddc57e5SXin Li# Avoid interferences from the environment. 132*5ddc57e5SXin Ligccflag= dashmflag= 133*5ddc57e5SXin Li 134*5ddc57e5SXin Li# Some modes work just like other modes, but use different flags. We 135*5ddc57e5SXin Li# parameterize here, but still list the modes in the big case below, 136*5ddc57e5SXin Li# to make depend.m4 easier to write. Note that we *cannot* use a case 137*5ddc57e5SXin Li# here, because this file can only contain one case statement. 138*5ddc57e5SXin Liif test "$depmode" = hp; then 139*5ddc57e5SXin Li # HP compiler uses -M and no extra arg. 140*5ddc57e5SXin Li gccflag=-M 141*5ddc57e5SXin Li depmode=gcc 142*5ddc57e5SXin Lifi 143*5ddc57e5SXin Li 144*5ddc57e5SXin Liif test "$depmode" = dashXmstdout; then 145*5ddc57e5SXin Li # This is just like dashmstdout with a different argument. 146*5ddc57e5SXin Li dashmflag=-xM 147*5ddc57e5SXin Li depmode=dashmstdout 148*5ddc57e5SXin Lifi 149*5ddc57e5SXin Li 150*5ddc57e5SXin Licygpath_u="cygpath -u -f -" 151*5ddc57e5SXin Liif test "$depmode" = msvcmsys; then 152*5ddc57e5SXin Li # This is just like msvisualcpp but w/o cygpath translation. 153*5ddc57e5SXin Li # Just convert the backslash-escaped backslashes to single forward 154*5ddc57e5SXin Li # slashes to satisfy depend.m4 155*5ddc57e5SXin Li cygpath_u='sed s,\\\\,/,g' 156*5ddc57e5SXin Li depmode=msvisualcpp 157*5ddc57e5SXin Lifi 158*5ddc57e5SXin Li 159*5ddc57e5SXin Liif test "$depmode" = msvc7msys; then 160*5ddc57e5SXin Li # This is just like msvc7 but w/o cygpath translation. 161*5ddc57e5SXin Li # Just convert the backslash-escaped backslashes to single forward 162*5ddc57e5SXin Li # slashes to satisfy depend.m4 163*5ddc57e5SXin Li cygpath_u='sed s,\\\\,/,g' 164*5ddc57e5SXin Li depmode=msvc7 165*5ddc57e5SXin Lifi 166*5ddc57e5SXin Li 167*5ddc57e5SXin Liif test "$depmode" = xlc; then 168*5ddc57e5SXin Li # IBM C/C++ Compilers xlc/xlC can output gcc-like dependency information. 169*5ddc57e5SXin Li gccflag=-qmakedep=gcc,-MF 170*5ddc57e5SXin Li depmode=gcc 171*5ddc57e5SXin Lifi 172*5ddc57e5SXin Li 173*5ddc57e5SXin Licase "$depmode" in 174*5ddc57e5SXin Ligcc3) 175*5ddc57e5SXin Li## gcc 3 implements dependency tracking that does exactly what 176*5ddc57e5SXin Li## we want. Yay! Note: for some reason libtool 1.4 doesn't like 177*5ddc57e5SXin Li## it if -MD -MP comes after the -MF stuff. Hmm. 178*5ddc57e5SXin Li## Unfortunately, FreeBSD c89 acceptance of flags depends upon 179*5ddc57e5SXin Li## the command line argument order; so add the flags where they 180*5ddc57e5SXin Li## appear in depend2.am. Note that the slowdown incurred here 181*5ddc57e5SXin Li## affects only configure: in makefiles, %FASTDEP% shortcuts this. 182*5ddc57e5SXin Li for arg 183*5ddc57e5SXin Li do 184*5ddc57e5SXin Li case $arg in 185*5ddc57e5SXin Li -c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;; 186*5ddc57e5SXin Li *) set fnord "$@" "$arg" ;; 187*5ddc57e5SXin Li esac 188*5ddc57e5SXin Li shift # fnord 189*5ddc57e5SXin Li shift # $arg 190*5ddc57e5SXin Li done 191*5ddc57e5SXin Li "$@" 192*5ddc57e5SXin Li stat=$? 193*5ddc57e5SXin Li if test $stat -ne 0; then 194*5ddc57e5SXin Li rm -f "$tmpdepfile" 195*5ddc57e5SXin Li exit $stat 196*5ddc57e5SXin Li fi 197*5ddc57e5SXin Li mv "$tmpdepfile" "$depfile" 198*5ddc57e5SXin Li ;; 199*5ddc57e5SXin Li 200*5ddc57e5SXin Ligcc) 201*5ddc57e5SXin Li## Note that this doesn't just cater to obsosete pre-3.x GCC compilers. 202*5ddc57e5SXin Li## but also to in-use compilers like IMB xlc/xlC and the HP C compiler. 203*5ddc57e5SXin Li## (see the conditional assignment to $gccflag above). 204*5ddc57e5SXin Li## There are various ways to get dependency output from gcc. Here's 205*5ddc57e5SXin Li## why we pick this rather obscure method: 206*5ddc57e5SXin Li## - Don't want to use -MD because we'd like the dependencies to end 207*5ddc57e5SXin Li## up in a subdir. Having to rename by hand is ugly. 208*5ddc57e5SXin Li## (We might end up doing this anyway to support other compilers.) 209*5ddc57e5SXin Li## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like 210*5ddc57e5SXin Li## -MM, not -M (despite what the docs say). Also, it might not be 211*5ddc57e5SXin Li## supported by the other compilers which use the 'gcc' depmode. 212*5ddc57e5SXin Li## - Using -M directly means running the compiler twice (even worse 213*5ddc57e5SXin Li## than renaming). 214*5ddc57e5SXin Li if test -z "$gccflag"; then 215*5ddc57e5SXin Li gccflag=-MD, 216*5ddc57e5SXin Li fi 217*5ddc57e5SXin Li "$@" -Wp,"$gccflag$tmpdepfile" 218*5ddc57e5SXin Li stat=$? 219*5ddc57e5SXin Li if test $stat -ne 0; then 220*5ddc57e5SXin Li rm -f "$tmpdepfile" 221*5ddc57e5SXin Li exit $stat 222*5ddc57e5SXin Li fi 223*5ddc57e5SXin Li rm -f "$depfile" 224*5ddc57e5SXin Li echo "$object : \\" > "$depfile" 225*5ddc57e5SXin Li # The second -e expression handles DOS-style file names with drive 226*5ddc57e5SXin Li # letters. 227*5ddc57e5SXin Li sed -e 's/^[^:]*: / /' \ 228*5ddc57e5SXin Li -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" 229*5ddc57e5SXin Li## This next piece of magic avoids the "deleted header file" problem. 230*5ddc57e5SXin Li## The problem is that when a header file which appears in a .P file 231*5ddc57e5SXin Li## is deleted, the dependency causes make to die (because there is 232*5ddc57e5SXin Li## typically no way to rebuild the header). We avoid this by adding 233*5ddc57e5SXin Li## dummy dependencies for each header file. Too bad gcc doesn't do 234*5ddc57e5SXin Li## this for us directly. 235*5ddc57e5SXin Li## Some versions of gcc put a space before the ':'. On the theory 236*5ddc57e5SXin Li## that the space means something, we add a space to the output as 237*5ddc57e5SXin Li## well. hp depmode also adds that space, but also prefixes the VPATH 238*5ddc57e5SXin Li## to the object. Take care to not repeat it in the output. 239*5ddc57e5SXin Li## Some versions of the HPUX 10.20 sed can't process this invocation 240*5ddc57e5SXin Li## correctly. Breaking it into two sed invocations is a workaround. 241*5ddc57e5SXin Li tr ' ' "$nl" < "$tmpdepfile" \ 242*5ddc57e5SXin Li | sed -e 's/^\\$//' -e '/^$/d' -e "s|.*$object$||" -e '/:$/d' \ 243*5ddc57e5SXin Li | sed -e 's/$/ :/' >> "$depfile" 244*5ddc57e5SXin Li rm -f "$tmpdepfile" 245*5ddc57e5SXin Li ;; 246*5ddc57e5SXin Li 247*5ddc57e5SXin Lihp) 248*5ddc57e5SXin Li # This case exists only to let depend.m4 do its work. It works by 249*5ddc57e5SXin Li # looking at the text of this script. This case will never be run, 250*5ddc57e5SXin Li # since it is checked for above. 251*5ddc57e5SXin Li exit 1 252*5ddc57e5SXin Li ;; 253*5ddc57e5SXin Li 254*5ddc57e5SXin Lisgi) 255*5ddc57e5SXin Li if test "$libtool" = yes; then 256*5ddc57e5SXin Li "$@" "-Wp,-MDupdate,$tmpdepfile" 257*5ddc57e5SXin Li else 258*5ddc57e5SXin Li "$@" -MDupdate "$tmpdepfile" 259*5ddc57e5SXin Li fi 260*5ddc57e5SXin Li stat=$? 261*5ddc57e5SXin Li if test $stat -ne 0; then 262*5ddc57e5SXin Li rm -f "$tmpdepfile" 263*5ddc57e5SXin Li exit $stat 264*5ddc57e5SXin Li fi 265*5ddc57e5SXin Li rm -f "$depfile" 266*5ddc57e5SXin Li 267*5ddc57e5SXin Li if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files 268*5ddc57e5SXin Li echo "$object : \\" > "$depfile" 269*5ddc57e5SXin Li # Clip off the initial element (the dependent). Don't try to be 270*5ddc57e5SXin Li # clever and replace this with sed code, as IRIX sed won't handle 271*5ddc57e5SXin Li # lines with more than a fixed number of characters (4096 in 272*5ddc57e5SXin Li # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; 273*5ddc57e5SXin Li # the IRIX cc adds comments like '#:fec' to the end of the 274*5ddc57e5SXin Li # dependency line. 275*5ddc57e5SXin Li tr ' ' "$nl" < "$tmpdepfile" \ 276*5ddc57e5SXin Li | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' \ 277*5ddc57e5SXin Li | tr "$nl" ' ' >> "$depfile" 278*5ddc57e5SXin Li echo >> "$depfile" 279*5ddc57e5SXin Li # The second pass generates a dummy entry for each header file. 280*5ddc57e5SXin Li tr ' ' "$nl" < "$tmpdepfile" \ 281*5ddc57e5SXin Li | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ 282*5ddc57e5SXin Li >> "$depfile" 283*5ddc57e5SXin Li else 284*5ddc57e5SXin Li make_dummy_depfile 285*5ddc57e5SXin Li fi 286*5ddc57e5SXin Li rm -f "$tmpdepfile" 287*5ddc57e5SXin Li ;; 288*5ddc57e5SXin Li 289*5ddc57e5SXin Lixlc) 290*5ddc57e5SXin Li # This case exists only to let depend.m4 do its work. It works by 291*5ddc57e5SXin Li # looking at the text of this script. This case will never be run, 292*5ddc57e5SXin Li # since it is checked for above. 293*5ddc57e5SXin Li exit 1 294*5ddc57e5SXin Li ;; 295*5ddc57e5SXin Li 296*5ddc57e5SXin Liaix) 297*5ddc57e5SXin Li # The C for AIX Compiler uses -M and outputs the dependencies 298*5ddc57e5SXin Li # in a .u file. In older versions, this file always lives in the 299*5ddc57e5SXin Li # current directory. Also, the AIX compiler puts '$object:' at the 300*5ddc57e5SXin Li # start of each line; $object doesn't have directory information. 301*5ddc57e5SXin Li # Version 6 uses the directory in both cases. 302*5ddc57e5SXin Li set_dir_from "$object" 303*5ddc57e5SXin Li set_base_from "$object" 304*5ddc57e5SXin Li if test "$libtool" = yes; then 305*5ddc57e5SXin Li tmpdepfile1=$dir$base.u 306*5ddc57e5SXin Li tmpdepfile2=$base.u 307*5ddc57e5SXin Li tmpdepfile3=$dir.libs/$base.u 308*5ddc57e5SXin Li "$@" -Wc,-M 309*5ddc57e5SXin Li else 310*5ddc57e5SXin Li tmpdepfile1=$dir$base.u 311*5ddc57e5SXin Li tmpdepfile2=$dir$base.u 312*5ddc57e5SXin Li tmpdepfile3=$dir$base.u 313*5ddc57e5SXin Li "$@" -M 314*5ddc57e5SXin Li fi 315*5ddc57e5SXin Li stat=$? 316*5ddc57e5SXin Li if test $stat -ne 0; then 317*5ddc57e5SXin Li rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" 318*5ddc57e5SXin Li exit $stat 319*5ddc57e5SXin Li fi 320*5ddc57e5SXin Li 321*5ddc57e5SXin Li for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" 322*5ddc57e5SXin Li do 323*5ddc57e5SXin Li test -f "$tmpdepfile" && break 324*5ddc57e5SXin Li done 325*5ddc57e5SXin Li aix_post_process_depfile 326*5ddc57e5SXin Li ;; 327*5ddc57e5SXin Li 328*5ddc57e5SXin Litcc) 329*5ddc57e5SXin Li # tcc (Tiny C Compiler) understand '-MD -MF file' since version 0.9.26 330*5ddc57e5SXin Li # FIXME: That version still under development at the moment of writing. 331*5ddc57e5SXin Li # Make that this statement remains true also for stable, released 332*5ddc57e5SXin Li # versions. 333*5ddc57e5SXin Li # It will wrap lines (doesn't matter whether long or short) with a 334*5ddc57e5SXin Li # trailing '\', as in: 335*5ddc57e5SXin Li # 336*5ddc57e5SXin Li # foo.o : \ 337*5ddc57e5SXin Li # foo.c \ 338*5ddc57e5SXin Li # foo.h \ 339*5ddc57e5SXin Li # 340*5ddc57e5SXin Li # It will put a trailing '\' even on the last line, and will use leading 341*5ddc57e5SXin Li # spaces rather than leading tabs (at least since its commit 0394caf7 342*5ddc57e5SXin Li # "Emit spaces for -MD"). 343*5ddc57e5SXin Li "$@" -MD -MF "$tmpdepfile" 344*5ddc57e5SXin Li stat=$? 345*5ddc57e5SXin Li if test $stat -ne 0; then 346*5ddc57e5SXin Li rm -f "$tmpdepfile" 347*5ddc57e5SXin Li exit $stat 348*5ddc57e5SXin Li fi 349*5ddc57e5SXin Li rm -f "$depfile" 350*5ddc57e5SXin Li # Each non-empty line is of the form 'foo.o : \' or ' dep.h \'. 351*5ddc57e5SXin Li # We have to change lines of the first kind to '$object: \'. 352*5ddc57e5SXin Li sed -e "s|.*:|$object :|" < "$tmpdepfile" > "$depfile" 353*5ddc57e5SXin Li # And for each line of the second kind, we have to emit a 'dep.h:' 354*5ddc57e5SXin Li # dummy dependency, to avoid the deleted-header problem. 355*5ddc57e5SXin Li sed -n -e 's|^ *\(.*\) *\\$|\1:|p' < "$tmpdepfile" >> "$depfile" 356*5ddc57e5SXin Li rm -f "$tmpdepfile" 357*5ddc57e5SXin Li ;; 358*5ddc57e5SXin Li 359*5ddc57e5SXin Li## The order of this option in the case statement is important, since the 360*5ddc57e5SXin Li## shell code in configure will try each of these formats in the order 361*5ddc57e5SXin Li## listed in this file. A plain '-MD' option would be understood by many 362*5ddc57e5SXin Li## compilers, so we must ensure this comes after the gcc and icc options. 363*5ddc57e5SXin Lipgcc) 364*5ddc57e5SXin Li # Portland's C compiler understands '-MD'. 365*5ddc57e5SXin Li # Will always output deps to 'file.d' where file is the root name of the 366*5ddc57e5SXin Li # source file under compilation, even if file resides in a subdirectory. 367*5ddc57e5SXin Li # The object file name does not affect the name of the '.d' file. 368*5ddc57e5SXin Li # pgcc 10.2 will output 369*5ddc57e5SXin Li # foo.o: sub/foo.c sub/foo.h 370*5ddc57e5SXin Li # and will wrap long lines using '\' : 371*5ddc57e5SXin Li # foo.o: sub/foo.c ... \ 372*5ddc57e5SXin Li # sub/foo.h ... \ 373*5ddc57e5SXin Li # ... 374*5ddc57e5SXin Li set_dir_from "$object" 375*5ddc57e5SXin Li # Use the source, not the object, to determine the base name, since 376*5ddc57e5SXin Li # that's sadly what pgcc will do too. 377*5ddc57e5SXin Li set_base_from "$source" 378*5ddc57e5SXin Li tmpdepfile=$base.d 379*5ddc57e5SXin Li 380*5ddc57e5SXin Li # For projects that build the same source file twice into different object 381*5ddc57e5SXin Li # files, the pgcc approach of using the *source* file root name can cause 382*5ddc57e5SXin Li # problems in parallel builds. Use a locking strategy to avoid stomping on 383*5ddc57e5SXin Li # the same $tmpdepfile. 384*5ddc57e5SXin Li lockdir=$base.d-lock 385*5ddc57e5SXin Li trap " 386*5ddc57e5SXin Li echo '$0: caught signal, cleaning up...' >&2 387*5ddc57e5SXin Li rmdir '$lockdir' 388*5ddc57e5SXin Li exit 1 389*5ddc57e5SXin Li " 1 2 13 15 390*5ddc57e5SXin Li numtries=100 391*5ddc57e5SXin Li i=$numtries 392*5ddc57e5SXin Li while test $i -gt 0; do 393*5ddc57e5SXin Li # mkdir is a portable test-and-set. 394*5ddc57e5SXin Li if mkdir "$lockdir" 2>/dev/null; then 395*5ddc57e5SXin Li # This process acquired the lock. 396*5ddc57e5SXin Li "$@" -MD 397*5ddc57e5SXin Li stat=$? 398*5ddc57e5SXin Li # Release the lock. 399*5ddc57e5SXin Li rmdir "$lockdir" 400*5ddc57e5SXin Li break 401*5ddc57e5SXin Li else 402*5ddc57e5SXin Li # If the lock is being held by a different process, wait 403*5ddc57e5SXin Li # until the winning process is done or we timeout. 404*5ddc57e5SXin Li while test -d "$lockdir" && test $i -gt 0; do 405*5ddc57e5SXin Li sleep 1 406*5ddc57e5SXin Li i=`expr $i - 1` 407*5ddc57e5SXin Li done 408*5ddc57e5SXin Li fi 409*5ddc57e5SXin Li i=`expr $i - 1` 410*5ddc57e5SXin Li done 411*5ddc57e5SXin Li trap - 1 2 13 15 412*5ddc57e5SXin Li if test $i -le 0; then 413*5ddc57e5SXin Li echo "$0: failed to acquire lock after $numtries attempts" >&2 414*5ddc57e5SXin Li echo "$0: check lockdir '$lockdir'" >&2 415*5ddc57e5SXin Li exit 1 416*5ddc57e5SXin Li fi 417*5ddc57e5SXin Li 418*5ddc57e5SXin Li if test $stat -ne 0; then 419*5ddc57e5SXin Li rm -f "$tmpdepfile" 420*5ddc57e5SXin Li exit $stat 421*5ddc57e5SXin Li fi 422*5ddc57e5SXin Li rm -f "$depfile" 423*5ddc57e5SXin Li # Each line is of the form `foo.o: dependent.h', 424*5ddc57e5SXin Li # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'. 425*5ddc57e5SXin Li # Do two passes, one to just change these to 426*5ddc57e5SXin Li # `$object: dependent.h' and one to simply `dependent.h:'. 427*5ddc57e5SXin Li sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" 428*5ddc57e5SXin Li # Some versions of the HPUX 10.20 sed can't process this invocation 429*5ddc57e5SXin Li # correctly. Breaking it into two sed invocations is a workaround. 430*5ddc57e5SXin Li sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" \ 431*5ddc57e5SXin Li | sed -e 's/$/ :/' >> "$depfile" 432*5ddc57e5SXin Li rm -f "$tmpdepfile" 433*5ddc57e5SXin Li ;; 434*5ddc57e5SXin Li 435*5ddc57e5SXin Lihp2) 436*5ddc57e5SXin Li # The "hp" stanza above does not work with aCC (C++) and HP's ia64 437*5ddc57e5SXin Li # compilers, which have integrated preprocessors. The correct option 438*5ddc57e5SXin Li # to use with these is +Maked; it writes dependencies to a file named 439*5ddc57e5SXin Li # 'foo.d', which lands next to the object file, wherever that 440*5ddc57e5SXin Li # happens to be. 441*5ddc57e5SXin Li # Much of this is similar to the tru64 case; see comments there. 442*5ddc57e5SXin Li set_dir_from "$object" 443*5ddc57e5SXin Li set_base_from "$object" 444*5ddc57e5SXin Li if test "$libtool" = yes; then 445*5ddc57e5SXin Li tmpdepfile1=$dir$base.d 446*5ddc57e5SXin Li tmpdepfile2=$dir.libs/$base.d 447*5ddc57e5SXin Li "$@" -Wc,+Maked 448*5ddc57e5SXin Li else 449*5ddc57e5SXin Li tmpdepfile1=$dir$base.d 450*5ddc57e5SXin Li tmpdepfile2=$dir$base.d 451*5ddc57e5SXin Li "$@" +Maked 452*5ddc57e5SXin Li fi 453*5ddc57e5SXin Li stat=$? 454*5ddc57e5SXin Li if test $stat -ne 0; then 455*5ddc57e5SXin Li rm -f "$tmpdepfile1" "$tmpdepfile2" 456*5ddc57e5SXin Li exit $stat 457*5ddc57e5SXin Li fi 458*5ddc57e5SXin Li 459*5ddc57e5SXin Li for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" 460*5ddc57e5SXin Li do 461*5ddc57e5SXin Li test -f "$tmpdepfile" && break 462*5ddc57e5SXin Li done 463*5ddc57e5SXin Li if test -f "$tmpdepfile"; then 464*5ddc57e5SXin Li sed -e "s,^.*\.[$lower]*:,$object:," "$tmpdepfile" > "$depfile" 465*5ddc57e5SXin Li # Add 'dependent.h:' lines. 466*5ddc57e5SXin Li sed -ne '2,${ 467*5ddc57e5SXin Li s/^ *// 468*5ddc57e5SXin Li s/ \\*$// 469*5ddc57e5SXin Li s/$/:/ 470*5ddc57e5SXin Li p 471*5ddc57e5SXin Li }' "$tmpdepfile" >> "$depfile" 472*5ddc57e5SXin Li else 473*5ddc57e5SXin Li make_dummy_depfile 474*5ddc57e5SXin Li fi 475*5ddc57e5SXin Li rm -f "$tmpdepfile" "$tmpdepfile2" 476*5ddc57e5SXin Li ;; 477*5ddc57e5SXin Li 478*5ddc57e5SXin Litru64) 479*5ddc57e5SXin Li # The Tru64 compiler uses -MD to generate dependencies as a side 480*5ddc57e5SXin Li # effect. 'cc -MD -o foo.o ...' puts the dependencies into 'foo.o.d'. 481*5ddc57e5SXin Li # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put 482*5ddc57e5SXin Li # dependencies in 'foo.d' instead, so we check for that too. 483*5ddc57e5SXin Li # Subdirectories are respected. 484*5ddc57e5SXin Li set_dir_from "$object" 485*5ddc57e5SXin Li set_base_from "$object" 486*5ddc57e5SXin Li 487*5ddc57e5SXin Li if test "$libtool" = yes; then 488*5ddc57e5SXin Li # Libtool generates 2 separate objects for the 2 libraries. These 489*5ddc57e5SXin Li # two compilations output dependencies in $dir.libs/$base.o.d and 490*5ddc57e5SXin Li # in $dir$base.o.d. We have to check for both files, because 491*5ddc57e5SXin Li # one of the two compilations can be disabled. We should prefer 492*5ddc57e5SXin Li # $dir$base.o.d over $dir.libs/$base.o.d because the latter is 493*5ddc57e5SXin Li # automatically cleaned when .libs/ is deleted, while ignoring 494*5ddc57e5SXin Li # the former would cause a distcleancheck panic. 495*5ddc57e5SXin Li tmpdepfile1=$dir$base.o.d # libtool 1.5 496*5ddc57e5SXin Li tmpdepfile2=$dir.libs/$base.o.d # Likewise. 497*5ddc57e5SXin Li tmpdepfile3=$dir.libs/$base.d # Compaq CCC V6.2-504 498*5ddc57e5SXin Li "$@" -Wc,-MD 499*5ddc57e5SXin Li else 500*5ddc57e5SXin Li tmpdepfile1=$dir$base.d 501*5ddc57e5SXin Li tmpdepfile2=$dir$base.d 502*5ddc57e5SXin Li tmpdepfile3=$dir$base.d 503*5ddc57e5SXin Li "$@" -MD 504*5ddc57e5SXin Li fi 505*5ddc57e5SXin Li 506*5ddc57e5SXin Li stat=$? 507*5ddc57e5SXin Li if test $stat -ne 0; then 508*5ddc57e5SXin Li rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" 509*5ddc57e5SXin Li exit $stat 510*5ddc57e5SXin Li fi 511*5ddc57e5SXin Li 512*5ddc57e5SXin Li for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" 513*5ddc57e5SXin Li do 514*5ddc57e5SXin Li test -f "$tmpdepfile" && break 515*5ddc57e5SXin Li done 516*5ddc57e5SXin Li # Same post-processing that is required for AIX mode. 517*5ddc57e5SXin Li aix_post_process_depfile 518*5ddc57e5SXin Li ;; 519*5ddc57e5SXin Li 520*5ddc57e5SXin Limsvc7) 521*5ddc57e5SXin Li if test "$libtool" = yes; then 522*5ddc57e5SXin Li showIncludes=-Wc,-showIncludes 523*5ddc57e5SXin Li else 524*5ddc57e5SXin Li showIncludes=-showIncludes 525*5ddc57e5SXin Li fi 526*5ddc57e5SXin Li "$@" $showIncludes > "$tmpdepfile" 527*5ddc57e5SXin Li stat=$? 528*5ddc57e5SXin Li grep -v '^Note: including file: ' "$tmpdepfile" 529*5ddc57e5SXin Li if test $stat -ne 0; then 530*5ddc57e5SXin Li rm -f "$tmpdepfile" 531*5ddc57e5SXin Li exit $stat 532*5ddc57e5SXin Li fi 533*5ddc57e5SXin Li rm -f "$depfile" 534*5ddc57e5SXin Li echo "$object : \\" > "$depfile" 535*5ddc57e5SXin Li # The first sed program below extracts the file names and escapes 536*5ddc57e5SXin Li # backslashes for cygpath. The second sed program outputs the file 537*5ddc57e5SXin Li # name when reading, but also accumulates all include files in the 538*5ddc57e5SXin Li # hold buffer in order to output them again at the end. This only 539*5ddc57e5SXin Li # works with sed implementations that can handle large buffers. 540*5ddc57e5SXin Li sed < "$tmpdepfile" -n ' 541*5ddc57e5SXin Li/^Note: including file: *\(.*\)/ { 542*5ddc57e5SXin Li s//\1/ 543*5ddc57e5SXin Li s/\\/\\\\/g 544*5ddc57e5SXin Li p 545*5ddc57e5SXin Li}' | $cygpath_u | sort -u | sed -n ' 546*5ddc57e5SXin Lis/ /\\ /g 547*5ddc57e5SXin Lis/\(.*\)/'"$tab"'\1 \\/p 548*5ddc57e5SXin Lis/.\(.*\) \\/\1:/ 549*5ddc57e5SXin LiH 550*5ddc57e5SXin Li$ { 551*5ddc57e5SXin Li s/.*/'"$tab"'/ 552*5ddc57e5SXin Li G 553*5ddc57e5SXin Li p 554*5ddc57e5SXin Li}' >> "$depfile" 555*5ddc57e5SXin Li echo >> "$depfile" # make sure the fragment doesn't end with a backslash 556*5ddc57e5SXin Li rm -f "$tmpdepfile" 557*5ddc57e5SXin Li ;; 558*5ddc57e5SXin Li 559*5ddc57e5SXin Limsvc7msys) 560*5ddc57e5SXin Li # This case exists only to let depend.m4 do its work. It works by 561*5ddc57e5SXin Li # looking at the text of this script. This case will never be run, 562*5ddc57e5SXin Li # since it is checked for above. 563*5ddc57e5SXin Li exit 1 564*5ddc57e5SXin Li ;; 565*5ddc57e5SXin Li 566*5ddc57e5SXin Li#nosideeffect) 567*5ddc57e5SXin Li # This comment above is used by automake to tell side-effect 568*5ddc57e5SXin Li # dependency tracking mechanisms from slower ones. 569*5ddc57e5SXin Li 570*5ddc57e5SXin Lidashmstdout) 571*5ddc57e5SXin Li # Important note: in order to support this mode, a compiler *must* 572*5ddc57e5SXin Li # always write the preprocessed file to stdout, regardless of -o. 573*5ddc57e5SXin Li "$@" || exit $? 574*5ddc57e5SXin Li 575*5ddc57e5SXin Li # Remove the call to Libtool. 576*5ddc57e5SXin Li if test "$libtool" = yes; then 577*5ddc57e5SXin Li while test "X$1" != 'X--mode=compile'; do 578*5ddc57e5SXin Li shift 579*5ddc57e5SXin Li done 580*5ddc57e5SXin Li shift 581*5ddc57e5SXin Li fi 582*5ddc57e5SXin Li 583*5ddc57e5SXin Li # Remove '-o $object'. 584*5ddc57e5SXin Li IFS=" " 585*5ddc57e5SXin Li for arg 586*5ddc57e5SXin Li do 587*5ddc57e5SXin Li case $arg in 588*5ddc57e5SXin Li -o) 589*5ddc57e5SXin Li shift 590*5ddc57e5SXin Li ;; 591*5ddc57e5SXin Li $object) 592*5ddc57e5SXin Li shift 593*5ddc57e5SXin Li ;; 594*5ddc57e5SXin Li *) 595*5ddc57e5SXin Li set fnord "$@" "$arg" 596*5ddc57e5SXin Li shift # fnord 597*5ddc57e5SXin Li shift # $arg 598*5ddc57e5SXin Li ;; 599*5ddc57e5SXin Li esac 600*5ddc57e5SXin Li done 601*5ddc57e5SXin Li 602*5ddc57e5SXin Li test -z "$dashmflag" && dashmflag=-M 603*5ddc57e5SXin Li # Require at least two characters before searching for ':' 604*5ddc57e5SXin Li # in the target name. This is to cope with DOS-style filenames: 605*5ddc57e5SXin Li # a dependency such as 'c:/foo/bar' could be seen as target 'c' otherwise. 606*5ddc57e5SXin Li "$@" $dashmflag | 607*5ddc57e5SXin Li sed "s|^[$tab ]*[^:$tab ][^:][^:]*:[$tab ]*|$object: |" > "$tmpdepfile" 608*5ddc57e5SXin Li rm -f "$depfile" 609*5ddc57e5SXin Li cat < "$tmpdepfile" > "$depfile" 610*5ddc57e5SXin Li # Some versions of the HPUX 10.20 sed can't process this sed invocation 611*5ddc57e5SXin Li # correctly. Breaking it into two sed invocations is a workaround. 612*5ddc57e5SXin Li tr ' ' "$nl" < "$tmpdepfile" \ 613*5ddc57e5SXin Li | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \ 614*5ddc57e5SXin Li | sed -e 's/$/ :/' >> "$depfile" 615*5ddc57e5SXin Li rm -f "$tmpdepfile" 616*5ddc57e5SXin Li ;; 617*5ddc57e5SXin Li 618*5ddc57e5SXin LidashXmstdout) 619*5ddc57e5SXin Li # This case only exists to satisfy depend.m4. It is never actually 620*5ddc57e5SXin Li # run, as this mode is specially recognized in the preamble. 621*5ddc57e5SXin Li exit 1 622*5ddc57e5SXin Li ;; 623*5ddc57e5SXin Li 624*5ddc57e5SXin Limakedepend) 625*5ddc57e5SXin Li "$@" || exit $? 626*5ddc57e5SXin Li # Remove any Libtool call 627*5ddc57e5SXin Li if test "$libtool" = yes; then 628*5ddc57e5SXin Li while test "X$1" != 'X--mode=compile'; do 629*5ddc57e5SXin Li shift 630*5ddc57e5SXin Li done 631*5ddc57e5SXin Li shift 632*5ddc57e5SXin Li fi 633*5ddc57e5SXin Li # X makedepend 634*5ddc57e5SXin Li shift 635*5ddc57e5SXin Li cleared=no eat=no 636*5ddc57e5SXin Li for arg 637*5ddc57e5SXin Li do 638*5ddc57e5SXin Li case $cleared in 639*5ddc57e5SXin Li no) 640*5ddc57e5SXin Li set ""; shift 641*5ddc57e5SXin Li cleared=yes ;; 642*5ddc57e5SXin Li esac 643*5ddc57e5SXin Li if test $eat = yes; then 644*5ddc57e5SXin Li eat=no 645*5ddc57e5SXin Li continue 646*5ddc57e5SXin Li fi 647*5ddc57e5SXin Li case "$arg" in 648*5ddc57e5SXin Li -D*|-I*) 649*5ddc57e5SXin Li set fnord "$@" "$arg"; shift ;; 650*5ddc57e5SXin Li # Strip any option that makedepend may not understand. Remove 651*5ddc57e5SXin Li # the object too, otherwise makedepend will parse it as a source file. 652*5ddc57e5SXin Li -arch) 653*5ddc57e5SXin Li eat=yes ;; 654*5ddc57e5SXin Li -*|$object) 655*5ddc57e5SXin Li ;; 656*5ddc57e5SXin Li *) 657*5ddc57e5SXin Li set fnord "$@" "$arg"; shift ;; 658*5ddc57e5SXin Li esac 659*5ddc57e5SXin Li done 660*5ddc57e5SXin Li obj_suffix=`echo "$object" | sed 's/^.*\././'` 661*5ddc57e5SXin Li touch "$tmpdepfile" 662*5ddc57e5SXin Li ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" 663*5ddc57e5SXin Li rm -f "$depfile" 664*5ddc57e5SXin Li # makedepend may prepend the VPATH from the source file name to the object. 665*5ddc57e5SXin Li # No need to regex-escape $object, excess matching of '.' is harmless. 666*5ddc57e5SXin Li sed "s|^.*\($object *:\)|\1|" "$tmpdepfile" > "$depfile" 667*5ddc57e5SXin Li # Some versions of the HPUX 10.20 sed can't process the last invocation 668*5ddc57e5SXin Li # correctly. Breaking it into two sed invocations is a workaround. 669*5ddc57e5SXin Li sed '1,2d' "$tmpdepfile" \ 670*5ddc57e5SXin Li | tr ' ' "$nl" \ 671*5ddc57e5SXin Li | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \ 672*5ddc57e5SXin Li | sed -e 's/$/ :/' >> "$depfile" 673*5ddc57e5SXin Li rm -f "$tmpdepfile" "$tmpdepfile".bak 674*5ddc57e5SXin Li ;; 675*5ddc57e5SXin Li 676*5ddc57e5SXin Licpp) 677*5ddc57e5SXin Li # Important note: in order to support this mode, a compiler *must* 678*5ddc57e5SXin Li # always write the preprocessed file to stdout. 679*5ddc57e5SXin Li "$@" || exit $? 680*5ddc57e5SXin Li 681*5ddc57e5SXin Li # Remove the call to Libtool. 682*5ddc57e5SXin Li if test "$libtool" = yes; then 683*5ddc57e5SXin Li while test "X$1" != 'X--mode=compile'; do 684*5ddc57e5SXin Li shift 685*5ddc57e5SXin Li done 686*5ddc57e5SXin Li shift 687*5ddc57e5SXin Li fi 688*5ddc57e5SXin Li 689*5ddc57e5SXin Li # Remove '-o $object'. 690*5ddc57e5SXin Li IFS=" " 691*5ddc57e5SXin Li for arg 692*5ddc57e5SXin Li do 693*5ddc57e5SXin Li case $arg in 694*5ddc57e5SXin Li -o) 695*5ddc57e5SXin Li shift 696*5ddc57e5SXin Li ;; 697*5ddc57e5SXin Li $object) 698*5ddc57e5SXin Li shift 699*5ddc57e5SXin Li ;; 700*5ddc57e5SXin Li *) 701*5ddc57e5SXin Li set fnord "$@" "$arg" 702*5ddc57e5SXin Li shift # fnord 703*5ddc57e5SXin Li shift # $arg 704*5ddc57e5SXin Li ;; 705*5ddc57e5SXin Li esac 706*5ddc57e5SXin Li done 707*5ddc57e5SXin Li 708*5ddc57e5SXin Li "$@" -E \ 709*5ddc57e5SXin Li | sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ 710*5ddc57e5SXin Li -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ 711*5ddc57e5SXin Li | sed '$ s: \\$::' > "$tmpdepfile" 712*5ddc57e5SXin Li rm -f "$depfile" 713*5ddc57e5SXin Li echo "$object : \\" > "$depfile" 714*5ddc57e5SXin Li cat < "$tmpdepfile" >> "$depfile" 715*5ddc57e5SXin Li sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" 716*5ddc57e5SXin Li rm -f "$tmpdepfile" 717*5ddc57e5SXin Li ;; 718*5ddc57e5SXin Li 719*5ddc57e5SXin Limsvisualcpp) 720*5ddc57e5SXin Li # Important note: in order to support this mode, a compiler *must* 721*5ddc57e5SXin Li # always write the preprocessed file to stdout. 722*5ddc57e5SXin Li "$@" || exit $? 723*5ddc57e5SXin Li 724*5ddc57e5SXin Li # Remove the call to Libtool. 725*5ddc57e5SXin Li if test "$libtool" = yes; then 726*5ddc57e5SXin Li while test "X$1" != 'X--mode=compile'; do 727*5ddc57e5SXin Li shift 728*5ddc57e5SXin Li done 729*5ddc57e5SXin Li shift 730*5ddc57e5SXin Li fi 731*5ddc57e5SXin Li 732*5ddc57e5SXin Li IFS=" " 733*5ddc57e5SXin Li for arg 734*5ddc57e5SXin Li do 735*5ddc57e5SXin Li case "$arg" in 736*5ddc57e5SXin Li -o) 737*5ddc57e5SXin Li shift 738*5ddc57e5SXin Li ;; 739*5ddc57e5SXin Li $object) 740*5ddc57e5SXin Li shift 741*5ddc57e5SXin Li ;; 742*5ddc57e5SXin Li "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") 743*5ddc57e5SXin Li set fnord "$@" 744*5ddc57e5SXin Li shift 745*5ddc57e5SXin Li shift 746*5ddc57e5SXin Li ;; 747*5ddc57e5SXin Li *) 748*5ddc57e5SXin Li set fnord "$@" "$arg" 749*5ddc57e5SXin Li shift 750*5ddc57e5SXin Li shift 751*5ddc57e5SXin Li ;; 752*5ddc57e5SXin Li esac 753*5ddc57e5SXin Li done 754*5ddc57e5SXin Li "$@" -E 2>/dev/null | 755*5ddc57e5SXin Li sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile" 756*5ddc57e5SXin Li rm -f "$depfile" 757*5ddc57e5SXin Li echo "$object : \\" > "$depfile" 758*5ddc57e5SXin Li sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::'"$tab"'\1 \\:p' >> "$depfile" 759*5ddc57e5SXin Li echo "$tab" >> "$depfile" 760*5ddc57e5SXin Li sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile" 761*5ddc57e5SXin Li rm -f "$tmpdepfile" 762*5ddc57e5SXin Li ;; 763*5ddc57e5SXin Li 764*5ddc57e5SXin Limsvcmsys) 765*5ddc57e5SXin Li # This case exists only to let depend.m4 do its work. It works by 766*5ddc57e5SXin Li # looking at the text of this script. This case will never be run, 767*5ddc57e5SXin Li # since it is checked for above. 768*5ddc57e5SXin Li exit 1 769*5ddc57e5SXin Li ;; 770*5ddc57e5SXin Li 771*5ddc57e5SXin Linone) 772*5ddc57e5SXin Li exec "$@" 773*5ddc57e5SXin Li ;; 774*5ddc57e5SXin Li 775*5ddc57e5SXin Li*) 776*5ddc57e5SXin Li echo "Unknown depmode $depmode" 1>&2 777*5ddc57e5SXin Li exit 1 778*5ddc57e5SXin Li ;; 779*5ddc57e5SXin Liesac 780*5ddc57e5SXin Li 781*5ddc57e5SXin Liexit 0 782*5ddc57e5SXin Li 783*5ddc57e5SXin Li# Local Variables: 784*5ddc57e5SXin Li# mode: shell-script 785*5ddc57e5SXin Li# sh-indentation: 2 786*5ddc57e5SXin Li# eval: (add-hook 'write-file-hooks 'time-stamp) 787*5ddc57e5SXin Li# time-stamp-start: "scriptversion=" 788*5ddc57e5SXin Li# time-stamp-format: "%:y-%02m-%02d.%02H" 789*5ddc57e5SXin Li# time-stamp-time-zone: "UTC" 790*5ddc57e5SXin Li# time-stamp-end: "; # UTC" 791*5ddc57e5SXin Li# End: 792