annotate depcomp @ 138:fc828634a951

merge
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Thu, 08 Nov 2018 14:17:14 +0900
parents 04ced10e8804
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1 #! /bin/sh
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2 # depcomp - compile a program generating dependencies as side-effects
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
3
111
kono
parents: 55
diff changeset
4 scriptversion=2013-05-30.07; # UTC
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
5
111
kono
parents: 55
diff changeset
6 # Copyright (C) 1999-2014 Free Software Foundation, Inc.
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
7
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
8 # This program is free software; you can redistribute it and/or modify
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
9 # it under the terms of the GNU General Public License as published by
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
10 # the Free Software Foundation; either version 2, or (at your option)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
11 # any later version.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
12
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
13 # This program is distributed in the hope that it will be useful,
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
16 # GNU General Public License for more details.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
17
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
18 # You should have received a copy of the GNU General Public License
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
19 # along with this program. If not, see <http://www.gnu.org/licenses/>.
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
20
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
21 # As a special exception to the GNU General Public License, if you
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
22 # distribute this file as part of a program that contains a
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
23 # configuration script generated by Autoconf, you may include it under
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
24 # the same distribution terms that you use for the rest of that program.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
25
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
26 # Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
27
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
28 case $1 in
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
29 '')
111
kono
parents: 55
diff changeset
30 echo "$0: No command. Try '$0 --help' for more information." 1>&2
kono
parents: 55
diff changeset
31 exit 1;
kono
parents: 55
diff changeset
32 ;;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
33 -h | --h*)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
34 cat <<\EOF
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
35 Usage: depcomp [--help] [--version] PROGRAM [ARGS]
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
36
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
37 Run PROGRAMS ARGS to compile a file, generating dependencies
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
38 as side-effects.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
39
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
40 Environment variables:
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
41 depmode Dependency tracking mode.
111
kono
parents: 55
diff changeset
42 source Source file read by 'PROGRAMS ARGS'.
kono
parents: 55
diff changeset
43 object Object file output by 'PROGRAMS ARGS'.
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
44 DEPDIR directory where to store dependencies.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
45 depfile Dependency file to output.
111
kono
parents: 55
diff changeset
46 tmpdepfile Temporary file to use when outputting dependencies.
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
47 libtool Whether libtool is used (yes/no).
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
48
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
49 Report bugs to <bug-automake@gnu.org>.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
50 EOF
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
51 exit $?
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
52 ;;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
53 -v | --v*)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
54 echo "depcomp $scriptversion"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
55 exit $?
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
56 ;;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
57 esac
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
58
111
kono
parents: 55
diff changeset
59 # Get the directory component of the given path, and save it in the
kono
parents: 55
diff changeset
60 # global variables '$dir'. Note that this directory component will
kono
parents: 55
diff changeset
61 # be either empty or ending with a '/' character. This is deliberate.
kono
parents: 55
diff changeset
62 set_dir_from ()
kono
parents: 55
diff changeset
63 {
kono
parents: 55
diff changeset
64 case $1 in
kono
parents: 55
diff changeset
65 */*) dir=`echo "$1" | sed -e 's|/[^/]*$|/|'`;;
kono
parents: 55
diff changeset
66 *) dir=;;
kono
parents: 55
diff changeset
67 esac
kono
parents: 55
diff changeset
68 }
kono
parents: 55
diff changeset
69
kono
parents: 55
diff changeset
70 # Get the suffix-stripped basename of the given path, and save it the
kono
parents: 55
diff changeset
71 # global variable '$base'.
kono
parents: 55
diff changeset
72 set_base_from ()
kono
parents: 55
diff changeset
73 {
kono
parents: 55
diff changeset
74 base=`echo "$1" | sed -e 's|^.*/||' -e 's/\.[^.]*$//'`
kono
parents: 55
diff changeset
75 }
kono
parents: 55
diff changeset
76
kono
parents: 55
diff changeset
77 # If no dependency file was actually created by the compiler invocation,
kono
parents: 55
diff changeset
78 # we still have to create a dummy depfile, to avoid errors with the
kono
parents: 55
diff changeset
79 # Makefile "include basename.Plo" scheme.
kono
parents: 55
diff changeset
80 make_dummy_depfile ()
kono
parents: 55
diff changeset
81 {
kono
parents: 55
diff changeset
82 echo "#dummy" > "$depfile"
kono
parents: 55
diff changeset
83 }
kono
parents: 55
diff changeset
84
kono
parents: 55
diff changeset
85 # Factor out some common post-processing of the generated depfile.
kono
parents: 55
diff changeset
86 # Requires the auxiliary global variable '$tmpdepfile' to be set.
kono
parents: 55
diff changeset
87 aix_post_process_depfile ()
kono
parents: 55
diff changeset
88 {
kono
parents: 55
diff changeset
89 # If the compiler actually managed to produce a dependency file,
kono
parents: 55
diff changeset
90 # post-process it.
kono
parents: 55
diff changeset
91 if test -f "$tmpdepfile"; then
kono
parents: 55
diff changeset
92 # Each line is of the form 'foo.o: dependency.h'.
kono
parents: 55
diff changeset
93 # Do two passes, one to just change these to
kono
parents: 55
diff changeset
94 # $object: dependency.h
kono
parents: 55
diff changeset
95 # and one to simply output
kono
parents: 55
diff changeset
96 # dependency.h:
kono
parents: 55
diff changeset
97 # which is needed to avoid the deleted-header problem.
kono
parents: 55
diff changeset
98 { sed -e "s,^.*\.[$lower]*:,$object:," < "$tmpdepfile"
kono
parents: 55
diff changeset
99 sed -e "s,^.*\.[$lower]*:[$tab ]*,," -e 's,$,:,' < "$tmpdepfile"
kono
parents: 55
diff changeset
100 } > "$depfile"
kono
parents: 55
diff changeset
101 rm -f "$tmpdepfile"
kono
parents: 55
diff changeset
102 else
kono
parents: 55
diff changeset
103 make_dummy_depfile
kono
parents: 55
diff changeset
104 fi
kono
parents: 55
diff changeset
105 }
kono
parents: 55
diff changeset
106
kono
parents: 55
diff changeset
107 # A tabulation character.
kono
parents: 55
diff changeset
108 tab=' '
kono
parents: 55
diff changeset
109 # A newline character.
kono
parents: 55
diff changeset
110 nl='
kono
parents: 55
diff changeset
111 '
kono
parents: 55
diff changeset
112 # Character ranges might be problematic outside the C locale.
kono
parents: 55
diff changeset
113 # These definitions help.
kono
parents: 55
diff changeset
114 upper=ABCDEFGHIJKLMNOPQRSTUVWXYZ
kono
parents: 55
diff changeset
115 lower=abcdefghijklmnopqrstuvwxyz
kono
parents: 55
diff changeset
116 digits=0123456789
kono
parents: 55
diff changeset
117 alpha=${upper}${lower}
kono
parents: 55
diff changeset
118
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
119 if test -z "$depmode" || test -z "$source" || test -z "$object"; then
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
120 echo "depcomp: Variables source, object and depmode must be set" 1>&2
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
121 exit 1
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
122 fi
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
123
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
124 # Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
125 depfile=${depfile-`echo "$object" |
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
126 sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`}
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
127 tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
128
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
129 rm -f "$tmpdepfile"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
130
111
kono
parents: 55
diff changeset
131 # Avoid interferences from the environment.
kono
parents: 55
diff changeset
132 gccflag= dashmflag=
kono
parents: 55
diff changeset
133
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
134 # Some modes work just like other modes, but use different flags. We
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
135 # parameterize here, but still list the modes in the big case below,
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
136 # to make depend.m4 easier to write. Note that we *cannot* use a case
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
137 # here, because this file can only contain one case statement.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
138 if test "$depmode" = hp; then
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
139 # HP compiler uses -M and no extra arg.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
140 gccflag=-M
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
141 depmode=gcc
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
142 fi
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
143
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
144 if test "$depmode" = dashXmstdout; then
111
kono
parents: 55
diff changeset
145 # This is just like dashmstdout with a different argument.
kono
parents: 55
diff changeset
146 dashmflag=-xM
kono
parents: 55
diff changeset
147 depmode=dashmstdout
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
148 fi
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
149
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
150 cygpath_u="cygpath -u -f -"
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
151 if test "$depmode" = msvcmsys; then
111
kono
parents: 55
diff changeset
152 # This is just like msvisualcpp but w/o cygpath translation.
kono
parents: 55
diff changeset
153 # Just convert the backslash-escaped backslashes to single forward
kono
parents: 55
diff changeset
154 # slashes to satisfy depend.m4
kono
parents: 55
diff changeset
155 cygpath_u='sed s,\\\\,/,g'
kono
parents: 55
diff changeset
156 depmode=msvisualcpp
kono
parents: 55
diff changeset
157 fi
kono
parents: 55
diff changeset
158
kono
parents: 55
diff changeset
159 if test "$depmode" = msvc7msys; then
kono
parents: 55
diff changeset
160 # This is just like msvc7 but w/o cygpath translation.
kono
parents: 55
diff changeset
161 # Just convert the backslash-escaped backslashes to single forward
kono
parents: 55
diff changeset
162 # slashes to satisfy depend.m4
kono
parents: 55
diff changeset
163 cygpath_u='sed s,\\\\,/,g'
kono
parents: 55
diff changeset
164 depmode=msvc7
kono
parents: 55
diff changeset
165 fi
kono
parents: 55
diff changeset
166
kono
parents: 55
diff changeset
167 if test "$depmode" = xlc; then
kono
parents: 55
diff changeset
168 # IBM C/C++ Compilers xlc/xlC can output gcc-like dependency information.
kono
parents: 55
diff changeset
169 gccflag=-qmakedep=gcc,-MF
kono
parents: 55
diff changeset
170 depmode=gcc
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
171 fi
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
172
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
173 case "$depmode" in
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
174 gcc3)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
175 ## gcc 3 implements dependency tracking that does exactly what
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
176 ## we want. Yay! Note: for some reason libtool 1.4 doesn't like
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
177 ## it if -MD -MP comes after the -MF stuff. Hmm.
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
178 ## Unfortunately, FreeBSD c89 acceptance of flags depends upon
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
179 ## the command line argument order; so add the flags where they
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
180 ## appear in depend2.am. Note that the slowdown incurred here
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
181 ## affects only configure: in makefiles, %FASTDEP% shortcuts this.
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
182 for arg
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
183 do
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
184 case $arg in
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
185 -c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;;
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
186 *) set fnord "$@" "$arg" ;;
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
187 esac
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
188 shift # fnord
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
189 shift # $arg
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
190 done
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
191 "$@"
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
192 stat=$?
111
kono
parents: 55
diff changeset
193 if test $stat -ne 0; then
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
194 rm -f "$tmpdepfile"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
195 exit $stat
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
196 fi
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
197 mv "$tmpdepfile" "$depfile"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
198 ;;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
199
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
200 gcc)
111
kono
parents: 55
diff changeset
201 ## Note that this doesn't just cater to obsosete pre-3.x GCC compilers.
kono
parents: 55
diff changeset
202 ## but also to in-use compilers like IMB xlc/xlC and the HP C compiler.
kono
parents: 55
diff changeset
203 ## (see the conditional assignment to $gccflag above).
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
204 ## There are various ways to get dependency output from gcc. Here's
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
205 ## why we pick this rather obscure method:
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
206 ## - Don't want to use -MD because we'd like the dependencies to end
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
207 ## up in a subdir. Having to rename by hand is ugly.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
208 ## (We might end up doing this anyway to support other compilers.)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
209 ## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
111
kono
parents: 55
diff changeset
210 ## -MM, not -M (despite what the docs say). Also, it might not be
kono
parents: 55
diff changeset
211 ## supported by the other compilers which use the 'gcc' depmode.
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
212 ## - Using -M directly means running the compiler twice (even worse
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
213 ## than renaming).
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
214 if test -z "$gccflag"; then
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
215 gccflag=-MD,
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
216 fi
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
217 "$@" -Wp,"$gccflag$tmpdepfile"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
218 stat=$?
111
kono
parents: 55
diff changeset
219 if test $stat -ne 0; then
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
220 rm -f "$tmpdepfile"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
221 exit $stat
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
222 fi
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
223 rm -f "$depfile"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
224 echo "$object : \\" > "$depfile"
111
kono
parents: 55
diff changeset
225 # The second -e expression handles DOS-style file names with drive
kono
parents: 55
diff changeset
226 # letters.
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
227 sed -e 's/^[^:]*: / /' \
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
228 -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
111
kono
parents: 55
diff changeset
229 ## This next piece of magic avoids the "deleted header file" problem.
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
230 ## The problem is that when a header file which appears in a .P file
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
231 ## is deleted, the dependency causes make to die (because there is
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
232 ## typically no way to rebuild the header). We avoid this by adding
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
233 ## dummy dependencies for each header file. Too bad gcc doesn't do
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
234 ## this for us directly.
111
kono
parents: 55
diff changeset
235 ## Some versions of gcc put a space before the ':'. On the theory
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
236 ## that the space means something, we add a space to the output as
111
kono
parents: 55
diff changeset
237 ## well. hp depmode also adds that space, but also prefixes the VPATH
kono
parents: 55
diff changeset
238 ## to the object. Take care to not repeat it in the output.
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
239 ## Some versions of the HPUX 10.20 sed can't process this invocation
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
240 ## correctly. Breaking it into two sed invocations is a workaround.
111
kono
parents: 55
diff changeset
241 tr ' ' "$nl" < "$tmpdepfile" \
kono
parents: 55
diff changeset
242 | sed -e 's/^\\$//' -e '/^$/d' -e "s|.*$object$||" -e '/:$/d' \
kono
parents: 55
diff changeset
243 | sed -e 's/$/ :/' >> "$depfile"
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
244 rm -f "$tmpdepfile"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
245 ;;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
246
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
247 hp)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
248 # This case exists only to let depend.m4 do its work. It works by
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
249 # looking at the text of this script. This case will never be run,
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
250 # since it is checked for above.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
251 exit 1
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
252 ;;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
253
111
kono
parents: 55
diff changeset
254 xlc)
kono
parents: 55
diff changeset
255 # This case exists only to let depend.m4 do its work. It works by
kono
parents: 55
diff changeset
256 # looking at the text of this script. This case will never be run,
kono
parents: 55
diff changeset
257 # since it is checked for above.
kono
parents: 55
diff changeset
258 exit 1
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
259 ;;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
260
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
261 aix)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
262 # The C for AIX Compiler uses -M and outputs the dependencies
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
263 # in a .u file. In older versions, this file always lives in the
111
kono
parents: 55
diff changeset
264 # current directory. Also, the AIX compiler puts '$object:' at the
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
265 # start of each line; $object doesn't have directory information.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
266 # Version 6 uses the directory in both cases.
111
kono
parents: 55
diff changeset
267 set_dir_from "$object"
kono
parents: 55
diff changeset
268 set_base_from "$object"
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
269 if test "$libtool" = yes; then
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
270 tmpdepfile1=$dir$base.u
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
271 tmpdepfile2=$base.u
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
272 tmpdepfile3=$dir.libs/$base.u
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
273 "$@" -Wc,-M
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
274 else
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
275 tmpdepfile1=$dir$base.u
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
276 tmpdepfile2=$dir$base.u
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
277 tmpdepfile3=$dir$base.u
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
278 "$@" -M
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
279 fi
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
280 stat=$?
111
kono
parents: 55
diff changeset
281 if test $stat -ne 0; then
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
282 rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
283 exit $stat
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
284 fi
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
285
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
286 for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
287 do
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
288 test -f "$tmpdepfile" && break
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
289 done
111
kono
parents: 55
diff changeset
290 aix_post_process_depfile
kono
parents: 55
diff changeset
291 ;;
kono
parents: 55
diff changeset
292
kono
parents: 55
diff changeset
293 tcc)
kono
parents: 55
diff changeset
294 # tcc (Tiny C Compiler) understand '-MD -MF file' since version 0.9.26
kono
parents: 55
diff changeset
295 # FIXME: That version still under development at the moment of writing.
kono
parents: 55
diff changeset
296 # Make that this statement remains true also for stable, released
kono
parents: 55
diff changeset
297 # versions.
kono
parents: 55
diff changeset
298 # It will wrap lines (doesn't matter whether long or short) with a
kono
parents: 55
diff changeset
299 # trailing '\', as in:
kono
parents: 55
diff changeset
300 #
kono
parents: 55
diff changeset
301 # foo.o : \
kono
parents: 55
diff changeset
302 # foo.c \
kono
parents: 55
diff changeset
303 # foo.h \
kono
parents: 55
diff changeset
304 #
kono
parents: 55
diff changeset
305 # It will put a trailing '\' even on the last line, and will use leading
kono
parents: 55
diff changeset
306 # spaces rather than leading tabs (at least since its commit 0394caf7
kono
parents: 55
diff changeset
307 # "Emit spaces for -MD").
kono
parents: 55
diff changeset
308 "$@" -MD -MF "$tmpdepfile"
kono
parents: 55
diff changeset
309 stat=$?
kono
parents: 55
diff changeset
310 if test $stat -ne 0; then
kono
parents: 55
diff changeset
311 rm -f "$tmpdepfile"
kono
parents: 55
diff changeset
312 exit $stat
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
313 fi
111
kono
parents: 55
diff changeset
314 rm -f "$depfile"
kono
parents: 55
diff changeset
315 # Each non-empty line is of the form 'foo.o : \' or ' dep.h \'.
kono
parents: 55
diff changeset
316 # We have to change lines of the first kind to '$object: \'.
kono
parents: 55
diff changeset
317 sed -e "s|.*:|$object :|" < "$tmpdepfile" > "$depfile"
kono
parents: 55
diff changeset
318 # And for each line of the second kind, we have to emit a 'dep.h:'
kono
parents: 55
diff changeset
319 # dummy dependency, to avoid the deleted-header problem.
kono
parents: 55
diff changeset
320 sed -n -e 's|^ *\(.*\) *\\$|\1:|p' < "$tmpdepfile" >> "$depfile"
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
321 rm -f "$tmpdepfile"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
322 ;;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
323
111
kono
parents: 55
diff changeset
324 ## The order of this option in the case statement is important, since the
kono
parents: 55
diff changeset
325 ## shell code in configure will try each of these formats in the order
kono
parents: 55
diff changeset
326 ## listed in this file. A plain '-MD' option would be understood by many
kono
parents: 55
diff changeset
327 ## compilers, so we must ensure this comes after the gcc and icc options.
kono
parents: 55
diff changeset
328 pgcc)
kono
parents: 55
diff changeset
329 # Portland's C compiler understands '-MD'.
kono
parents: 55
diff changeset
330 # Will always output deps to 'file.d' where file is the root name of the
kono
parents: 55
diff changeset
331 # source file under compilation, even if file resides in a subdirectory.
kono
parents: 55
diff changeset
332 # The object file name does not affect the name of the '.d' file.
kono
parents: 55
diff changeset
333 # pgcc 10.2 will output
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
334 # foo.o: sub/foo.c sub/foo.h
111
kono
parents: 55
diff changeset
335 # and will wrap long lines using '\' :
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
336 # foo.o: sub/foo.c ... \
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
337 # sub/foo.h ... \
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
338 # ...
111
kono
parents: 55
diff changeset
339 set_dir_from "$object"
kono
parents: 55
diff changeset
340 # Use the source, not the object, to determine the base name, since
kono
parents: 55
diff changeset
341 # that's sadly what pgcc will do too.
kono
parents: 55
diff changeset
342 set_base_from "$source"
kono
parents: 55
diff changeset
343 tmpdepfile=$base.d
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
344
111
kono
parents: 55
diff changeset
345 # For projects that build the same source file twice into different object
kono
parents: 55
diff changeset
346 # files, the pgcc approach of using the *source* file root name can cause
kono
parents: 55
diff changeset
347 # problems in parallel builds. Use a locking strategy to avoid stomping on
kono
parents: 55
diff changeset
348 # the same $tmpdepfile.
kono
parents: 55
diff changeset
349 lockdir=$base.d-lock
kono
parents: 55
diff changeset
350 trap "
kono
parents: 55
diff changeset
351 echo '$0: caught signal, cleaning up...' >&2
kono
parents: 55
diff changeset
352 rmdir '$lockdir'
kono
parents: 55
diff changeset
353 exit 1
kono
parents: 55
diff changeset
354 " 1 2 13 15
kono
parents: 55
diff changeset
355 numtries=100
kono
parents: 55
diff changeset
356 i=$numtries
kono
parents: 55
diff changeset
357 while test $i -gt 0; do
kono
parents: 55
diff changeset
358 # mkdir is a portable test-and-set.
kono
parents: 55
diff changeset
359 if mkdir "$lockdir" 2>/dev/null; then
kono
parents: 55
diff changeset
360 # This process acquired the lock.
kono
parents: 55
diff changeset
361 "$@" -MD
kono
parents: 55
diff changeset
362 stat=$?
kono
parents: 55
diff changeset
363 # Release the lock.
kono
parents: 55
diff changeset
364 rmdir "$lockdir"
kono
parents: 55
diff changeset
365 break
kono
parents: 55
diff changeset
366 else
kono
parents: 55
diff changeset
367 # If the lock is being held by a different process, wait
kono
parents: 55
diff changeset
368 # until the winning process is done or we timeout.
kono
parents: 55
diff changeset
369 while test -d "$lockdir" && test $i -gt 0; do
kono
parents: 55
diff changeset
370 sleep 1
kono
parents: 55
diff changeset
371 i=`expr $i - 1`
kono
parents: 55
diff changeset
372 done
kono
parents: 55
diff changeset
373 fi
kono
parents: 55
diff changeset
374 i=`expr $i - 1`
kono
parents: 55
diff changeset
375 done
kono
parents: 55
diff changeset
376 trap - 1 2 13 15
kono
parents: 55
diff changeset
377 if test $i -le 0; then
kono
parents: 55
diff changeset
378 echo "$0: failed to acquire lock after $numtries attempts" >&2
kono
parents: 55
diff changeset
379 echo "$0: check lockdir '$lockdir'" >&2
kono
parents: 55
diff changeset
380 exit 1
kono
parents: 55
diff changeset
381 fi
kono
parents: 55
diff changeset
382
kono
parents: 55
diff changeset
383 if test $stat -ne 0; then
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
384 rm -f "$tmpdepfile"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
385 exit $stat
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
386 fi
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
387 rm -f "$depfile"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
388 # Each line is of the form `foo.o: dependent.h',
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
389 # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
390 # Do two passes, one to just change these to
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
391 # `$object: dependent.h' and one to simply `dependent.h:'.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
392 sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
393 # Some versions of the HPUX 10.20 sed can't process this invocation
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
394 # correctly. Breaking it into two sed invocations is a workaround.
111
kono
parents: 55
diff changeset
395 sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" \
kono
parents: 55
diff changeset
396 | sed -e 's/$/ :/' >> "$depfile"
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
397 rm -f "$tmpdepfile"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
398 ;;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
399
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
400 hp2)
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
401 # The "hp" stanza above does not work with aCC (C++) and HP's ia64
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
402 # compilers, which have integrated preprocessors. The correct option
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
403 # to use with these is +Maked; it writes dependencies to a file named
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
404 # 'foo.d', which lands next to the object file, wherever that
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
405 # happens to be.
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
406 # Much of this is similar to the tru64 case; see comments there.
111
kono
parents: 55
diff changeset
407 set_dir_from "$object"
kono
parents: 55
diff changeset
408 set_base_from "$object"
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
409 if test "$libtool" = yes; then
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
410 tmpdepfile1=$dir$base.d
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
411 tmpdepfile2=$dir.libs/$base.d
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
412 "$@" -Wc,+Maked
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
413 else
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
414 tmpdepfile1=$dir$base.d
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
415 tmpdepfile2=$dir$base.d
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
416 "$@" +Maked
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
417 fi
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
418 stat=$?
111
kono
parents: 55
diff changeset
419 if test $stat -ne 0; then
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
420 rm -f "$tmpdepfile1" "$tmpdepfile2"
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
421 exit $stat
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
422 fi
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
423
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
424 for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2"
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
425 do
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
426 test -f "$tmpdepfile" && break
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
427 done
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
428 if test -f "$tmpdepfile"; then
111
kono
parents: 55
diff changeset
429 sed -e "s,^.*\.[$lower]*:,$object:," "$tmpdepfile" > "$depfile"
kono
parents: 55
diff changeset
430 # Add 'dependent.h:' lines.
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
431 sed -ne '2,${
111
kono
parents: 55
diff changeset
432 s/^ *//
kono
parents: 55
diff changeset
433 s/ \\*$//
kono
parents: 55
diff changeset
434 s/$/:/
kono
parents: 55
diff changeset
435 p
kono
parents: 55
diff changeset
436 }' "$tmpdepfile" >> "$depfile"
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
437 else
111
kono
parents: 55
diff changeset
438 make_dummy_depfile
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
439 fi
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
440 rm -f "$tmpdepfile" "$tmpdepfile2"
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
441 ;;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
442
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
443 tru64)
111
kono
parents: 55
diff changeset
444 # The Tru64 compiler uses -MD to generate dependencies as a side
kono
parents: 55
diff changeset
445 # effect. 'cc -MD -o foo.o ...' puts the dependencies into 'foo.o.d'.
kono
parents: 55
diff changeset
446 # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
kono
parents: 55
diff changeset
447 # dependencies in 'foo.d' instead, so we check for that too.
kono
parents: 55
diff changeset
448 # Subdirectories are respected.
kono
parents: 55
diff changeset
449 set_dir_from "$object"
kono
parents: 55
diff changeset
450 set_base_from "$object"
kono
parents: 55
diff changeset
451
kono
parents: 55
diff changeset
452 if test "$libtool" = yes; then
kono
parents: 55
diff changeset
453 # Libtool generates 2 separate objects for the 2 libraries. These
kono
parents: 55
diff changeset
454 # two compilations output dependencies in $dir.libs/$base.o.d and
kono
parents: 55
diff changeset
455 # in $dir$base.o.d. We have to check for both files, because
kono
parents: 55
diff changeset
456 # one of the two compilations can be disabled. We should prefer
kono
parents: 55
diff changeset
457 # $dir$base.o.d over $dir.libs/$base.o.d because the latter is
kono
parents: 55
diff changeset
458 # automatically cleaned when .libs/ is deleted, while ignoring
kono
parents: 55
diff changeset
459 # the former would cause a distcleancheck panic.
kono
parents: 55
diff changeset
460 tmpdepfile1=$dir$base.o.d # libtool 1.5
kono
parents: 55
diff changeset
461 tmpdepfile2=$dir.libs/$base.o.d # Likewise.
kono
parents: 55
diff changeset
462 tmpdepfile3=$dir.libs/$base.d # Compaq CCC V6.2-504
kono
parents: 55
diff changeset
463 "$@" -Wc,-MD
kono
parents: 55
diff changeset
464 else
kono
parents: 55
diff changeset
465 tmpdepfile1=$dir$base.d
kono
parents: 55
diff changeset
466 tmpdepfile2=$dir$base.d
kono
parents: 55
diff changeset
467 tmpdepfile3=$dir$base.d
kono
parents: 55
diff changeset
468 "$@" -MD
kono
parents: 55
diff changeset
469 fi
kono
parents: 55
diff changeset
470
kono
parents: 55
diff changeset
471 stat=$?
kono
parents: 55
diff changeset
472 if test $stat -ne 0; then
kono
parents: 55
diff changeset
473 rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
kono
parents: 55
diff changeset
474 exit $stat
kono
parents: 55
diff changeset
475 fi
kono
parents: 55
diff changeset
476
kono
parents: 55
diff changeset
477 for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
kono
parents: 55
diff changeset
478 do
kono
parents: 55
diff changeset
479 test -f "$tmpdepfile" && break
kono
parents: 55
diff changeset
480 done
kono
parents: 55
diff changeset
481 # Same post-processing that is required for AIX mode.
kono
parents: 55
diff changeset
482 aix_post_process_depfile
kono
parents: 55
diff changeset
483 ;;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
484
111
kono
parents: 55
diff changeset
485 msvc7)
kono
parents: 55
diff changeset
486 if test "$libtool" = yes; then
kono
parents: 55
diff changeset
487 showIncludes=-Wc,-showIncludes
kono
parents: 55
diff changeset
488 else
kono
parents: 55
diff changeset
489 showIncludes=-showIncludes
kono
parents: 55
diff changeset
490 fi
kono
parents: 55
diff changeset
491 "$@" $showIncludes > "$tmpdepfile"
kono
parents: 55
diff changeset
492 stat=$?
kono
parents: 55
diff changeset
493 grep -v '^Note: including file: ' "$tmpdepfile"
kono
parents: 55
diff changeset
494 if test $stat -ne 0; then
kono
parents: 55
diff changeset
495 rm -f "$tmpdepfile"
kono
parents: 55
diff changeset
496 exit $stat
kono
parents: 55
diff changeset
497 fi
kono
parents: 55
diff changeset
498 rm -f "$depfile"
kono
parents: 55
diff changeset
499 echo "$object : \\" > "$depfile"
kono
parents: 55
diff changeset
500 # The first sed program below extracts the file names and escapes
kono
parents: 55
diff changeset
501 # backslashes for cygpath. The second sed program outputs the file
kono
parents: 55
diff changeset
502 # name when reading, but also accumulates all include files in the
kono
parents: 55
diff changeset
503 # hold buffer in order to output them again at the end. This only
kono
parents: 55
diff changeset
504 # works with sed implementations that can handle large buffers.
kono
parents: 55
diff changeset
505 sed < "$tmpdepfile" -n '
kono
parents: 55
diff changeset
506 /^Note: including file: *\(.*\)/ {
kono
parents: 55
diff changeset
507 s//\1/
kono
parents: 55
diff changeset
508 s/\\/\\\\/g
kono
parents: 55
diff changeset
509 p
kono
parents: 55
diff changeset
510 }' | $cygpath_u | sort -u | sed -n '
kono
parents: 55
diff changeset
511 s/ /\\ /g
kono
parents: 55
diff changeset
512 s/\(.*\)/'"$tab"'\1 \\/p
kono
parents: 55
diff changeset
513 s/.\(.*\) \\/\1:/
kono
parents: 55
diff changeset
514 H
kono
parents: 55
diff changeset
515 $ {
kono
parents: 55
diff changeset
516 s/.*/'"$tab"'/
kono
parents: 55
diff changeset
517 G
kono
parents: 55
diff changeset
518 p
kono
parents: 55
diff changeset
519 }' >> "$depfile"
kono
parents: 55
diff changeset
520 echo >> "$depfile" # make sure the fragment doesn't end with a backslash
kono
parents: 55
diff changeset
521 rm -f "$tmpdepfile"
kono
parents: 55
diff changeset
522 ;;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
523
111
kono
parents: 55
diff changeset
524 msvc7msys)
kono
parents: 55
diff changeset
525 # This case exists only to let depend.m4 do its work. It works by
kono
parents: 55
diff changeset
526 # looking at the text of this script. This case will never be run,
kono
parents: 55
diff changeset
527 # since it is checked for above.
kono
parents: 55
diff changeset
528 exit 1
kono
parents: 55
diff changeset
529 ;;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
530
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
531 #nosideeffect)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
532 # This comment above is used by automake to tell side-effect
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
533 # dependency tracking mechanisms from slower ones.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
534
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
535 dashmstdout)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
536 # Important note: in order to support this mode, a compiler *must*
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
537 # always write the preprocessed file to stdout, regardless of -o.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
538 "$@" || exit $?
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
539
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
540 # Remove the call to Libtool.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
541 if test "$libtool" = yes; then
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
542 while test "X$1" != 'X--mode=compile'; do
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
543 shift
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
544 done
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
545 shift
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
546 fi
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
547
111
kono
parents: 55
diff changeset
548 # Remove '-o $object'.
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
549 IFS=" "
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
550 for arg
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
551 do
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
552 case $arg in
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
553 -o)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
554 shift
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
555 ;;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
556 $object)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
557 shift
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
558 ;;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
559 *)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
560 set fnord "$@" "$arg"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
561 shift # fnord
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
562 shift # $arg
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
563 ;;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
564 esac
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
565 done
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
566
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
567 test -z "$dashmflag" && dashmflag=-M
111
kono
parents: 55
diff changeset
568 # Require at least two characters before searching for ':'
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
569 # in the target name. This is to cope with DOS-style filenames:
111
kono
parents: 55
diff changeset
570 # a dependency such as 'c:/foo/bar' could be seen as target 'c' otherwise.
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
571 "$@" $dashmflag |
111
kono
parents: 55
diff changeset
572 sed "s|^[$tab ]*[^:$tab ][^:][^:]*:[$tab ]*|$object: |" > "$tmpdepfile"
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
573 rm -f "$depfile"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
574 cat < "$tmpdepfile" > "$depfile"
111
kono
parents: 55
diff changeset
575 # Some versions of the HPUX 10.20 sed can't process this sed invocation
kono
parents: 55
diff changeset
576 # correctly. Breaking it into two sed invocations is a workaround.
kono
parents: 55
diff changeset
577 tr ' ' "$nl" < "$tmpdepfile" \
kono
parents: 55
diff changeset
578 | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \
kono
parents: 55
diff changeset
579 | sed -e 's/$/ :/' >> "$depfile"
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
580 rm -f "$tmpdepfile"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
581 ;;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
582
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
583 dashXmstdout)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
584 # This case only exists to satisfy depend.m4. It is never actually
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
585 # run, as this mode is specially recognized in the preamble.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
586 exit 1
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
587 ;;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
588
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
589 makedepend)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
590 "$@" || exit $?
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
591 # Remove any Libtool call
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
592 if test "$libtool" = yes; then
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
593 while test "X$1" != 'X--mode=compile'; do
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
594 shift
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
595 done
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
596 shift
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
597 fi
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
598 # X makedepend
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
599 shift
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
600 cleared=no eat=no
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
601 for arg
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
602 do
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
603 case $cleared in
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
604 no)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
605 set ""; shift
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
606 cleared=yes ;;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
607 esac
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
608 if test $eat = yes; then
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
609 eat=no
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
610 continue
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
611 fi
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
612 case "$arg" in
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
613 -D*|-I*)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
614 set fnord "$@" "$arg"; shift ;;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
615 # Strip any option that makedepend may not understand. Remove
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
616 # the object too, otherwise makedepend will parse it as a source file.
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
617 -arch)
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
618 eat=yes ;;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
619 -*|$object)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
620 ;;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
621 *)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
622 set fnord "$@" "$arg"; shift ;;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
623 esac
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
624 done
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
625 obj_suffix=`echo "$object" | sed 's/^.*\././'`
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
626 touch "$tmpdepfile"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
627 ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
628 rm -f "$depfile"
111
kono
parents: 55
diff changeset
629 # makedepend may prepend the VPATH from the source file name to the object.
kono
parents: 55
diff changeset
630 # No need to regex-escape $object, excess matching of '.' is harmless.
kono
parents: 55
diff changeset
631 sed "s|^.*\($object *:\)|\1|" "$tmpdepfile" > "$depfile"
kono
parents: 55
diff changeset
632 # Some versions of the HPUX 10.20 sed can't process the last invocation
kono
parents: 55
diff changeset
633 # correctly. Breaking it into two sed invocations is a workaround.
kono
parents: 55
diff changeset
634 sed '1,2d' "$tmpdepfile" \
kono
parents: 55
diff changeset
635 | tr ' ' "$nl" \
kono
parents: 55
diff changeset
636 | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \
kono
parents: 55
diff changeset
637 | sed -e 's/$/ :/' >> "$depfile"
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
638 rm -f "$tmpdepfile" "$tmpdepfile".bak
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
639 ;;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
640
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
641 cpp)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
642 # Important note: in order to support this mode, a compiler *must*
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
643 # always write the preprocessed file to stdout.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
644 "$@" || exit $?
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
645
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
646 # Remove the call to Libtool.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
647 if test "$libtool" = yes; then
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
648 while test "X$1" != 'X--mode=compile'; do
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
649 shift
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
650 done
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
651 shift
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
652 fi
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
653
111
kono
parents: 55
diff changeset
654 # Remove '-o $object'.
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
655 IFS=" "
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
656 for arg
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
657 do
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
658 case $arg in
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
659 -o)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
660 shift
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
661 ;;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
662 $object)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
663 shift
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
664 ;;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
665 *)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
666 set fnord "$@" "$arg"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
667 shift # fnord
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
668 shift # $arg
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
669 ;;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
670 esac
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
671 done
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
672
111
kono
parents: 55
diff changeset
673 "$@" -E \
kono
parents: 55
diff changeset
674 | sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
kono
parents: 55
diff changeset
675 -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
kono
parents: 55
diff changeset
676 | sed '$ s: \\$::' > "$tmpdepfile"
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
677 rm -f "$depfile"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
678 echo "$object : \\" > "$depfile"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
679 cat < "$tmpdepfile" >> "$depfile"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
680 sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
681 rm -f "$tmpdepfile"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
682 ;;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
683
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
684 msvisualcpp)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
685 # Important note: in order to support this mode, a compiler *must*
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
686 # always write the preprocessed file to stdout.
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
687 "$@" || exit $?
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
688
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
689 # Remove the call to Libtool.
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
690 if test "$libtool" = yes; then
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
691 while test "X$1" != 'X--mode=compile'; do
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
692 shift
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
693 done
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
694 shift
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
695 fi
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
696
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
697 IFS=" "
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
698 for arg
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
699 do
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
700 case "$arg" in
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
701 -o)
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
702 shift
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
703 ;;
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
704 $object)
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
705 shift
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
706 ;;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
707 "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
111
kono
parents: 55
diff changeset
708 set fnord "$@"
kono
parents: 55
diff changeset
709 shift
kono
parents: 55
diff changeset
710 shift
kono
parents: 55
diff changeset
711 ;;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
712 *)
111
kono
parents: 55
diff changeset
713 set fnord "$@" "$arg"
kono
parents: 55
diff changeset
714 shift
kono
parents: 55
diff changeset
715 shift
kono
parents: 55
diff changeset
716 ;;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
717 esac
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
718 done
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
719 "$@" -E 2>/dev/null |
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
720 sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile"
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
721 rm -f "$depfile"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
722 echo "$object : \\" > "$depfile"
111
kono
parents: 55
diff changeset
723 sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::'"$tab"'\1 \\:p' >> "$depfile"
kono
parents: 55
diff changeset
724 echo "$tab" >> "$depfile"
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
725 sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile"
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
726 rm -f "$tmpdepfile"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
727 ;;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
728
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
729 msvcmsys)
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
730 # This case exists only to let depend.m4 do its work. It works by
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
731 # looking at the text of this script. This case will never be run,
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
732 # since it is checked for above.
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
733 exit 1
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
734 ;;
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
735
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
736 none)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
737 exec "$@"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
738 ;;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
739
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
740 *)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
741 echo "Unknown depmode $depmode" 1>&2
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
742 exit 1
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
743 ;;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
744 esac
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
745
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
746 exit 0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
747
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
748 # Local Variables:
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
749 # mode: shell-script
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
750 # sh-indentation: 2
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
751 # eval: (add-hook 'write-file-hooks 'time-stamp)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
752 # time-stamp-start: "scriptversion="
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
753 # time-stamp-format: "%:y-%02m-%02d.%02H"
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
754 # time-stamp-time-zone: "UTC"
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
755 # time-stamp-end: "; # UTC"
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
756 # End: