11cb0ef41Sopenharmony_ci#! /bin/sh 21cb0ef41Sopenharmony_ci# depcomp - compile a program generating dependencies as side-effects 31cb0ef41Sopenharmony_ci 41cb0ef41Sopenharmony_ciscriptversion=2018-03-07.03; # UTC 51cb0ef41Sopenharmony_ci 61cb0ef41Sopenharmony_ci# Copyright (C) 1999-2021 Free Software Foundation, Inc. 71cb0ef41Sopenharmony_ci 81cb0ef41Sopenharmony_ci# This program is free software; you can redistribute it and/or modify 91cb0ef41Sopenharmony_ci# it under the terms of the GNU General Public License as published by 101cb0ef41Sopenharmony_ci# the Free Software Foundation; either version 2, or (at your option) 111cb0ef41Sopenharmony_ci# any later version. 121cb0ef41Sopenharmony_ci 131cb0ef41Sopenharmony_ci# This program is distributed in the hope that it will be useful, 141cb0ef41Sopenharmony_ci# but WITHOUT ANY WARRANTY; without even the implied warranty of 151cb0ef41Sopenharmony_ci# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 161cb0ef41Sopenharmony_ci# GNU General Public License for more details. 171cb0ef41Sopenharmony_ci 181cb0ef41Sopenharmony_ci# You should have received a copy of the GNU General Public License 191cb0ef41Sopenharmony_ci# along with this program. If not, see <https://www.gnu.org/licenses/>. 201cb0ef41Sopenharmony_ci 211cb0ef41Sopenharmony_ci# As a special exception to the GNU General Public License, if you 221cb0ef41Sopenharmony_ci# distribute this file as part of a program that contains a 231cb0ef41Sopenharmony_ci# configuration script generated by Autoconf, you may include it under 241cb0ef41Sopenharmony_ci# the same distribution terms that you use for the rest of that program. 251cb0ef41Sopenharmony_ci 261cb0ef41Sopenharmony_ci# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>. 271cb0ef41Sopenharmony_ci 281cb0ef41Sopenharmony_cicase $1 in 291cb0ef41Sopenharmony_ci '') 301cb0ef41Sopenharmony_ci echo "$0: No command. Try '$0 --help' for more information." 1>&2 311cb0ef41Sopenharmony_ci exit 1; 321cb0ef41Sopenharmony_ci ;; 331cb0ef41Sopenharmony_ci -h | --h*) 341cb0ef41Sopenharmony_ci cat <<\EOF 351cb0ef41Sopenharmony_ciUsage: depcomp [--help] [--version] PROGRAM [ARGS] 361cb0ef41Sopenharmony_ci 371cb0ef41Sopenharmony_ciRun PROGRAMS ARGS to compile a file, generating dependencies 381cb0ef41Sopenharmony_cias side-effects. 391cb0ef41Sopenharmony_ci 401cb0ef41Sopenharmony_ciEnvironment variables: 411cb0ef41Sopenharmony_ci depmode Dependency tracking mode. 421cb0ef41Sopenharmony_ci source Source file read by 'PROGRAMS ARGS'. 431cb0ef41Sopenharmony_ci object Object file output by 'PROGRAMS ARGS'. 441cb0ef41Sopenharmony_ci DEPDIR directory where to store dependencies. 451cb0ef41Sopenharmony_ci depfile Dependency file to output. 461cb0ef41Sopenharmony_ci tmpdepfile Temporary file to use when outputting dependencies. 471cb0ef41Sopenharmony_ci libtool Whether libtool is used (yes/no). 481cb0ef41Sopenharmony_ci 491cb0ef41Sopenharmony_ciReport bugs to <bug-automake@gnu.org>. 501cb0ef41Sopenharmony_ciEOF 511cb0ef41Sopenharmony_ci exit $? 521cb0ef41Sopenharmony_ci ;; 531cb0ef41Sopenharmony_ci -v | --v*) 541cb0ef41Sopenharmony_ci echo "depcomp $scriptversion" 551cb0ef41Sopenharmony_ci exit $? 561cb0ef41Sopenharmony_ci ;; 571cb0ef41Sopenharmony_ciesac 581cb0ef41Sopenharmony_ci 591cb0ef41Sopenharmony_ci# Get the directory component of the given path, and save it in the 601cb0ef41Sopenharmony_ci# global variables '$dir'. Note that this directory component will 611cb0ef41Sopenharmony_ci# be either empty or ending with a '/' character. This is deliberate. 621cb0ef41Sopenharmony_ciset_dir_from () 631cb0ef41Sopenharmony_ci{ 641cb0ef41Sopenharmony_ci case $1 in 651cb0ef41Sopenharmony_ci */*) dir=`echo "$1" | sed -e 's|/[^/]*$|/|'`;; 661cb0ef41Sopenharmony_ci *) dir=;; 671cb0ef41Sopenharmony_ci esac 681cb0ef41Sopenharmony_ci} 691cb0ef41Sopenharmony_ci 701cb0ef41Sopenharmony_ci# Get the suffix-stripped basename of the given path, and save it the 711cb0ef41Sopenharmony_ci# global variable '$base'. 721cb0ef41Sopenharmony_ciset_base_from () 731cb0ef41Sopenharmony_ci{ 741cb0ef41Sopenharmony_ci base=`echo "$1" | sed -e 's|^.*/||' -e 's/\.[^.]*$//'` 751cb0ef41Sopenharmony_ci} 761cb0ef41Sopenharmony_ci 771cb0ef41Sopenharmony_ci# If no dependency file was actually created by the compiler invocation, 781cb0ef41Sopenharmony_ci# we still have to create a dummy depfile, to avoid errors with the 791cb0ef41Sopenharmony_ci# Makefile "include basename.Plo" scheme. 801cb0ef41Sopenharmony_cimake_dummy_depfile () 811cb0ef41Sopenharmony_ci{ 821cb0ef41Sopenharmony_ci echo "#dummy" > "$depfile" 831cb0ef41Sopenharmony_ci} 841cb0ef41Sopenharmony_ci 851cb0ef41Sopenharmony_ci# Factor out some common post-processing of the generated depfile. 861cb0ef41Sopenharmony_ci# Requires the auxiliary global variable '$tmpdepfile' to be set. 871cb0ef41Sopenharmony_ciaix_post_process_depfile () 881cb0ef41Sopenharmony_ci{ 891cb0ef41Sopenharmony_ci # If the compiler actually managed to produce a dependency file, 901cb0ef41Sopenharmony_ci # post-process it. 911cb0ef41Sopenharmony_ci if test -f "$tmpdepfile"; then 921cb0ef41Sopenharmony_ci # Each line is of the form 'foo.o: dependency.h'. 931cb0ef41Sopenharmony_ci # Do two passes, one to just change these to 941cb0ef41Sopenharmony_ci # $object: dependency.h 951cb0ef41Sopenharmony_ci # and one to simply output 961cb0ef41Sopenharmony_ci # dependency.h: 971cb0ef41Sopenharmony_ci # which is needed to avoid the deleted-header problem. 981cb0ef41Sopenharmony_ci { sed -e "s,^.*\.[$lower]*:,$object:," < "$tmpdepfile" 991cb0ef41Sopenharmony_ci sed -e "s,^.*\.[$lower]*:[$tab ]*,," -e 's,$,:,' < "$tmpdepfile" 1001cb0ef41Sopenharmony_ci } > "$depfile" 1011cb0ef41Sopenharmony_ci rm -f "$tmpdepfile" 1021cb0ef41Sopenharmony_ci else 1031cb0ef41Sopenharmony_ci make_dummy_depfile 1041cb0ef41Sopenharmony_ci fi 1051cb0ef41Sopenharmony_ci} 1061cb0ef41Sopenharmony_ci 1071cb0ef41Sopenharmony_ci# A tabulation character. 1081cb0ef41Sopenharmony_citab=' ' 1091cb0ef41Sopenharmony_ci# A newline character. 1101cb0ef41Sopenharmony_cinl=' 1111cb0ef41Sopenharmony_ci' 1121cb0ef41Sopenharmony_ci# Character ranges might be problematic outside the C locale. 1131cb0ef41Sopenharmony_ci# These definitions help. 1141cb0ef41Sopenharmony_ciupper=ABCDEFGHIJKLMNOPQRSTUVWXYZ 1151cb0ef41Sopenharmony_cilower=abcdefghijklmnopqrstuvwxyz 1161cb0ef41Sopenharmony_cidigits=0123456789 1171cb0ef41Sopenharmony_cialpha=${upper}${lower} 1181cb0ef41Sopenharmony_ci 1191cb0ef41Sopenharmony_ciif test -z "$depmode" || test -z "$source" || test -z "$object"; then 1201cb0ef41Sopenharmony_ci echo "depcomp: Variables source, object and depmode must be set" 1>&2 1211cb0ef41Sopenharmony_ci exit 1 1221cb0ef41Sopenharmony_cifi 1231cb0ef41Sopenharmony_ci 1241cb0ef41Sopenharmony_ci# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po. 1251cb0ef41Sopenharmony_cidepfile=${depfile-`echo "$object" | 1261cb0ef41Sopenharmony_ci sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`} 1271cb0ef41Sopenharmony_citmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} 1281cb0ef41Sopenharmony_ci 1291cb0ef41Sopenharmony_cirm -f "$tmpdepfile" 1301cb0ef41Sopenharmony_ci 1311cb0ef41Sopenharmony_ci# Avoid interferences from the environment. 1321cb0ef41Sopenharmony_cigccflag= dashmflag= 1331cb0ef41Sopenharmony_ci 1341cb0ef41Sopenharmony_ci# Some modes work just like other modes, but use different flags. We 1351cb0ef41Sopenharmony_ci# parameterize here, but still list the modes in the big case below, 1361cb0ef41Sopenharmony_ci# to make depend.m4 easier to write. Note that we *cannot* use a case 1371cb0ef41Sopenharmony_ci# here, because this file can only contain one case statement. 1381cb0ef41Sopenharmony_ciif test "$depmode" = hp; then 1391cb0ef41Sopenharmony_ci # HP compiler uses -M and no extra arg. 1401cb0ef41Sopenharmony_ci gccflag=-M 1411cb0ef41Sopenharmony_ci depmode=gcc 1421cb0ef41Sopenharmony_cifi 1431cb0ef41Sopenharmony_ci 1441cb0ef41Sopenharmony_ciif test "$depmode" = dashXmstdout; then 1451cb0ef41Sopenharmony_ci # This is just like dashmstdout with a different argument. 1461cb0ef41Sopenharmony_ci dashmflag=-xM 1471cb0ef41Sopenharmony_ci depmode=dashmstdout 1481cb0ef41Sopenharmony_cifi 1491cb0ef41Sopenharmony_ci 1501cb0ef41Sopenharmony_cicygpath_u="cygpath -u -f -" 1511cb0ef41Sopenharmony_ciif test "$depmode" = msvcmsys; then 1521cb0ef41Sopenharmony_ci # This is just like msvisualcpp but w/o cygpath translation. 1531cb0ef41Sopenharmony_ci # Just convert the backslash-escaped backslashes to single forward 1541cb0ef41Sopenharmony_ci # slashes to satisfy depend.m4 1551cb0ef41Sopenharmony_ci cygpath_u='sed s,\\\\,/,g' 1561cb0ef41Sopenharmony_ci depmode=msvisualcpp 1571cb0ef41Sopenharmony_cifi 1581cb0ef41Sopenharmony_ci 1591cb0ef41Sopenharmony_ciif test "$depmode" = msvc7msys; then 1601cb0ef41Sopenharmony_ci # This is just like msvc7 but w/o cygpath translation. 1611cb0ef41Sopenharmony_ci # Just convert the backslash-escaped backslashes to single forward 1621cb0ef41Sopenharmony_ci # slashes to satisfy depend.m4 1631cb0ef41Sopenharmony_ci cygpath_u='sed s,\\\\,/,g' 1641cb0ef41Sopenharmony_ci depmode=msvc7 1651cb0ef41Sopenharmony_cifi 1661cb0ef41Sopenharmony_ci 1671cb0ef41Sopenharmony_ciif test "$depmode" = xlc; then 1681cb0ef41Sopenharmony_ci # IBM C/C++ Compilers xlc/xlC can output gcc-like dependency information. 1691cb0ef41Sopenharmony_ci gccflag=-qmakedep=gcc,-MF 1701cb0ef41Sopenharmony_ci depmode=gcc 1711cb0ef41Sopenharmony_cifi 1721cb0ef41Sopenharmony_ci 1731cb0ef41Sopenharmony_cicase "$depmode" in 1741cb0ef41Sopenharmony_cigcc3) 1751cb0ef41Sopenharmony_ci## gcc 3 implements dependency tracking that does exactly what 1761cb0ef41Sopenharmony_ci## we want. Yay! Note: for some reason libtool 1.4 doesn't like 1771cb0ef41Sopenharmony_ci## it if -MD -MP comes after the -MF stuff. Hmm. 1781cb0ef41Sopenharmony_ci## Unfortunately, FreeBSD c89 acceptance of flags depends upon 1791cb0ef41Sopenharmony_ci## the command line argument order; so add the flags where they 1801cb0ef41Sopenharmony_ci## appear in depend2.am. Note that the slowdown incurred here 1811cb0ef41Sopenharmony_ci## affects only configure: in makefiles, %FASTDEP% shortcuts this. 1821cb0ef41Sopenharmony_ci for arg 1831cb0ef41Sopenharmony_ci do 1841cb0ef41Sopenharmony_ci case $arg in 1851cb0ef41Sopenharmony_ci -c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;; 1861cb0ef41Sopenharmony_ci *) set fnord "$@" "$arg" ;; 1871cb0ef41Sopenharmony_ci esac 1881cb0ef41Sopenharmony_ci shift # fnord 1891cb0ef41Sopenharmony_ci shift # $arg 1901cb0ef41Sopenharmony_ci done 1911cb0ef41Sopenharmony_ci "$@" 1921cb0ef41Sopenharmony_ci stat=$? 1931cb0ef41Sopenharmony_ci if test $stat -ne 0; then 1941cb0ef41Sopenharmony_ci rm -f "$tmpdepfile" 1951cb0ef41Sopenharmony_ci exit $stat 1961cb0ef41Sopenharmony_ci fi 1971cb0ef41Sopenharmony_ci mv "$tmpdepfile" "$depfile" 1981cb0ef41Sopenharmony_ci ;; 1991cb0ef41Sopenharmony_ci 2001cb0ef41Sopenharmony_cigcc) 2011cb0ef41Sopenharmony_ci## Note that this doesn't just cater to obsosete pre-3.x GCC compilers. 2021cb0ef41Sopenharmony_ci## but also to in-use compilers like IMB xlc/xlC and the HP C compiler. 2031cb0ef41Sopenharmony_ci## (see the conditional assignment to $gccflag above). 2041cb0ef41Sopenharmony_ci## There are various ways to get dependency output from gcc. Here's 2051cb0ef41Sopenharmony_ci## why we pick this rather obscure method: 2061cb0ef41Sopenharmony_ci## - Don't want to use -MD because we'd like the dependencies to end 2071cb0ef41Sopenharmony_ci## up in a subdir. Having to rename by hand is ugly. 2081cb0ef41Sopenharmony_ci## (We might end up doing this anyway to support other compilers.) 2091cb0ef41Sopenharmony_ci## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like 2101cb0ef41Sopenharmony_ci## -MM, not -M (despite what the docs say). Also, it might not be 2111cb0ef41Sopenharmony_ci## supported by the other compilers which use the 'gcc' depmode. 2121cb0ef41Sopenharmony_ci## - Using -M directly means running the compiler twice (even worse 2131cb0ef41Sopenharmony_ci## than renaming). 2141cb0ef41Sopenharmony_ci if test -z "$gccflag"; then 2151cb0ef41Sopenharmony_ci gccflag=-MD, 2161cb0ef41Sopenharmony_ci fi 2171cb0ef41Sopenharmony_ci "$@" -Wp,"$gccflag$tmpdepfile" 2181cb0ef41Sopenharmony_ci stat=$? 2191cb0ef41Sopenharmony_ci if test $stat -ne 0; then 2201cb0ef41Sopenharmony_ci rm -f "$tmpdepfile" 2211cb0ef41Sopenharmony_ci exit $stat 2221cb0ef41Sopenharmony_ci fi 2231cb0ef41Sopenharmony_ci rm -f "$depfile" 2241cb0ef41Sopenharmony_ci echo "$object : \\" > "$depfile" 2251cb0ef41Sopenharmony_ci # The second -e expression handles DOS-style file names with drive 2261cb0ef41Sopenharmony_ci # letters. 2271cb0ef41Sopenharmony_ci sed -e 's/^[^:]*: / /' \ 2281cb0ef41Sopenharmony_ci -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" 2291cb0ef41Sopenharmony_ci## This next piece of magic avoids the "deleted header file" problem. 2301cb0ef41Sopenharmony_ci## The problem is that when a header file which appears in a .P file 2311cb0ef41Sopenharmony_ci## is deleted, the dependency causes make to die (because there is 2321cb0ef41Sopenharmony_ci## typically no way to rebuild the header). We avoid this by adding 2331cb0ef41Sopenharmony_ci## dummy dependencies for each header file. Too bad gcc doesn't do 2341cb0ef41Sopenharmony_ci## this for us directly. 2351cb0ef41Sopenharmony_ci## Some versions of gcc put a space before the ':'. On the theory 2361cb0ef41Sopenharmony_ci## that the space means something, we add a space to the output as 2371cb0ef41Sopenharmony_ci## well. hp depmode also adds that space, but also prefixes the VPATH 2381cb0ef41Sopenharmony_ci## to the object. Take care to not repeat it in the output. 2391cb0ef41Sopenharmony_ci## Some versions of the HPUX 10.20 sed can't process this invocation 2401cb0ef41Sopenharmony_ci## correctly. Breaking it into two sed invocations is a workaround. 2411cb0ef41Sopenharmony_ci tr ' ' "$nl" < "$tmpdepfile" \ 2421cb0ef41Sopenharmony_ci | sed -e 's/^\\$//' -e '/^$/d' -e "s|.*$object$||" -e '/:$/d' \ 2431cb0ef41Sopenharmony_ci | sed -e 's/$/ :/' >> "$depfile" 2441cb0ef41Sopenharmony_ci rm -f "$tmpdepfile" 2451cb0ef41Sopenharmony_ci ;; 2461cb0ef41Sopenharmony_ci 2471cb0ef41Sopenharmony_cihp) 2481cb0ef41Sopenharmony_ci # This case exists only to let depend.m4 do its work. It works by 2491cb0ef41Sopenharmony_ci # looking at the text of this script. This case will never be run, 2501cb0ef41Sopenharmony_ci # since it is checked for above. 2511cb0ef41Sopenharmony_ci exit 1 2521cb0ef41Sopenharmony_ci ;; 2531cb0ef41Sopenharmony_ci 2541cb0ef41Sopenharmony_cisgi) 2551cb0ef41Sopenharmony_ci if test "$libtool" = yes; then 2561cb0ef41Sopenharmony_ci "$@" "-Wp,-MDupdate,$tmpdepfile" 2571cb0ef41Sopenharmony_ci else 2581cb0ef41Sopenharmony_ci "$@" -MDupdate "$tmpdepfile" 2591cb0ef41Sopenharmony_ci fi 2601cb0ef41Sopenharmony_ci stat=$? 2611cb0ef41Sopenharmony_ci if test $stat -ne 0; then 2621cb0ef41Sopenharmony_ci rm -f "$tmpdepfile" 2631cb0ef41Sopenharmony_ci exit $stat 2641cb0ef41Sopenharmony_ci fi 2651cb0ef41Sopenharmony_ci rm -f "$depfile" 2661cb0ef41Sopenharmony_ci 2671cb0ef41Sopenharmony_ci if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files 2681cb0ef41Sopenharmony_ci echo "$object : \\" > "$depfile" 2691cb0ef41Sopenharmony_ci # Clip off the initial element (the dependent). Don't try to be 2701cb0ef41Sopenharmony_ci # clever and replace this with sed code, as IRIX sed won't handle 2711cb0ef41Sopenharmony_ci # lines with more than a fixed number of characters (4096 in 2721cb0ef41Sopenharmony_ci # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; 2731cb0ef41Sopenharmony_ci # the IRIX cc adds comments like '#:fec' to the end of the 2741cb0ef41Sopenharmony_ci # dependency line. 2751cb0ef41Sopenharmony_ci tr ' ' "$nl" < "$tmpdepfile" \ 2761cb0ef41Sopenharmony_ci | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' \ 2771cb0ef41Sopenharmony_ci | tr "$nl" ' ' >> "$depfile" 2781cb0ef41Sopenharmony_ci echo >> "$depfile" 2791cb0ef41Sopenharmony_ci # The second pass generates a dummy entry for each header file. 2801cb0ef41Sopenharmony_ci tr ' ' "$nl" < "$tmpdepfile" \ 2811cb0ef41Sopenharmony_ci | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ 2821cb0ef41Sopenharmony_ci >> "$depfile" 2831cb0ef41Sopenharmony_ci else 2841cb0ef41Sopenharmony_ci make_dummy_depfile 2851cb0ef41Sopenharmony_ci fi 2861cb0ef41Sopenharmony_ci rm -f "$tmpdepfile" 2871cb0ef41Sopenharmony_ci ;; 2881cb0ef41Sopenharmony_ci 2891cb0ef41Sopenharmony_cixlc) 2901cb0ef41Sopenharmony_ci # This case exists only to let depend.m4 do its work. It works by 2911cb0ef41Sopenharmony_ci # looking at the text of this script. This case will never be run, 2921cb0ef41Sopenharmony_ci # since it is checked for above. 2931cb0ef41Sopenharmony_ci exit 1 2941cb0ef41Sopenharmony_ci ;; 2951cb0ef41Sopenharmony_ci 2961cb0ef41Sopenharmony_ciaix) 2971cb0ef41Sopenharmony_ci # The C for AIX Compiler uses -M and outputs the dependencies 2981cb0ef41Sopenharmony_ci # in a .u file. In older versions, this file always lives in the 2991cb0ef41Sopenharmony_ci # current directory. Also, the AIX compiler puts '$object:' at the 3001cb0ef41Sopenharmony_ci # start of each line; $object doesn't have directory information. 3011cb0ef41Sopenharmony_ci # Version 6 uses the directory in both cases. 3021cb0ef41Sopenharmony_ci set_dir_from "$object" 3031cb0ef41Sopenharmony_ci set_base_from "$object" 3041cb0ef41Sopenharmony_ci if test "$libtool" = yes; then 3051cb0ef41Sopenharmony_ci tmpdepfile1=$dir$base.u 3061cb0ef41Sopenharmony_ci tmpdepfile2=$base.u 3071cb0ef41Sopenharmony_ci tmpdepfile3=$dir.libs/$base.u 3081cb0ef41Sopenharmony_ci "$@" -Wc,-M 3091cb0ef41Sopenharmony_ci else 3101cb0ef41Sopenharmony_ci tmpdepfile1=$dir$base.u 3111cb0ef41Sopenharmony_ci tmpdepfile2=$dir$base.u 3121cb0ef41Sopenharmony_ci tmpdepfile3=$dir$base.u 3131cb0ef41Sopenharmony_ci "$@" -M 3141cb0ef41Sopenharmony_ci fi 3151cb0ef41Sopenharmony_ci stat=$? 3161cb0ef41Sopenharmony_ci if test $stat -ne 0; then 3171cb0ef41Sopenharmony_ci rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" 3181cb0ef41Sopenharmony_ci exit $stat 3191cb0ef41Sopenharmony_ci fi 3201cb0ef41Sopenharmony_ci 3211cb0ef41Sopenharmony_ci for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" 3221cb0ef41Sopenharmony_ci do 3231cb0ef41Sopenharmony_ci test -f "$tmpdepfile" && break 3241cb0ef41Sopenharmony_ci done 3251cb0ef41Sopenharmony_ci aix_post_process_depfile 3261cb0ef41Sopenharmony_ci ;; 3271cb0ef41Sopenharmony_ci 3281cb0ef41Sopenharmony_citcc) 3291cb0ef41Sopenharmony_ci # tcc (Tiny C Compiler) understand '-MD -MF file' since version 0.9.26 3301cb0ef41Sopenharmony_ci # FIXME: That version still under development at the moment of writing. 3311cb0ef41Sopenharmony_ci # Make that this statement remains true also for stable, released 3321cb0ef41Sopenharmony_ci # versions. 3331cb0ef41Sopenharmony_ci # It will wrap lines (doesn't matter whether long or short) with a 3341cb0ef41Sopenharmony_ci # trailing '\', as in: 3351cb0ef41Sopenharmony_ci # 3361cb0ef41Sopenharmony_ci # foo.o : \ 3371cb0ef41Sopenharmony_ci # foo.c \ 3381cb0ef41Sopenharmony_ci # foo.h \ 3391cb0ef41Sopenharmony_ci # 3401cb0ef41Sopenharmony_ci # It will put a trailing '\' even on the last line, and will use leading 3411cb0ef41Sopenharmony_ci # spaces rather than leading tabs (at least since its commit 0394caf7 3421cb0ef41Sopenharmony_ci # "Emit spaces for -MD"). 3431cb0ef41Sopenharmony_ci "$@" -MD -MF "$tmpdepfile" 3441cb0ef41Sopenharmony_ci stat=$? 3451cb0ef41Sopenharmony_ci if test $stat -ne 0; then 3461cb0ef41Sopenharmony_ci rm -f "$tmpdepfile" 3471cb0ef41Sopenharmony_ci exit $stat 3481cb0ef41Sopenharmony_ci fi 3491cb0ef41Sopenharmony_ci rm -f "$depfile" 3501cb0ef41Sopenharmony_ci # Each non-empty line is of the form 'foo.o : \' or ' dep.h \'. 3511cb0ef41Sopenharmony_ci # We have to change lines of the first kind to '$object: \'. 3521cb0ef41Sopenharmony_ci sed -e "s|.*:|$object :|" < "$tmpdepfile" > "$depfile" 3531cb0ef41Sopenharmony_ci # And for each line of the second kind, we have to emit a 'dep.h:' 3541cb0ef41Sopenharmony_ci # dummy dependency, to avoid the deleted-header problem. 3551cb0ef41Sopenharmony_ci sed -n -e 's|^ *\(.*\) *\\$|\1:|p' < "$tmpdepfile" >> "$depfile" 3561cb0ef41Sopenharmony_ci rm -f "$tmpdepfile" 3571cb0ef41Sopenharmony_ci ;; 3581cb0ef41Sopenharmony_ci 3591cb0ef41Sopenharmony_ci## The order of this option in the case statement is important, since the 3601cb0ef41Sopenharmony_ci## shell code in configure will try each of these formats in the order 3611cb0ef41Sopenharmony_ci## listed in this file. A plain '-MD' option would be understood by many 3621cb0ef41Sopenharmony_ci## compilers, so we must ensure this comes after the gcc and icc options. 3631cb0ef41Sopenharmony_cipgcc) 3641cb0ef41Sopenharmony_ci # Portland's C compiler understands '-MD'. 3651cb0ef41Sopenharmony_ci # Will always output deps to 'file.d' where file is the root name of the 3661cb0ef41Sopenharmony_ci # source file under compilation, even if file resides in a subdirectory. 3671cb0ef41Sopenharmony_ci # The object file name does not affect the name of the '.d' file. 3681cb0ef41Sopenharmony_ci # pgcc 10.2 will output 3691cb0ef41Sopenharmony_ci # foo.o: sub/foo.c sub/foo.h 3701cb0ef41Sopenharmony_ci # and will wrap long lines using '\' : 3711cb0ef41Sopenharmony_ci # foo.o: sub/foo.c ... \ 3721cb0ef41Sopenharmony_ci # sub/foo.h ... \ 3731cb0ef41Sopenharmony_ci # ... 3741cb0ef41Sopenharmony_ci set_dir_from "$object" 3751cb0ef41Sopenharmony_ci # Use the source, not the object, to determine the base name, since 3761cb0ef41Sopenharmony_ci # that's sadly what pgcc will do too. 3771cb0ef41Sopenharmony_ci set_base_from "$source" 3781cb0ef41Sopenharmony_ci tmpdepfile=$base.d 3791cb0ef41Sopenharmony_ci 3801cb0ef41Sopenharmony_ci # For projects that build the same source file twice into different object 3811cb0ef41Sopenharmony_ci # files, the pgcc approach of using the *source* file root name can cause 3821cb0ef41Sopenharmony_ci # problems in parallel builds. Use a locking strategy to avoid stomping on 3831cb0ef41Sopenharmony_ci # the same $tmpdepfile. 3841cb0ef41Sopenharmony_ci lockdir=$base.d-lock 3851cb0ef41Sopenharmony_ci trap " 3861cb0ef41Sopenharmony_ci echo '$0: caught signal, cleaning up...' >&2 3871cb0ef41Sopenharmony_ci rmdir '$lockdir' 3881cb0ef41Sopenharmony_ci exit 1 3891cb0ef41Sopenharmony_ci " 1 2 13 15 3901cb0ef41Sopenharmony_ci numtries=100 3911cb0ef41Sopenharmony_ci i=$numtries 3921cb0ef41Sopenharmony_ci while test $i -gt 0; do 3931cb0ef41Sopenharmony_ci # mkdir is a portable test-and-set. 3941cb0ef41Sopenharmony_ci if mkdir "$lockdir" 2>/dev/null; then 3951cb0ef41Sopenharmony_ci # This process acquired the lock. 3961cb0ef41Sopenharmony_ci "$@" -MD 3971cb0ef41Sopenharmony_ci stat=$? 3981cb0ef41Sopenharmony_ci # Release the lock. 3991cb0ef41Sopenharmony_ci rmdir "$lockdir" 4001cb0ef41Sopenharmony_ci break 4011cb0ef41Sopenharmony_ci else 4021cb0ef41Sopenharmony_ci # If the lock is being held by a different process, wait 4031cb0ef41Sopenharmony_ci # until the winning process is done or we timeout. 4041cb0ef41Sopenharmony_ci while test -d "$lockdir" && test $i -gt 0; do 4051cb0ef41Sopenharmony_ci sleep 1 4061cb0ef41Sopenharmony_ci i=`expr $i - 1` 4071cb0ef41Sopenharmony_ci done 4081cb0ef41Sopenharmony_ci fi 4091cb0ef41Sopenharmony_ci i=`expr $i - 1` 4101cb0ef41Sopenharmony_ci done 4111cb0ef41Sopenharmony_ci trap - 1 2 13 15 4121cb0ef41Sopenharmony_ci if test $i -le 0; then 4131cb0ef41Sopenharmony_ci echo "$0: failed to acquire lock after $numtries attempts" >&2 4141cb0ef41Sopenharmony_ci echo "$0: check lockdir '$lockdir'" >&2 4151cb0ef41Sopenharmony_ci exit 1 4161cb0ef41Sopenharmony_ci fi 4171cb0ef41Sopenharmony_ci 4181cb0ef41Sopenharmony_ci if test $stat -ne 0; then 4191cb0ef41Sopenharmony_ci rm -f "$tmpdepfile" 4201cb0ef41Sopenharmony_ci exit $stat 4211cb0ef41Sopenharmony_ci fi 4221cb0ef41Sopenharmony_ci rm -f "$depfile" 4231cb0ef41Sopenharmony_ci # Each line is of the form `foo.o: dependent.h', 4241cb0ef41Sopenharmony_ci # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'. 4251cb0ef41Sopenharmony_ci # Do two passes, one to just change these to 4261cb0ef41Sopenharmony_ci # `$object: dependent.h' and one to simply `dependent.h:'. 4271cb0ef41Sopenharmony_ci sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" 4281cb0ef41Sopenharmony_ci # Some versions of the HPUX 10.20 sed can't process this invocation 4291cb0ef41Sopenharmony_ci # correctly. Breaking it into two sed invocations is a workaround. 4301cb0ef41Sopenharmony_ci sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" \ 4311cb0ef41Sopenharmony_ci | sed -e 's/$/ :/' >> "$depfile" 4321cb0ef41Sopenharmony_ci rm -f "$tmpdepfile" 4331cb0ef41Sopenharmony_ci ;; 4341cb0ef41Sopenharmony_ci 4351cb0ef41Sopenharmony_cihp2) 4361cb0ef41Sopenharmony_ci # The "hp" stanza above does not work with aCC (C++) and HP's ia64 4371cb0ef41Sopenharmony_ci # compilers, which have integrated preprocessors. The correct option 4381cb0ef41Sopenharmony_ci # to use with these is +Maked; it writes dependencies to a file named 4391cb0ef41Sopenharmony_ci # 'foo.d', which lands next to the object file, wherever that 4401cb0ef41Sopenharmony_ci # happens to be. 4411cb0ef41Sopenharmony_ci # Much of this is similar to the tru64 case; see comments there. 4421cb0ef41Sopenharmony_ci set_dir_from "$object" 4431cb0ef41Sopenharmony_ci set_base_from "$object" 4441cb0ef41Sopenharmony_ci if test "$libtool" = yes; then 4451cb0ef41Sopenharmony_ci tmpdepfile1=$dir$base.d 4461cb0ef41Sopenharmony_ci tmpdepfile2=$dir.libs/$base.d 4471cb0ef41Sopenharmony_ci "$@" -Wc,+Maked 4481cb0ef41Sopenharmony_ci else 4491cb0ef41Sopenharmony_ci tmpdepfile1=$dir$base.d 4501cb0ef41Sopenharmony_ci tmpdepfile2=$dir$base.d 4511cb0ef41Sopenharmony_ci "$@" +Maked 4521cb0ef41Sopenharmony_ci fi 4531cb0ef41Sopenharmony_ci stat=$? 4541cb0ef41Sopenharmony_ci if test $stat -ne 0; then 4551cb0ef41Sopenharmony_ci rm -f "$tmpdepfile1" "$tmpdepfile2" 4561cb0ef41Sopenharmony_ci exit $stat 4571cb0ef41Sopenharmony_ci fi 4581cb0ef41Sopenharmony_ci 4591cb0ef41Sopenharmony_ci for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" 4601cb0ef41Sopenharmony_ci do 4611cb0ef41Sopenharmony_ci test -f "$tmpdepfile" && break 4621cb0ef41Sopenharmony_ci done 4631cb0ef41Sopenharmony_ci if test -f "$tmpdepfile"; then 4641cb0ef41Sopenharmony_ci sed -e "s,^.*\.[$lower]*:,$object:," "$tmpdepfile" > "$depfile" 4651cb0ef41Sopenharmony_ci # Add 'dependent.h:' lines. 4661cb0ef41Sopenharmony_ci sed -ne '2,${ 4671cb0ef41Sopenharmony_ci s/^ *// 4681cb0ef41Sopenharmony_ci s/ \\*$// 4691cb0ef41Sopenharmony_ci s/$/:/ 4701cb0ef41Sopenharmony_ci p 4711cb0ef41Sopenharmony_ci }' "$tmpdepfile" >> "$depfile" 4721cb0ef41Sopenharmony_ci else 4731cb0ef41Sopenharmony_ci make_dummy_depfile 4741cb0ef41Sopenharmony_ci fi 4751cb0ef41Sopenharmony_ci rm -f "$tmpdepfile" "$tmpdepfile2" 4761cb0ef41Sopenharmony_ci ;; 4771cb0ef41Sopenharmony_ci 4781cb0ef41Sopenharmony_citru64) 4791cb0ef41Sopenharmony_ci # The Tru64 compiler uses -MD to generate dependencies as a side 4801cb0ef41Sopenharmony_ci # effect. 'cc -MD -o foo.o ...' puts the dependencies into 'foo.o.d'. 4811cb0ef41Sopenharmony_ci # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put 4821cb0ef41Sopenharmony_ci # dependencies in 'foo.d' instead, so we check for that too. 4831cb0ef41Sopenharmony_ci # Subdirectories are respected. 4841cb0ef41Sopenharmony_ci set_dir_from "$object" 4851cb0ef41Sopenharmony_ci set_base_from "$object" 4861cb0ef41Sopenharmony_ci 4871cb0ef41Sopenharmony_ci if test "$libtool" = yes; then 4881cb0ef41Sopenharmony_ci # Libtool generates 2 separate objects for the 2 libraries. These 4891cb0ef41Sopenharmony_ci # two compilations output dependencies in $dir.libs/$base.o.d and 4901cb0ef41Sopenharmony_ci # in $dir$base.o.d. We have to check for both files, because 4911cb0ef41Sopenharmony_ci # one of the two compilations can be disabled. We should prefer 4921cb0ef41Sopenharmony_ci # $dir$base.o.d over $dir.libs/$base.o.d because the latter is 4931cb0ef41Sopenharmony_ci # automatically cleaned when .libs/ is deleted, while ignoring 4941cb0ef41Sopenharmony_ci # the former would cause a distcleancheck panic. 4951cb0ef41Sopenharmony_ci tmpdepfile1=$dir$base.o.d # libtool 1.5 4961cb0ef41Sopenharmony_ci tmpdepfile2=$dir.libs/$base.o.d # Likewise. 4971cb0ef41Sopenharmony_ci tmpdepfile3=$dir.libs/$base.d # Compaq CCC V6.2-504 4981cb0ef41Sopenharmony_ci "$@" -Wc,-MD 4991cb0ef41Sopenharmony_ci else 5001cb0ef41Sopenharmony_ci tmpdepfile1=$dir$base.d 5011cb0ef41Sopenharmony_ci tmpdepfile2=$dir$base.d 5021cb0ef41Sopenharmony_ci tmpdepfile3=$dir$base.d 5031cb0ef41Sopenharmony_ci "$@" -MD 5041cb0ef41Sopenharmony_ci fi 5051cb0ef41Sopenharmony_ci 5061cb0ef41Sopenharmony_ci stat=$? 5071cb0ef41Sopenharmony_ci if test $stat -ne 0; then 5081cb0ef41Sopenharmony_ci rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" 5091cb0ef41Sopenharmony_ci exit $stat 5101cb0ef41Sopenharmony_ci fi 5111cb0ef41Sopenharmony_ci 5121cb0ef41Sopenharmony_ci for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" 5131cb0ef41Sopenharmony_ci do 5141cb0ef41Sopenharmony_ci test -f "$tmpdepfile" && break 5151cb0ef41Sopenharmony_ci done 5161cb0ef41Sopenharmony_ci # Same post-processing that is required for AIX mode. 5171cb0ef41Sopenharmony_ci aix_post_process_depfile 5181cb0ef41Sopenharmony_ci ;; 5191cb0ef41Sopenharmony_ci 5201cb0ef41Sopenharmony_cimsvc7) 5211cb0ef41Sopenharmony_ci if test "$libtool" = yes; then 5221cb0ef41Sopenharmony_ci showIncludes=-Wc,-showIncludes 5231cb0ef41Sopenharmony_ci else 5241cb0ef41Sopenharmony_ci showIncludes=-showIncludes 5251cb0ef41Sopenharmony_ci fi 5261cb0ef41Sopenharmony_ci "$@" $showIncludes > "$tmpdepfile" 5271cb0ef41Sopenharmony_ci stat=$? 5281cb0ef41Sopenharmony_ci grep -v '^Note: including file: ' "$tmpdepfile" 5291cb0ef41Sopenharmony_ci if test $stat -ne 0; then 5301cb0ef41Sopenharmony_ci rm -f "$tmpdepfile" 5311cb0ef41Sopenharmony_ci exit $stat 5321cb0ef41Sopenharmony_ci fi 5331cb0ef41Sopenharmony_ci rm -f "$depfile" 5341cb0ef41Sopenharmony_ci echo "$object : \\" > "$depfile" 5351cb0ef41Sopenharmony_ci # The first sed program below extracts the file names and escapes 5361cb0ef41Sopenharmony_ci # backslashes for cygpath. The second sed program outputs the file 5371cb0ef41Sopenharmony_ci # name when reading, but also accumulates all include files in the 5381cb0ef41Sopenharmony_ci # hold buffer in order to output them again at the end. This only 5391cb0ef41Sopenharmony_ci # works with sed implementations that can handle large buffers. 5401cb0ef41Sopenharmony_ci sed < "$tmpdepfile" -n ' 5411cb0ef41Sopenharmony_ci/^Note: including file: *\(.*\)/ { 5421cb0ef41Sopenharmony_ci s//\1/ 5431cb0ef41Sopenharmony_ci s/\\/\\\\/g 5441cb0ef41Sopenharmony_ci p 5451cb0ef41Sopenharmony_ci}' | $cygpath_u | sort -u | sed -n ' 5461cb0ef41Sopenharmony_cis/ /\\ /g 5471cb0ef41Sopenharmony_cis/\(.*\)/'"$tab"'\1 \\/p 5481cb0ef41Sopenharmony_cis/.\(.*\) \\/\1:/ 5491cb0ef41Sopenharmony_ciH 5501cb0ef41Sopenharmony_ci$ { 5511cb0ef41Sopenharmony_ci s/.*/'"$tab"'/ 5521cb0ef41Sopenharmony_ci G 5531cb0ef41Sopenharmony_ci p 5541cb0ef41Sopenharmony_ci}' >> "$depfile" 5551cb0ef41Sopenharmony_ci echo >> "$depfile" # make sure the fragment doesn't end with a backslash 5561cb0ef41Sopenharmony_ci rm -f "$tmpdepfile" 5571cb0ef41Sopenharmony_ci ;; 5581cb0ef41Sopenharmony_ci 5591cb0ef41Sopenharmony_cimsvc7msys) 5601cb0ef41Sopenharmony_ci # This case exists only to let depend.m4 do its work. It works by 5611cb0ef41Sopenharmony_ci # looking at the text of this script. This case will never be run, 5621cb0ef41Sopenharmony_ci # since it is checked for above. 5631cb0ef41Sopenharmony_ci exit 1 5641cb0ef41Sopenharmony_ci ;; 5651cb0ef41Sopenharmony_ci 5661cb0ef41Sopenharmony_ci#nosideeffect) 5671cb0ef41Sopenharmony_ci # This comment above is used by automake to tell side-effect 5681cb0ef41Sopenharmony_ci # dependency tracking mechanisms from slower ones. 5691cb0ef41Sopenharmony_ci 5701cb0ef41Sopenharmony_cidashmstdout) 5711cb0ef41Sopenharmony_ci # Important note: in order to support this mode, a compiler *must* 5721cb0ef41Sopenharmony_ci # always write the preprocessed file to stdout, regardless of -o. 5731cb0ef41Sopenharmony_ci "$@" || exit $? 5741cb0ef41Sopenharmony_ci 5751cb0ef41Sopenharmony_ci # Remove the call to Libtool. 5761cb0ef41Sopenharmony_ci if test "$libtool" = yes; then 5771cb0ef41Sopenharmony_ci while test "X$1" != 'X--mode=compile'; do 5781cb0ef41Sopenharmony_ci shift 5791cb0ef41Sopenharmony_ci done 5801cb0ef41Sopenharmony_ci shift 5811cb0ef41Sopenharmony_ci fi 5821cb0ef41Sopenharmony_ci 5831cb0ef41Sopenharmony_ci # Remove '-o $object'. 5841cb0ef41Sopenharmony_ci IFS=" " 5851cb0ef41Sopenharmony_ci for arg 5861cb0ef41Sopenharmony_ci do 5871cb0ef41Sopenharmony_ci case $arg in 5881cb0ef41Sopenharmony_ci -o) 5891cb0ef41Sopenharmony_ci shift 5901cb0ef41Sopenharmony_ci ;; 5911cb0ef41Sopenharmony_ci $object) 5921cb0ef41Sopenharmony_ci shift 5931cb0ef41Sopenharmony_ci ;; 5941cb0ef41Sopenharmony_ci *) 5951cb0ef41Sopenharmony_ci set fnord "$@" "$arg" 5961cb0ef41Sopenharmony_ci shift # fnord 5971cb0ef41Sopenharmony_ci shift # $arg 5981cb0ef41Sopenharmony_ci ;; 5991cb0ef41Sopenharmony_ci esac 6001cb0ef41Sopenharmony_ci done 6011cb0ef41Sopenharmony_ci 6021cb0ef41Sopenharmony_ci test -z "$dashmflag" && dashmflag=-M 6031cb0ef41Sopenharmony_ci # Require at least two characters before searching for ':' 6041cb0ef41Sopenharmony_ci # in the target name. This is to cope with DOS-style filenames: 6051cb0ef41Sopenharmony_ci # a dependency such as 'c:/foo/bar' could be seen as target 'c' otherwise. 6061cb0ef41Sopenharmony_ci "$@" $dashmflag | 6071cb0ef41Sopenharmony_ci sed "s|^[$tab ]*[^:$tab ][^:][^:]*:[$tab ]*|$object: |" > "$tmpdepfile" 6081cb0ef41Sopenharmony_ci rm -f "$depfile" 6091cb0ef41Sopenharmony_ci cat < "$tmpdepfile" > "$depfile" 6101cb0ef41Sopenharmony_ci # Some versions of the HPUX 10.20 sed can't process this sed invocation 6111cb0ef41Sopenharmony_ci # correctly. Breaking it into two sed invocations is a workaround. 6121cb0ef41Sopenharmony_ci tr ' ' "$nl" < "$tmpdepfile" \ 6131cb0ef41Sopenharmony_ci | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \ 6141cb0ef41Sopenharmony_ci | sed -e 's/$/ :/' >> "$depfile" 6151cb0ef41Sopenharmony_ci rm -f "$tmpdepfile" 6161cb0ef41Sopenharmony_ci ;; 6171cb0ef41Sopenharmony_ci 6181cb0ef41Sopenharmony_cidashXmstdout) 6191cb0ef41Sopenharmony_ci # This case only exists to satisfy depend.m4. It is never actually 6201cb0ef41Sopenharmony_ci # run, as this mode is specially recognized in the preamble. 6211cb0ef41Sopenharmony_ci exit 1 6221cb0ef41Sopenharmony_ci ;; 6231cb0ef41Sopenharmony_ci 6241cb0ef41Sopenharmony_cimakedepend) 6251cb0ef41Sopenharmony_ci "$@" || exit $? 6261cb0ef41Sopenharmony_ci # Remove any Libtool call 6271cb0ef41Sopenharmony_ci if test "$libtool" = yes; then 6281cb0ef41Sopenharmony_ci while test "X$1" != 'X--mode=compile'; do 6291cb0ef41Sopenharmony_ci shift 6301cb0ef41Sopenharmony_ci done 6311cb0ef41Sopenharmony_ci shift 6321cb0ef41Sopenharmony_ci fi 6331cb0ef41Sopenharmony_ci # X makedepend 6341cb0ef41Sopenharmony_ci shift 6351cb0ef41Sopenharmony_ci cleared=no eat=no 6361cb0ef41Sopenharmony_ci for arg 6371cb0ef41Sopenharmony_ci do 6381cb0ef41Sopenharmony_ci case $cleared in 6391cb0ef41Sopenharmony_ci no) 6401cb0ef41Sopenharmony_ci set ""; shift 6411cb0ef41Sopenharmony_ci cleared=yes ;; 6421cb0ef41Sopenharmony_ci esac 6431cb0ef41Sopenharmony_ci if test $eat = yes; then 6441cb0ef41Sopenharmony_ci eat=no 6451cb0ef41Sopenharmony_ci continue 6461cb0ef41Sopenharmony_ci fi 6471cb0ef41Sopenharmony_ci case "$arg" in 6481cb0ef41Sopenharmony_ci -D*|-I*) 6491cb0ef41Sopenharmony_ci set fnord "$@" "$arg"; shift ;; 6501cb0ef41Sopenharmony_ci # Strip any option that makedepend may not understand. Remove 6511cb0ef41Sopenharmony_ci # the object too, otherwise makedepend will parse it as a source file. 6521cb0ef41Sopenharmony_ci -arch) 6531cb0ef41Sopenharmony_ci eat=yes ;; 6541cb0ef41Sopenharmony_ci -*|$object) 6551cb0ef41Sopenharmony_ci ;; 6561cb0ef41Sopenharmony_ci *) 6571cb0ef41Sopenharmony_ci set fnord "$@" "$arg"; shift ;; 6581cb0ef41Sopenharmony_ci esac 6591cb0ef41Sopenharmony_ci done 6601cb0ef41Sopenharmony_ci obj_suffix=`echo "$object" | sed 's/^.*\././'` 6611cb0ef41Sopenharmony_ci touch "$tmpdepfile" 6621cb0ef41Sopenharmony_ci ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" 6631cb0ef41Sopenharmony_ci rm -f "$depfile" 6641cb0ef41Sopenharmony_ci # makedepend may prepend the VPATH from the source file name to the object. 6651cb0ef41Sopenharmony_ci # No need to regex-escape $object, excess matching of '.' is harmless. 6661cb0ef41Sopenharmony_ci sed "s|^.*\($object *:\)|\1|" "$tmpdepfile" > "$depfile" 6671cb0ef41Sopenharmony_ci # Some versions of the HPUX 10.20 sed can't process the last invocation 6681cb0ef41Sopenharmony_ci # correctly. Breaking it into two sed invocations is a workaround. 6691cb0ef41Sopenharmony_ci sed '1,2d' "$tmpdepfile" \ 6701cb0ef41Sopenharmony_ci | tr ' ' "$nl" \ 6711cb0ef41Sopenharmony_ci | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \ 6721cb0ef41Sopenharmony_ci | sed -e 's/$/ :/' >> "$depfile" 6731cb0ef41Sopenharmony_ci rm -f "$tmpdepfile" "$tmpdepfile".bak 6741cb0ef41Sopenharmony_ci ;; 6751cb0ef41Sopenharmony_ci 6761cb0ef41Sopenharmony_cicpp) 6771cb0ef41Sopenharmony_ci # Important note: in order to support this mode, a compiler *must* 6781cb0ef41Sopenharmony_ci # always write the preprocessed file to stdout. 6791cb0ef41Sopenharmony_ci "$@" || exit $? 6801cb0ef41Sopenharmony_ci 6811cb0ef41Sopenharmony_ci # Remove the call to Libtool. 6821cb0ef41Sopenharmony_ci if test "$libtool" = yes; then 6831cb0ef41Sopenharmony_ci while test "X$1" != 'X--mode=compile'; do 6841cb0ef41Sopenharmony_ci shift 6851cb0ef41Sopenharmony_ci done 6861cb0ef41Sopenharmony_ci shift 6871cb0ef41Sopenharmony_ci fi 6881cb0ef41Sopenharmony_ci 6891cb0ef41Sopenharmony_ci # Remove '-o $object'. 6901cb0ef41Sopenharmony_ci IFS=" " 6911cb0ef41Sopenharmony_ci for arg 6921cb0ef41Sopenharmony_ci do 6931cb0ef41Sopenharmony_ci case $arg in 6941cb0ef41Sopenharmony_ci -o) 6951cb0ef41Sopenharmony_ci shift 6961cb0ef41Sopenharmony_ci ;; 6971cb0ef41Sopenharmony_ci $object) 6981cb0ef41Sopenharmony_ci shift 6991cb0ef41Sopenharmony_ci ;; 7001cb0ef41Sopenharmony_ci *) 7011cb0ef41Sopenharmony_ci set fnord "$@" "$arg" 7021cb0ef41Sopenharmony_ci shift # fnord 7031cb0ef41Sopenharmony_ci shift # $arg 7041cb0ef41Sopenharmony_ci ;; 7051cb0ef41Sopenharmony_ci esac 7061cb0ef41Sopenharmony_ci done 7071cb0ef41Sopenharmony_ci 7081cb0ef41Sopenharmony_ci "$@" -E \ 7091cb0ef41Sopenharmony_ci | sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ 7101cb0ef41Sopenharmony_ci -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ 7111cb0ef41Sopenharmony_ci | sed '$ s: \\$::' > "$tmpdepfile" 7121cb0ef41Sopenharmony_ci rm -f "$depfile" 7131cb0ef41Sopenharmony_ci echo "$object : \\" > "$depfile" 7141cb0ef41Sopenharmony_ci cat < "$tmpdepfile" >> "$depfile" 7151cb0ef41Sopenharmony_ci sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" 7161cb0ef41Sopenharmony_ci rm -f "$tmpdepfile" 7171cb0ef41Sopenharmony_ci ;; 7181cb0ef41Sopenharmony_ci 7191cb0ef41Sopenharmony_cimsvisualcpp) 7201cb0ef41Sopenharmony_ci # Important note: in order to support this mode, a compiler *must* 7211cb0ef41Sopenharmony_ci # always write the preprocessed file to stdout. 7221cb0ef41Sopenharmony_ci "$@" || exit $? 7231cb0ef41Sopenharmony_ci 7241cb0ef41Sopenharmony_ci # Remove the call to Libtool. 7251cb0ef41Sopenharmony_ci if test "$libtool" = yes; then 7261cb0ef41Sopenharmony_ci while test "X$1" != 'X--mode=compile'; do 7271cb0ef41Sopenharmony_ci shift 7281cb0ef41Sopenharmony_ci done 7291cb0ef41Sopenharmony_ci shift 7301cb0ef41Sopenharmony_ci fi 7311cb0ef41Sopenharmony_ci 7321cb0ef41Sopenharmony_ci IFS=" " 7331cb0ef41Sopenharmony_ci for arg 7341cb0ef41Sopenharmony_ci do 7351cb0ef41Sopenharmony_ci case "$arg" in 7361cb0ef41Sopenharmony_ci -o) 7371cb0ef41Sopenharmony_ci shift 7381cb0ef41Sopenharmony_ci ;; 7391cb0ef41Sopenharmony_ci $object) 7401cb0ef41Sopenharmony_ci shift 7411cb0ef41Sopenharmony_ci ;; 7421cb0ef41Sopenharmony_ci "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") 7431cb0ef41Sopenharmony_ci set fnord "$@" 7441cb0ef41Sopenharmony_ci shift 7451cb0ef41Sopenharmony_ci shift 7461cb0ef41Sopenharmony_ci ;; 7471cb0ef41Sopenharmony_ci *) 7481cb0ef41Sopenharmony_ci set fnord "$@" "$arg" 7491cb0ef41Sopenharmony_ci shift 7501cb0ef41Sopenharmony_ci shift 7511cb0ef41Sopenharmony_ci ;; 7521cb0ef41Sopenharmony_ci esac 7531cb0ef41Sopenharmony_ci done 7541cb0ef41Sopenharmony_ci "$@" -E 2>/dev/null | 7551cb0ef41Sopenharmony_ci sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile" 7561cb0ef41Sopenharmony_ci rm -f "$depfile" 7571cb0ef41Sopenharmony_ci echo "$object : \\" > "$depfile" 7581cb0ef41Sopenharmony_ci sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::'"$tab"'\1 \\:p' >> "$depfile" 7591cb0ef41Sopenharmony_ci echo "$tab" >> "$depfile" 7601cb0ef41Sopenharmony_ci sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile" 7611cb0ef41Sopenharmony_ci rm -f "$tmpdepfile" 7621cb0ef41Sopenharmony_ci ;; 7631cb0ef41Sopenharmony_ci 7641cb0ef41Sopenharmony_cimsvcmsys) 7651cb0ef41Sopenharmony_ci # This case exists only to let depend.m4 do its work. It works by 7661cb0ef41Sopenharmony_ci # looking at the text of this script. This case will never be run, 7671cb0ef41Sopenharmony_ci # since it is checked for above. 7681cb0ef41Sopenharmony_ci exit 1 7691cb0ef41Sopenharmony_ci ;; 7701cb0ef41Sopenharmony_ci 7711cb0ef41Sopenharmony_cinone) 7721cb0ef41Sopenharmony_ci exec "$@" 7731cb0ef41Sopenharmony_ci ;; 7741cb0ef41Sopenharmony_ci 7751cb0ef41Sopenharmony_ci*) 7761cb0ef41Sopenharmony_ci echo "Unknown depmode $depmode" 1>&2 7771cb0ef41Sopenharmony_ci exit 1 7781cb0ef41Sopenharmony_ci ;; 7791cb0ef41Sopenharmony_ciesac 7801cb0ef41Sopenharmony_ci 7811cb0ef41Sopenharmony_ciexit 0 7821cb0ef41Sopenharmony_ci 7831cb0ef41Sopenharmony_ci# Local Variables: 7841cb0ef41Sopenharmony_ci# mode: shell-script 7851cb0ef41Sopenharmony_ci# sh-indentation: 2 7861cb0ef41Sopenharmony_ci# eval: (add-hook 'before-save-hook 'time-stamp) 7871cb0ef41Sopenharmony_ci# time-stamp-start: "scriptversion=" 7881cb0ef41Sopenharmony_ci# time-stamp-format: "%:y-%02m-%02d.%02H" 7891cb0ef41Sopenharmony_ci# time-stamp-time-zone: "UTC0" 7901cb0ef41Sopenharmony_ci# time-stamp-end: "; # UTC" 7911cb0ef41Sopenharmony_ci# End: 792