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