s4:lib/messaging: terminate the irpc_servers_byname() result with server_id_set_disco...
[Samba/gebeck_regimport.git] / buildtools / wafadmin / Tools / bison.py
blob49c605187336c254e740eca143a0fe3bafd1341e
1 #!/usr/bin/env python
2 # encoding: utf-8
3 # John O'Meara, 2006
4 # Thomas Nagy 2009
6 "Bison processing"
8 import Task
9 from TaskGen import extension
11 bison = '${BISON} ${BISONFLAGS} ${SRC[0].abspath()} -o ${TGT[0].name}'
12 cls = Task.simple_task_type('bison', bison, 'GREEN', ext_in='.yc .y .yy', ext_out='.c .cxx .h .l', shell=False)
14 @extension(['.y', '.yc', '.yy'])
15 def big_bison(self, node):
16 """when it becomes complicated (unlike flex), the old recipes work better (cwd)"""
17 has_h = '-d' in self.env['BISONFLAGS']
19 outs = []
20 if node.name.endswith('.yc'):
21 outs.append(node.change_ext('.tab.cc'))
22 if has_h:
23 outs.append(node.change_ext('.tab.hh'))
24 else:
25 outs.append(node.change_ext('.tab.c'))
26 if has_h:
27 outs.append(node.change_ext('.tab.h'))
29 tsk = self.create_task('bison', node, outs)
30 tsk.cwd = node.bld_dir(tsk.env)
32 # and the c/cxx file must be compiled too
33 self.allnodes.append(outs[0])
35 def detect(conf):
36 bison = conf.find_program('bison', var='BISON', mandatory=True)
37 conf.env['BISONFLAGS'] = '-d'