blob: 13f6207e91706d5f3ca811d6814d0210bedf63f9 [file] [log] [blame]
akmhoquefa8ee9b2014-03-14 09:06:24 -05001#! /usr/bin/env python
2# encoding: utf-8
3# WARNING! Do not edit! http://waf.googlecode.com/git/docs/wafbook/single.html#_obtaining_the_waf_file
4
5import waflib.TaskGen,os,re
6def decide_ext(self,node):
7 if'cxx'in self.features:
8 return['.lex.cc']
9 return['.lex.c']
10def flexfun(tsk):
11 env=tsk.env
12 bld=tsk.generator.bld
13 wd=bld.variant_dir
14 def to_list(xx):
15 if isinstance(xx,str):return[xx]
16 return xx
17 tsk.last_cmd=lst=[]
18 lst.extend(to_list(env['FLEX']))
19 lst.extend(to_list(env['FLEXFLAGS']))
20 inputs=[a.path_from(bld.bldnode)for a in tsk.inputs]
21 if env.FLEX_MSYS:
22 inputs=[x.replace(os.sep,'/')for x in inputs]
23 lst.extend(inputs)
24 lst=[x for x in lst if x]
25 txt=bld.cmd_and_log(lst,cwd=wd,env=env.env or None,quiet=0)
26 tsk.outputs[0].write(txt.replace('\r\n','\n').replace('\r','\n'))
27waflib.TaskGen.declare_chain(name='flex',rule=flexfun,ext_in='.l',decider=decide_ext,)
28def configure(conf):
29 conf.find_program('flex',var='FLEX')
30 conf.env.FLEXFLAGS=['-t']
31 if re.search(r"\\msys\\[0-9.]+\\bin\\flex.exe$",conf.env.FLEX):
32 conf.env.FLEX_MSYS=True