1 #============================================================================
2 # Rules for flex and bison
3 #============================================================================
9 local cfile = [ LocateTarget $(<:S=.c) ] ;
10 local object = [ CompileObjects $(cfile) ] ;
16 RegisterFileType LexRule : .l ;
20 local cppfile = [ LocateTarget $(<:S=.cpp) ] ;
21 local object = [ CompileObjects $(cppfile) ] ;
23 Lex $(cppfile) : $(<) ;
27 RegisterFileType Flex++Rule : .ll ;
29 if $(COMPILER_TYPE) != "GCC"
31 # compilers like msvc don't like #line statements.
38 LEX_FLAGS on $(cfile) += $(LEX_FLAGS) ;
39 Clean clean : $(cfile) ;
42 # Use -t and output redirection to avoid flex choosing stupid names for it's
46 $(LEX) -t $(LEX_FLAGS) $(>) > $(<)
54 local cfile = [ LocateTarget $(<:S=.c) ] ;
55 local headerfile = [ LocateTarget $(<:S=.h) ] ;
56 local object = [ CompileObjects $(cfile) ] ;
58 Includes $(headerfile:G=) : $(headerfile) ;
60 Bison $(cfile) $(headerfile) : $(<) ;
61 # work around jam warning about independent target
62 Includes $(cfile) : $(headerfile) ;
66 RegisterFileType BisonRule : .y ;
70 local cppfile = [ LocateTarget $(<:S=.cpp) ] ;
71 local headerfile = [ LocateTarget $(<:S=.hpp) ] ;
72 headerfile = $(headerfile:G=) ;
73 local object = [ CompileObjects $(cppfile) ] ;
75 # jams header file scannning doesn't use grist so we have to workaround this
77 Includes $(headerfile:G=) : $(headerfile) ;
79 Bison $(cppfile) $(headerfile) : $(<) ;
80 Includes $(cppfile) : $(headerfile) ;
84 RegisterFileType Bison++Rule : .yy ;
89 BISON_FLAGS on $(<) += $(BISON_FLAGS) ;
98 target = [ LocateTarget $(<:S=.cpp) $(<:S=.hpp) ] ;
102 target = [ LocateTarget $(<:S=.c) $(<:S=.h) ] ;
104 BISON_FLAGS on $(target) += $(>) ;
107 if $(COMPILER_TYPE) != "GCC"
109 # compilers like msvc don't like #line statements.
110 BISON_FLAGS += --no-lines ;
114 $(BISON) -d $(BISON_FLAGS) -o $(<[1]) $(>)