[Xorp-hackers] [PATCH 07/15] xorp:policy:backend: Automaticly build lex and yacc files from backend.{ll, yy}

igorm at etf.rs igorm at etf.rs
Fri Aug 31 04:33:53 PDT 2012


From: Igor Maravic <igorm at etf.rs>


Signed-off-by: Igor Maravic <igorm at etf.rs>
---
 xorp/policy/backend/SConscript |   31 +++++++++++++++++++++++++++++--
 1 file changed, 29 insertions(+), 2 deletions(-)

diff --git a/xorp/policy/backend/SConscript b/xorp/policy/backend/SConscript
index 0d811a4..f91e022 100644
--- a/xorp/policy/backend/SConscript
+++ b/xorp/policy/backend/SConscript
@@ -26,7 +26,36 @@ is_shared = env.has_key('SHAREDLIBS')
 
 env.AppendUnique(CPPPATH = [ '#' ])
 
+# Automatically generate flex and yacc files
+
+#Create yacc files
+yacc_env = env.Clone()
+
+# bison on BSD generates headers files with .h suffix,
+# while on other OSs it generates header files with .hh suffix
+#
+# But, on FreeBSD at least, if you don't do the .hh suffix, it doesn't even
+# build a .h file of any type --Ben
+yacc_env.Replace(YACCHXXFILESUFFIX='.hh')
+
+yacc_env.AppendUnique(YACCFLAGS='-d')
+
+yacc_env.AppendUnique(YACCFLAGS='-ppolicy_backend_parser')
+
+backend_yacc = yacc_env.CXXFile(target='y.policy_backend_parser_tab.cc',
+				source='backend.yy')
+
+#create lex files
+lex_env = env.Clone()
+
+lex_env.AppendUnique(LEXFLAGS='-Ppolicy_backend_parser')
+
+backend_lex = lex_env.CXXFile(target='lex.policy_backend_parser.cc',
+					source='backend.ll')
+
 libpbesrcs = [
+    backend_lex[0],
+    backend_yacc[0],
     'iv_exec.cc',
     'policy_filter.cc',
     'policy_filters.cc',
@@ -36,8 +65,6 @@ libpbesrcs = [
     'single_varrw.cc',
     'version_filter.cc',
     'version_filters.cc',
-    'lex.yy_policy_backend_parser.cc',
-    'yacc.yy_policy_backend_parser.cc'
     ]
 
 if not (env.has_key('disable_profile') and env['disable_profile']):
-- 
1.7.9.5



More information about the Xorp-hackers mailing list