123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143 |
- #! /bin/sh
- scriptversion=2005-05-14.22
- case $1 in
- '')
- echo "$0: No command. Try \`$0 --help' for more information." 1>&2
- exit 1;
- ;;
- -h | --h*)
- cat <<\EOF
- Usage: compile [--help] [--version] PROGRAM [ARGS]
- Wrapper for compilers which do not understand `-c -o'.
- Remove `-o dest.o' from ARGS, run PROGRAM with the remaining
- arguments, and rename the output as expected.
- If you are trying to build a whole package this is not the
- right script to run: please start by reading the file `INSTALL'.
- Report bugs to <bug-automake@gnu.org>.
- EOF
- exit $?
- ;;
- -v | --v*)
- echo "compile $scriptversion"
- exit $?
- ;;
- esac
- ofile=
- cfile=
- eat=
- for arg
- do
- if test -n "$eat"; then
- eat=
- else
- case $1 in
- -o)
- # configure might choose to run compile as `compile cc -o foo foo.c'.
-
- eat=1
- case $2 in
- *.o | *.obj)
- ofile=$2
- ;;
- *)
- set x "$@" -o "$2"
- shift
- ;;
- esac
- ;;
- *.c)
- cfile=$1
- set x "$@" "$1"
- shift
- ;;
- *)
- set x "$@" "$1"
- shift
- ;;
- esac
- fi
- shift
- done
- if test -z "$ofile" || test -z "$cfile"; then
-
-
-
-
-
- exec "$@"
- fi
- cofile=`echo "$cfile" | sed -e 's|^.*/||' -e 's/\.c$/.o/'`
- lockdir=`echo "$cofile" | sed -e 's|[/.-]|_|g'`.d
- while true; do
- if mkdir "$lockdir" >/dev/null 2>&1; then
- break
- fi
- sleep 1
- done
- trap "rmdir '$lockdir'; exit 1" 1 2 15
- "$@"
- ret=$?
- if test -f "$cofile"; then
- mv "$cofile" "$ofile"
- elif test -f "${cofile}bj"; then
- mv "${cofile}bj" "$ofile"
- fi
- rmdir "$lockdir"
- exit $ret
|