OILS / ysh / NINJA_subgraph.py View on Github | oilshell.org

39 lines, 25 significant
1"""
2ysh/NINJA_subgraph.py
3"""
4
5from __future__ import print_function
6
7from build.ninja_lib import log
8
9_ = log
10
11
12def NinjaGraph(ru):
13 n = ru.n
14
15 ru.comment('Generated by %s' % __name__)
16
17 ru.py_binary('ysh/grammar_gen.py')
18
19 n.rule(
20 'grammar-gen',
21 # uses shell style
22 command='_bin/shwrap/grammar_gen cpp $in $out_dir',
23 description='grammar_gen cpp $in $out_dir')
24
25 n.build(
26 ['_gen/ysh/grammar_nt.h', '_gen/ysh/grammar_tables.cc'],
27 'grammar-gen',
28 ['ysh/grammar.pgen2'],
29 implicit=['_bin/shwrap/grammar_gen'],
30 variables=[('out_dir', '_gen/ysh')],
31 )
32 n.newline()
33
34 ru.cc_library('//ysh/grammar',
35 srcs=['_gen/ysh/grammar_tables.cc'],
36 deps=['//cpp/pgen2'],
37 generated_headers=[
38 '_gen/ysh/grammar_nt.h',
39 ])