annotate depcomp @ 177:d340e9c8191f 2.2

Added autotool files for releae
author lost
date Wed, 04 Mar 2009 03:44:49 +0000
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
177
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
1 #! /bin/sh
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
2 # depcomp - compile a program generating dependencies as side-effects
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
3
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
4 scriptversion=2005-07-09.11
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
5
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
6 # Copyright (C) 1999, 2000, 2003, 2004, 2005 Free Software Foundation, Inc.
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
7
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
8 # This program is free software; you can redistribute it and/or modify
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
9 # it under the terms of the GNU General Public License as published by
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
10 # the Free Software Foundation; either version 2, or (at your option)
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
11 # any later version.
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
12
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
13 # This program is distributed in the hope that it will be useful,
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
16 # GNU General Public License for more details.
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
17
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
18 # You should have received a copy of the GNU General Public License
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
19 # along with this program; if not, write to the Free Software
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
20 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
21 # 02110-1301, USA.
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
22
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
23 # As a special exception to the GNU General Public License, if you
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
24 # distribute this file as part of a program that contains a
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
25 # configuration script generated by Autoconf, you may include it under
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
26 # the same distribution terms that you use for the rest of that program.
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
27
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
28 # Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>.
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
29
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
30 case $1 in
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
31 '')
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
32 echo "$0: No command. Try \`$0 --help' for more information." 1>&2
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
33 exit 1;
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
34 ;;
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
35 -h | --h*)
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
36 cat <<\EOF
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
37 Usage: depcomp [--help] [--version] PROGRAM [ARGS]
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
38
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
39 Run PROGRAMS ARGS to compile a file, generating dependencies
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
40 as side-effects.
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
41
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
42 Environment variables:
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
43 depmode Dependency tracking mode.
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
44 source Source file read by `PROGRAMS ARGS'.
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
45 object Object file output by `PROGRAMS ARGS'.
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
46 DEPDIR directory where to store dependencies.
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
47 depfile Dependency file to output.
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
48 tmpdepfile Temporary file to use when outputing dependencies.
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
49 libtool Whether libtool is used (yes/no).
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
50
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
51 Report bugs to <bug-automake@gnu.org>.
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
52 EOF
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
53 exit $?
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
54 ;;
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
55 -v | --v*)
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
56 echo "depcomp $scriptversion"
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
57 exit $?
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
58 ;;
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
59 esac
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
60
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
61 if test -z "$depmode" || test -z "$source" || test -z "$object"; then
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
62 echo "depcomp: Variables source, object and depmode must be set" 1>&2
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
63 exit 1
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
64 fi
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
65
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
66 # Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po.
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
67 depfile=${depfile-`echo "$object" |
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
68 sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`}
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
69 tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
70
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
71 rm -f "$tmpdepfile"
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
72
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
73 # Some modes work just like other modes, but use different flags. We
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
74 # parameterize here, but still list the modes in the big case below,
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
75 # to make depend.m4 easier to write. Note that we *cannot* use a case
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
76 # here, because this file can only contain one case statement.
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
77 if test "$depmode" = hp; then
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
78 # HP compiler uses -M and no extra arg.
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
79 gccflag=-M
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
80 depmode=gcc
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
81 fi
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
82
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
83 if test "$depmode" = dashXmstdout; then
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
84 # This is just like dashmstdout with a different argument.
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
85 dashmflag=-xM
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
86 depmode=dashmstdout
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
87 fi
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
88
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
89 case "$depmode" in
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
90 gcc3)
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
91 ## gcc 3 implements dependency tracking that does exactly what
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
92 ## we want. Yay! Note: for some reason libtool 1.4 doesn't like
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
93 ## it if -MD -MP comes after the -MF stuff. Hmm.
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
94 "$@" -MT "$object" -MD -MP -MF "$tmpdepfile"
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
95 stat=$?
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
96 if test $stat -eq 0; then :
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
97 else
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
98 rm -f "$tmpdepfile"
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
99 exit $stat
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
100 fi
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
101 mv "$tmpdepfile" "$depfile"
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
102 ;;
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
103
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
104 gcc)
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
105 ## There are various ways to get dependency output from gcc. Here's
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
106 ## why we pick this rather obscure method:
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
107 ## - Don't want to use -MD because we'd like the dependencies to end
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
108 ## up in a subdir. Having to rename by hand is ugly.
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
109 ## (We might end up doing this anyway to support other compilers.)
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
110 ## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
111 ## -MM, not -M (despite what the docs say).
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
112 ## - Using -M directly means running the compiler twice (even worse
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
113 ## than renaming).
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
114 if test -z "$gccflag"; then
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
115 gccflag=-MD,
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
116 fi
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
117 "$@" -Wp,"$gccflag$tmpdepfile"
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
118 stat=$?
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
119 if test $stat -eq 0; then :
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
120 else
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
121 rm -f "$tmpdepfile"
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
122 exit $stat
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
123 fi
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
124 rm -f "$depfile"
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
125 echo "$object : \\" > "$depfile"
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
126 alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
127 ## The second -e expression handles DOS-style file names with drive letters.
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
128 sed -e 's/^[^:]*: / /' \
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
129 -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
130 ## This next piece of magic avoids the `deleted header file' problem.
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
131 ## The problem is that when a header file which appears in a .P file
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
132 ## is deleted, the dependency causes make to die (because there is
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
133 ## typically no way to rebuild the header). We avoid this by adding
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
134 ## dummy dependencies for each header file. Too bad gcc doesn't do
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
135 ## this for us directly.
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
136 tr ' ' '
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
137 ' < "$tmpdepfile" |
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
138 ## Some versions of gcc put a space before the `:'. On the theory
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
139 ## that the space means something, we add a space to the output as
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
140 ## well.
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
141 ## Some versions of the HPUX 10.20 sed can't process this invocation
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
142 ## correctly. Breaking it into two sed invocations is a workaround.
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
143 sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
144 rm -f "$tmpdepfile"
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
145 ;;
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
146
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
147 hp)
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
148 # This case exists only to let depend.m4 do its work. It works by
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
149 # looking at the text of this script. This case will never be run,
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
150 # since it is checked for above.
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
151 exit 1
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
152 ;;
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
153
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
154 sgi)
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
155 if test "$libtool" = yes; then
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
156 "$@" "-Wp,-MDupdate,$tmpdepfile"
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
157 else
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
158 "$@" -MDupdate "$tmpdepfile"
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
159 fi
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
160 stat=$?
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
161 if test $stat -eq 0; then :
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
162 else
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
163 rm -f "$tmpdepfile"
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
164 exit $stat
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
165 fi
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
166 rm -f "$depfile"
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
167
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
168 if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
169 echo "$object : \\" > "$depfile"
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
170
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
171 # Clip off the initial element (the dependent). Don't try to be
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
172 # clever and replace this with sed code, as IRIX sed won't handle
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
173 # lines with more than a fixed number of characters (4096 in
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
174 # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines;
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
175 # the IRIX cc adds comments like `#:fec' to the end of the
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
176 # dependency line.
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
177 tr ' ' '
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
178 ' < "$tmpdepfile" \
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
179 | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
180 tr '
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
181 ' ' ' >> $depfile
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
182 echo >> $depfile
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
183
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
184 # The second pass generates a dummy entry for each header file.
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
185 tr ' ' '
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
186 ' < "$tmpdepfile" \
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
187 | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
188 >> $depfile
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
189 else
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
190 # The sourcefile does not contain any dependencies, so just
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
191 # store a dummy comment line, to avoid errors with the Makefile
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
192 # "include basename.Plo" scheme.
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
193 echo "#dummy" > "$depfile"
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
194 fi
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
195 rm -f "$tmpdepfile"
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
196 ;;
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
197
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
198 aix)
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
199 # The C for AIX Compiler uses -M and outputs the dependencies
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
200 # in a .u file. In older versions, this file always lives in the
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
201 # current directory. Also, the AIX compiler puts `$object:' at the
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
202 # start of each line; $object doesn't have directory information.
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
203 # Version 6 uses the directory in both cases.
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
204 stripped=`echo "$object" | sed 's/\(.*\)\..*$/\1/'`
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
205 tmpdepfile="$stripped.u"
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
206 if test "$libtool" = yes; then
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
207 "$@" -Wc,-M
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
208 else
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
209 "$@" -M
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
210 fi
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
211 stat=$?
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
212
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
213 if test -f "$tmpdepfile"; then :
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
214 else
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
215 stripped=`echo "$stripped" | sed 's,^.*/,,'`
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
216 tmpdepfile="$stripped.u"
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
217 fi
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
218
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
219 if test $stat -eq 0; then :
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
220 else
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
221 rm -f "$tmpdepfile"
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
222 exit $stat
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
223 fi
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
224
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
225 if test -f "$tmpdepfile"; then
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
226 outname="$stripped.o"
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
227 # Each line is of the form `foo.o: dependent.h'.
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
228 # Do two passes, one to just change these to
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
229 # `$object: dependent.h' and one to simply `dependent.h:'.
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
230 sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile"
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
231 sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile"
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
232 else
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
233 # The sourcefile does not contain any dependencies, so just
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
234 # store a dummy comment line, to avoid errors with the Makefile
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
235 # "include basename.Plo" scheme.
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
236 echo "#dummy" > "$depfile"
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
237 fi
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
238 rm -f "$tmpdepfile"
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
239 ;;
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
240
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
241 icc)
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
242 # Intel's C compiler understands `-MD -MF file'. However on
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
243 # icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
244 # ICC 7.0 will fill foo.d with something like
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
245 # foo.o: sub/foo.c
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
246 # foo.o: sub/foo.h
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
247 # which is wrong. We want:
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
248 # sub/foo.o: sub/foo.c
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
249 # sub/foo.o: sub/foo.h
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
250 # sub/foo.c:
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
251 # sub/foo.h:
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
252 # ICC 7.1 will output
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
253 # foo.o: sub/foo.c sub/foo.h
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
254 # and will wrap long lines using \ :
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
255 # foo.o: sub/foo.c ... \
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
256 # sub/foo.h ... \
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
257 # ...
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
258
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
259 "$@" -MD -MF "$tmpdepfile"
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
260 stat=$?
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
261 if test $stat -eq 0; then :
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
262 else
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
263 rm -f "$tmpdepfile"
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
264 exit $stat
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
265 fi
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
266 rm -f "$depfile"
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
267 # Each line is of the form `foo.o: dependent.h',
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
268 # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'.
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
269 # Do two passes, one to just change these to
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
270 # `$object: dependent.h' and one to simply `dependent.h:'.
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
271 sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
272 # Some versions of the HPUX 10.20 sed can't process this invocation
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
273 # correctly. Breaking it into two sed invocations is a workaround.
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
274 sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" |
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
275 sed -e 's/$/ :/' >> "$depfile"
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
276 rm -f "$tmpdepfile"
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
277 ;;
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
278
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
279 tru64)
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
280 # The Tru64 compiler uses -MD to generate dependencies as a side
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
281 # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'.
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
282 # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
283 # dependencies in `foo.d' instead, so we check for that too.
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
284 # Subdirectories are respected.
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
285 dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
286 test "x$dir" = "x$object" && dir=
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
287 base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
288
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
289 if test "$libtool" = yes; then
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
290 # With Tru64 cc, shared objects can also be used to make a
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
291 # static library. This mecanism is used in libtool 1.4 series to
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
292 # handle both shared and static libraries in a single compilation.
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
293 # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d.
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
294 #
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
295 # With libtool 1.5 this exception was removed, and libtool now
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
296 # generates 2 separate objects for the 2 libraries. These two
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
297 # compilations output dependencies in in $dir.libs/$base.o.d and
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
298 # in $dir$base.o.d. We have to check for both files, because
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
299 # one of the two compilations can be disabled. We should prefer
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
300 # $dir$base.o.d over $dir.libs/$base.o.d because the latter is
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
301 # automatically cleaned when .libs/ is deleted, while ignoring
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
302 # the former would cause a distcleancheck panic.
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
303 tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
304 tmpdepfile2=$dir$base.o.d # libtool 1.5
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
305 tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
306 tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
307 "$@" -Wc,-MD
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
308 else
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
309 tmpdepfile1=$dir$base.o.d
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
310 tmpdepfile2=$dir$base.d
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
311 tmpdepfile3=$dir$base.d
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
312 tmpdepfile4=$dir$base.d
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
313 "$@" -MD
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
314 fi
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
315
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
316 stat=$?
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
317 if test $stat -eq 0; then :
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
318 else
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
319 rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
320 exit $stat
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
321 fi
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
322
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
323 for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
324 do
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
325 test -f "$tmpdepfile" && break
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
326 done
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
327 if test -f "$tmpdepfile"; then
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
328 sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
329 # That's a tab and a space in the [].
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
330 sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
331 else
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
332 echo "#dummy" > "$depfile"
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
333 fi
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
334 rm -f "$tmpdepfile"
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
335 ;;
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
336
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
337 #nosideeffect)
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
338 # This comment above is used by automake to tell side-effect
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
339 # dependency tracking mechanisms from slower ones.
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
340
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
341 dashmstdout)
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
342 # Important note: in order to support this mode, a compiler *must*
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
343 # always write the preprocessed file to stdout, regardless of -o.
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
344 "$@" || exit $?
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
345
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
346 # Remove the call to Libtool.
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
347 if test "$libtool" = yes; then
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
348 while test $1 != '--mode=compile'; do
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
349 shift
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
350 done
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
351 shift
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
352 fi
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
353
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
354 # Remove `-o $object'.
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
355 IFS=" "
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
356 for arg
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
357 do
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
358 case $arg in
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
359 -o)
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
360 shift
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
361 ;;
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
362 $object)
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
363 shift
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
364 ;;
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
365 *)
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
366 set fnord "$@" "$arg"
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
367 shift # fnord
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
368 shift # $arg
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
369 ;;
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
370 esac
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
371 done
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
372
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
373 test -z "$dashmflag" && dashmflag=-M
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
374 # Require at least two characters before searching for `:'
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
375 # in the target name. This is to cope with DOS-style filenames:
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
376 # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise.
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
377 "$@" $dashmflag |
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
378 sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile"
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
379 rm -f "$depfile"
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
380 cat < "$tmpdepfile" > "$depfile"
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
381 tr ' ' '
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
382 ' < "$tmpdepfile" | \
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
383 ## Some versions of the HPUX 10.20 sed can't process this invocation
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
384 ## correctly. Breaking it into two sed invocations is a workaround.
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
385 sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
386 rm -f "$tmpdepfile"
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
387 ;;
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
388
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
389 dashXmstdout)
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
390 # This case only exists to satisfy depend.m4. It is never actually
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
391 # run, as this mode is specially recognized in the preamble.
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
392 exit 1
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
393 ;;
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
394
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
395 makedepend)
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
396 "$@" || exit $?
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
397 # Remove any Libtool call
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
398 if test "$libtool" = yes; then
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
399 while test $1 != '--mode=compile'; do
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
400 shift
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
401 done
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
402 shift
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
403 fi
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
404 # X makedepend
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
405 shift
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
406 cleared=no
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
407 for arg in "$@"; do
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
408 case $cleared in
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
409 no)
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
410 set ""; shift
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
411 cleared=yes ;;
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
412 esac
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
413 case "$arg" in
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
414 -D*|-I*)
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
415 set fnord "$@" "$arg"; shift ;;
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
416 # Strip any option that makedepend may not understand. Remove
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
417 # the object too, otherwise makedepend will parse it as a source file.
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
418 -*|$object)
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
419 ;;
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
420 *)
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
421 set fnord "$@" "$arg"; shift ;;
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
422 esac
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
423 done
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
424 obj_suffix="`echo $object | sed 's/^.*\././'`"
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
425 touch "$tmpdepfile"
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
426 ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
427 rm -f "$depfile"
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
428 cat < "$tmpdepfile" > "$depfile"
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
429 sed '1,2d' "$tmpdepfile" | tr ' ' '
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
430 ' | \
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
431 ## Some versions of the HPUX 10.20 sed can't process this invocation
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
432 ## correctly. Breaking it into two sed invocations is a workaround.
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
433 sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
434 rm -f "$tmpdepfile" "$tmpdepfile".bak
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
435 ;;
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
436
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
437 cpp)
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
438 # Important note: in order to support this mode, a compiler *must*
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
439 # always write the preprocessed file to stdout.
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
440 "$@" || exit $?
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
441
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
442 # Remove the call to Libtool.
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
443 if test "$libtool" = yes; then
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
444 while test $1 != '--mode=compile'; do
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
445 shift
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
446 done
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
447 shift
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
448 fi
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
449
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
450 # Remove `-o $object'.
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
451 IFS=" "
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
452 for arg
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
453 do
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
454 case $arg in
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
455 -o)
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
456 shift
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
457 ;;
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
458 $object)
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
459 shift
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
460 ;;
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
461 *)
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
462 set fnord "$@" "$arg"
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
463 shift # fnord
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
464 shift # $arg
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
465 ;;
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
466 esac
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
467 done
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
468
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
469 "$@" -E |
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
470 sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
471 -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
472 sed '$ s: \\$::' > "$tmpdepfile"
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
473 rm -f "$depfile"
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
474 echo "$object : \\" > "$depfile"
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
475 cat < "$tmpdepfile" >> "$depfile"
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
476 sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile"
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
477 rm -f "$tmpdepfile"
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
478 ;;
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
479
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
480 msvisualcpp)
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
481 # Important note: in order to support this mode, a compiler *must*
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
482 # always write the preprocessed file to stdout, regardless of -o,
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
483 # because we must use -o when running libtool.
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
484 "$@" || exit $?
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
485 IFS=" "
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
486 for arg
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
487 do
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
488 case "$arg" in
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
489 "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
490 set fnord "$@"
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
491 shift
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
492 shift
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
493 ;;
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
494 *)
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
495 set fnord "$@" "$arg"
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
496 shift
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
497 shift
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
498 ;;
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
499 esac
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
500 done
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
501 "$@" -E |
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
502 sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile"
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
503 rm -f "$depfile"
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
504 echo "$object : \\" > "$depfile"
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
505 . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile"
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
506 echo " " >> "$depfile"
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
507 . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile"
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
508 rm -f "$tmpdepfile"
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
509 ;;
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
510
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
511 none)
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
512 exec "$@"
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
513 ;;
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
514
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
515 *)
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
516 echo "Unknown depmode $depmode" 1>&2
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
517 exit 1
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
518 ;;
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
519 esac
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
520
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
521 exit 0
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
522
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
523 # Local Variables:
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
524 # mode: shell-script
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
525 # sh-indentation: 2
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
526 # eval: (add-hook 'write-file-hooks 'time-stamp)
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
527 # time-stamp-start: "scriptversion="
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
528 # time-stamp-format: "%:y-%02m-%02d.%02H"
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
529 # time-stamp-end: "$"
d340e9c8191f Added autotool files for releae
lost
parents:
diff changeset
530 # End: