1159b3361Sopenharmony_ci#! /bin/sh 2159b3361Sopenharmony_ci# depcomp - compile a program generating dependencies as side-effects 3159b3361Sopenharmony_ci 4159b3361Sopenharmony_ciscriptversion=2016-01-11.22; # UTC 5159b3361Sopenharmony_ci 6159b3361Sopenharmony_ci# Copyright (C) 1999-2017 Free Software Foundation, Inc. 7159b3361Sopenharmony_ci 8159b3361Sopenharmony_ci# This program is free software; you can redistribute it and/or modify 9159b3361Sopenharmony_ci# it under the terms of the GNU General Public License as published by 10159b3361Sopenharmony_ci# the Free Software Foundation; either version 2, or (at your option) 11159b3361Sopenharmony_ci# any later version. 12159b3361Sopenharmony_ci 13159b3361Sopenharmony_ci# This program is distributed in the hope that it will be useful, 14159b3361Sopenharmony_ci# but WITHOUT ANY WARRANTY; without even the implied warranty of 15159b3361Sopenharmony_ci# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16159b3361Sopenharmony_ci# GNU General Public License for more details. 17159b3361Sopenharmony_ci 18159b3361Sopenharmony_ci# You should have received a copy of the GNU General Public License 19159b3361Sopenharmony_ci# along with this program. If not, see <http://www.gnu.org/licenses/>. 20159b3361Sopenharmony_ci 21159b3361Sopenharmony_ci# As a special exception to the GNU General Public License, if you 22159b3361Sopenharmony_ci# distribute this file as part of a program that contains a 23159b3361Sopenharmony_ci# configuration script generated by Autoconf, you may include it under 24159b3361Sopenharmony_ci# the same distribution terms that you use for the rest of that program. 25159b3361Sopenharmony_ci 26159b3361Sopenharmony_ci# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>. 27159b3361Sopenharmony_ci 28159b3361Sopenharmony_cicase $1 in 29159b3361Sopenharmony_ci '') 30159b3361Sopenharmony_ci echo "$0: No command. Try '$0 --help' for more information." 1>&2 31159b3361Sopenharmony_ci exit 1; 32159b3361Sopenharmony_ci ;; 33159b3361Sopenharmony_ci -h | --h*) 34159b3361Sopenharmony_ci cat <<\EOF 35159b3361Sopenharmony_ciUsage: depcomp [--help] [--version] PROGRAM [ARGS] 36159b3361Sopenharmony_ci 37159b3361Sopenharmony_ciRun PROGRAMS ARGS to compile a file, generating dependencies 38159b3361Sopenharmony_cias side-effects. 39159b3361Sopenharmony_ci 40159b3361Sopenharmony_ciEnvironment variables: 41159b3361Sopenharmony_ci depmode Dependency tracking mode. 42159b3361Sopenharmony_ci source Source file read by 'PROGRAMS ARGS'. 43159b3361Sopenharmony_ci object Object file output by 'PROGRAMS ARGS'. 44159b3361Sopenharmony_ci DEPDIR directory where to store dependencies. 45159b3361Sopenharmony_ci depfile Dependency file to output. 46159b3361Sopenharmony_ci tmpdepfile Temporary file to use when outputting dependencies. 47159b3361Sopenharmony_ci libtool Whether libtool is used (yes/no). 48159b3361Sopenharmony_ci 49159b3361Sopenharmony_ciReport bugs to <bug-automake@gnu.org>. 50159b3361Sopenharmony_ciEOF 51159b3361Sopenharmony_ci exit $? 52159b3361Sopenharmony_ci ;; 53159b3361Sopenharmony_ci -v | --v*) 54159b3361Sopenharmony_ci echo "depcomp $scriptversion" 55159b3361Sopenharmony_ci exit $? 56159b3361Sopenharmony_ci ;; 57159b3361Sopenharmony_ciesac 58159b3361Sopenharmony_ci 59159b3361Sopenharmony_ci# Get the directory component of the given path, and save it in the 60159b3361Sopenharmony_ci# global variables '$dir'. Note that this directory component will 61159b3361Sopenharmony_ci# be either empty or ending with a '/' character. This is deliberate. 62159b3361Sopenharmony_ciset_dir_from () 63159b3361Sopenharmony_ci{ 64159b3361Sopenharmony_ci case $1 in 65159b3361Sopenharmony_ci */*) dir=`echo "$1" | sed -e 's|/[^/]*$|/|'`;; 66159b3361Sopenharmony_ci *) dir=;; 67159b3361Sopenharmony_ci esac 68159b3361Sopenharmony_ci} 69159b3361Sopenharmony_ci 70159b3361Sopenharmony_ci# Get the suffix-stripped basename of the given path, and save it the 71159b3361Sopenharmony_ci# global variable '$base'. 72159b3361Sopenharmony_ciset_base_from () 73159b3361Sopenharmony_ci{ 74159b3361Sopenharmony_ci base=`echo "$1" | sed -e 's|^.*/||' -e 's/\.[^.]*$//'` 75159b3361Sopenharmony_ci} 76159b3361Sopenharmony_ci 77159b3361Sopenharmony_ci# If no dependency file was actually created by the compiler invocation, 78159b3361Sopenharmony_ci# we still have to create a dummy depfile, to avoid errors with the 79159b3361Sopenharmony_ci# Makefile "include basename.Plo" scheme. 80159b3361Sopenharmony_cimake_dummy_depfile () 81159b3361Sopenharmony_ci{ 82159b3361Sopenharmony_ci echo "#dummy" > "$depfile" 83159b3361Sopenharmony_ci} 84159b3361Sopenharmony_ci 85159b3361Sopenharmony_ci# Factor out some common post-processing of the generated depfile. 86159b3361Sopenharmony_ci# Requires the auxiliary global variable '$tmpdepfile' to be set. 87159b3361Sopenharmony_ciaix_post_process_depfile () 88159b3361Sopenharmony_ci{ 89159b3361Sopenharmony_ci # If the compiler actually managed to produce a dependency file, 90159b3361Sopenharmony_ci # post-process it. 91159b3361Sopenharmony_ci if test -f "$tmpdepfile"; then 92159b3361Sopenharmony_ci # Each line is of the form 'foo.o: dependency.h'. 93159b3361Sopenharmony_ci # Do two passes, one to just change these to 94159b3361Sopenharmony_ci # $object: dependency.h 95159b3361Sopenharmony_ci # and one to simply output 96159b3361Sopenharmony_ci # dependency.h: 97159b3361Sopenharmony_ci # which is needed to avoid the deleted-header problem. 98159b3361Sopenharmony_ci { sed -e "s,^.*\.[$lower]*:,$object:," < "$tmpdepfile" 99159b3361Sopenharmony_ci sed -e "s,^.*\.[$lower]*:[$tab ]*,," -e 's,$,:,' < "$tmpdepfile" 100159b3361Sopenharmony_ci } > "$depfile" 101159b3361Sopenharmony_ci rm -f "$tmpdepfile" 102159b3361Sopenharmony_ci else 103159b3361Sopenharmony_ci make_dummy_depfile 104159b3361Sopenharmony_ci fi 105159b3361Sopenharmony_ci} 106159b3361Sopenharmony_ci 107159b3361Sopenharmony_ci# A tabulation character. 108159b3361Sopenharmony_citab=' ' 109159b3361Sopenharmony_ci# A newline character. 110159b3361Sopenharmony_cinl=' 111159b3361Sopenharmony_ci' 112159b3361Sopenharmony_ci# Character ranges might be problematic outside the C locale. 113159b3361Sopenharmony_ci# These definitions help. 114159b3361Sopenharmony_ciupper=ABCDEFGHIJKLMNOPQRSTUVWXYZ 115159b3361Sopenharmony_cilower=abcdefghijklmnopqrstuvwxyz 116159b3361Sopenharmony_cidigits=0123456789 117159b3361Sopenharmony_cialpha=${upper}${lower} 118159b3361Sopenharmony_ci 119159b3361Sopenharmony_ciif test -z "$depmode" || test -z "$source" || test -z "$object"; then 120159b3361Sopenharmony_ci echo "depcomp: Variables source, object and depmode must be set" 1>&2 121159b3361Sopenharmony_ci exit 1 122159b3361Sopenharmony_cifi 123159b3361Sopenharmony_ci 124159b3361Sopenharmony_ci# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po. 125159b3361Sopenharmony_cidepfile=${depfile-`echo "$object" | 126159b3361Sopenharmony_ci sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`} 127159b3361Sopenharmony_citmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} 128159b3361Sopenharmony_ci 129159b3361Sopenharmony_cirm -f "$tmpdepfile" 130159b3361Sopenharmony_ci 131159b3361Sopenharmony_ci# Avoid interferences from the environment. 132159b3361Sopenharmony_cigccflag= dashmflag= 133159b3361Sopenharmony_ci 134159b3361Sopenharmony_ci# Some modes work just like other modes, but use different flags. We 135159b3361Sopenharmony_ci# parameterize here, but still list the modes in the big case below, 136159b3361Sopenharmony_ci# to make depend.m4 easier to write. Note that we *cannot* use a case 137159b3361Sopenharmony_ci# here, because this file can only contain one case statement. 138159b3361Sopenharmony_ciif test "$depmode" = hp; then 139159b3361Sopenharmony_ci # HP compiler uses -M and no extra arg. 140159b3361Sopenharmony_ci gccflag=-M 141159b3361Sopenharmony_ci depmode=gcc 142159b3361Sopenharmony_cifi 143159b3361Sopenharmony_ci 144159b3361Sopenharmony_ciif test "$depmode" = dashXmstdout; then 145159b3361Sopenharmony_ci # This is just like dashmstdout with a different argument. 146159b3361Sopenharmony_ci dashmflag=-xM 147159b3361Sopenharmony_ci depmode=dashmstdout 148159b3361Sopenharmony_cifi 149159b3361Sopenharmony_ci 150159b3361Sopenharmony_cicygpath_u="cygpath -u -f -" 151159b3361Sopenharmony_ciif test "$depmode" = msvcmsys; then 152159b3361Sopenharmony_ci # This is just like msvisualcpp but w/o cygpath translation. 153159b3361Sopenharmony_ci # Just convert the backslash-escaped backslashes to single forward 154159b3361Sopenharmony_ci # slashes to satisfy depend.m4 155159b3361Sopenharmony_ci cygpath_u='sed s,\\\\,/,g' 156159b3361Sopenharmony_ci depmode=msvisualcpp 157159b3361Sopenharmony_cifi 158159b3361Sopenharmony_ci 159159b3361Sopenharmony_ciif test "$depmode" = msvc7msys; then 160159b3361Sopenharmony_ci # This is just like msvc7 but w/o cygpath translation. 161159b3361Sopenharmony_ci # Just convert the backslash-escaped backslashes to single forward 162159b3361Sopenharmony_ci # slashes to satisfy depend.m4 163159b3361Sopenharmony_ci cygpath_u='sed s,\\\\,/,g' 164159b3361Sopenharmony_ci depmode=msvc7 165159b3361Sopenharmony_cifi 166159b3361Sopenharmony_ci 167159b3361Sopenharmony_ciif test "$depmode" = xlc; then 168159b3361Sopenharmony_ci # IBM C/C++ Compilers xlc/xlC can output gcc-like dependency information. 169159b3361Sopenharmony_ci gccflag=-qmakedep=gcc,-MF 170159b3361Sopenharmony_ci depmode=gcc 171159b3361Sopenharmony_cifi 172159b3361Sopenharmony_ci 173159b3361Sopenharmony_cicase "$depmode" in 174159b3361Sopenharmony_cigcc3) 175159b3361Sopenharmony_ci## gcc 3 implements dependency tracking that does exactly what 176159b3361Sopenharmony_ci## we want. Yay! Note: for some reason libtool 1.4 doesn't like 177159b3361Sopenharmony_ci## it if -MD -MP comes after the -MF stuff. Hmm. 178159b3361Sopenharmony_ci## Unfortunately, FreeBSD c89 acceptance of flags depends upon 179159b3361Sopenharmony_ci## the command line argument order; so add the flags where they 180159b3361Sopenharmony_ci## appear in depend2.am. Note that the slowdown incurred here 181159b3361Sopenharmony_ci## affects only configure: in makefiles, %FASTDEP% shortcuts this. 182159b3361Sopenharmony_ci for arg 183159b3361Sopenharmony_ci do 184159b3361Sopenharmony_ci case $arg in 185159b3361Sopenharmony_ci -c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;; 186159b3361Sopenharmony_ci *) set fnord "$@" "$arg" ;; 187159b3361Sopenharmony_ci esac 188159b3361Sopenharmony_ci shift # fnord 189159b3361Sopenharmony_ci shift # $arg 190159b3361Sopenharmony_ci done 191159b3361Sopenharmony_ci "$@" 192159b3361Sopenharmony_ci stat=$? 193159b3361Sopenharmony_ci if test $stat -ne 0; then 194159b3361Sopenharmony_ci rm -f "$tmpdepfile" 195159b3361Sopenharmony_ci exit $stat 196159b3361Sopenharmony_ci fi 197159b3361Sopenharmony_ci mv "$tmpdepfile" "$depfile" 198159b3361Sopenharmony_ci ;; 199159b3361Sopenharmony_ci 200159b3361Sopenharmony_cigcc) 201159b3361Sopenharmony_ci## Note that this doesn't just cater to obsosete pre-3.x GCC compilers. 202159b3361Sopenharmony_ci## but also to in-use compilers like IMB xlc/xlC and the HP C compiler. 203159b3361Sopenharmony_ci## (see the conditional assignment to $gccflag above). 204159b3361Sopenharmony_ci## There are various ways to get dependency output from gcc. Here's 205159b3361Sopenharmony_ci## why we pick this rather obscure method: 206159b3361Sopenharmony_ci## - Don't want to use -MD because we'd like the dependencies to end 207159b3361Sopenharmony_ci## up in a subdir. Having to rename by hand is ugly. 208159b3361Sopenharmony_ci## (We might end up doing this anyway to support other compilers.) 209159b3361Sopenharmony_ci## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like 210159b3361Sopenharmony_ci## -MM, not -M (despite what the docs say). Also, it might not be 211159b3361Sopenharmony_ci## supported by the other compilers which use the 'gcc' depmode. 212159b3361Sopenharmony_ci## - Using -M directly means running the compiler twice (even worse 213159b3361Sopenharmony_ci## than renaming). 214159b3361Sopenharmony_ci if test -z "$gccflag"; then 215159b3361Sopenharmony_ci gccflag=-MD, 216159b3361Sopenharmony_ci fi 217159b3361Sopenharmony_ci "$@" -Wp,"$gccflag$tmpdepfile" 218159b3361Sopenharmony_ci stat=$? 219159b3361Sopenharmony_ci if test $stat -ne 0; then 220159b3361Sopenharmony_ci rm -f "$tmpdepfile" 221159b3361Sopenharmony_ci exit $stat 222159b3361Sopenharmony_ci fi 223159b3361Sopenharmony_ci rm -f "$depfile" 224159b3361Sopenharmony_ci echo "$object : \\" > "$depfile" 225159b3361Sopenharmony_ci # The second -e expression handles DOS-style file names with drive 226159b3361Sopenharmony_ci # letters. 227159b3361Sopenharmony_ci sed -e 's/^[^:]*: / /' \ 228159b3361Sopenharmony_ci -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" 229159b3361Sopenharmony_ci## This next piece of magic avoids the "deleted header file" problem. 230159b3361Sopenharmony_ci## The problem is that when a header file which appears in a .P file 231159b3361Sopenharmony_ci## is deleted, the dependency causes make to die (because there is 232159b3361Sopenharmony_ci## typically no way to rebuild the header). We avoid this by adding 233159b3361Sopenharmony_ci## dummy dependencies for each header file. Too bad gcc doesn't do 234159b3361Sopenharmony_ci## this for us directly. 235159b3361Sopenharmony_ci## Some versions of gcc put a space before the ':'. On the theory 236159b3361Sopenharmony_ci## that the space means something, we add a space to the output as 237159b3361Sopenharmony_ci## well. hp depmode also adds that space, but also prefixes the VPATH 238159b3361Sopenharmony_ci## to the object. Take care to not repeat it in the output. 239159b3361Sopenharmony_ci## Some versions of the HPUX 10.20 sed can't process this invocation 240159b3361Sopenharmony_ci## correctly. Breaking it into two sed invocations is a workaround. 241159b3361Sopenharmony_ci tr ' ' "$nl" < "$tmpdepfile" \ 242159b3361Sopenharmony_ci | sed -e 's/^\\$//' -e '/^$/d' -e "s|.*$object$||" -e '/:$/d' \ 243159b3361Sopenharmony_ci | sed -e 's/$/ :/' >> "$depfile" 244159b3361Sopenharmony_ci rm -f "$tmpdepfile" 245159b3361Sopenharmony_ci ;; 246159b3361Sopenharmony_ci 247159b3361Sopenharmony_cihp) 248159b3361Sopenharmony_ci # This case exists only to let depend.m4 do its work. It works by 249159b3361Sopenharmony_ci # looking at the text of this script. This case will never be run, 250159b3361Sopenharmony_ci # since it is checked for above. 251159b3361Sopenharmony_ci exit 1 252159b3361Sopenharmony_ci ;; 253159b3361Sopenharmony_ci 254159b3361Sopenharmony_cisgi) 255159b3361Sopenharmony_ci if test "$libtool" = yes; then 256159b3361Sopenharmony_ci "$@" "-Wp,-MDupdate,$tmpdepfile" 257159b3361Sopenharmony_ci else 258159b3361Sopenharmony_ci "$@" -MDupdate "$tmpdepfile" 259159b3361Sopenharmony_ci fi 260159b3361Sopenharmony_ci stat=$? 261159b3361Sopenharmony_ci if test $stat -ne 0; then 262159b3361Sopenharmony_ci rm -f "$tmpdepfile" 263159b3361Sopenharmony_ci exit $stat 264159b3361Sopenharmony_ci fi 265159b3361Sopenharmony_ci rm -f "$depfile" 266159b3361Sopenharmony_ci 267159b3361Sopenharmony_ci if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files 268159b3361Sopenharmony_ci echo "$object : \\" > "$depfile" 269159b3361Sopenharmony_ci # Clip off the initial element (the dependent). Don't try to be 270159b3361Sopenharmony_ci # clever and replace this with sed code, as IRIX sed won't handle 271159b3361Sopenharmony_ci # lines with more than a fixed number of characters (4096 in 272159b3361Sopenharmony_ci # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; 273159b3361Sopenharmony_ci # the IRIX cc adds comments like '#:fec' to the end of the 274159b3361Sopenharmony_ci # dependency line. 275159b3361Sopenharmony_ci tr ' ' "$nl" < "$tmpdepfile" \ 276159b3361Sopenharmony_ci | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' \ 277159b3361Sopenharmony_ci | tr "$nl" ' ' >> "$depfile" 278159b3361Sopenharmony_ci echo >> "$depfile" 279159b3361Sopenharmony_ci # The second pass generates a dummy entry for each header file. 280159b3361Sopenharmony_ci tr ' ' "$nl" < "$tmpdepfile" \ 281159b3361Sopenharmony_ci | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ 282159b3361Sopenharmony_ci >> "$depfile" 283159b3361Sopenharmony_ci else 284159b3361Sopenharmony_ci make_dummy_depfile 285159b3361Sopenharmony_ci fi 286159b3361Sopenharmony_ci rm -f "$tmpdepfile" 287159b3361Sopenharmony_ci ;; 288159b3361Sopenharmony_ci 289159b3361Sopenharmony_cixlc) 290159b3361Sopenharmony_ci # This case exists only to let depend.m4 do its work. It works by 291159b3361Sopenharmony_ci # looking at the text of this script. This case will never be run, 292159b3361Sopenharmony_ci # since it is checked for above. 293159b3361Sopenharmony_ci exit 1 294159b3361Sopenharmony_ci ;; 295159b3361Sopenharmony_ci 296159b3361Sopenharmony_ciaix) 297159b3361Sopenharmony_ci # The C for AIX Compiler uses -M and outputs the dependencies 298159b3361Sopenharmony_ci # in a .u file. In older versions, this file always lives in the 299159b3361Sopenharmony_ci # current directory. Also, the AIX compiler puts '$object:' at the 300159b3361Sopenharmony_ci # start of each line; $object doesn't have directory information. 301159b3361Sopenharmony_ci # Version 6 uses the directory in both cases. 302159b3361Sopenharmony_ci set_dir_from "$object" 303159b3361Sopenharmony_ci set_base_from "$object" 304159b3361Sopenharmony_ci if test "$libtool" = yes; then 305159b3361Sopenharmony_ci tmpdepfile1=$dir$base.u 306159b3361Sopenharmony_ci tmpdepfile2=$base.u 307159b3361Sopenharmony_ci tmpdepfile3=$dir.libs/$base.u 308159b3361Sopenharmony_ci "$@" -Wc,-M 309159b3361Sopenharmony_ci else 310159b3361Sopenharmony_ci tmpdepfile1=$dir$base.u 311159b3361Sopenharmony_ci tmpdepfile2=$dir$base.u 312159b3361Sopenharmony_ci tmpdepfile3=$dir$base.u 313159b3361Sopenharmony_ci "$@" -M 314159b3361Sopenharmony_ci fi 315159b3361Sopenharmony_ci stat=$? 316159b3361Sopenharmony_ci if test $stat -ne 0; then 317159b3361Sopenharmony_ci rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" 318159b3361Sopenharmony_ci exit $stat 319159b3361Sopenharmony_ci fi 320159b3361Sopenharmony_ci 321159b3361Sopenharmony_ci for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" 322159b3361Sopenharmony_ci do 323159b3361Sopenharmony_ci test -f "$tmpdepfile" && break 324159b3361Sopenharmony_ci done 325159b3361Sopenharmony_ci aix_post_process_depfile 326159b3361Sopenharmony_ci ;; 327159b3361Sopenharmony_ci 328159b3361Sopenharmony_citcc) 329159b3361Sopenharmony_ci # tcc (Tiny C Compiler) understand '-MD -MF file' since version 0.9.26 330159b3361Sopenharmony_ci # FIXME: That version still under development at the moment of writing. 331159b3361Sopenharmony_ci # Make that this statement remains true also for stable, released 332159b3361Sopenharmony_ci # versions. 333159b3361Sopenharmony_ci # It will wrap lines (doesn't matter whether long or short) with a 334159b3361Sopenharmony_ci # trailing '\', as in: 335159b3361Sopenharmony_ci # 336159b3361Sopenharmony_ci # foo.o : \ 337159b3361Sopenharmony_ci # foo.c \ 338159b3361Sopenharmony_ci # foo.h \ 339159b3361Sopenharmony_ci # 340159b3361Sopenharmony_ci # It will put a trailing '\' even on the last line, and will use leading 341159b3361Sopenharmony_ci # spaces rather than leading tabs (at least since its commit 0394caf7 342159b3361Sopenharmony_ci # "Emit spaces for -MD"). 343159b3361Sopenharmony_ci "$@" -MD -MF "$tmpdepfile" 344159b3361Sopenharmony_ci stat=$? 345159b3361Sopenharmony_ci if test $stat -ne 0; then 346159b3361Sopenharmony_ci rm -f "$tmpdepfile" 347159b3361Sopenharmony_ci exit $stat 348159b3361Sopenharmony_ci fi 349159b3361Sopenharmony_ci rm -f "$depfile" 350159b3361Sopenharmony_ci # Each non-empty line is of the form 'foo.o : \' or ' dep.h \'. 351159b3361Sopenharmony_ci # We have to change lines of the first kind to '$object: \'. 352159b3361Sopenharmony_ci sed -e "s|.*:|$object :|" < "$tmpdepfile" > "$depfile" 353159b3361Sopenharmony_ci # And for each line of the second kind, we have to emit a 'dep.h:' 354159b3361Sopenharmony_ci # dummy dependency, to avoid the deleted-header problem. 355159b3361Sopenharmony_ci sed -n -e 's|^ *\(.*\) *\\$|\1:|p' < "$tmpdepfile" >> "$depfile" 356159b3361Sopenharmony_ci rm -f "$tmpdepfile" 357159b3361Sopenharmony_ci ;; 358159b3361Sopenharmony_ci 359159b3361Sopenharmony_ci## The order of this option in the case statement is important, since the 360159b3361Sopenharmony_ci## shell code in configure will try each of these formats in the order 361159b3361Sopenharmony_ci## listed in this file. A plain '-MD' option would be understood by many 362159b3361Sopenharmony_ci## compilers, so we must ensure this comes after the gcc and icc options. 363159b3361Sopenharmony_cipgcc) 364159b3361Sopenharmony_ci # Portland's C compiler understands '-MD'. 365159b3361Sopenharmony_ci # Will always output deps to 'file.d' where file is the root name of the 366159b3361Sopenharmony_ci # source file under compilation, even if file resides in a subdirectory. 367159b3361Sopenharmony_ci # The object file name does not affect the name of the '.d' file. 368159b3361Sopenharmony_ci # pgcc 10.2 will output 369159b3361Sopenharmony_ci # foo.o: sub/foo.c sub/foo.h 370159b3361Sopenharmony_ci # and will wrap long lines using '\' : 371159b3361Sopenharmony_ci # foo.o: sub/foo.c ... \ 372159b3361Sopenharmony_ci # sub/foo.h ... \ 373159b3361Sopenharmony_ci # ... 374159b3361Sopenharmony_ci set_dir_from "$object" 375159b3361Sopenharmony_ci # Use the source, not the object, to determine the base name, since 376159b3361Sopenharmony_ci # that's sadly what pgcc will do too. 377159b3361Sopenharmony_ci set_base_from "$source" 378159b3361Sopenharmony_ci tmpdepfile=$base.d 379159b3361Sopenharmony_ci 380159b3361Sopenharmony_ci # For projects that build the same source file twice into different object 381159b3361Sopenharmony_ci # files, the pgcc approach of using the *source* file root name can cause 382159b3361Sopenharmony_ci # problems in parallel builds. Use a locking strategy to avoid stomping on 383159b3361Sopenharmony_ci # the same $tmpdepfile. 384159b3361Sopenharmony_ci lockdir=$base.d-lock 385159b3361Sopenharmony_ci trap " 386159b3361Sopenharmony_ci echo '$0: caught signal, cleaning up...' >&2 387159b3361Sopenharmony_ci rmdir '$lockdir' 388159b3361Sopenharmony_ci exit 1 389159b3361Sopenharmony_ci " 1 2 13 15 390159b3361Sopenharmony_ci numtries=100 391159b3361Sopenharmony_ci i=$numtries 392159b3361Sopenharmony_ci while test $i -gt 0; do 393159b3361Sopenharmony_ci # mkdir is a portable test-and-set. 394159b3361Sopenharmony_ci if mkdir "$lockdir" 2>/dev/null; then 395159b3361Sopenharmony_ci # This process acquired the lock. 396159b3361Sopenharmony_ci "$@" -MD 397159b3361Sopenharmony_ci stat=$? 398159b3361Sopenharmony_ci # Release the lock. 399159b3361Sopenharmony_ci rmdir "$lockdir" 400159b3361Sopenharmony_ci break 401159b3361Sopenharmony_ci else 402159b3361Sopenharmony_ci # If the lock is being held by a different process, wait 403159b3361Sopenharmony_ci # until the winning process is done or we timeout. 404159b3361Sopenharmony_ci while test -d "$lockdir" && test $i -gt 0; do 405159b3361Sopenharmony_ci sleep 1 406159b3361Sopenharmony_ci i=`expr $i - 1` 407159b3361Sopenharmony_ci done 408159b3361Sopenharmony_ci fi 409159b3361Sopenharmony_ci i=`expr $i - 1` 410159b3361Sopenharmony_ci done 411159b3361Sopenharmony_ci trap - 1 2 13 15 412159b3361Sopenharmony_ci if test $i -le 0; then 413159b3361Sopenharmony_ci echo "$0: failed to acquire lock after $numtries attempts" >&2 414159b3361Sopenharmony_ci echo "$0: check lockdir '$lockdir'" >&2 415159b3361Sopenharmony_ci exit 1 416159b3361Sopenharmony_ci fi 417159b3361Sopenharmony_ci 418159b3361Sopenharmony_ci if test $stat -ne 0; then 419159b3361Sopenharmony_ci rm -f "$tmpdepfile" 420159b3361Sopenharmony_ci exit $stat 421159b3361Sopenharmony_ci fi 422159b3361Sopenharmony_ci rm -f "$depfile" 423159b3361Sopenharmony_ci # Each line is of the form `foo.o: dependent.h', 424159b3361Sopenharmony_ci # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'. 425159b3361Sopenharmony_ci # Do two passes, one to just change these to 426159b3361Sopenharmony_ci # `$object: dependent.h' and one to simply `dependent.h:'. 427159b3361Sopenharmony_ci sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" 428159b3361Sopenharmony_ci # Some versions of the HPUX 10.20 sed can't process this invocation 429159b3361Sopenharmony_ci # correctly. Breaking it into two sed invocations is a workaround. 430159b3361Sopenharmony_ci sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" \ 431159b3361Sopenharmony_ci | sed -e 's/$/ :/' >> "$depfile" 432159b3361Sopenharmony_ci rm -f "$tmpdepfile" 433159b3361Sopenharmony_ci ;; 434159b3361Sopenharmony_ci 435159b3361Sopenharmony_cihp2) 436159b3361Sopenharmony_ci # The "hp" stanza above does not work with aCC (C++) and HP's ia64 437159b3361Sopenharmony_ci # compilers, which have integrated preprocessors. The correct option 438159b3361Sopenharmony_ci # to use with these is +Maked; it writes dependencies to a file named 439159b3361Sopenharmony_ci # 'foo.d', which lands next to the object file, wherever that 440159b3361Sopenharmony_ci # happens to be. 441159b3361Sopenharmony_ci # Much of this is similar to the tru64 case; see comments there. 442159b3361Sopenharmony_ci set_dir_from "$object" 443159b3361Sopenharmony_ci set_base_from "$object" 444159b3361Sopenharmony_ci if test "$libtool" = yes; then 445159b3361Sopenharmony_ci tmpdepfile1=$dir$base.d 446159b3361Sopenharmony_ci tmpdepfile2=$dir.libs/$base.d 447159b3361Sopenharmony_ci "$@" -Wc,+Maked 448159b3361Sopenharmony_ci else 449159b3361Sopenharmony_ci tmpdepfile1=$dir$base.d 450159b3361Sopenharmony_ci tmpdepfile2=$dir$base.d 451159b3361Sopenharmony_ci "$@" +Maked 452159b3361Sopenharmony_ci fi 453159b3361Sopenharmony_ci stat=$? 454159b3361Sopenharmony_ci if test $stat -ne 0; then 455159b3361Sopenharmony_ci rm -f "$tmpdepfile1" "$tmpdepfile2" 456159b3361Sopenharmony_ci exit $stat 457159b3361Sopenharmony_ci fi 458159b3361Sopenharmony_ci 459159b3361Sopenharmony_ci for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" 460159b3361Sopenharmony_ci do 461159b3361Sopenharmony_ci test -f "$tmpdepfile" && break 462159b3361Sopenharmony_ci done 463159b3361Sopenharmony_ci if test -f "$tmpdepfile"; then 464159b3361Sopenharmony_ci sed -e "s,^.*\.[$lower]*:,$object:," "$tmpdepfile" > "$depfile" 465159b3361Sopenharmony_ci # Add 'dependent.h:' lines. 466159b3361Sopenharmony_ci sed -ne '2,${ 467159b3361Sopenharmony_ci s/^ *// 468159b3361Sopenharmony_ci s/ \\*$// 469159b3361Sopenharmony_ci s/$/:/ 470159b3361Sopenharmony_ci p 471159b3361Sopenharmony_ci }' "$tmpdepfile" >> "$depfile" 472159b3361Sopenharmony_ci else 473159b3361Sopenharmony_ci make_dummy_depfile 474159b3361Sopenharmony_ci fi 475159b3361Sopenharmony_ci rm -f "$tmpdepfile" "$tmpdepfile2" 476159b3361Sopenharmony_ci ;; 477159b3361Sopenharmony_ci 478159b3361Sopenharmony_citru64) 479159b3361Sopenharmony_ci # The Tru64 compiler uses -MD to generate dependencies as a side 480159b3361Sopenharmony_ci # effect. 'cc -MD -o foo.o ...' puts the dependencies into 'foo.o.d'. 481159b3361Sopenharmony_ci # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put 482159b3361Sopenharmony_ci # dependencies in 'foo.d' instead, so we check for that too. 483159b3361Sopenharmony_ci # Subdirectories are respected. 484159b3361Sopenharmony_ci set_dir_from "$object" 485159b3361Sopenharmony_ci set_base_from "$object" 486159b3361Sopenharmony_ci 487159b3361Sopenharmony_ci if test "$libtool" = yes; then 488159b3361Sopenharmony_ci # Libtool generates 2 separate objects for the 2 libraries. These 489159b3361Sopenharmony_ci # two compilations output dependencies in $dir.libs/$base.o.d and 490159b3361Sopenharmony_ci # in $dir$base.o.d. We have to check for both files, because 491159b3361Sopenharmony_ci # one of the two compilations can be disabled. We should prefer 492159b3361Sopenharmony_ci # $dir$base.o.d over $dir.libs/$base.o.d because the latter is 493159b3361Sopenharmony_ci # automatically cleaned when .libs/ is deleted, while ignoring 494159b3361Sopenharmony_ci # the former would cause a distcleancheck panic. 495159b3361Sopenharmony_ci tmpdepfile1=$dir$base.o.d # libtool 1.5 496159b3361Sopenharmony_ci tmpdepfile2=$dir.libs/$base.o.d # Likewise. 497159b3361Sopenharmony_ci tmpdepfile3=$dir.libs/$base.d # Compaq CCC V6.2-504 498159b3361Sopenharmony_ci "$@" -Wc,-MD 499159b3361Sopenharmony_ci else 500159b3361Sopenharmony_ci tmpdepfile1=$dir$base.d 501159b3361Sopenharmony_ci tmpdepfile2=$dir$base.d 502159b3361Sopenharmony_ci tmpdepfile3=$dir$base.d 503159b3361Sopenharmony_ci "$@" -MD 504159b3361Sopenharmony_ci fi 505159b3361Sopenharmony_ci 506159b3361Sopenharmony_ci stat=$? 507159b3361Sopenharmony_ci if test $stat -ne 0; then 508159b3361Sopenharmony_ci rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" 509159b3361Sopenharmony_ci exit $stat 510159b3361Sopenharmony_ci fi 511159b3361Sopenharmony_ci 512159b3361Sopenharmony_ci for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" 513159b3361Sopenharmony_ci do 514159b3361Sopenharmony_ci test -f "$tmpdepfile" && break 515159b3361Sopenharmony_ci done 516159b3361Sopenharmony_ci # Same post-processing that is required for AIX mode. 517159b3361Sopenharmony_ci aix_post_process_depfile 518159b3361Sopenharmony_ci ;; 519159b3361Sopenharmony_ci 520159b3361Sopenharmony_cimsvc7) 521159b3361Sopenharmony_ci if test "$libtool" = yes; then 522159b3361Sopenharmony_ci showIncludes=-Wc,-showIncludes 523159b3361Sopenharmony_ci else 524159b3361Sopenharmony_ci showIncludes=-showIncludes 525159b3361Sopenharmony_ci fi 526159b3361Sopenharmony_ci "$@" $showIncludes > "$tmpdepfile" 527159b3361Sopenharmony_ci stat=$? 528159b3361Sopenharmony_ci grep -v '^Note: including file: ' "$tmpdepfile" 529159b3361Sopenharmony_ci if test $stat -ne 0; then 530159b3361Sopenharmony_ci rm -f "$tmpdepfile" 531159b3361Sopenharmony_ci exit $stat 532159b3361Sopenharmony_ci fi 533159b3361Sopenharmony_ci rm -f "$depfile" 534159b3361Sopenharmony_ci echo "$object : \\" > "$depfile" 535159b3361Sopenharmony_ci # The first sed program below extracts the file names and escapes 536159b3361Sopenharmony_ci # backslashes for cygpath. The second sed program outputs the file 537159b3361Sopenharmony_ci # name when reading, but also accumulates all include files in the 538159b3361Sopenharmony_ci # hold buffer in order to output them again at the end. This only 539159b3361Sopenharmony_ci # works with sed implementations that can handle large buffers. 540159b3361Sopenharmony_ci sed < "$tmpdepfile" -n ' 541159b3361Sopenharmony_ci/^Note: including file: *\(.*\)/ { 542159b3361Sopenharmony_ci s//\1/ 543159b3361Sopenharmony_ci s/\\/\\\\/g 544159b3361Sopenharmony_ci p 545159b3361Sopenharmony_ci}' | $cygpath_u | sort -u | sed -n ' 546159b3361Sopenharmony_cis/ /\\ /g 547159b3361Sopenharmony_cis/\(.*\)/'"$tab"'\1 \\/p 548159b3361Sopenharmony_cis/.\(.*\) \\/\1:/ 549159b3361Sopenharmony_ciH 550159b3361Sopenharmony_ci$ { 551159b3361Sopenharmony_ci s/.*/'"$tab"'/ 552159b3361Sopenharmony_ci G 553159b3361Sopenharmony_ci p 554159b3361Sopenharmony_ci}' >> "$depfile" 555159b3361Sopenharmony_ci echo >> "$depfile" # make sure the fragment doesn't end with a backslash 556159b3361Sopenharmony_ci rm -f "$tmpdepfile" 557159b3361Sopenharmony_ci ;; 558159b3361Sopenharmony_ci 559159b3361Sopenharmony_cimsvc7msys) 560159b3361Sopenharmony_ci # This case exists only to let depend.m4 do its work. It works by 561159b3361Sopenharmony_ci # looking at the text of this script. This case will never be run, 562159b3361Sopenharmony_ci # since it is checked for above. 563159b3361Sopenharmony_ci exit 1 564159b3361Sopenharmony_ci ;; 565159b3361Sopenharmony_ci 566159b3361Sopenharmony_ci#nosideeffect) 567159b3361Sopenharmony_ci # This comment above is used by automake to tell side-effect 568159b3361Sopenharmony_ci # dependency tracking mechanisms from slower ones. 569159b3361Sopenharmony_ci 570159b3361Sopenharmony_cidashmstdout) 571159b3361Sopenharmony_ci # Important note: in order to support this mode, a compiler *must* 572159b3361Sopenharmony_ci # always write the preprocessed file to stdout, regardless of -o. 573159b3361Sopenharmony_ci "$@" || exit $? 574159b3361Sopenharmony_ci 575159b3361Sopenharmony_ci # Remove the call to Libtool. 576159b3361Sopenharmony_ci if test "$libtool" = yes; then 577159b3361Sopenharmony_ci while test "X$1" != 'X--mode=compile'; do 578159b3361Sopenharmony_ci shift 579159b3361Sopenharmony_ci done 580159b3361Sopenharmony_ci shift 581159b3361Sopenharmony_ci fi 582159b3361Sopenharmony_ci 583159b3361Sopenharmony_ci # Remove '-o $object'. 584159b3361Sopenharmony_ci IFS=" " 585159b3361Sopenharmony_ci for arg 586159b3361Sopenharmony_ci do 587159b3361Sopenharmony_ci case $arg in 588159b3361Sopenharmony_ci -o) 589159b3361Sopenharmony_ci shift 590159b3361Sopenharmony_ci ;; 591159b3361Sopenharmony_ci $object) 592159b3361Sopenharmony_ci shift 593159b3361Sopenharmony_ci ;; 594159b3361Sopenharmony_ci *) 595159b3361Sopenharmony_ci set fnord "$@" "$arg" 596159b3361Sopenharmony_ci shift # fnord 597159b3361Sopenharmony_ci shift # $arg 598159b3361Sopenharmony_ci ;; 599159b3361Sopenharmony_ci esac 600159b3361Sopenharmony_ci done 601159b3361Sopenharmony_ci 602159b3361Sopenharmony_ci test -z "$dashmflag" && dashmflag=-M 603159b3361Sopenharmony_ci # Require at least two characters before searching for ':' 604159b3361Sopenharmony_ci # in the target name. This is to cope with DOS-style filenames: 605159b3361Sopenharmony_ci # a dependency such as 'c:/foo/bar' could be seen as target 'c' otherwise. 606159b3361Sopenharmony_ci "$@" $dashmflag | 607159b3361Sopenharmony_ci sed "s|^[$tab ]*[^:$tab ][^:][^:]*:[$tab ]*|$object: |" > "$tmpdepfile" 608159b3361Sopenharmony_ci rm -f "$depfile" 609159b3361Sopenharmony_ci cat < "$tmpdepfile" > "$depfile" 610159b3361Sopenharmony_ci # Some versions of the HPUX 10.20 sed can't process this sed invocation 611159b3361Sopenharmony_ci # correctly. Breaking it into two sed invocations is a workaround. 612159b3361Sopenharmony_ci tr ' ' "$nl" < "$tmpdepfile" \ 613159b3361Sopenharmony_ci | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \ 614159b3361Sopenharmony_ci | sed -e 's/$/ :/' >> "$depfile" 615159b3361Sopenharmony_ci rm -f "$tmpdepfile" 616159b3361Sopenharmony_ci ;; 617159b3361Sopenharmony_ci 618159b3361Sopenharmony_cidashXmstdout) 619159b3361Sopenharmony_ci # This case only exists to satisfy depend.m4. It is never actually 620159b3361Sopenharmony_ci # run, as this mode is specially recognized in the preamble. 621159b3361Sopenharmony_ci exit 1 622159b3361Sopenharmony_ci ;; 623159b3361Sopenharmony_ci 624159b3361Sopenharmony_cimakedepend) 625159b3361Sopenharmony_ci "$@" || exit $? 626159b3361Sopenharmony_ci # Remove any Libtool call 627159b3361Sopenharmony_ci if test "$libtool" = yes; then 628159b3361Sopenharmony_ci while test "X$1" != 'X--mode=compile'; do 629159b3361Sopenharmony_ci shift 630159b3361Sopenharmony_ci done 631159b3361Sopenharmony_ci shift 632159b3361Sopenharmony_ci fi 633159b3361Sopenharmony_ci # X makedepend 634159b3361Sopenharmony_ci shift 635159b3361Sopenharmony_ci cleared=no eat=no 636159b3361Sopenharmony_ci for arg 637159b3361Sopenharmony_ci do 638159b3361Sopenharmony_ci case $cleared in 639159b3361Sopenharmony_ci no) 640159b3361Sopenharmony_ci set ""; shift 641159b3361Sopenharmony_ci cleared=yes ;; 642159b3361Sopenharmony_ci esac 643159b3361Sopenharmony_ci if test $eat = yes; then 644159b3361Sopenharmony_ci eat=no 645159b3361Sopenharmony_ci continue 646159b3361Sopenharmony_ci fi 647159b3361Sopenharmony_ci case "$arg" in 648159b3361Sopenharmony_ci -D*|-I*) 649159b3361Sopenharmony_ci set fnord "$@" "$arg"; shift ;; 650159b3361Sopenharmony_ci # Strip any option that makedepend may not understand. Remove 651159b3361Sopenharmony_ci # the object too, otherwise makedepend will parse it as a source file. 652159b3361Sopenharmony_ci -arch) 653159b3361Sopenharmony_ci eat=yes ;; 654159b3361Sopenharmony_ci -*|$object) 655159b3361Sopenharmony_ci ;; 656159b3361Sopenharmony_ci *) 657159b3361Sopenharmony_ci set fnord "$@" "$arg"; shift ;; 658159b3361Sopenharmony_ci esac 659159b3361Sopenharmony_ci done 660159b3361Sopenharmony_ci obj_suffix=`echo "$object" | sed 's/^.*\././'` 661159b3361Sopenharmony_ci touch "$tmpdepfile" 662159b3361Sopenharmony_ci ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" 663159b3361Sopenharmony_ci rm -f "$depfile" 664159b3361Sopenharmony_ci # makedepend may prepend the VPATH from the source file name to the object. 665159b3361Sopenharmony_ci # No need to regex-escape $object, excess matching of '.' is harmless. 666159b3361Sopenharmony_ci sed "s|^.*\($object *:\)|\1|" "$tmpdepfile" > "$depfile" 667159b3361Sopenharmony_ci # Some versions of the HPUX 10.20 sed can't process the last invocation 668159b3361Sopenharmony_ci # correctly. Breaking it into two sed invocations is a workaround. 669159b3361Sopenharmony_ci sed '1,2d' "$tmpdepfile" \ 670159b3361Sopenharmony_ci | tr ' ' "$nl" \ 671159b3361Sopenharmony_ci | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \ 672159b3361Sopenharmony_ci | sed -e 's/$/ :/' >> "$depfile" 673159b3361Sopenharmony_ci rm -f "$tmpdepfile" "$tmpdepfile".bak 674159b3361Sopenharmony_ci ;; 675159b3361Sopenharmony_ci 676159b3361Sopenharmony_cicpp) 677159b3361Sopenharmony_ci # Important note: in order to support this mode, a compiler *must* 678159b3361Sopenharmony_ci # always write the preprocessed file to stdout. 679159b3361Sopenharmony_ci "$@" || exit $? 680159b3361Sopenharmony_ci 681159b3361Sopenharmony_ci # Remove the call to Libtool. 682159b3361Sopenharmony_ci if test "$libtool" = yes; then 683159b3361Sopenharmony_ci while test "X$1" != 'X--mode=compile'; do 684159b3361Sopenharmony_ci shift 685159b3361Sopenharmony_ci done 686159b3361Sopenharmony_ci shift 687159b3361Sopenharmony_ci fi 688159b3361Sopenharmony_ci 689159b3361Sopenharmony_ci # Remove '-o $object'. 690159b3361Sopenharmony_ci IFS=" " 691159b3361Sopenharmony_ci for arg 692159b3361Sopenharmony_ci do 693159b3361Sopenharmony_ci case $arg in 694159b3361Sopenharmony_ci -o) 695159b3361Sopenharmony_ci shift 696159b3361Sopenharmony_ci ;; 697159b3361Sopenharmony_ci $object) 698159b3361Sopenharmony_ci shift 699159b3361Sopenharmony_ci ;; 700159b3361Sopenharmony_ci *) 701159b3361Sopenharmony_ci set fnord "$@" "$arg" 702159b3361Sopenharmony_ci shift # fnord 703159b3361Sopenharmony_ci shift # $arg 704159b3361Sopenharmony_ci ;; 705159b3361Sopenharmony_ci esac 706159b3361Sopenharmony_ci done 707159b3361Sopenharmony_ci 708159b3361Sopenharmony_ci "$@" -E \ 709159b3361Sopenharmony_ci | sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ 710159b3361Sopenharmony_ci -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ 711159b3361Sopenharmony_ci | sed '$ s: \\$::' > "$tmpdepfile" 712159b3361Sopenharmony_ci rm -f "$depfile" 713159b3361Sopenharmony_ci echo "$object : \\" > "$depfile" 714159b3361Sopenharmony_ci cat < "$tmpdepfile" >> "$depfile" 715159b3361Sopenharmony_ci sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" 716159b3361Sopenharmony_ci rm -f "$tmpdepfile" 717159b3361Sopenharmony_ci ;; 718159b3361Sopenharmony_ci 719159b3361Sopenharmony_cimsvisualcpp) 720159b3361Sopenharmony_ci # Important note: in order to support this mode, a compiler *must* 721159b3361Sopenharmony_ci # always write the preprocessed file to stdout. 722159b3361Sopenharmony_ci "$@" || exit $? 723159b3361Sopenharmony_ci 724159b3361Sopenharmony_ci # Remove the call to Libtool. 725159b3361Sopenharmony_ci if test "$libtool" = yes; then 726159b3361Sopenharmony_ci while test "X$1" != 'X--mode=compile'; do 727159b3361Sopenharmony_ci shift 728159b3361Sopenharmony_ci done 729159b3361Sopenharmony_ci shift 730159b3361Sopenharmony_ci fi 731159b3361Sopenharmony_ci 732159b3361Sopenharmony_ci IFS=" " 733159b3361Sopenharmony_ci for arg 734159b3361Sopenharmony_ci do 735159b3361Sopenharmony_ci case "$arg" in 736159b3361Sopenharmony_ci -o) 737159b3361Sopenharmony_ci shift 738159b3361Sopenharmony_ci ;; 739159b3361Sopenharmony_ci $object) 740159b3361Sopenharmony_ci shift 741159b3361Sopenharmony_ci ;; 742159b3361Sopenharmony_ci "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") 743159b3361Sopenharmony_ci set fnord "$@" 744159b3361Sopenharmony_ci shift 745159b3361Sopenharmony_ci shift 746159b3361Sopenharmony_ci ;; 747159b3361Sopenharmony_ci *) 748159b3361Sopenharmony_ci set fnord "$@" "$arg" 749159b3361Sopenharmony_ci shift 750159b3361Sopenharmony_ci shift 751159b3361Sopenharmony_ci ;; 752159b3361Sopenharmony_ci esac 753159b3361Sopenharmony_ci done 754159b3361Sopenharmony_ci "$@" -E 2>/dev/null | 755159b3361Sopenharmony_ci sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile" 756159b3361Sopenharmony_ci rm -f "$depfile" 757159b3361Sopenharmony_ci echo "$object : \\" > "$depfile" 758159b3361Sopenharmony_ci sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::'"$tab"'\1 \\:p' >> "$depfile" 759159b3361Sopenharmony_ci echo "$tab" >> "$depfile" 760159b3361Sopenharmony_ci sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile" 761159b3361Sopenharmony_ci rm -f "$tmpdepfile" 762159b3361Sopenharmony_ci ;; 763159b3361Sopenharmony_ci 764159b3361Sopenharmony_cimsvcmsys) 765159b3361Sopenharmony_ci # This case exists only to let depend.m4 do its work. It works by 766159b3361Sopenharmony_ci # looking at the text of this script. This case will never be run, 767159b3361Sopenharmony_ci # since it is checked for above. 768159b3361Sopenharmony_ci exit 1 769159b3361Sopenharmony_ci ;; 770159b3361Sopenharmony_ci 771159b3361Sopenharmony_cinone) 772159b3361Sopenharmony_ci exec "$@" 773159b3361Sopenharmony_ci ;; 774159b3361Sopenharmony_ci 775159b3361Sopenharmony_ci*) 776159b3361Sopenharmony_ci echo "Unknown depmode $depmode" 1>&2 777159b3361Sopenharmony_ci exit 1 778159b3361Sopenharmony_ci ;; 779159b3361Sopenharmony_ciesac 780159b3361Sopenharmony_ci 781159b3361Sopenharmony_ciexit 0 782159b3361Sopenharmony_ci 783159b3361Sopenharmony_ci# Local Variables: 784159b3361Sopenharmony_ci# mode: shell-script 785159b3361Sopenharmony_ci# sh-indentation: 2 786159b3361Sopenharmony_ci# eval: (add-hook 'write-file-hooks 'time-stamp) 787159b3361Sopenharmony_ci# time-stamp-start: "scriptversion=" 788159b3361Sopenharmony_ci# time-stamp-format: "%:y-%02m-%02d.%02H" 789159b3361Sopenharmony_ci# time-stamp-time-zone: "UTC0" 790159b3361Sopenharmony_ci# time-stamp-end: "; # UTC" 791159b3361Sopenharmony_ci# End: 792