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