OILS
/
frontend
/
NINJA_subgraph.py
1 |
"""
|
2 |
frontend/NINJA_subgraph.py
|
3 |
"""
|
4 |
|
5 |
from __future__ import print_function
|
6 |
|
7 |
from build import ninja_lib
|
8 |
from build.ninja_lib import log
|
9 |
|
10 |
_ = log
|
11 |
|
12 |
|
13 |
def NinjaGraph(ru):
|
14 |
n = ru.n
|
15 |
|
16 |
ru.comment('Generated by %s' % __name__)
|
17 |
|
18 |
n.rule('consts-gen',
|
19 |
command='_bin/shwrap/consts_gen $action $out_prefix',
|
20 |
description='consts_gen $action $out_prefix')
|
21 |
|
22 |
n.rule('flag-gen',
|
23 |
command='_bin/shwrap/flag_gen $action $out_prefix',
|
24 |
description='flag_gen $action $out_prefix')
|
25 |
|
26 |
n.rule('option-gen',
|
27 |
command='_bin/shwrap/option_gen $action $out_prefix',
|
28 |
description='consts_gen $action $out_prefix')
|
29 |
|
30 |
n.rule('signal-gen',
|
31 |
command='_bin/shwrap/signal_gen $action $out_prefix',
|
32 |
description='signal_gen $action $out_prefix')
|
33 |
|
34 |
ru.py_binary('frontend/consts_gen.py')
|
35 |
|
36 |
ru.py_binary('frontend/flag_gen.py')
|
37 |
|
38 |
# TODO: hook this up
|
39 |
#ru.py_binary('frontend/lexer_gen.py')
|
40 |
|
41 |
ru.py_binary('frontend/option_gen.py')
|
42 |
|
43 |
ru.py_binary('frontend/signal_gen.py')
|
44 |
|
45 |
prefix = '_gen/frontend/id_kind.asdl'
|
46 |
n.build([prefix + '.h', prefix + '.cc'], 'consts-gen', [],
|
47 |
implicit=['_bin/shwrap/consts_gen'],
|
48 |
variables=[
|
49 |
('out_prefix', prefix),
|
50 |
('action', 'cpp'),
|
51 |
])
|
52 |
n.newline()
|
53 |
|
54 |
ru.cc_library(
|
55 |
'//frontend/help_meta',
|
56 |
srcs = ['_gen/frontend/help_meta.cc'],
|
57 |
# generated by build/py.all -> build/doc.sh all-help -> doctools/help_gen.py
|
58 |
generated_headers = ['_gen/frontend/help_meta.h'])
|
59 |
|
60 |
ru.cc_library(
|
61 |
'//frontend/id_kind.asdl',
|
62 |
srcs = ['_gen/frontend/id_kind.asdl.cc'],
|
63 |
generated_headers = ['_gen/frontend/id_kind.asdl.h'])
|
64 |
|
65 |
# Similar to above
|
66 |
prefix = '_gen/frontend/consts'
|
67 |
n.build([prefix + '.h', prefix + '.cc'], 'consts-gen', [],
|
68 |
implicit=['_bin/shwrap/consts_gen'],
|
69 |
variables=[
|
70 |
('out_prefix', prefix),
|
71 |
('action', 'cpp-consts'),
|
72 |
])
|
73 |
n.newline()
|
74 |
|
75 |
ru.cc_library(
|
76 |
'//frontend/consts',
|
77 |
srcs = ['_gen/frontend/consts.cc'],
|
78 |
generated_headers = ['_gen/frontend/consts.h'],
|
79 |
# See header
|
80 |
deps = [
|
81 |
'//core/runtime.asdl',
|
82 |
'//frontend/id_kind.asdl',
|
83 |
'//frontend/option.asdl',
|
84 |
'//frontend/types.asdl',
|
85 |
])
|
86 |
|
87 |
prefix = '_gen/frontend/arg_types'
|
88 |
n.build([prefix + '.h', prefix + '.cc'], 'flag-gen', [],
|
89 |
implicit=['_bin/shwrap/flag_gen'],
|
90 |
variables=[
|
91 |
('out_prefix', prefix),
|
92 |
('action', 'cpp'),
|
93 |
])
|
94 |
n.newline()
|
95 |
|
96 |
ru.cc_library(
|
97 |
'//frontend/arg_types',
|
98 |
generated_headers = ['_gen/frontend/arg_types.h'],
|
99 |
srcs = ['_gen/frontend/arg_types.cc'],
|
100 |
deps = ['//cpp/frontend_flag_spec'],
|
101 |
)
|
102 |
|
103 |
ru.cc_binary(
|
104 |
'frontend/arg_types_test.cc',
|
105 |
deps = [
|
106 |
'//frontend/arg_types',
|
107 |
'//mycpp/runtime'],
|
108 |
matrix = ninja_lib.COMPILERS_VARIANTS,
|
109 |
)
|
110 |
|
111 |
prefix = '_gen/frontend/option.asdl'
|
112 |
# no .cc file
|
113 |
n.build([prefix + '.h'], 'option-gen', [],
|
114 |
implicit=['_bin/shwrap/option_gen'],
|
115 |
variables=[
|
116 |
('out_prefix', prefix),
|
117 |
('action', 'cpp'),
|
118 |
])
|
119 |
n.newline()
|
120 |
|
121 |
ru.cc_library(
|
122 |
'//frontend/option.asdl',
|
123 |
srcs = [],
|
124 |
generated_headers = ['_gen/frontend/option.asdl.h'])
|
125 |
|
126 |
prefix = '_gen/frontend/signal'
|
127 |
n.build([prefix + '.h', prefix + '.cc'], 'signal-gen', [],
|
128 |
implicit=['_bin/shwrap/signal_gen'],
|
129 |
variables=[
|
130 |
('out_prefix', prefix),
|
131 |
('action', 'cpp'),
|
132 |
])
|
133 |
n.newline()
|
134 |
|
135 |
ru.cc_library(
|
136 |
'//frontend/signal',
|
137 |
srcs = ['_gen/frontend/signal.cc'],
|
138 |
generated_headers = ['_gen/frontend/signal.h'])
|
139 |
|
140 |
ru.asdl_library(
|
141 |
'frontend/types.asdl',
|
142 |
pretty_print_methods = False)
|
143 |
|
144 |
ru.asdl_library(
|
145 |
'frontend/syntax.asdl',
|
146 |
deps = ['//frontend/id_kind.asdl'])
|
147 |
|
148 |
ru.cc_binary(
|
149 |
'frontend/syntax_asdl_test.cc',
|
150 |
deps = ['//frontend/syntax.asdl'],
|
151 |
matrix = ninja_lib.COMPILERS_VARIANTS)
|