123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136 |
- #! /bin/sh
- scriptversion=2003-11-09.00
- 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 0
- ;;
- -v | --v*)
- echo "compile $scriptversion"
- exit 0
- ;;
- esac
- prog=$1
- shift
- ofile=
- cfile=
- args=
- while test $# -gt 0; do
- case "$1" in
- -o)
- # configure might choose to run compile as `compile cc -o foo foo.c'.
-
- ofile=$2
- shift
- case "$ofile" in
- *.o | *.obj)
- ;;
- *)
- args="$args -o $ofile"
- ofile=
- ;;
- esac
- ;;
- *.c)
- cfile=$1
- args="$args $1"
- ;;
- *)
- args="$args $1"
- ;;
- esac
- shift
- done
- if test -z "$ofile" || test -z "$cfile"; then
-
-
-
-
-
- exec "$prog" $args
- 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
- "$prog" $args
- status=$?
- if test -f "$cofile"; then
- mv "$cofile" "$ofile"
- fi
- rmdir $lockdir
- exit $status
|