71 lines
871 B
Plaintext
71 lines
871 B
Plaintext
|
trap "rm -f x$$.c" 0 1 2 3 15
|
||
|
EMHOME=/usr/em
|
||
|
CFLAG=0
|
||
|
TARGET=a.out
|
||
|
while :
|
||
|
do
|
||
|
case $# in
|
||
|
0) break;;
|
||
|
esac
|
||
|
case $1 in
|
||
|
-I*|-D*|-U*)
|
||
|
PREP=$PREP" "$1
|
||
|
;;
|
||
|
-c) CFLAG=1
|
||
|
;;
|
||
|
-o) shift
|
||
|
TARGET=$1
|
||
|
;;
|
||
|
-F) shift
|
||
|
LFLAG="-F $1"
|
||
|
;;
|
||
|
-*) FLAGS=$FLAGS" "$1
|
||
|
;;
|
||
|
*) ARG=$ARG" "$1
|
||
|
;;
|
||
|
esac
|
||
|
shift
|
||
|
done
|
||
|
for i in $ARG
|
||
|
do
|
||
|
case $i in
|
||
|
*.c)
|
||
|
nm=`basename $i .c`
|
||
|
if [ -x $EMHOME/lib/cpp ]
|
||
|
then
|
||
|
cpp=$EMHOME/lib/cpp
|
||
|
cppf=-P
|
||
|
else
|
||
|
cpp=/bin/cc
|
||
|
cppf=-E
|
||
|
fi
|
||
|
if $cpp $cppf $PREP $i > x$$.c && /bin/cc $FLAGS -c x$$.c
|
||
|
then
|
||
|
mv x$$.o $nm.o
|
||
|
LDARG=$LDARG" "$nm.o
|
||
|
else
|
||
|
rm -f x$$.c
|
||
|
exit 1
|
||
|
fi
|
||
|
rm -f x$$.c
|
||
|
;;
|
||
|
*.s)
|
||
|
if /bin/cc $FLAGS -c $i
|
||
|
then
|
||
|
LDARG=$LDARG" "`basename $i .s`.o
|
||
|
else exit 1
|
||
|
fi
|
||
|
;;
|
||
|
*) LDARG=$LDARG" "$i
|
||
|
;;
|
||
|
esac
|
||
|
done
|
||
|
case $CFLAG in
|
||
|
1) ;;
|
||
|
*) if /bin/cc $FLAGS $LFLAG $LDARG -o $TARGET
|
||
|
then :
|
||
|
else exit 1
|
||
|
fi
|
||
|
;;
|
||
|
esac
|