[rtems-libbsd commit] waf: Allow to only generate lex and yacc.
Christian Mauderer
christianm at rtems.org
Mon Aug 6 13:14:45 UTC 2018
Module: rtems-libbsd
Branch: master
Commit: 01855a5acd8bea448b5cd83d61fa9a7ebbf1815e
Changeset: http://git.rtems.org/rtems-libbsd/commit/?id=01855a5acd8bea448b5cd83d61fa9a7ebbf1815e
Author: Christian Mauderer <christian.mauderer at embedded-brains.de>
Date: Mon May 7 10:19:28 2018 +0200
waf: Allow to only generate lex and yacc.
In some applications, it's usefull if the files generated by lex or yacc
are not build automatically. With that it is for example possible to
create a wrapper source file that sets some defines before the generated
code is parsed.
---
builder.py | 12 ++++++++----
waf_libbsd.py | 26 ++++++++++++++------------
2 files changed, 22 insertions(+), 16 deletions(-)
diff --git a/builder.py b/builder.py
index b0d6374..78f592c 100755
--- a/builder.py
+++ b/builder.py
@@ -547,15 +547,17 @@ class RouteKeywordsFragmentComposer(BuildSystemFragmentComposer):
class LexFragmentComposer(BuildSystemFragmentComposer):
- def __init__(self, sym, dep, cflags = None, includes = None):
+ def __init__(self, sym, dep, cflags = None, includes = None, build = True):
self.sym = sym
self.dep = dep
self.cflags, self.includes = _cflagsIncludes(cflags, includes)
+ self.build = build
def compose(self, path):
d = { 'file': path,
'sym': self.sym,
- 'dep': self.dep }
+ 'dep': self.dep,
+ 'build': self.build }
if None not in self.cflags:
d['cflags'] = self.cflags
if None not in self.includes:
@@ -564,15 +566,17 @@ class LexFragmentComposer(BuildSystemFragmentComposer):
class YaccFragmentComposer(BuildSystemFragmentComposer):
- def __init__(self, sym, header, cflags = None, includes = None):
+ def __init__(self, sym, header, cflags = None, includes = None, build = True):
self.sym = sym
self.header = header
self.cflags, self.includes = _cflagsIncludes(cflags, includes)
+ self.build = build
def compose(self, path):
d = { 'file': path,
'sym': self.sym,
- 'header': self.header }
+ 'header': self.header,
+ 'build': self.build }
if None not in self.cflags:
d['cflags'] = self.cflags
if None not in self.includes:
diff --git a/waf_libbsd.py b/waf_libbsd.py
index bbc8b42..597e882 100644
--- a/waf_libbsd.py
+++ b/waf_libbsd.py
@@ -361,12 +361,13 @@ class Builder(builder.ModuleManager):
bld(target = lex['file'][:-2]+ '.c',
source = lex['file'],
rule = lex_rule)
- bld.objects(target = 'lex_%s' % (lex['sym']),
- features = 'c',
- cflags = cflags,
- includes = lexIncludes + includes,
- defines = defines + lexDefines,
- source = lex['file'][:-2] + '.c')
+ if lex['build']:
+ bld.objects(target = 'lex_%s' % (lex['sym']),
+ features = 'c',
+ cflags = cflags,
+ includes = lexIncludes + includes,
+ defines = defines + lexDefines,
+ source = lex['file'][:-2] + '.c')
libbsd_use += ['lex_%s' % (lex['sym'])]
#
@@ -398,12 +399,13 @@ class Builder(builder.ModuleManager):
bld(target = yaccFile[:-2] + '.c',
source = yaccFile,
rule = yacc_rule)
- bld.objects(target = 'yacc_%s' % (yaccSym),
- features = 'c',
- cflags = cflags,
- includes = yaccIncludes + includes,
- defines = defines + yaccDefines,
- source = yaccFile[:-2] + '.c')
+ if yacc['build']:
+ bld.objects(target = 'yacc_%s' % (yaccSym),
+ features = 'c',
+ cflags = cflags,
+ includes = yaccIncludes + includes,
+ defines = defines + yaccDefines,
+ source = yaccFile[:-2] + '.c')
libbsd_use += ['yacc_%s' % (yaccSym)]
#
More information about the vc
mailing list