File: flex.py

package info (click to toggle)
gpick 0.2.5-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 2,400 kB
  • ctags: 3,306
  • sloc: cpp: 22,216; python: 740; ansic: 476; yacc: 252; lex: 197; makefile: 49; xml: 11; sh: 8
file content (20 lines) | stat: -rw-r--r-- 534 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
from SCons.Script import *

def addFlexBuilder(env):

	FlexAction = SCons.Action.Action("$FLEXCOM", "$FLEXCOMSTR")
	
	env["FLEX"]      = env.Detect("flex")
	env["FLEXCOM"] = "flex --header-file=${TARGET.base}.h -o $TARGET $SOURCE"
	
	def headerEmitter(target, source, env): 
		bs = SCons.Util.splitext(str(source[0].name))[0] 
		target.append(bs + '.h') 
		return (target, source) 
	
	builder = Builder(action = FlexAction,
		suffix = '.cpp',
		src_suffix = '.l',
		emitter = headerEmitter)

	env.Append(BUILDERS = {'Flex': builder})