4 # Wrapper for compilers which do not understand `-c -o'.
6 scriptversion=2005-05-14.22
8 # Copyright (C) 1999, 2000, 2003, 2004, 2005 Free Software Foundation, Inc.
9 # Written by Tom Tromey <tromey@cygnus.com>.
11 # This program is free software; you can redistribute it and/or modify
12 # it under the terms of the GNU General Public License as published by
13 # the Free Software Foundation; either version 2, or (at your option)
16 # This program is distributed in the hope that it will be useful,
17 # but WITHOUT ANY WARRANTY; without even the implied warranty of
18 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 # GNU General Public License for more details.
21 # You should have received a copy of the GNU General Public License
22 # along with this program; if not, write to the Free Software
23 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
25 # As a special exception to the GNU General Public License, if you
26 # distribute this file as part of a program that contains a
27 # configuration script generated by Autoconf, you may include it under
28 # the same distribution terms that you use for the rest of that program.
30 # This file is maintained in Automake, please report
31 # bugs to <bug-automake@gnu.org> or send patches to
32 # <automake-patches@gnu.org>.
36 echo "$0: No command. Try \`$0 --help' for more information." 1>&2
41 Usage: compile [--help] [--version] PROGRAM [ARGS]
43 Wrapper for compilers which do not understand `-c -o'.
44 Remove `-o dest.o' from ARGS, run PROGRAM with the remaining
45 arguments, and rename the output as expected.
47 If you are trying to build a whole package this is not the
48 right script to run: please start by reading the file `INSTALL'.
50 Report bugs to <bug-automake@gnu.org>.
55 echo "compile $scriptversion"
66 if test -n "$eat"; then
71 # configure might choose to run compile as `compile cc -o foo foo.c'.
72 # So we strip `-o arg' only if arg is an object.
98 if test -z "$ofile" || test -z "$cfile"; then
99 # If no `-o' option was seen then we might have been invoked from a
100 # pattern rule where we don't need one. That is ok -- this is a
101 # normal compilation that the losing compiler can handle. If no
102 # `.c' file was seen then we are probably linking. That is also
107 # Name of file we expect compiler to create.
108 cofile=`echo "$cfile" | sed -e 's|^.*/||' -e 's/\.c$/.o/'`
110 # Create the lock directory.
111 # Note: use `[/.-]' here to ensure that we don't use the same name
112 # that we are using for the .o file. Also, base the name on the expected
113 # object file name, since that is what matters with a parallel build.
114 lockdir=`echo "$cofile" | sed -e 's|[/.-]|_|g'`.d
116 if mkdir "$lockdir" >/dev/null 2>&1; then
121 # FIXME: race condition here if user kills between mkdir and trap.
122 trap "rmdir '$lockdir'; exit 1" 1 2 15
128 if test -f "$cofile"; then
129 mv "$cofile" "$ofile"
130 elif test -f "${cofile}bj"; then
131 mv "${cofile}bj" "$ofile"
140 # eval: (add-hook 'write-file-hooks 'time-stamp)
141 # time-stamp-start: "scriptversion="
142 # time-stamp-format: "%:y-%02m-%02d.%02H"
143 # time-stamp-end: "$"