depcomp revision 1b8adde7ba7d5e04395c141c5400dc2cffd7d809
0N/A# depcomp - compile a program generating dependencies as side-effects 0N/A# Copyright (C) 1999, 2000, 2003, 2004 Free Software Foundation, Inc. 0N/A# This program is free software; you can redistribute it and/or modify 0N/A# it under the terms of the GNU General Public License as published by 0N/A# the Free Software Foundation; either version 2, or (at your option) 0N/A# This program is distributed in the hope that it will be useful, 0N/A# but WITHOUT ANY WARRANTY; without even the implied warranty of 0N/A# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0N/A# GNU General Public License for more details. 0N/A# You should have received a copy of the GNU General Public License 873N/A# along with this program; if not, write to the Free Software 0N/A# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 0N/A# As a special exception to the GNU General Public License, if you 0N/A# distribute this file as part of a program that contains a 3231N/A# configuration script generated by Autoconf, you may include it under 0N/A# the same distribution terms that you use for the rest of that program. 0N/A# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>. 0N/A echo "$0: No command. Try \`$0 --help' for more information." 1>&
2 0N/A object Object file output by `PROGRAMS ARGS'. 2095N/A echo "depcomp: Variables source, object and depmode must be set" 1>&2 1400N/A# Some modes work just like other modes, but use different flags. We 0N/A# parameterize here, but still list the modes in the big case below, 0N/A# to make depend.m4 easier to write. Note that we *cannot* use a case 0N/A# here, because this file can only contain one case statement. 0N/A # HP compiler uses -M and no extra arg. 0N/A # This is just like dashmstdout with a different argument. 0N/A## gcc 3 implements dependency tracking that does exactly what 0N/A## we want. Yay! Note: for some reason libtool 1.4 doesn't like 0N/A## it if -MD -MP comes after the -MF stuff. Hmm. 0N/A## There are various ways to get dependency output from gcc. Here's 0N/A## why we pick this rather obscure method: 0N/A## - Don't want to use -MD because we'd like the dependencies to end 0N/A## up in a subdir. Having to rename by hand is ugly. 0N/A## (We might end up doing this anyway to support other compilers.) 0N/A## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like 0N/A## -MM, not -M (despite what the docs say). 0N/A## - Using -M directly means running the compiler twice (even worse 0N/A## The second -e expression handles DOS-style file names with drive letters. 0N/A## This next piece of magic avoids the `deleted header file' problem. 0N/A## The problem is that when a header file which appears in a .P file 0N/A## is deleted, the dependency causes make to die (because there is 0N/A## typically no way to rebuild the header). We avoid this by adding 0N/A## dummy dependencies for each header file. Too bad gcc doesn't do 0N/A## this for us directly. 0N/A## Some versions of gcc put a space before the `:'. On the theory 0N/A## that the space means something, we add a space to the output as 0N/A## Some versions of the HPUX 10.20 sed can't process this invocation 0N/A## correctly. Breaking it into two sed invocations is a workaround. 0N/A # This case exists only to let depend.m4 do its work. It works by 0N/A # looking at the text of this script. This case will never be run, 0N/A # since it is checked for above. 0N/A if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files 0N/A # Clip off the initial element (the dependent). Don't try to be 0N/A # clever and replace this with sed code, as IRIX sed won't handle 0N/A # lines with more than a fixed number of characters (4096 in 0N/A # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; 0N/A # the IRIX cc adds comments like `#:fec' to the end of the 0N/A | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \ 0N/A # The second pass generates a dummy entry for each header file. 0N/A | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ 0N/A # The sourcefile does not contain any dependencies, so just 0N/A # store a dummy comment line, to avoid errors with the Makefile 0N/A # The C for AIX Compiler uses -M and outputs the dependencies 0N/A # in a .u file. In older versions, this file always lives in the 0N/A # current directory. Also, the AIX compiler puts `$object:' at the 0N/A # start of each line; $object doesn't have directory information. 0N/A # Version 6 uses the directory in both cases. 0N/A # Do two passes, one to just change these to 0N/A # The sourcefile does not contain any dependencies, so just 0N/A # store a dummy comment line, to avoid errors with the Makefile 0N/A # Intel's C compiler understands `-MD -MF file'. However on 0N/A # ICC 7.0 will fill foo.d with something like 3853N/A # and will wrap long lines using \ : 0N/A # Do two passes, one to just change these to 0N/A # Some versions of the HPUX 10.20 sed can't process this invocation 0N/A # correctly. Breaking it into two sed invocations is a workaround. 0N/A # The Tru64 compiler uses -MD to generate dependencies as a side 0N/A # dependencies in `foo.d' instead, so we check for that too. 0N/A # Subdirectories are respected. 0N/A # Dependencies are output in .lo.d with libtool 1.4. 0N/A # latter, because the former will be cleaned when $dir.libs is 0N/A # That's a tab and a space in the []. 0N/A # This comment above is used by automake to tell side-effect 0N/A # dependency tracking mechanisms from slower ones. 0N/A # Important note: in order to support this mode, a compiler *must* 0N/A # always write the preprocessed file to stdout, regardless of -o. 0N/A # Remove the call to Libtool. 0N/A while test $1 != '--mode=compile'; do 0N/A # Remove `-o $object'. 0N/A # Require at least two characters before searching for `:' 0N/A # in the target name. This is to cope with DOS-style filenames: 0N/A # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise. 0N/A## Some versions of the HPUX 10.20 sed can't process this invocation 0N/A## correctly. Breaking it into two sed invocations is a workaround. 0N/A # This case only exists to satisfy depend.m4. It is never actually 0N/A # run, as this mode is specially recognized in the preamble. 2464N/A while test $1 != '--mode=compile'; do 2464N/A # Strip any option that makedepend may not understand. Remove 2464N/A # the object too, otherwise makedepend will parse it as a source file. 2464N/A## Some versions of the HPUX 10.20 sed can't process this invocation 2464N/A## correctly. Breaking it into two sed invocations is a workaround. 0N/A # Important note: in order to support this mode, a compiler *must* 0N/A # always write the preprocessed file to stdout. 0N/A # Remove the call to Libtool. 0N/A while test $1 != '--mode=compile'; do 0N/A # Remove `-o $object'. 0N/A sed -n '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' | 0N/A # Important note: in order to support this mode, a compiler *must* 0N/A # always write the preprocessed file to stdout, regardless of -o, 0N/A # because we must use -o when running libtool. 0N/A "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") 0N/A# eval: (add-hook 'write-file-hooks 'time-stamp) 0N/A# time-stamp-start: "scriptversion=" 0N/A# time-stamp-format: "%:y-%02m-%02d.%02H" 0N/A# time-stamp-end: "$"