s3: libsmbclient: Add missing talloc stackframe.
[sfrench/samba-autobuild/.git] / buildtools / wafadmin / Tools / bison.py
1 #!/usr/bin/env python
2 # encoding: utf-8
3 # John O'Meara, 2006
4 # Thomas Nagy 2009
5
6 "Bison processing"
7
8 import Task
9 from TaskGen import extension
10
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)
13
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']
18
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'))
28
29         tsk = self.create_task('bison', node, outs)
30         tsk.cwd = node.bld_dir(tsk.env)
31
32         # and the c/cxx file must be compiled too
33         self.allnodes.append(outs[0])
34
35 def detect(conf):
36         bison = conf.find_program('bison', var='BISON', mandatory=True)
37         conf.env['BISONFLAGS'] = '-d'
38