summaryrefslogtreecommitdiff
path: root/buildtools/wafadmin/Tools/flex.py
diff options
context:
space:
mode:
Diffstat (limited to 'buildtools/wafadmin/Tools/flex.py')
-rw-r--r--buildtools/wafadmin/Tools/flex.py25
1 files changed, 25 insertions, 0 deletions
diff --git a/buildtools/wafadmin/Tools/flex.py b/buildtools/wafadmin/Tools/flex.py
new file mode 100644
index 0000000000..5ce9f2210e
--- /dev/null
+++ b/buildtools/wafadmin/Tools/flex.py
@@ -0,0 +1,25 @@
+#!/usr/bin/env python
+# encoding: utf-8
+# John O'Meara, 2006
+# Thomas Nagy, 2006-2008
+
+"Flex processing"
+
+import TaskGen
+
+def decide_ext(self, node):
+ if 'cxx' in self.features: return '.lex.cc'
+ else: return '.lex.c'
+
+TaskGen.declare_chain(
+ name = 'flex',
+ rule = '${FLEX} -o${TGT} ${FLEXFLAGS} ${SRC}',
+ ext_in = '.l',
+ ext_out = '.c .cxx',
+ decider = decide_ext
+)
+
+def detect(conf):
+ conf.find_program('flex', var='FLEX', mandatory=True)
+ conf.env['FLEXFLAGS'] = ''
+