OLD | NEW |
1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 # The yasm build process creates a slew of small C subprograms that | 5 # The yasm build process creates a slew of small C subprograms that |
6 # dynamically generate files at various point in the build process. This makes | 6 # dynamically generate files at various point in the build process. This makes |
7 # the build integration moderately complex. | 7 # the build integration moderately complex. |
8 # | 8 # |
9 # There are three classes of dynamically generated files: | 9 # There are three classes of dynamically generated files: |
10 # 1) C source files that should be included in the build (eg., lc3bid.c) | 10 # 1) C source files that should be included in the build (eg., lc3bid.c) |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 | 48 |
49 executable("genmacro") { | 49 executable("genmacro") { |
50 sources = [ | 50 sources = [ |
51 "source/patched-yasm/tools/genmacro/genmacro.c", | 51 "source/patched-yasm/tools/genmacro/genmacro.c", |
52 ] | 52 ] |
53 configs -= [ "//build/config/compiler:chromium_code" ] | 53 configs -= [ "//build/config/compiler:chromium_code" ] |
54 configs += [ | 54 configs += [ |
55 ":yasm_config", | 55 ":yasm_config", |
56 "//build/config/compiler:no_chromium_code", | 56 "//build/config/compiler:no_chromium_code", |
57 ] | 57 ] |
| 58 deps = [ |
| 59 "//build/config/sanitizers:deps", |
| 60 ] |
58 } | 61 } |
59 | 62 |
60 executable("genmodule") { | 63 executable("genmodule") { |
61 sources = [ | 64 sources = [ |
62 "source/patched-yasm/libyasm/genmodule.c", | 65 "source/patched-yasm/libyasm/genmodule.c", |
63 ] | 66 ] |
64 configs -= [ "//build/config/compiler:chromium_code" ] | 67 configs -= [ "//build/config/compiler:chromium_code" ] |
65 configs += [ | 68 configs += [ |
66 ":yasm_config", | 69 ":yasm_config", |
67 "//build/config/compiler:no_chromium_code", | 70 "//build/config/compiler:no_chromium_code", |
68 ] | 71 ] |
| 72 deps = [ |
| 73 "//build/config/sanitizers:deps", |
| 74 ] |
69 } | 75 } |
70 | 76 |
71 executable("genperf") { | 77 executable("genperf") { |
72 sources = [ | 78 sources = [ |
73 "source/patched-yasm/tools/genperf/genperf.c", | 79 "source/patched-yasm/tools/genperf/genperf.c", |
74 "source/patched-yasm/tools/genperf/perfect.c", | 80 "source/patched-yasm/tools/genperf/perfect.c", |
75 ] | 81 ] |
76 | 82 |
77 configs -= [ "//build/config/compiler:chromium_code" ] | 83 configs -= [ "//build/config/compiler:chromium_code" ] |
78 configs += [ | 84 configs += [ |
79 ":yasm_config", | 85 ":yasm_config", |
80 "//build/config/compiler:no_chromium_code", | 86 "//build/config/compiler:no_chromium_code", |
81 ] | 87 ] |
82 | 88 |
83 deps = [ | 89 deps = [ |
84 ":yasm_utils", | 90 ":yasm_utils", |
| 91 "//build/config/sanitizers:deps", |
85 ] | 92 ] |
86 } | 93 } |
87 | 94 |
88 # Used by both yasm and genperf binaries. | 95 # Used by both yasm and genperf binaries. |
89 source_set("yasm_utils") { | 96 source_set("yasm_utils") { |
90 sources = [ | 97 sources = [ |
91 "source/patched-yasm/libyasm/phash.c", | 98 "source/patched-yasm/libyasm/phash.c", |
92 "source/patched-yasm/libyasm/xmalloc.c", | 99 "source/patched-yasm/libyasm/xmalloc.c", |
93 "source/patched-yasm/libyasm/xstrdup.c", | 100 "source/patched-yasm/libyasm/xstrdup.c", |
94 ] | 101 ] |
95 | 102 |
96 configs -= [ "//build/config/compiler:chromium_code" ] | 103 configs -= [ "//build/config/compiler:chromium_code" ] |
97 configs += [ | 104 configs += [ |
98 ":yasm_config", | 105 ":yasm_config", |
99 "//build/config/compiler:no_chromium_code", | 106 "//build/config/compiler:no_chromium_code", |
100 ] | 107 ] |
101 } | 108 } |
102 | 109 |
103 executable("genstring") { | 110 executable("genstring") { |
104 sources = [ | 111 sources = [ |
105 "source/patched-yasm/genstring.c", | 112 "source/patched-yasm/genstring.c", |
106 ] | 113 ] |
107 configs -= [ "//build/config/compiler:chromium_code" ] | 114 configs -= [ "//build/config/compiler:chromium_code" ] |
108 configs += [ | 115 configs += [ |
109 ":yasm_config", | 116 ":yasm_config", |
110 "//build/config/compiler:no_chromium_code", | 117 "//build/config/compiler:no_chromium_code", |
111 ] | 118 ] |
| 119 deps = [ |
| 120 "//build/config/sanitizers:deps", |
| 121 ] |
112 } | 122 } |
113 | 123 |
114 executable("genversion") { | 124 executable("genversion") { |
115 sources = [ | 125 sources = [ |
116 "source/patched-yasm/modules/preprocs/nasm/genversion.c", | 126 "source/patched-yasm/modules/preprocs/nasm/genversion.c", |
117 ] | 127 ] |
118 configs -= [ "//build/config/compiler:chromium_code" ] | 128 configs -= [ "//build/config/compiler:chromium_code" ] |
119 configs += [ | 129 configs += [ |
120 ":yasm_config", | 130 ":yasm_config", |
121 "//build/config/compiler:no_chromium_code", | 131 "//build/config/compiler:no_chromium_code", |
122 ] | 132 ] |
| 133 deps = [ |
| 134 "//build/config/sanitizers:deps", |
| 135 ] |
| 136 } |
| 137 |
| 138 config("re2c_warnings") { |
| 139 # re2c is missing CLOSEVOP from one switch. |
| 140 if (is_clang) { |
| 141 cflags = [ |
| 142 # re2c is missing CLOSEVOP from one switch. |
| 143 "-Wno-switch", |
| 144 |
| 145 # re2c contains many static functions in headers (because it's |
| 146 # a C library predating C99.) |
| 147 "-Wno-unused-function", |
| 148 ] |
| 149 } |
123 } | 150 } |
124 | 151 |
125 executable("re2c") { | 152 executable("re2c") { |
126 sources = [ | 153 sources = [ |
127 "source/patched-yasm/tools/re2c/actions.c", | 154 "source/patched-yasm/tools/re2c/actions.c", |
128 "source/patched-yasm/tools/re2c/code.c", | 155 "source/patched-yasm/tools/re2c/code.c", |
129 "source/patched-yasm/tools/re2c/dfa.c", | 156 "source/patched-yasm/tools/re2c/dfa.c", |
130 "source/patched-yasm/tools/re2c/main.c", | 157 "source/patched-yasm/tools/re2c/main.c", |
131 "source/patched-yasm/tools/re2c/mbo_getopt.c", | 158 "source/patched-yasm/tools/re2c/mbo_getopt.c", |
132 "source/patched-yasm/tools/re2c/parser.c", | 159 "source/patched-yasm/tools/re2c/parser.c", |
133 "source/patched-yasm/tools/re2c/scanner.c", | 160 "source/patched-yasm/tools/re2c/scanner.c", |
134 "source/patched-yasm/tools/re2c/substr.c", | 161 "source/patched-yasm/tools/re2c/substr.c", |
135 "source/patched-yasm/tools/re2c/translate.c", | 162 "source/patched-yasm/tools/re2c/translate.c", |
136 ] | 163 ] |
137 | 164 |
138 configs -= [ "//build/config/compiler:chromium_code" ] | 165 configs -= [ "//build/config/compiler:chromium_code" ] |
139 configs += [ | 166 configs += [ |
140 ":yasm_config", | 167 ":yasm_config", |
141 "//build/config/compiler:no_chromium_code", | 168 "//build/config/compiler:no_chromium_code", |
| 169 |
| 170 # Must be after no_chromium_code for warning flags to be ordered |
| 171 # correctly. |
| 172 ":re2c_warnings", |
142 ] | 173 ] |
| 174 deps = [ |
| 175 "//build/config/sanitizers:deps", |
| 176 ] |
| 177 } |
143 | 178 |
144 # re2c is missing CLOSEVOP from one switch. | 179 config("yasm_warnings") { |
145 if (is_posix) { | 180 if (is_clang) { |
146 cflags = [ "-Wno-switch" ] | 181 cflags = [ |
| 182 # reg3264type in x86expr.c is unused. |
| 183 "-Wno-unused-local-typedef", |
| 184 ] |
147 } | 185 } |
148 } | 186 } |
149 | 187 |
150 executable("yasm") { | 188 executable("yasm") { |
151 sources = [ | 189 sources = [ |
152 "source/patched-yasm/frontends/yasm/yasm-options.c", | 190 "source/patched-yasm/frontends/yasm/yasm-options.c", |
153 "source/patched-yasm/frontends/yasm/yasm.c", | 191 "source/patched-yasm/frontends/yasm/yasm.c", |
154 "source/patched-yasm/libyasm/assocdat.c", | 192 "source/patched-yasm/libyasm/assocdat.c", |
155 "source/patched-yasm/libyasm/bc-align.c", | 193 "source/patched-yasm/libyasm/bc-align.c", |
156 "source/patched-yasm/libyasm/bc-data.c", | 194 "source/patched-yasm/libyasm/bc-data.c", |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 "$target_gen_dir/lc3bid.c", | 265 "$target_gen_dir/lc3bid.c", |
228 | 266 |
229 # File generated by generate_module | 267 # File generated by generate_module |
230 "$target_gen_dir/module.c", | 268 "$target_gen_dir/module.c", |
231 ] | 269 ] |
232 | 270 |
233 configs -= [ "//build/config/compiler:chromium_code" ] | 271 configs -= [ "//build/config/compiler:chromium_code" ] |
234 configs += [ | 272 configs += [ |
235 ":yasm_config", | 273 ":yasm_config", |
236 "//build/config/compiler:no_chromium_code", | 274 "//build/config/compiler:no_chromium_code", |
| 275 "//build/config/compiler:no_incompatible_pointer_warnings", |
| 276 |
| 277 # Must be after no_chromium_code for warning flags to be ordered |
| 278 # correctly. |
| 279 ":yasm_warnings", |
237 ] | 280 ] |
238 | 281 |
239 # Yasm generates a bunch of .c files which its source file #include. | 282 # Yasm generates a bunch of .c files which its source file #include. |
240 # Add the |target_gen_dir| into the include path so it can find them. | 283 # Add the |target_gen_dir| into the include path so it can find them. |
241 # Ideally, these generated .c files would be placed into a separate | 284 # Ideally, these generated .c files would be placed into a separate |
242 # directory, but the gen_x86_insn.py script does not make this easy. | 285 # directory, but the gen_x86_insn.py script does not make this easy. |
243 include_dirs = [ yasm_gen_include_dir ] | 286 include_dirs = [ yasm_gen_include_dir ] |
244 | 287 |
245 if (!is_win) { | 288 if (!is_win) { |
246 cflags = [ | 289 cflags = [ |
247 "-ansi", | 290 "-std=c89", |
248 "-pedantic", | 291 "-pedantic", |
249 ] | 292 ] |
250 if (is_clang) { | |
251 cflags += [ "-Wno-incompatible-pointer-types" ] | |
252 } | |
253 } | 293 } |
254 | 294 |
255 # TODO(ajwong): This should take most of the generated output as | 295 # TODO(ajwong): This should take most of the generated output as |
256 # inputs. | 296 # inputs. |
257 deps = [ | 297 deps = [ |
258 ":compile_gperf", | 298 ":compile_gperf", |
259 ":compile_gperf_for_include", | 299 ":compile_gperf_for_include", |
260 ":compile_nasm_macros", | 300 ":compile_nasm_macros", |
261 ":compile_nasm_version", | 301 ":compile_nasm_version", |
| 302 ":compile_re2c", |
262 ":compile_re2c_lc3b", | 303 ":compile_re2c_lc3b", |
263 ":compile_win64_gas", | 304 ":compile_win64_gas", |
264 ":compile_win64_nasm", | 305 ":compile_win64_nasm", |
265 ":compile_re2c", | |
266 ":generate_license", | 306 ":generate_license", |
267 ":generate_module", | 307 ":generate_module", |
268 ":generate_version", | 308 ":generate_version", |
269 ":yasm_utils", | 309 ":yasm_utils", |
| 310 "//build/config/sanitizers:deps", |
270 ] | 311 ] |
271 } | 312 } |
272 | 313 |
273 compiled_action_foreach("compile_gperf") { | 314 compiled_action_foreach("compile_gperf") { |
274 tool = ":genperf" | 315 tool = ":genperf" |
275 sources = [ | 316 sources = [ |
276 "source/patched-yasm/modules/arch/x86/x86cpu.gperf", | 317 "source/patched-yasm/modules/arch/x86/x86cpu.gperf", |
277 "source/patched-yasm/modules/arch/x86/x86regtmod.gperf", | 318 "source/patched-yasm/modules/arch/x86/x86regtmod.gperf", |
278 ] | 319 ] |
279 | 320 |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
463 | 504 |
464 # Output eventually #included by source/patched-yasm/frontends/yasm/x86id.c | 505 # Output eventually #included by source/patched-yasm/frontends/yasm/x86id.c |
465 outputs = [ | 506 outputs = [ |
466 "$yasm_gen_include_dir/x86insns.c", | 507 "$yasm_gen_include_dir/x86insns.c", |
467 "$yasm_gen_include_dir/x86insn_gas.gperf", | 508 "$yasm_gen_include_dir/x86insn_gas.gperf", |
468 "$yasm_gen_include_dir/x86insn_nasm.gperf", | 509 "$yasm_gen_include_dir/x86insn_nasm.gperf", |
469 ] | 510 ] |
470 args = [ rebase_path(yasm_gen_include_dir, root_build_dir) ] | 511 args = [ rebase_path(yasm_gen_include_dir, root_build_dir) ] |
471 } | 512 } |
472 } | 513 } |
OLD | NEW |