113498266Sopenharmony_ci#! /bin/sh
213498266Sopenharmony_ci# depcomp - compile a program generating dependencies as side-effects
313498266Sopenharmony_ci
413498266Sopenharmony_ciscriptversion=2018-03-07.03; # UTC
513498266Sopenharmony_ci
613498266Sopenharmony_ci# Copyright (C) 1999-2021 Free Software Foundation, Inc.
713498266Sopenharmony_ci
813498266Sopenharmony_ci# This program is free software; you can redistribute it and/or modify
913498266Sopenharmony_ci# it under the terms of the GNU General Public License as published by
1013498266Sopenharmony_ci# the Free Software Foundation; either version 2, or (at your option)
1113498266Sopenharmony_ci# any later version.
1213498266Sopenharmony_ci
1313498266Sopenharmony_ci# This program is distributed in the hope that it will be useful,
1413498266Sopenharmony_ci# but WITHOUT ANY WARRANTY; without even the implied warranty of
1513498266Sopenharmony_ci# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1613498266Sopenharmony_ci# GNU General Public License for more details.
1713498266Sopenharmony_ci
1813498266Sopenharmony_ci# You should have received a copy of the GNU General Public License
1913498266Sopenharmony_ci# along with this program.  If not, see <https://www.gnu.org/licenses/>.
2013498266Sopenharmony_ci
2113498266Sopenharmony_ci# As a special exception to the GNU General Public License, if you
2213498266Sopenharmony_ci# distribute this file as part of a program that contains a
2313498266Sopenharmony_ci# configuration script generated by Autoconf, you may include it under
2413498266Sopenharmony_ci# the same distribution terms that you use for the rest of that program.
2513498266Sopenharmony_ci
2613498266Sopenharmony_ci# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>.
2713498266Sopenharmony_ci
2813498266Sopenharmony_cicase $1 in
2913498266Sopenharmony_ci  '')
3013498266Sopenharmony_ci    echo "$0: No command.  Try '$0 --help' for more information." 1>&2
3113498266Sopenharmony_ci    exit 1;
3213498266Sopenharmony_ci    ;;
3313498266Sopenharmony_ci  -h | --h*)
3413498266Sopenharmony_ci    cat <<\EOF
3513498266Sopenharmony_ciUsage: depcomp [--help] [--version] PROGRAM [ARGS]
3613498266Sopenharmony_ci
3713498266Sopenharmony_ciRun PROGRAMS ARGS to compile a file, generating dependencies
3813498266Sopenharmony_cias side-effects.
3913498266Sopenharmony_ci
4013498266Sopenharmony_ciEnvironment variables:
4113498266Sopenharmony_ci  depmode     Dependency tracking mode.
4213498266Sopenharmony_ci  source      Source file read by 'PROGRAMS ARGS'.
4313498266Sopenharmony_ci  object      Object file output by 'PROGRAMS ARGS'.
4413498266Sopenharmony_ci  DEPDIR      directory where to store dependencies.
4513498266Sopenharmony_ci  depfile     Dependency file to output.
4613498266Sopenharmony_ci  tmpdepfile  Temporary file to use when outputting dependencies.
4713498266Sopenharmony_ci  libtool     Whether libtool is used (yes/no).
4813498266Sopenharmony_ci
4913498266Sopenharmony_ciReport bugs to <bug-automake@gnu.org>.
5013498266Sopenharmony_ciEOF
5113498266Sopenharmony_ci    exit $?
5213498266Sopenharmony_ci    ;;
5313498266Sopenharmony_ci  -v | --v*)
5413498266Sopenharmony_ci    echo "depcomp $scriptversion"
5513498266Sopenharmony_ci    exit $?
5613498266Sopenharmony_ci    ;;
5713498266Sopenharmony_ciesac
5813498266Sopenharmony_ci
5913498266Sopenharmony_ci# Get the directory component of the given path, and save it in the
6013498266Sopenharmony_ci# global variables '$dir'.  Note that this directory component will
6113498266Sopenharmony_ci# be either empty or ending with a '/' character.  This is deliberate.
6213498266Sopenharmony_ciset_dir_from ()
6313498266Sopenharmony_ci{
6413498266Sopenharmony_ci  case $1 in
6513498266Sopenharmony_ci    */*) dir=`echo "$1" | sed -e 's|/[^/]*$|/|'`;;
6613498266Sopenharmony_ci      *) dir=;;
6713498266Sopenharmony_ci  esac
6813498266Sopenharmony_ci}
6913498266Sopenharmony_ci
7013498266Sopenharmony_ci# Get the suffix-stripped basename of the given path, and save it the
7113498266Sopenharmony_ci# global variable '$base'.
7213498266Sopenharmony_ciset_base_from ()
7313498266Sopenharmony_ci{
7413498266Sopenharmony_ci  base=`echo "$1" | sed -e 's|^.*/||' -e 's/\.[^.]*$//'`
7513498266Sopenharmony_ci}
7613498266Sopenharmony_ci
7713498266Sopenharmony_ci# If no dependency file was actually created by the compiler invocation,
7813498266Sopenharmony_ci# we still have to create a dummy depfile, to avoid errors with the
7913498266Sopenharmony_ci# Makefile "include basename.Plo" scheme.
8013498266Sopenharmony_cimake_dummy_depfile ()
8113498266Sopenharmony_ci{
8213498266Sopenharmony_ci  echo "#dummy" > "$depfile"
8313498266Sopenharmony_ci}
8413498266Sopenharmony_ci
8513498266Sopenharmony_ci# Factor out some common post-processing of the generated depfile.
8613498266Sopenharmony_ci# Requires the auxiliary global variable '$tmpdepfile' to be set.
8713498266Sopenharmony_ciaix_post_process_depfile ()
8813498266Sopenharmony_ci{
8913498266Sopenharmony_ci  # If the compiler actually managed to produce a dependency file,
9013498266Sopenharmony_ci  # post-process it.
9113498266Sopenharmony_ci  if test -f "$tmpdepfile"; then
9213498266Sopenharmony_ci    # Each line is of the form 'foo.o: dependency.h'.
9313498266Sopenharmony_ci    # Do two passes, one to just change these to
9413498266Sopenharmony_ci    #   $object: dependency.h
9513498266Sopenharmony_ci    # and one to simply output
9613498266Sopenharmony_ci    #   dependency.h:
9713498266Sopenharmony_ci    # which is needed to avoid the deleted-header problem.
9813498266Sopenharmony_ci    { sed -e "s,^.*\.[$lower]*:,$object:," < "$tmpdepfile"
9913498266Sopenharmony_ci      sed -e "s,^.*\.[$lower]*:[$tab ]*,," -e 's,$,:,' < "$tmpdepfile"
10013498266Sopenharmony_ci    } > "$depfile"
10113498266Sopenharmony_ci    rm -f "$tmpdepfile"
10213498266Sopenharmony_ci  else
10313498266Sopenharmony_ci    make_dummy_depfile
10413498266Sopenharmony_ci  fi
10513498266Sopenharmony_ci}
10613498266Sopenharmony_ci
10713498266Sopenharmony_ci# A tabulation character.
10813498266Sopenharmony_citab='	'
10913498266Sopenharmony_ci# A newline character.
11013498266Sopenharmony_cinl='
11113498266Sopenharmony_ci'
11213498266Sopenharmony_ci# Character ranges might be problematic outside the C locale.
11313498266Sopenharmony_ci# These definitions help.
11413498266Sopenharmony_ciupper=ABCDEFGHIJKLMNOPQRSTUVWXYZ
11513498266Sopenharmony_cilower=abcdefghijklmnopqrstuvwxyz
11613498266Sopenharmony_cidigits=0123456789
11713498266Sopenharmony_cialpha=${upper}${lower}
11813498266Sopenharmony_ci
11913498266Sopenharmony_ciif test -z "$depmode" || test -z "$source" || test -z "$object"; then
12013498266Sopenharmony_ci  echo "depcomp: Variables source, object and depmode must be set" 1>&2
12113498266Sopenharmony_ci  exit 1
12213498266Sopenharmony_cifi
12313498266Sopenharmony_ci
12413498266Sopenharmony_ci# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po.
12513498266Sopenharmony_cidepfile=${depfile-`echo "$object" |
12613498266Sopenharmony_ci  sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`}
12713498266Sopenharmony_citmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
12813498266Sopenharmony_ci
12913498266Sopenharmony_cirm -f "$tmpdepfile"
13013498266Sopenharmony_ci
13113498266Sopenharmony_ci# Avoid interferences from the environment.
13213498266Sopenharmony_cigccflag= dashmflag=
13313498266Sopenharmony_ci
13413498266Sopenharmony_ci# Some modes work just like other modes, but use different flags.  We
13513498266Sopenharmony_ci# parameterize here, but still list the modes in the big case below,
13613498266Sopenharmony_ci# to make depend.m4 easier to write.  Note that we *cannot* use a case
13713498266Sopenharmony_ci# here, because this file can only contain one case statement.
13813498266Sopenharmony_ciif test "$depmode" = hp; then
13913498266Sopenharmony_ci  # HP compiler uses -M and no extra arg.
14013498266Sopenharmony_ci  gccflag=-M
14113498266Sopenharmony_ci  depmode=gcc
14213498266Sopenharmony_cifi
14313498266Sopenharmony_ci
14413498266Sopenharmony_ciif test "$depmode" = dashXmstdout; then
14513498266Sopenharmony_ci  # This is just like dashmstdout with a different argument.
14613498266Sopenharmony_ci  dashmflag=-xM
14713498266Sopenharmony_ci  depmode=dashmstdout
14813498266Sopenharmony_cifi
14913498266Sopenharmony_ci
15013498266Sopenharmony_cicygpath_u="cygpath -u -f -"
15113498266Sopenharmony_ciif test "$depmode" = msvcmsys; then
15213498266Sopenharmony_ci  # This is just like msvisualcpp but w/o cygpath translation.
15313498266Sopenharmony_ci  # Just convert the backslash-escaped backslashes to single forward
15413498266Sopenharmony_ci  # slashes to satisfy depend.m4
15513498266Sopenharmony_ci  cygpath_u='sed s,\\\\,/,g'
15613498266Sopenharmony_ci  depmode=msvisualcpp
15713498266Sopenharmony_cifi
15813498266Sopenharmony_ci
15913498266Sopenharmony_ciif test "$depmode" = msvc7msys; then
16013498266Sopenharmony_ci  # This is just like msvc7 but w/o cygpath translation.
16113498266Sopenharmony_ci  # Just convert the backslash-escaped backslashes to single forward
16213498266Sopenharmony_ci  # slashes to satisfy depend.m4
16313498266Sopenharmony_ci  cygpath_u='sed s,\\\\,/,g'
16413498266Sopenharmony_ci  depmode=msvc7
16513498266Sopenharmony_cifi
16613498266Sopenharmony_ci
16713498266Sopenharmony_ciif test "$depmode" = xlc; then
16813498266Sopenharmony_ci  # IBM C/C++ Compilers xlc/xlC can output gcc-like dependency information.
16913498266Sopenharmony_ci  gccflag=-qmakedep=gcc,-MF
17013498266Sopenharmony_ci  depmode=gcc
17113498266Sopenharmony_cifi
17213498266Sopenharmony_ci
17313498266Sopenharmony_cicase "$depmode" in
17413498266Sopenharmony_cigcc3)
17513498266Sopenharmony_ci## gcc 3 implements dependency tracking that does exactly what
17613498266Sopenharmony_ci## we want.  Yay!  Note: for some reason libtool 1.4 doesn't like
17713498266Sopenharmony_ci## it if -MD -MP comes after the -MF stuff.  Hmm.
17813498266Sopenharmony_ci## Unfortunately, FreeBSD c89 acceptance of flags depends upon
17913498266Sopenharmony_ci## the command line argument order; so add the flags where they
18013498266Sopenharmony_ci## appear in depend2.am.  Note that the slowdown incurred here
18113498266Sopenharmony_ci## affects only configure: in makefiles, %FASTDEP% shortcuts this.
18213498266Sopenharmony_ci  for arg
18313498266Sopenharmony_ci  do
18413498266Sopenharmony_ci    case $arg in
18513498266Sopenharmony_ci    -c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;;
18613498266Sopenharmony_ci    *)  set fnord "$@" "$arg" ;;
18713498266Sopenharmony_ci    esac
18813498266Sopenharmony_ci    shift # fnord
18913498266Sopenharmony_ci    shift # $arg
19013498266Sopenharmony_ci  done
19113498266Sopenharmony_ci  "$@"
19213498266Sopenharmony_ci  stat=$?
19313498266Sopenharmony_ci  if test $stat -ne 0; then
19413498266Sopenharmony_ci    rm -f "$tmpdepfile"
19513498266Sopenharmony_ci    exit $stat
19613498266Sopenharmony_ci  fi
19713498266Sopenharmony_ci  mv "$tmpdepfile" "$depfile"
19813498266Sopenharmony_ci  ;;
19913498266Sopenharmony_ci
20013498266Sopenharmony_cigcc)
20113498266Sopenharmony_ci## Note that this doesn't just cater to obsosete pre-3.x GCC compilers.
20213498266Sopenharmony_ci## but also to in-use compilers like IMB xlc/xlC and the HP C compiler.
20313498266Sopenharmony_ci## (see the conditional assignment to $gccflag above).
20413498266Sopenharmony_ci## There are various ways to get dependency output from gcc.  Here's
20513498266Sopenharmony_ci## why we pick this rather obscure method:
20613498266Sopenharmony_ci## - Don't want to use -MD because we'd like the dependencies to end
20713498266Sopenharmony_ci##   up in a subdir.  Having to rename by hand is ugly.
20813498266Sopenharmony_ci##   (We might end up doing this anyway to support other compilers.)
20913498266Sopenharmony_ci## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
21013498266Sopenharmony_ci##   -MM, not -M (despite what the docs say).  Also, it might not be
21113498266Sopenharmony_ci##   supported by the other compilers which use the 'gcc' depmode.
21213498266Sopenharmony_ci## - Using -M directly means running the compiler twice (even worse
21313498266Sopenharmony_ci##   than renaming).
21413498266Sopenharmony_ci  if test -z "$gccflag"; then
21513498266Sopenharmony_ci    gccflag=-MD,
21613498266Sopenharmony_ci  fi
21713498266Sopenharmony_ci  "$@" -Wp,"$gccflag$tmpdepfile"
21813498266Sopenharmony_ci  stat=$?
21913498266Sopenharmony_ci  if test $stat -ne 0; then
22013498266Sopenharmony_ci    rm -f "$tmpdepfile"
22113498266Sopenharmony_ci    exit $stat
22213498266Sopenharmony_ci  fi
22313498266Sopenharmony_ci  rm -f "$depfile"
22413498266Sopenharmony_ci  echo "$object : \\" > "$depfile"
22513498266Sopenharmony_ci  # The second -e expression handles DOS-style file names with drive
22613498266Sopenharmony_ci  # letters.
22713498266Sopenharmony_ci  sed -e 's/^[^:]*: / /' \
22813498266Sopenharmony_ci      -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
22913498266Sopenharmony_ci## This next piece of magic avoids the "deleted header file" problem.
23013498266Sopenharmony_ci## The problem is that when a header file which appears in a .P file
23113498266Sopenharmony_ci## is deleted, the dependency causes make to die (because there is
23213498266Sopenharmony_ci## typically no way to rebuild the header).  We avoid this by adding
23313498266Sopenharmony_ci## dummy dependencies for each header file.  Too bad gcc doesn't do
23413498266Sopenharmony_ci## this for us directly.
23513498266Sopenharmony_ci## Some versions of gcc put a space before the ':'.  On the theory
23613498266Sopenharmony_ci## that the space means something, we add a space to the output as
23713498266Sopenharmony_ci## well.  hp depmode also adds that space, but also prefixes the VPATH
23813498266Sopenharmony_ci## to the object.  Take care to not repeat it in the output.
23913498266Sopenharmony_ci## Some versions of the HPUX 10.20 sed can't process this invocation
24013498266Sopenharmony_ci## correctly.  Breaking it into two sed invocations is a workaround.
24113498266Sopenharmony_ci  tr ' ' "$nl" < "$tmpdepfile" \
24213498266Sopenharmony_ci    | sed -e 's/^\\$//' -e '/^$/d' -e "s|.*$object$||" -e '/:$/d' \
24313498266Sopenharmony_ci    | sed -e 's/$/ :/' >> "$depfile"
24413498266Sopenharmony_ci  rm -f "$tmpdepfile"
24513498266Sopenharmony_ci  ;;
24613498266Sopenharmony_ci
24713498266Sopenharmony_cihp)
24813498266Sopenharmony_ci  # This case exists only to let depend.m4 do its work.  It works by
24913498266Sopenharmony_ci  # looking at the text of this script.  This case will never be run,
25013498266Sopenharmony_ci  # since it is checked for above.
25113498266Sopenharmony_ci  exit 1
25213498266Sopenharmony_ci  ;;
25313498266Sopenharmony_ci
25413498266Sopenharmony_cisgi)
25513498266Sopenharmony_ci  if test "$libtool" = yes; then
25613498266Sopenharmony_ci    "$@" "-Wp,-MDupdate,$tmpdepfile"
25713498266Sopenharmony_ci  else
25813498266Sopenharmony_ci    "$@" -MDupdate "$tmpdepfile"
25913498266Sopenharmony_ci  fi
26013498266Sopenharmony_ci  stat=$?
26113498266Sopenharmony_ci  if test $stat -ne 0; then
26213498266Sopenharmony_ci    rm -f "$tmpdepfile"
26313498266Sopenharmony_ci    exit $stat
26413498266Sopenharmony_ci  fi
26513498266Sopenharmony_ci  rm -f "$depfile"
26613498266Sopenharmony_ci
26713498266Sopenharmony_ci  if test -f "$tmpdepfile"; then  # yes, the sourcefile depend on other files
26813498266Sopenharmony_ci    echo "$object : \\" > "$depfile"
26913498266Sopenharmony_ci    # Clip off the initial element (the dependent).  Don't try to be
27013498266Sopenharmony_ci    # clever and replace this with sed code, as IRIX sed won't handle
27113498266Sopenharmony_ci    # lines with more than a fixed number of characters (4096 in
27213498266Sopenharmony_ci    # IRIX 6.2 sed, 8192 in IRIX 6.5).  We also remove comment lines;
27313498266Sopenharmony_ci    # the IRIX cc adds comments like '#:fec' to the end of the
27413498266Sopenharmony_ci    # dependency line.
27513498266Sopenharmony_ci    tr ' ' "$nl" < "$tmpdepfile" \
27613498266Sopenharmony_ci      | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' \
27713498266Sopenharmony_ci      | tr "$nl" ' ' >> "$depfile"
27813498266Sopenharmony_ci    echo >> "$depfile"
27913498266Sopenharmony_ci    # The second pass generates a dummy entry for each header file.
28013498266Sopenharmony_ci    tr ' ' "$nl" < "$tmpdepfile" \
28113498266Sopenharmony_ci      | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
28213498266Sopenharmony_ci      >> "$depfile"
28313498266Sopenharmony_ci  else
28413498266Sopenharmony_ci    make_dummy_depfile
28513498266Sopenharmony_ci  fi
28613498266Sopenharmony_ci  rm -f "$tmpdepfile"
28713498266Sopenharmony_ci  ;;
28813498266Sopenharmony_ci
28913498266Sopenharmony_cixlc)
29013498266Sopenharmony_ci  # This case exists only to let depend.m4 do its work.  It works by
29113498266Sopenharmony_ci  # looking at the text of this script.  This case will never be run,
29213498266Sopenharmony_ci  # since it is checked for above.
29313498266Sopenharmony_ci  exit 1
29413498266Sopenharmony_ci  ;;
29513498266Sopenharmony_ci
29613498266Sopenharmony_ciaix)
29713498266Sopenharmony_ci  # The C for AIX Compiler uses -M and outputs the dependencies
29813498266Sopenharmony_ci  # in a .u file.  In older versions, this file always lives in the
29913498266Sopenharmony_ci  # current directory.  Also, the AIX compiler puts '$object:' at the
30013498266Sopenharmony_ci  # start of each line; $object doesn't have directory information.
30113498266Sopenharmony_ci  # Version 6 uses the directory in both cases.
30213498266Sopenharmony_ci  set_dir_from "$object"
30313498266Sopenharmony_ci  set_base_from "$object"
30413498266Sopenharmony_ci  if test "$libtool" = yes; then
30513498266Sopenharmony_ci    tmpdepfile1=$dir$base.u
30613498266Sopenharmony_ci    tmpdepfile2=$base.u
30713498266Sopenharmony_ci    tmpdepfile3=$dir.libs/$base.u
30813498266Sopenharmony_ci    "$@" -Wc,-M
30913498266Sopenharmony_ci  else
31013498266Sopenharmony_ci    tmpdepfile1=$dir$base.u
31113498266Sopenharmony_ci    tmpdepfile2=$dir$base.u
31213498266Sopenharmony_ci    tmpdepfile3=$dir$base.u
31313498266Sopenharmony_ci    "$@" -M
31413498266Sopenharmony_ci  fi
31513498266Sopenharmony_ci  stat=$?
31613498266Sopenharmony_ci  if test $stat -ne 0; then
31713498266Sopenharmony_ci    rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
31813498266Sopenharmony_ci    exit $stat
31913498266Sopenharmony_ci  fi
32013498266Sopenharmony_ci
32113498266Sopenharmony_ci  for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
32213498266Sopenharmony_ci  do
32313498266Sopenharmony_ci    test -f "$tmpdepfile" && break
32413498266Sopenharmony_ci  done
32513498266Sopenharmony_ci  aix_post_process_depfile
32613498266Sopenharmony_ci  ;;
32713498266Sopenharmony_ci
32813498266Sopenharmony_citcc)
32913498266Sopenharmony_ci  # tcc (Tiny C Compiler) understand '-MD -MF file' since version 0.9.26
33013498266Sopenharmony_ci  # FIXME: That version still under development at the moment of writing.
33113498266Sopenharmony_ci  #        Make that this statement remains true also for stable, released
33213498266Sopenharmony_ci  #        versions.
33313498266Sopenharmony_ci  # It will wrap lines (doesn't matter whether long or short) with a
33413498266Sopenharmony_ci  # trailing '\', as in:
33513498266Sopenharmony_ci  #
33613498266Sopenharmony_ci  #   foo.o : \
33713498266Sopenharmony_ci  #    foo.c \
33813498266Sopenharmony_ci  #    foo.h \
33913498266Sopenharmony_ci  #
34013498266Sopenharmony_ci  # It will put a trailing '\' even on the last line, and will use leading
34113498266Sopenharmony_ci  # spaces rather than leading tabs (at least since its commit 0394caf7
34213498266Sopenharmony_ci  # "Emit spaces for -MD").
34313498266Sopenharmony_ci  "$@" -MD -MF "$tmpdepfile"
34413498266Sopenharmony_ci  stat=$?
34513498266Sopenharmony_ci  if test $stat -ne 0; then
34613498266Sopenharmony_ci    rm -f "$tmpdepfile"
34713498266Sopenharmony_ci    exit $stat
34813498266Sopenharmony_ci  fi
34913498266Sopenharmony_ci  rm -f "$depfile"
35013498266Sopenharmony_ci  # Each non-empty line is of the form 'foo.o : \' or ' dep.h \'.
35113498266Sopenharmony_ci  # We have to change lines of the first kind to '$object: \'.
35213498266Sopenharmony_ci  sed -e "s|.*:|$object :|" < "$tmpdepfile" > "$depfile"
35313498266Sopenharmony_ci  # And for each line of the second kind, we have to emit a 'dep.h:'
35413498266Sopenharmony_ci  # dummy dependency, to avoid the deleted-header problem.
35513498266Sopenharmony_ci  sed -n -e 's|^  *\(.*\) *\\$|\1:|p' < "$tmpdepfile" >> "$depfile"
35613498266Sopenharmony_ci  rm -f "$tmpdepfile"
35713498266Sopenharmony_ci  ;;
35813498266Sopenharmony_ci
35913498266Sopenharmony_ci## The order of this option in the case statement is important, since the
36013498266Sopenharmony_ci## shell code in configure will try each of these formats in the order
36113498266Sopenharmony_ci## listed in this file.  A plain '-MD' option would be understood by many
36213498266Sopenharmony_ci## compilers, so we must ensure this comes after the gcc and icc options.
36313498266Sopenharmony_cipgcc)
36413498266Sopenharmony_ci  # Portland's C compiler understands '-MD'.
36513498266Sopenharmony_ci  # Will always output deps to 'file.d' where file is the root name of the
36613498266Sopenharmony_ci  # source file under compilation, even if file resides in a subdirectory.
36713498266Sopenharmony_ci  # The object file name does not affect the name of the '.d' file.
36813498266Sopenharmony_ci  # pgcc 10.2 will output
36913498266Sopenharmony_ci  #    foo.o: sub/foo.c sub/foo.h
37013498266Sopenharmony_ci  # and will wrap long lines using '\' :
37113498266Sopenharmony_ci  #    foo.o: sub/foo.c ... \
37213498266Sopenharmony_ci  #     sub/foo.h ... \
37313498266Sopenharmony_ci  #     ...
37413498266Sopenharmony_ci  set_dir_from "$object"
37513498266Sopenharmony_ci  # Use the source, not the object, to determine the base name, since
37613498266Sopenharmony_ci  # that's sadly what pgcc will do too.
37713498266Sopenharmony_ci  set_base_from "$source"
37813498266Sopenharmony_ci  tmpdepfile=$base.d
37913498266Sopenharmony_ci
38013498266Sopenharmony_ci  # For projects that build the same source file twice into different object
38113498266Sopenharmony_ci  # files, the pgcc approach of using the *source* file root name can cause
38213498266Sopenharmony_ci  # problems in parallel builds.  Use a locking strategy to avoid stomping on
38313498266Sopenharmony_ci  # the same $tmpdepfile.
38413498266Sopenharmony_ci  lockdir=$base.d-lock
38513498266Sopenharmony_ci  trap "
38613498266Sopenharmony_ci    echo '$0: caught signal, cleaning up...' >&2
38713498266Sopenharmony_ci    rmdir '$lockdir'
38813498266Sopenharmony_ci    exit 1
38913498266Sopenharmony_ci  " 1 2 13 15
39013498266Sopenharmony_ci  numtries=100
39113498266Sopenharmony_ci  i=$numtries
39213498266Sopenharmony_ci  while test $i -gt 0; do
39313498266Sopenharmony_ci    # mkdir is a portable test-and-set.
39413498266Sopenharmony_ci    if mkdir "$lockdir" 2>/dev/null; then
39513498266Sopenharmony_ci      # This process acquired the lock.
39613498266Sopenharmony_ci      "$@" -MD
39713498266Sopenharmony_ci      stat=$?
39813498266Sopenharmony_ci      # Release the lock.
39913498266Sopenharmony_ci      rmdir "$lockdir"
40013498266Sopenharmony_ci      break
40113498266Sopenharmony_ci    else
40213498266Sopenharmony_ci      # If the lock is being held by a different process, wait
40313498266Sopenharmony_ci      # until the winning process is done or we timeout.
40413498266Sopenharmony_ci      while test -d "$lockdir" && test $i -gt 0; do
40513498266Sopenharmony_ci        sleep 1
40613498266Sopenharmony_ci        i=`expr $i - 1`
40713498266Sopenharmony_ci      done
40813498266Sopenharmony_ci    fi
40913498266Sopenharmony_ci    i=`expr $i - 1`
41013498266Sopenharmony_ci  done
41113498266Sopenharmony_ci  trap - 1 2 13 15
41213498266Sopenharmony_ci  if test $i -le 0; then
41313498266Sopenharmony_ci    echo "$0: failed to acquire lock after $numtries attempts" >&2
41413498266Sopenharmony_ci    echo "$0: check lockdir '$lockdir'" >&2
41513498266Sopenharmony_ci    exit 1
41613498266Sopenharmony_ci  fi
41713498266Sopenharmony_ci
41813498266Sopenharmony_ci  if test $stat -ne 0; then
41913498266Sopenharmony_ci    rm -f "$tmpdepfile"
42013498266Sopenharmony_ci    exit $stat
42113498266Sopenharmony_ci  fi
42213498266Sopenharmony_ci  rm -f "$depfile"
42313498266Sopenharmony_ci  # Each line is of the form `foo.o: dependent.h',
42413498266Sopenharmony_ci  # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'.
42513498266Sopenharmony_ci  # Do two passes, one to just change these to
42613498266Sopenharmony_ci  # `$object: dependent.h' and one to simply `dependent.h:'.
42713498266Sopenharmony_ci  sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
42813498266Sopenharmony_ci  # Some versions of the HPUX 10.20 sed can't process this invocation
42913498266Sopenharmony_ci  # correctly.  Breaking it into two sed invocations is a workaround.
43013498266Sopenharmony_ci  sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" \
43113498266Sopenharmony_ci    | sed -e 's/$/ :/' >> "$depfile"
43213498266Sopenharmony_ci  rm -f "$tmpdepfile"
43313498266Sopenharmony_ci  ;;
43413498266Sopenharmony_ci
43513498266Sopenharmony_cihp2)
43613498266Sopenharmony_ci  # The "hp" stanza above does not work with aCC (C++) and HP's ia64
43713498266Sopenharmony_ci  # compilers, which have integrated preprocessors.  The correct option
43813498266Sopenharmony_ci  # to use with these is +Maked; it writes dependencies to a file named
43913498266Sopenharmony_ci  # 'foo.d', which lands next to the object file, wherever that
44013498266Sopenharmony_ci  # happens to be.
44113498266Sopenharmony_ci  # Much of this is similar to the tru64 case; see comments there.
44213498266Sopenharmony_ci  set_dir_from  "$object"
44313498266Sopenharmony_ci  set_base_from "$object"
44413498266Sopenharmony_ci  if test "$libtool" = yes; then
44513498266Sopenharmony_ci    tmpdepfile1=$dir$base.d
44613498266Sopenharmony_ci    tmpdepfile2=$dir.libs/$base.d
44713498266Sopenharmony_ci    "$@" -Wc,+Maked
44813498266Sopenharmony_ci  else
44913498266Sopenharmony_ci    tmpdepfile1=$dir$base.d
45013498266Sopenharmony_ci    tmpdepfile2=$dir$base.d
45113498266Sopenharmony_ci    "$@" +Maked
45213498266Sopenharmony_ci  fi
45313498266Sopenharmony_ci  stat=$?
45413498266Sopenharmony_ci  if test $stat -ne 0; then
45513498266Sopenharmony_ci     rm -f "$tmpdepfile1" "$tmpdepfile2"
45613498266Sopenharmony_ci     exit $stat
45713498266Sopenharmony_ci  fi
45813498266Sopenharmony_ci
45913498266Sopenharmony_ci  for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2"
46013498266Sopenharmony_ci  do
46113498266Sopenharmony_ci    test -f "$tmpdepfile" && break
46213498266Sopenharmony_ci  done
46313498266Sopenharmony_ci  if test -f "$tmpdepfile"; then
46413498266Sopenharmony_ci    sed -e "s,^.*\.[$lower]*:,$object:," "$tmpdepfile" > "$depfile"
46513498266Sopenharmony_ci    # Add 'dependent.h:' lines.
46613498266Sopenharmony_ci    sed -ne '2,${
46713498266Sopenharmony_ci               s/^ *//
46813498266Sopenharmony_ci               s/ \\*$//
46913498266Sopenharmony_ci               s/$/:/
47013498266Sopenharmony_ci               p
47113498266Sopenharmony_ci             }' "$tmpdepfile" >> "$depfile"
47213498266Sopenharmony_ci  else
47313498266Sopenharmony_ci    make_dummy_depfile
47413498266Sopenharmony_ci  fi
47513498266Sopenharmony_ci  rm -f "$tmpdepfile" "$tmpdepfile2"
47613498266Sopenharmony_ci  ;;
47713498266Sopenharmony_ci
47813498266Sopenharmony_citru64)
47913498266Sopenharmony_ci  # The Tru64 compiler uses -MD to generate dependencies as a side
48013498266Sopenharmony_ci  # effect.  'cc -MD -o foo.o ...' puts the dependencies into 'foo.o.d'.
48113498266Sopenharmony_ci  # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
48213498266Sopenharmony_ci  # dependencies in 'foo.d' instead, so we check for that too.
48313498266Sopenharmony_ci  # Subdirectories are respected.
48413498266Sopenharmony_ci  set_dir_from  "$object"
48513498266Sopenharmony_ci  set_base_from "$object"
48613498266Sopenharmony_ci
48713498266Sopenharmony_ci  if test "$libtool" = yes; then
48813498266Sopenharmony_ci    # Libtool generates 2 separate objects for the 2 libraries.  These
48913498266Sopenharmony_ci    # two compilations output dependencies in $dir.libs/$base.o.d and
49013498266Sopenharmony_ci    # in $dir$base.o.d.  We have to check for both files, because
49113498266Sopenharmony_ci    # one of the two compilations can be disabled.  We should prefer
49213498266Sopenharmony_ci    # $dir$base.o.d over $dir.libs/$base.o.d because the latter is
49313498266Sopenharmony_ci    # automatically cleaned when .libs/ is deleted, while ignoring
49413498266Sopenharmony_ci    # the former would cause a distcleancheck panic.
49513498266Sopenharmony_ci    tmpdepfile1=$dir$base.o.d          # libtool 1.5
49613498266Sopenharmony_ci    tmpdepfile2=$dir.libs/$base.o.d    # Likewise.
49713498266Sopenharmony_ci    tmpdepfile3=$dir.libs/$base.d      # Compaq CCC V6.2-504
49813498266Sopenharmony_ci    "$@" -Wc,-MD
49913498266Sopenharmony_ci  else
50013498266Sopenharmony_ci    tmpdepfile1=$dir$base.d
50113498266Sopenharmony_ci    tmpdepfile2=$dir$base.d
50213498266Sopenharmony_ci    tmpdepfile3=$dir$base.d
50313498266Sopenharmony_ci    "$@" -MD
50413498266Sopenharmony_ci  fi
50513498266Sopenharmony_ci
50613498266Sopenharmony_ci  stat=$?
50713498266Sopenharmony_ci  if test $stat -ne 0; then
50813498266Sopenharmony_ci    rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
50913498266Sopenharmony_ci    exit $stat
51013498266Sopenharmony_ci  fi
51113498266Sopenharmony_ci
51213498266Sopenharmony_ci  for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
51313498266Sopenharmony_ci  do
51413498266Sopenharmony_ci    test -f "$tmpdepfile" && break
51513498266Sopenharmony_ci  done
51613498266Sopenharmony_ci  # Same post-processing that is required for AIX mode.
51713498266Sopenharmony_ci  aix_post_process_depfile
51813498266Sopenharmony_ci  ;;
51913498266Sopenharmony_ci
52013498266Sopenharmony_cimsvc7)
52113498266Sopenharmony_ci  if test "$libtool" = yes; then
52213498266Sopenharmony_ci    showIncludes=-Wc,-showIncludes
52313498266Sopenharmony_ci  else
52413498266Sopenharmony_ci    showIncludes=-showIncludes
52513498266Sopenharmony_ci  fi
52613498266Sopenharmony_ci  "$@" $showIncludes > "$tmpdepfile"
52713498266Sopenharmony_ci  stat=$?
52813498266Sopenharmony_ci  grep -v '^Note: including file: ' "$tmpdepfile"
52913498266Sopenharmony_ci  if test $stat -ne 0; then
53013498266Sopenharmony_ci    rm -f "$tmpdepfile"
53113498266Sopenharmony_ci    exit $stat
53213498266Sopenharmony_ci  fi
53313498266Sopenharmony_ci  rm -f "$depfile"
53413498266Sopenharmony_ci  echo "$object : \\" > "$depfile"
53513498266Sopenharmony_ci  # The first sed program below extracts the file names and escapes
53613498266Sopenharmony_ci  # backslashes for cygpath.  The second sed program outputs the file
53713498266Sopenharmony_ci  # name when reading, but also accumulates all include files in the
53813498266Sopenharmony_ci  # hold buffer in order to output them again at the end.  This only
53913498266Sopenharmony_ci  # works with sed implementations that can handle large buffers.
54013498266Sopenharmony_ci  sed < "$tmpdepfile" -n '
54113498266Sopenharmony_ci/^Note: including file:  *\(.*\)/ {
54213498266Sopenharmony_ci  s//\1/
54313498266Sopenharmony_ci  s/\\/\\\\/g
54413498266Sopenharmony_ci  p
54513498266Sopenharmony_ci}' | $cygpath_u | sort -u | sed -n '
54613498266Sopenharmony_cis/ /\\ /g
54713498266Sopenharmony_cis/\(.*\)/'"$tab"'\1 \\/p
54813498266Sopenharmony_cis/.\(.*\) \\/\1:/
54913498266Sopenharmony_ciH
55013498266Sopenharmony_ci$ {
55113498266Sopenharmony_ci  s/.*/'"$tab"'/
55213498266Sopenharmony_ci  G
55313498266Sopenharmony_ci  p
55413498266Sopenharmony_ci}' >> "$depfile"
55513498266Sopenharmony_ci  echo >> "$depfile" # make sure the fragment doesn't end with a backslash
55613498266Sopenharmony_ci  rm -f "$tmpdepfile"
55713498266Sopenharmony_ci  ;;
55813498266Sopenharmony_ci
55913498266Sopenharmony_cimsvc7msys)
56013498266Sopenharmony_ci  # This case exists only to let depend.m4 do its work.  It works by
56113498266Sopenharmony_ci  # looking at the text of this script.  This case will never be run,
56213498266Sopenharmony_ci  # since it is checked for above.
56313498266Sopenharmony_ci  exit 1
56413498266Sopenharmony_ci  ;;
56513498266Sopenharmony_ci
56613498266Sopenharmony_ci#nosideeffect)
56713498266Sopenharmony_ci  # This comment above is used by automake to tell side-effect
56813498266Sopenharmony_ci  # dependency tracking mechanisms from slower ones.
56913498266Sopenharmony_ci
57013498266Sopenharmony_cidashmstdout)
57113498266Sopenharmony_ci  # Important note: in order to support this mode, a compiler *must*
57213498266Sopenharmony_ci  # always write the preprocessed file to stdout, regardless of -o.
57313498266Sopenharmony_ci  "$@" || exit $?
57413498266Sopenharmony_ci
57513498266Sopenharmony_ci  # Remove the call to Libtool.
57613498266Sopenharmony_ci  if test "$libtool" = yes; then
57713498266Sopenharmony_ci    while test "X$1" != 'X--mode=compile'; do
57813498266Sopenharmony_ci      shift
57913498266Sopenharmony_ci    done
58013498266Sopenharmony_ci    shift
58113498266Sopenharmony_ci  fi
58213498266Sopenharmony_ci
58313498266Sopenharmony_ci  # Remove '-o $object'.
58413498266Sopenharmony_ci  IFS=" "
58513498266Sopenharmony_ci  for arg
58613498266Sopenharmony_ci  do
58713498266Sopenharmony_ci    case $arg in
58813498266Sopenharmony_ci    -o)
58913498266Sopenharmony_ci      shift
59013498266Sopenharmony_ci      ;;
59113498266Sopenharmony_ci    $object)
59213498266Sopenharmony_ci      shift
59313498266Sopenharmony_ci      ;;
59413498266Sopenharmony_ci    *)
59513498266Sopenharmony_ci      set fnord "$@" "$arg"
59613498266Sopenharmony_ci      shift # fnord
59713498266Sopenharmony_ci      shift # $arg
59813498266Sopenharmony_ci      ;;
59913498266Sopenharmony_ci    esac
60013498266Sopenharmony_ci  done
60113498266Sopenharmony_ci
60213498266Sopenharmony_ci  test -z "$dashmflag" && dashmflag=-M
60313498266Sopenharmony_ci  # Require at least two characters before searching for ':'
60413498266Sopenharmony_ci  # in the target name.  This is to cope with DOS-style filenames:
60513498266Sopenharmony_ci  # a dependency such as 'c:/foo/bar' could be seen as target 'c' otherwise.
60613498266Sopenharmony_ci  "$@" $dashmflag |
60713498266Sopenharmony_ci    sed "s|^[$tab ]*[^:$tab ][^:][^:]*:[$tab ]*|$object: |" > "$tmpdepfile"
60813498266Sopenharmony_ci  rm -f "$depfile"
60913498266Sopenharmony_ci  cat < "$tmpdepfile" > "$depfile"
61013498266Sopenharmony_ci  # Some versions of the HPUX 10.20 sed can't process this sed invocation
61113498266Sopenharmony_ci  # correctly.  Breaking it into two sed invocations is a workaround.
61213498266Sopenharmony_ci  tr ' ' "$nl" < "$tmpdepfile" \
61313498266Sopenharmony_ci    | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \
61413498266Sopenharmony_ci    | sed -e 's/$/ :/' >> "$depfile"
61513498266Sopenharmony_ci  rm -f "$tmpdepfile"
61613498266Sopenharmony_ci  ;;
61713498266Sopenharmony_ci
61813498266Sopenharmony_cidashXmstdout)
61913498266Sopenharmony_ci  # This case only exists to satisfy depend.m4.  It is never actually
62013498266Sopenharmony_ci  # run, as this mode is specially recognized in the preamble.
62113498266Sopenharmony_ci  exit 1
62213498266Sopenharmony_ci  ;;
62313498266Sopenharmony_ci
62413498266Sopenharmony_cimakedepend)
62513498266Sopenharmony_ci  "$@" || exit $?
62613498266Sopenharmony_ci  # Remove any Libtool call
62713498266Sopenharmony_ci  if test "$libtool" = yes; then
62813498266Sopenharmony_ci    while test "X$1" != 'X--mode=compile'; do
62913498266Sopenharmony_ci      shift
63013498266Sopenharmony_ci    done
63113498266Sopenharmony_ci    shift
63213498266Sopenharmony_ci  fi
63313498266Sopenharmony_ci  # X makedepend
63413498266Sopenharmony_ci  shift
63513498266Sopenharmony_ci  cleared=no eat=no
63613498266Sopenharmony_ci  for arg
63713498266Sopenharmony_ci  do
63813498266Sopenharmony_ci    case $cleared in
63913498266Sopenharmony_ci    no)
64013498266Sopenharmony_ci      set ""; shift
64113498266Sopenharmony_ci      cleared=yes ;;
64213498266Sopenharmony_ci    esac
64313498266Sopenharmony_ci    if test $eat = yes; then
64413498266Sopenharmony_ci      eat=no
64513498266Sopenharmony_ci      continue
64613498266Sopenharmony_ci    fi
64713498266Sopenharmony_ci    case "$arg" in
64813498266Sopenharmony_ci    -D*|-I*)
64913498266Sopenharmony_ci      set fnord "$@" "$arg"; shift ;;
65013498266Sopenharmony_ci    # Strip any option that makedepend may not understand.  Remove
65113498266Sopenharmony_ci    # the object too, otherwise makedepend will parse it as a source file.
65213498266Sopenharmony_ci    -arch)
65313498266Sopenharmony_ci      eat=yes ;;
65413498266Sopenharmony_ci    -*|$object)
65513498266Sopenharmony_ci      ;;
65613498266Sopenharmony_ci    *)
65713498266Sopenharmony_ci      set fnord "$@" "$arg"; shift ;;
65813498266Sopenharmony_ci    esac
65913498266Sopenharmony_ci  done
66013498266Sopenharmony_ci  obj_suffix=`echo "$object" | sed 's/^.*\././'`
66113498266Sopenharmony_ci  touch "$tmpdepfile"
66213498266Sopenharmony_ci  ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
66313498266Sopenharmony_ci  rm -f "$depfile"
66413498266Sopenharmony_ci  # makedepend may prepend the VPATH from the source file name to the object.
66513498266Sopenharmony_ci  # No need to regex-escape $object, excess matching of '.' is harmless.
66613498266Sopenharmony_ci  sed "s|^.*\($object *:\)|\1|" "$tmpdepfile" > "$depfile"
66713498266Sopenharmony_ci  # Some versions of the HPUX 10.20 sed can't process the last invocation
66813498266Sopenharmony_ci  # correctly.  Breaking it into two sed invocations is a workaround.
66913498266Sopenharmony_ci  sed '1,2d' "$tmpdepfile" \
67013498266Sopenharmony_ci    | tr ' ' "$nl" \
67113498266Sopenharmony_ci    | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \
67213498266Sopenharmony_ci    | sed -e 's/$/ :/' >> "$depfile"
67313498266Sopenharmony_ci  rm -f "$tmpdepfile" "$tmpdepfile".bak
67413498266Sopenharmony_ci  ;;
67513498266Sopenharmony_ci
67613498266Sopenharmony_cicpp)
67713498266Sopenharmony_ci  # Important note: in order to support this mode, a compiler *must*
67813498266Sopenharmony_ci  # always write the preprocessed file to stdout.
67913498266Sopenharmony_ci  "$@" || exit $?
68013498266Sopenharmony_ci
68113498266Sopenharmony_ci  # Remove the call to Libtool.
68213498266Sopenharmony_ci  if test "$libtool" = yes; then
68313498266Sopenharmony_ci    while test "X$1" != 'X--mode=compile'; do
68413498266Sopenharmony_ci      shift
68513498266Sopenharmony_ci    done
68613498266Sopenharmony_ci    shift
68713498266Sopenharmony_ci  fi
68813498266Sopenharmony_ci
68913498266Sopenharmony_ci  # Remove '-o $object'.
69013498266Sopenharmony_ci  IFS=" "
69113498266Sopenharmony_ci  for arg
69213498266Sopenharmony_ci  do
69313498266Sopenharmony_ci    case $arg in
69413498266Sopenharmony_ci    -o)
69513498266Sopenharmony_ci      shift
69613498266Sopenharmony_ci      ;;
69713498266Sopenharmony_ci    $object)
69813498266Sopenharmony_ci      shift
69913498266Sopenharmony_ci      ;;
70013498266Sopenharmony_ci    *)
70113498266Sopenharmony_ci      set fnord "$@" "$arg"
70213498266Sopenharmony_ci      shift # fnord
70313498266Sopenharmony_ci      shift # $arg
70413498266Sopenharmony_ci      ;;
70513498266Sopenharmony_ci    esac
70613498266Sopenharmony_ci  done
70713498266Sopenharmony_ci
70813498266Sopenharmony_ci  "$@" -E \
70913498266Sopenharmony_ci    | sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
71013498266Sopenharmony_ci             -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
71113498266Sopenharmony_ci    | sed '$ s: \\$::' > "$tmpdepfile"
71213498266Sopenharmony_ci  rm -f "$depfile"
71313498266Sopenharmony_ci  echo "$object : \\" > "$depfile"
71413498266Sopenharmony_ci  cat < "$tmpdepfile" >> "$depfile"
71513498266Sopenharmony_ci  sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile"
71613498266Sopenharmony_ci  rm -f "$tmpdepfile"
71713498266Sopenharmony_ci  ;;
71813498266Sopenharmony_ci
71913498266Sopenharmony_cimsvisualcpp)
72013498266Sopenharmony_ci  # Important note: in order to support this mode, a compiler *must*
72113498266Sopenharmony_ci  # always write the preprocessed file to stdout.
72213498266Sopenharmony_ci  "$@" || exit $?
72313498266Sopenharmony_ci
72413498266Sopenharmony_ci  # Remove the call to Libtool.
72513498266Sopenharmony_ci  if test "$libtool" = yes; then
72613498266Sopenharmony_ci    while test "X$1" != 'X--mode=compile'; do
72713498266Sopenharmony_ci      shift
72813498266Sopenharmony_ci    done
72913498266Sopenharmony_ci    shift
73013498266Sopenharmony_ci  fi
73113498266Sopenharmony_ci
73213498266Sopenharmony_ci  IFS=" "
73313498266Sopenharmony_ci  for arg
73413498266Sopenharmony_ci  do
73513498266Sopenharmony_ci    case "$arg" in
73613498266Sopenharmony_ci    -o)
73713498266Sopenharmony_ci      shift
73813498266Sopenharmony_ci      ;;
73913498266Sopenharmony_ci    $object)
74013498266Sopenharmony_ci      shift
74113498266Sopenharmony_ci      ;;
74213498266Sopenharmony_ci    "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
74313498266Sopenharmony_ci        set fnord "$@"
74413498266Sopenharmony_ci        shift
74513498266Sopenharmony_ci        shift
74613498266Sopenharmony_ci        ;;
74713498266Sopenharmony_ci    *)
74813498266Sopenharmony_ci        set fnord "$@" "$arg"
74913498266Sopenharmony_ci        shift
75013498266Sopenharmony_ci        shift
75113498266Sopenharmony_ci        ;;
75213498266Sopenharmony_ci    esac
75313498266Sopenharmony_ci  done
75413498266Sopenharmony_ci  "$@" -E 2>/dev/null |
75513498266Sopenharmony_ci  sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile"
75613498266Sopenharmony_ci  rm -f "$depfile"
75713498266Sopenharmony_ci  echo "$object : \\" > "$depfile"
75813498266Sopenharmony_ci  sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::'"$tab"'\1 \\:p' >> "$depfile"
75913498266Sopenharmony_ci  echo "$tab" >> "$depfile"
76013498266Sopenharmony_ci  sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile"
76113498266Sopenharmony_ci  rm -f "$tmpdepfile"
76213498266Sopenharmony_ci  ;;
76313498266Sopenharmony_ci
76413498266Sopenharmony_cimsvcmsys)
76513498266Sopenharmony_ci  # This case exists only to let depend.m4 do its work.  It works by
76613498266Sopenharmony_ci  # looking at the text of this script.  This case will never be run,
76713498266Sopenharmony_ci  # since it is checked for above.
76813498266Sopenharmony_ci  exit 1
76913498266Sopenharmony_ci  ;;
77013498266Sopenharmony_ci
77113498266Sopenharmony_cinone)
77213498266Sopenharmony_ci  exec "$@"
77313498266Sopenharmony_ci  ;;
77413498266Sopenharmony_ci
77513498266Sopenharmony_ci*)
77613498266Sopenharmony_ci  echo "Unknown depmode $depmode" 1>&2
77713498266Sopenharmony_ci  exit 1
77813498266Sopenharmony_ci  ;;
77913498266Sopenharmony_ciesac
78013498266Sopenharmony_ci
78113498266Sopenharmony_ciexit 0
78213498266Sopenharmony_ci
78313498266Sopenharmony_ci# Local Variables:
78413498266Sopenharmony_ci# mode: shell-script
78513498266Sopenharmony_ci# sh-indentation: 2
78613498266Sopenharmony_ci# eval: (add-hook 'before-save-hook 'time-stamp)
78713498266Sopenharmony_ci# time-stamp-start: "scriptversion="
78813498266Sopenharmony_ci# time-stamp-format: "%:y-%02m-%02d.%02H"
78913498266Sopenharmony_ci# time-stamp-time-zone: "UTC0"
79013498266Sopenharmony_ci# time-stamp-end: "; # UTC"
79113498266Sopenharmony_ci# End:
792