Ignore:
Timestamp:
Sep 15, 2006, 7:09:38 AM (19 years ago)
Author:
bird
Message:

Untested merge with GNU Make v3.81 (vendor/gnumake/2005-05-16 -> vendor/gnumake/current).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/gmake/config/compile

    • Property svn:executable set to *
    r151 r503  
    22# Wrapper for compilers which do not understand `-c -o'.
    33
    4 scriptversion=2003-11-09.00
     4scriptversion=2005-05-14.22
    55
    6 # Copyright (C) 1999, 2000, 2003 Free Software Foundation, Inc.
     6# Copyright (C) 1999, 2000, 2003, 2004, 2005 Free Software Foundation, Inc.
    77# Written by Tom Tromey <tromey@cygnus.com>.
    88#
     
    1919# You should have received a copy of the GNU General Public License
    2020# along with this program; if not, write to the Free Software
    21 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
     21# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
    2222
    2323# As a special exception to the GNU General Public License, if you
     
    4848Report bugs to <bug-automake@gnu.org>.
    4949EOF
    50     exit 0
     50    exit $?
    5151    ;;
    5252  -v | --v*)
    5353    echo "compile $scriptversion"
    54     exit 0
     54    exit $?
    5555    ;;
    5656esac
    5757
    58 
    59 prog=$1
    60 shift
    61 
    6258ofile=
    6359cfile=
    64 args=
    65 while test $# -gt 0; do
    66   case "$1" in
    67     -o)
    68       # configure might choose to run compile as `compile cc -o foo foo.c'.
    69       # So we do something ugly here.
    70       ofile=$2
    71       shift
    72       case "$ofile" in
    73         *.o | *.obj)
    74           ;;
    75         *)
    76           args="$args -o $ofile"
    77           ofile=
    78           ;;
    79       esac
    80        ;;
    81     *.c)
    82       cfile=$1
    83       args="$args $1"
    84       ;;
    85     *)
    86       args="$args $1"
    87       ;;
    88   esac
     60eat=
     61
     62for arg
     63do
     64  if test -n "$eat"; then
     65    eat=
     66  else
     67    case $1 in
     68      -o)
     69        # configure might choose to run compile as `compile cc -o foo foo.c'.
     70        # So we strip `-o arg' only if arg is an object.
     71        eat=1
     72        case $2 in
     73          *.o | *.obj)
     74            ofile=$2
     75            ;;
     76          *)
     77            set x "$@" -o "$2"
     78            shift
     79            ;;
     80        esac
     81        ;;
     82      *.c)
     83        cfile=$1
     84        set x "$@" "$1"
     85        shift
     86        ;;
     87      *)
     88        set x "$@" "$1"
     89        shift
     90        ;;
     91    esac
     92  fi
    8993  shift
    9094done
     
    96100  # `.c' file was seen then we are probably linking.  That is also
    97101  # ok.
    98   exec "$prog" $args
     102  exec "$@"
    99103fi
    100104
    101105# Name of file we expect compiler to create.
    102 cofile=`echo $cfile | sed -e 's|^.*/||' -e 's/\.c$/.o/'`
     106cofile=`echo "$cfile" | sed -e 's|^.*/||' -e 's/\.c$/.o/'`
    103107
    104108# Create the lock directory.
     
    106110# that we are using for the .o file.  Also, base the name on the expected
    107111# object file name, since that is what matters with a parallel build.
    108 lockdir=`echo $cofile | sed -e 's|[/.-]|_|g'`.d
     112lockdir=`echo "$cofile" | sed -e 's|[/.-]|_|g'`.d
    109113while true; do
    110   if mkdir $lockdir > /dev/null 2>&1; then
     114  if mkdir "$lockdir" >/dev/null 2>&1; then
    111115    break
    112116  fi
     
    114118done
    115119# FIXME: race condition here if user kills between mkdir and trap.
    116 trap "rmdir $lockdir; exit 1" 1 2 15
     120trap "rmdir '$lockdir'; exit 1" 1 2 15
    117121
    118122# Run the compile.
    119 "$prog" $args
    120 status=$?
     123"$@"
     124ret=$?
    121125
    122126if test -f "$cofile"; then
    123127  mv "$cofile" "$ofile"
     128elif test -f "${cofile}bj"; then
     129  mv "${cofile}bj" "$ofile"
    124130fi
    125131
    126 rmdir $lockdir
    127 exit $status
     132rmdir "$lockdir"
     133exit $ret
    128134
    129135# Local Variables:
Note: See TracChangeset for help on using the changeset viewer.