annotate build-aux/depcomp @ 17363:5a51fb7777a9

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