File: flex.py

package info (click to toggle)
ntdb 1.0-9
  • links: PTS
  • area: main
  • in suites: stretch
  • size: 4,132 kB
  • ctags: 5,053
  • sloc: ansic: 32,598; python: 20,283; xml: 580; sh: 168; makefile: 151
file content (25 lines) | stat: -rw-r--r-- 471 bytes parent folder | download | duplicates (24)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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'] = ''