Milán Major

netscape-revival

1 branch
Code

build/hCC

#!/bin/sh
#
# Fix brain-damaged compliers that don't understand -o and -c together
#
DASH_C=0
DASH_O=0
for i in $*
do
   case $i in
   -c)     DASH_C=1;;
   -o)     DASH_O=1;;
   *.c)    C_SRC=$i;;
   *.s)    S_SRC=$i;;
   *.o)    OBJECT=$i;;
   esac
done

cc $* || exit $?

# if there was no -c and -o we're done
[ $DASH_C = 1 -a $DASH_O = 1 ] || exit 0

# cc always creates the .o from the .c name
[ $C_SRC ] && OBJ=`basename $C_SRC .c`.o
# or the .o from the .s name
[ $S_SRC ] && OBJ=`basename $S_SRC .s`.o

[ -f $OBJECT ] || [ -f $OBJ ] && mv -f $OBJ $OBJECT