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