Subject: | |
From: | |
Reply To: | |
Date: | Thu, 9 Oct 1997 14:30:46 +0200 |
Content-Type: | text/plain |
Parts/Attachments: |
|
|
Hi all-
If anybody else is bothered by c89 not supporting the "-o" for
object output: I doctored a shell front-end procedure that does
handle the -o if specified. Of course this is not going to make
compiling any quicker... I tried to limit the damage by creating
a shell function using only built-in ksh commands. Couldn't
get around using fgrep, though. If someome can do this without
piping, I would like to know.
Attached is the ksh fragment, best inserted into the /etc/profile.
Feel free to use it.
--
Kind regards,
Chris Breemer [log in to unmask]
Compuware Europe B.V. http://www.compuware.com
# c89 front-end
# Moves object file to the specified output, if any
# (the c89 command cannot handle that)
# If the command contains both -c and -o, meaning it's a compile
# to a specified output file, remove the -o spec from the command
# and remember to move the object file after the compile succeeded
# NOTE-- Uses Korn-shell specific syntax !
cc ()
{
ARGS="$*"
# Can we do this built-in ksh functions ?
if [ "$(echo $ARGS | fgrep -e '-c ')" != "" \
-a "$(echo $ARGS | fgrep -e '-o ')" != "" ]
then
OBJ=
CMD="c89"
for i in $ARGS
do
SRC=$i
if [ "$i" = "-o" ]
then
OBJ=@
continue
else
if [ "$OBJ" = "@" ]
then
OBJ=$i
continue
fi
fi
CMD="$CMD $i"
done
LOCALSRC=${SRC##*/}
LOCALOBJ=${LOCALSRC%.c}.o
echo $CMD
eval $CMD
[ $? -ne 0 ] && return
CMD="mv $LOCALOBJ $OBJ"
echo $CMD
eval $CMD
else
CMD="c89 $ARGS"
echo $CMD
eval $CMD
fi
}
typeset -xf cc
#--------------------- end of cc procedure -----------------------
|
|
|