mythtv_plugin/compile
branchtrunk
changeset 3 265cdb1c59e3
parent 2 bd3829c2e9c9
child 4 259b9773e5c3
     1.1 --- a/mythtv_plugin/compile	Wed Sep 20 23:59:48 2006 +0100
     1.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.3 @@ -1,136 +0,0 @@
     1.4 -#! /bin/sh
     1.5 -# Wrapper for compilers which do not understand `-c -o'.
     1.6 -
     1.7 -scriptversion=2003-11-09.00
     1.8 -
     1.9 -# Copyright (C) 1999, 2000, 2003 Free Software Foundation, Inc.
    1.10 -# Written by Tom Tromey <tromey@cygnus.com>.
    1.11 -#
    1.12 -# This program is free software; you can redistribute it and/or modify
    1.13 -# it under the terms of the GNU General Public License as published by
    1.14 -# the Free Software Foundation; either version 2, or (at your option)
    1.15 -# any later version.
    1.16 -#
    1.17 -# This program is distributed in the hope that it will be useful,
    1.18 -# but WITHOUT ANY WARRANTY; without even the implied warranty of
    1.19 -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    1.20 -# GNU General Public License for more details.
    1.21 -#
    1.22 -# You should have received a copy of the GNU General Public License
    1.23 -# along with this program; if not, write to the Free Software
    1.24 -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
    1.25 -
    1.26 -# As a special exception to the GNU General Public License, if you
    1.27 -# distribute this file as part of a program that contains a
    1.28 -# configuration script generated by Autoconf, you may include it under
    1.29 -# the same distribution terms that you use for the rest of that program.
    1.30 -
    1.31 -# This file is maintained in Automake, please report
    1.32 -# bugs to <bug-automake@gnu.org> or send patches to
    1.33 -# <automake-patches@gnu.org>.
    1.34 -
    1.35 -case $1 in
    1.36 -  '')
    1.37 -     echo "$0: No command.  Try \`$0 --help' for more information." 1>&2
    1.38 -     exit 1;
    1.39 -     ;;
    1.40 -  -h | --h*)
    1.41 -    cat <<\EOF
    1.42 -Usage: compile [--help] [--version] PROGRAM [ARGS]
    1.43 -
    1.44 -Wrapper for compilers which do not understand `-c -o'.
    1.45 -Remove `-o dest.o' from ARGS, run PROGRAM with the remaining
    1.46 -arguments, and rename the output as expected.
    1.47 -
    1.48 -If you are trying to build a whole package this is not the
    1.49 -right script to run: please start by reading the file `INSTALL'.
    1.50 -
    1.51 -Report bugs to <bug-automake@gnu.org>.
    1.52 -EOF
    1.53 -    exit 0
    1.54 -    ;;
    1.55 -  -v | --v*)
    1.56 -    echo "compile $scriptversion"
    1.57 -    exit 0
    1.58 -    ;;
    1.59 -esac
    1.60 -
    1.61 -
    1.62 -prog=$1
    1.63 -shift
    1.64 -
    1.65 -ofile=
    1.66 -cfile=
    1.67 -args=
    1.68 -while test $# -gt 0; do
    1.69 -  case "$1" in
    1.70 -    -o)
    1.71 -      # configure might choose to run compile as `compile cc -o foo foo.c'.
    1.72 -      # So we do something ugly here.
    1.73 -      ofile=$2
    1.74 -      shift
    1.75 -      case "$ofile" in
    1.76 -	*.o | *.obj)
    1.77 -	  ;;
    1.78 -	*)
    1.79 -	  args="$args -o $ofile"
    1.80 -	  ofile=
    1.81 -	  ;;
    1.82 -      esac
    1.83 -       ;;
    1.84 -    *.c)
    1.85 -      cfile=$1
    1.86 -      args="$args $1"
    1.87 -      ;;
    1.88 -    *)
    1.89 -      args="$args $1"
    1.90 -      ;;
    1.91 -  esac
    1.92 -  shift
    1.93 -done
    1.94 -
    1.95 -if test -z "$ofile" || test -z "$cfile"; then
    1.96 -  # If no `-o' option was seen then we might have been invoked from a
    1.97 -  # pattern rule where we don't need one.  That is ok -- this is a
    1.98 -  # normal compilation that the losing compiler can handle.  If no
    1.99 -  # `.c' file was seen then we are probably linking.  That is also
   1.100 -  # ok.
   1.101 -  exec "$prog" $args
   1.102 -fi
   1.103 -
   1.104 -# Name of file we expect compiler to create.
   1.105 -cofile=`echo $cfile | sed -e 's|^.*/||' -e 's/\.c$/.o/'`
   1.106 -
   1.107 -# Create the lock directory.
   1.108 -# Note: use `[/.-]' here to ensure that we don't use the same name
   1.109 -# that we are using for the .o file.  Also, base the name on the expected
   1.110 -# object file name, since that is what matters with a parallel build.
   1.111 -lockdir=`echo $cofile | sed -e 's|[/.-]|_|g'`.d
   1.112 -while true; do
   1.113 -  if mkdir $lockdir > /dev/null 2>&1; then
   1.114 -    break
   1.115 -  fi
   1.116 -  sleep 1
   1.117 -done
   1.118 -# FIXME: race condition here if user kills between mkdir and trap.
   1.119 -trap "rmdir $lockdir; exit 1" 1 2 15
   1.120 -
   1.121 -# Run the compile.
   1.122 -"$prog" $args
   1.123 -status=$?
   1.124 -
   1.125 -if test -f "$cofile"; then
   1.126 -  mv "$cofile" "$ofile"
   1.127 -fi
   1.128 -
   1.129 -rmdir $lockdir
   1.130 -exit $status
   1.131 -
   1.132 -# Local Variables:
   1.133 -# mode: shell-script
   1.134 -# sh-indentation: 2
   1.135 -# eval: (add-hook 'write-file-hooks 'time-stamp)
   1.136 -# time-stamp-start: "scriptversion="
   1.137 -# time-stamp-format: "%:y-%02m-%02d.%02H"
   1.138 -# time-stamp-end: "$"
   1.139 -# End: