1 """
2 ysh/NINJA_subgraph.py
3 """
4
5 from __future__ import print_function
6
7 from build.ninja_lib import log
8
9 _ = log
10
11
12 def 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('grammar-gen',
20 # uses shell style
21 command='_bin/shwrap/grammar_gen cpp $in $out_dir',
22 description='grammar_gen cpp $in $out_dir')
23
24 n.build(['_gen/ysh/grammar_nt.h', '_gen/ysh/grammar_tables.cc'], 'grammar-gen', ['ysh/grammar.pgen2'],
25 implicit=['_bin/shwrap/grammar_gen'],
26 variables = [('out_dir', '_gen/ysh')],
27 )
28 n.newline()
29
30 ru.cc_library(
31 '//ysh/grammar',
32 srcs = ['_gen/ysh/grammar_tables.cc'],
33 deps = ['//cpp/pgen2'],
34 generated_headers = [
35 '_gen/ysh/grammar_nt.h',
36 ])
37
38