#ident	"@(#)sgs-cmd:common/gencc	1.1"
#
#	TEMPLATE FOR THE FRONT-END TO CC

# This shell script creates the front-end to the cc command.  It should be run
# in the same directory where the front-end to cc is going to reside.  The front-end
# to cc is a one line shell script which calls the executable cc command
# with the appropriate '-Y' options.  This shell script will be given the same
# name as the executable cc.  Therefore, the front-end to cc and the executable
# cc command can not exist in the same directory when using this shell script.
# A logical place to put the executable cc command is the same directory where
# other tools which are not called directly are placed (E.g., /lib).

# ABSOLUTE PATHNAME FOR THE EXECUTABLE CC
y=`pwd | awk 'BEGIN { FS = "/"}
	      {for (i = 2; i < NF; i++)
	  	printf( "/%s", $i )}'`
CC="${y}/lib/m88kcc"

# DEFINE THE LOCATIONS OF THE VARIOUS PIECES OF THE SGS


# OPTION SPECIFYING DIRECTORY CONTAINING PREPROCESSOR
CPPOPT="-Y p,$y/lib"

# OPTION SPECIFYING DIRECTORY CONTAINING COMPILER
COMPOPT="-Y 0,$y/lib"

# OPTION SPECIFYING DIRECTORY CONTAINING OPTIMIZER
OPTOPT="-Y 2,$y/lib"

# OPTION SPECIFYING DIRECTORY CONTAINING ASSEMBLER
ASOPT="-Y a,$y/bin"

# OPTION SPECIFYING DIRECTORY CONTAINING LINK-EDITOR
LDOPT="-Y l,$y/bin"

# OPTION SPECIFYING DIRECTORY CONTAINING START-UP ROUTINES
SUPOPT="-Y S,$y/lib"

# OPTION SPECIFYING DEFAULT INCLUDE DIRECTORY
INCOPT="-Wp,-I$y/include"

# OPTION SPECIFYING DEFAULT LIB DIRECTORY
LIBOPT="-L$y/lib"

# OPTION SPECIFYING DEFAULT LIB DIRECTORY
LLIBOPT=""

# OPTION SPECIFYING TO SIFILTER FIX 
SIFOPTS="-Wa,-c -Wa,-p -Wa,-a -Wa,-b -Wa,-l -Wa,-n"

# OPTION SPECIFYING TO PREPROCESSOR TO DEFINE m88k AND UNDEFINE m68k
PREPOPTS="-Dm88k -DOCS_BCS -Um68k -Ughs"

# OPTION SPECIFYING TO COMPILER TO NOT DO DEF OF LABEL TO A LABEL
NODEFS="-W0,-d"

# OPTION SPECIFYING TO LINKER TO SEARCH EXCEPTION LIBRARY
XLIBR="-Wl,-L$y/lib"

# CREATE THE FRONT-END TO CC
echo "Creating the front-end to cc"
base=`basename $CC`
echo "$CC \\
$CPPOPT \\
$COMPOPT \\
$ASOPT \\
$LDOPT \\
$SUPOPT \\
$INCOPT \\
$SIFOPTS \\
$PREPOPTS \\
$NODEFS \\
$XLIBR \\
\"\$@\"" > $base
chmod a+x $base

echo ""
echo "remember to add directory"
echo $y/bin
echo "to your PATH variable"
