# @(#)genlib version 3.14
# script to be executed in *csh*
# laboratoire masi cao-vlsi, UPMC, copyright 1990
# software support e-mail : cao-vlsi@masi.ibp.fr
# Author : Frederic Petrot 07/10/92
# Modifications, and all that stuff, by Fred also

if( $1 == "" ) then 
	echo "usage : genlib [-gv] program (without extension)";
	exit( 1 );
else if( $2 == "" ) then
	set name = $1;
	set talk = 0;
	set erase = 1;
else if( $1 == "-v" ) then
	set name = $2;
	set talk = 1;
	set erase = 1;
else if( $1 == "-g" ) then
	set name = $2;
	set talk = 0;
	set erase = 0;
else if(( $1 == "-gv" ) || ( $1 == "-vg" )) then
	set name = $2;
	set talk = 1;
	set erase = 0;
else
	echo "usage : genlib [-gv] program (without extension)";
	exit( 1 );
endif

set lib = (-L$ALLIANCE_LIB -lMgn314 -lMpu306 -lMlu406 -lMcp307 -lMcl406 -lMap305 -lMal400 -lMhl402 -lMvl404 -lMsl600 -lMel400 -lMph306 -lMlo402 -lMut309)
set include = (-I$ALLIANCE_INCLUDE)
/bin/rm $name.grr $name.o >& /dev/null
echo "  @@@@@                  @"
echo " @     @   @@@@   @ @@@  @       @@@ @@@@@"
echo " @        @    @  @@   @ @        @  @    @"
echo " @  @@@@  @@@@@   @    @ @        @  @@@@@"
echo " @ @   @  @       @    @ @        @  @    @"
echo " @     @  @    @  @    @ @        @  @    @"
echo "  @@@@@    @@@@   @    @ @@@@@@@ @@@ @@@@@"
echo " "
echo "Alliance CAD system,             GenLib 3.14"
echo "Tool: GenLib,  procedural Generation Library"
echo "(c) copyright 1990-1993  MASI, CAO-VLSI team"
echo "E-mail support:         cao-vlsi@masi.ibp.fr"
echo " "
if( $talk ) echo "Compiling $name.c ...";
cc $include -c -g $name.c >& $name.grr;
if( $status ) then
	echo "Compilation aborted";
	more $name.grr;
	echo "Errors report in $name.grr file";
	exit(1);
endif
if( $talk ) echo "Linking $name.o with genlib ...";
cc -g -o $name $name.o $lib >>& $name.grr;
if( $status ) then
	echo "Link aborted";
	more $name.grr;
	echo "Errors report in $name.grr file";
	exit(1);
endif
if( $talk ) echo "Executing ...";
$name;
if( $talk ) echo "Removing tmp files ...";
if( $erase ) /bin/rm $name;
/bin/rm $name.o $name.grr >& /dev/null;
