11 base
=`basename $SRC .l`
12 if [ -z "$LEX" ]; then
13 # if $DEST is more recent than $SRC, we can just touch
14 # otherwise we touch but print out warnings
16 if [ x
`find $SRC -newer $DEST -print` = x
$SRC ]; then
17 echo "warning: lex not found - cannot generate $SRC => $DEST" >&2
18 echo "warning: lex not found - only updating the timestamp of $DEST" >&2
23 echo "error: lex not found - cannot generate $SRC => $DEST" >&2
26 # if $DEST is more recent than $SRC, we can just touch
28 if [ x
`find $SRC -newer $DEST -print` != x
$SRC ]; then
34 if cd $dir && $LEX $ARGS $file; then
35 if [ -r $base.yy.c
];then
36 # we must guarantee that config.h comes first
37 echo "#include \"config.h\"" > $base.c
38 sed -e "s|$base\.yy\.c|$DEST|" $base.yy.c
>> $base.c
40 elif [ -r $base.c
];then
41 # we must guarantee that config.h comes first
42 mv $base.c
$base.c.tmp
43 echo "#include \"config.h\"" > $base.c
44 sed -e "s|$base\.yy\.c|$DEST|" $base.c.tmp
>> $base.c
46 elif [ ! -r base.c
]; then
47 echo "$base.c nor $base.yy.c generated."