annotate depcomp @ 7:7e50d576470d 1.0 1.0 1.1

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