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