scons: Use Flex and Bison to generate lexer/parser files.
authorKenneth Graunke <kenneth@whitecape.org>
Tue, 1 Mar 2011 23:04:04 +0000 (15:04 -0800)
committerKenneth Graunke <kenneth@whitecape.org>
Tue, 1 Mar 2011 23:49:29 +0000 (15:49 -0800)
This gets it building again here; I'll leave it up to the SCons
maintainers to make further improvements.

src/glsl/SConscript
src/mesa/SConscript

index 7c6b6ae8c4df80541653cf1a257c3424a2933fa2..10abab6f945c8262d9d61f166e128d71a35d577e 100644 (file)
@@ -11,18 +11,29 @@ env.Prepend(CPPPATH = [
     '#src/mapi',
     '#src/mesa',
     '#src/glsl',
+    '#src/glsl/glcpp',
 ])
 
+env.Append(YACCFLAGS = '-d')
+
+parser_env = env.Clone();
+parser_env.Append(YACCFLAGS = ['--defines=src/glsl/glsl_parser.h', '-p', '_mesa_glsl_'])
+
+glcpp_lexer = env.CFile('glcpp/glcpp-lex.c', 'glcpp/glcpp-lex.l')
+glcpp_parser = env.CFile('glcpp/glcpp-parse.c', 'glcpp/glcpp-parse.y')
+glsl_lexer = parser_env.CXXFile('glsl_lexer.cpp', 'glsl_lexer.ll')
+glsl_parser = parser_env.CXXFile('glsl_parser.cpp', 'glsl_parser.yy')
+
 sources = [
-    'glcpp/glcpp-lex.c',
-    'glcpp/glcpp-parse.c',
+    glcpp_lexer,
+    glcpp_parser[0],
     'glcpp/pp.c',
     'ast_expr.cpp',
     'ast_function.cpp',
     'ast_to_hir.cpp',
     'ast_type.cpp',
-    'glsl_lexer.cpp',
-    'glsl_parser.cpp',
+    glsl_lexer,
+    glsl_parser[0],
     'glsl_parser_extras.cpp',
     'glsl_types.cpp',
     'glsl_symbol_table.cpp',
index d65750b93e263d71301abd8850576f9438c1c556..acbf86ebd2d464b3e86cbd19696510e4480a7968 100644 (file)
@@ -214,15 +214,17 @@ statetracker_sources = [
     'state_tracker/st_texture.c',
 ]
 
+env.Append(YACCFLAGS = '-d')
+program_lex = env.CFile('program/lex.yy.c', 'program/program_lexer.l')
+program_parse = env.CFile('program/program_parse.tab.c',
+                          'program/program_parse.y')
 program_sources = [
     'program/arbprogparse.c',
     'program/hash_table.c',
     'program/ir_to_mesa.cpp',
-    'program/lex.yy.c',
     'program/nvfragparse.c',
     'program/nvvertparse.c',
     'program/program.c',
-    'program/program_parse.tab.c',
     'program/program_parse_extra.c',
     'program/prog_cache.c',
     'program/prog_execute.c',
@@ -237,6 +239,8 @@ program_sources = [
     'program/programopt.c',
     'program/sampler.cpp',
     'program/symbol_table.c',
+    program_lex,
+    program_parse[0],
 ]
 
 mesa_sources = (