#!/bin/sh
#\- compile lex code; default = stdin to a.out
#usage: %makelex  [ lex_input_file.l   [ executable_file ] ]
#j.a. rupley, tucson, arizona

if [ \( $1"x" != "x" \) -a \( `echo $1 | grep "\.l$"`"x" = "x" \) ]
then
	echo "usage:  $0  [ lex_input_file.l   [ executable_file ] ]"
	exit
fi

OPTION=""
if [ $2"x" != "x" ]
then
	OPTION="-o $2"
fi

/usr/bin/lex -t $1 >/usr/tmp/lex.yy.c
cc -g  /usr/tmp/lex.yy.c -ll $OPTION

rm /usr/tmp/lex.yy.c
