File: bison.py

package info (click to toggle)
hotssh 0.2.6%2Bdfsg1-2
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd, stretch
  • size: 1,140 kB
  • ctags: 1,373
  • sloc: python: 11,679; makefile: 45; sh: 5; csh: 2
file content (18 lines) | stat: -rw-r--r-- 579 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#! /usr/bin/env python
# encoding: utf-8

import TaskGen
def decide_ext(self,node):
	c_ext='.tab.c'
	if node.name.endswith('.yc'):c_ext='.tab.cc'
	if'-d'in self.env['BISONFLAGS']:
		return[c_ext,c_ext.replace('c','h')]
	else:
		return c_ext
TaskGen.declare_chain(name='bison',action='cd ${SRC[0].bld_dir(env)} && ${BISON} ${BISONFLAGS} ${SRC[0].abspath()} -o ${TGT[0].name}',ext_in='.y .yc .yy',decider=decide_ext,before='cc cxx',)
def detect(conf):
	bison=conf.find_program('bison',var='BISON')
	if not bison:conf.fatal("bison was not found")
	v=conf.env
	v['BISONFLAGS']='-d'