filename | compile |
changeset | 1032:b3a4f104a83c |
author | nkeynes |
date | Mon Feb 13 22:16:43 2012 +1000 (12 years ago) |
permissions | -rw-r--r-- |
last change | Make palette textures 2D (1 pixel high) instead of 1D - pretty much the same, but some systems don't support 1D textures |
file | annotate | diff | log | raw |
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +00001.2 +++ b/compile Mon Feb 13 22:16:43 2012 +10001.3 @@ -0,0 +1,142 @@1.4 +#! /bin/sh1.5 +# Wrapper for compilers which do not understand `-c -o'.1.6 +1.7 +scriptversion=2005-05-14.221.8 +1.9 +# Copyright (C) 1999, 2000, 2003, 2004, 2005 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 modify1.13 +# it under the terms of the GNU General Public License as published by1.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 of1.19 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the1.20 +# GNU General Public License for more details.1.21 +#1.22 +# You should have received a copy of the GNU General Public License1.23 +# along with this program; if not, write to the Free Software1.24 +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.1.25 +1.26 +# As a special exception to the GNU General Public License, if you1.27 +# distribute this file as part of a program that contains a1.28 +# configuration script generated by Autoconf, you may include it under1.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 report1.32 +# bugs to <bug-automake@gnu.org> or send patches to1.33 +# <automake-patches@gnu.org>.1.34 +1.35 +case $1 in1.36 + '')1.37 + echo "$0: No command. Try \`$0 --help' for more information." 1>&21.38 + exit 1;1.39 + ;;1.40 + -h | --h*)1.41 + cat <<\EOF1.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 remaining1.46 +arguments, and rename the output as expected.1.47 +1.48 +If you are trying to build a whole package this is not the1.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 +EOF1.53 + exit $?1.54 + ;;1.55 + -v | --v*)1.56 + echo "compile $scriptversion"1.57 + exit $?1.58 + ;;1.59 +esac1.60 +1.61 +ofile=1.62 +cfile=1.63 +eat=1.64 +1.65 +for arg1.66 +do1.67 + if test -n "$eat"; then1.68 + eat=1.69 + else1.70 + case $1 in1.71 + -o)1.72 + # configure might choose to run compile as `compile cc -o foo foo.c'.1.73 + # So we strip `-o arg' only if arg is an object.1.74 + eat=11.75 + case $2 in1.76 + *.o | *.obj)1.77 + ofile=$21.78 + ;;1.79 + *)1.80 + set x "$@" -o "$2"1.81 + shift1.82 + ;;1.83 + esac1.84 + ;;1.85 + *.c)1.86 + cfile=$11.87 + set x "$@" "$1"1.88 + shift1.89 + ;;1.90 + *)1.91 + set x "$@" "$1"1.92 + shift1.93 + ;;1.94 + esac1.95 + fi1.96 + shift1.97 +done1.98 +1.99 +if test -z "$ofile" || test -z "$cfile"; then1.100 + # If no `-o' option was seen then we might have been invoked from a1.101 + # pattern rule where we don't need one. That is ok -- this is a1.102 + # normal compilation that the losing compiler can handle. If no1.103 + # `.c' file was seen then we are probably linking. That is also1.104 + # ok.1.105 + exec "$@"1.106 +fi1.107 +1.108 +# Name of file we expect compiler to create.1.109 +cofile=`echo "$cfile" | sed -e 's|^.*/||' -e 's/\.c$/.o/'`1.110 +1.111 +# Create the lock directory.1.112 +# Note: use `[/.-]' here to ensure that we don't use the same name1.113 +# that we are using for the .o file. Also, base the name on the expected1.114 +# object file name, since that is what matters with a parallel build.1.115 +lockdir=`echo "$cofile" | sed -e 's|[/.-]|_|g'`.d1.116 +while true; do1.117 + if mkdir "$lockdir" >/dev/null 2>&1; then1.118 + break1.119 + fi1.120 + sleep 11.121 +done1.122 +# FIXME: race condition here if user kills between mkdir and trap.1.123 +trap "rmdir '$lockdir'; exit 1" 1 2 151.124 +1.125 +# Run the compile.1.126 +"$@"1.127 +ret=$?1.128 +1.129 +if test -f "$cofile"; then1.130 + mv "$cofile" "$ofile"1.131 +elif test -f "${cofile}bj"; then1.132 + mv "${cofile}bj" "$ofile"1.133 +fi1.134 +1.135 +rmdir "$lockdir"1.136 +exit $ret1.137 +1.138 +# Local Variables:1.139 +# mode: shell-script1.140 +# sh-indentation: 21.141 +# eval: (add-hook 'write-file-hooks 'time-stamp)1.142 +# time-stamp-start: "scriptversion="1.143 +# time-stamp-format: "%:y-%02m-%02d.%02H"1.144 +# time-stamp-end: "$"1.145 +# End:
.