home *** CD-ROM | disk | FTP | other *** search
- $ Cakefile to handle coupled lex and yacc files.
-
- $ This file assumes that yacc sources are in files whose names
- $ are of the form %_g.y (the g is for grammar) and that lex
- $ sources are in files whose names are of the form %_s.l (the
- $ s is for scanner). It assumes that yacc and lex sources occur
- $ in pairs, i.e. %_g.y and %_s.l for the same value of %.
- $ It renames the output files of yacc and lex so that they
- $ have the same basename as their source files, and it massages
- $ the generated sources using yyrepl(1). This enables one to put
- $ more than one parser/scanner pair in the same directory without
- $ conflict over yy* variables. You should define the macro TABLES
- $ if you wish to keep the tables generated by the -v options
- $ of yacc and lex.
-
- $ This cakefile was written to work with the cakefile C and one
- $ of the cakefiles Main and System.
-
- #ifdef TABLES
- #define YFLAGS -dv
- #define LFLAGS -v
-
- %_g.c^ %_g.h@ %_g.t: %_g.y
- yacc YFLAGS %_g.y
- @mv y.tab.h %_g.h
- @mv y.tab.c %_g.c
- @mv y.output %_g.t
- @yyrepl %_g.y %_g.c %_g.h
-
- %_s.c^ %_s.t: %_s.l %_g.h
- lex LFLAGS %_s.l > %_s.t
- @mv lex.yy.c %_s.c
- @yyrepl %_g.y %_s.c
- #else
- #define YFLAGS -d
- #define LFLAGS
-
- %_g.c^ %_g.h@: %_g.y
- yacc YFLAGS %_g.y
- @mv y.tab.h %_g.h
- @mv y.tab.c %_g.c
- @yyrepl %_g.y %_g.c %_g.h
-
- %_s.c^: %_s.l %_g.h
- lex LFLAGS %_s.l
- @mv lex.yy.c %_s.c
- @yyrepl %_g.y %_s.c
- #endif
-
- #define USE_YACC
- #define USE_LEX
-