Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1146)

Side by Side Diff: third_party/yasm/BUILD.gn

Issue 1705533002: Remove yasm (and DONT_EMBED_BUILD_METADATA). (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « build/config/BUILD.gn ('k') | third_party/yasm/CHROMIUM.diff » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 # found in the LICENSE file.
4
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
7 # the build integration moderately complex.
8 #
9 # There are three classes of dynamically generated files:
10 # 1) C source files that should be included in the build (eg., lc3bid.c)
11 # 2) C source files that are #included by static C sources (eg., license.c)
12 # 3) Intermediate files that are used as input by other subprograms to
13 # further generate files in category #1 or #2. (eg., version.mac)
14 #
15 # This structure is represented with the following targets:
16 # 1) yasm -- Sources, flags for the main yasm executable. Also has most of
17 # of the actions and rules that invoke the subprograms.
18 # 2) yasm_config -- General build configuration including setting a
19 # inputs listing the checked in version of files
20 # generated by manually running configure. These manually
21 # generated files are used by all binaries.
22 # 3) yasm_utils -- Object files with memory management and hashing utilities
23 # shared between yasm and the genperf subprogram.
24 # 4) genmacro, genmodule, etc. -- One executable target for each subprogram.
25 # 5) generate_license, generate_module, etc. -- Actions that invoke programs
26 # built in #4 to generate .c files.
27 # 6) compile_gperf, compile_re2c, etc. -- Actions that invoke programs that
28 # turn intermediate files into .c files.
29
30 if (current_toolchain == host_toolchain) {
31 # Various files referenced by multiple targets.
32 yasm_gen_include_dir = "$target_gen_dir/include"
33 config_makefile = "source/config/$host_os/Makefile"
34 version_file = "version.mac"
35
36 import("//build/compiled_action.gni")
37
38 config("yasm_config") {
39 include_dirs = [
40 "source/config/$host_os",
41 "source/patched-yasm",
42 ]
43 defines = [ "HAVE_CONFIG_H" ]
44 if (is_posix) {
45 cflags = [ "-std=gnu99" ]
46 }
47 }
48
49 executable("genmacro") {
50 sources = [
51 "source/patched-yasm/tools/genmacro/genmacro.c",
52 ]
53 configs -= [ "//build/config/compiler:chromium_code" ]
54 configs += [
55 ":yasm_config",
56 "//build/config/compiler:no_chromium_code",
57 ]
58 }
59
60 executable("genmodule") {
61 sources = [
62 "source/patched-yasm/libyasm/genmodule.c",
63 ]
64 configs -= [ "//build/config/compiler:chromium_code" ]
65 configs += [
66 ":yasm_config",
67 "//build/config/compiler:no_chromium_code",
68 ]
69 }
70
71 executable("genperf") {
72 sources = [
73 "source/patched-yasm/tools/genperf/genperf.c",
74 "source/patched-yasm/tools/genperf/perfect.c",
75 ]
76
77 configs -= [ "//build/config/compiler:chromium_code" ]
78 configs += [
79 ":yasm_config",
80 "//build/config/compiler:no_chromium_code",
81 ]
82
83 deps = [
84 ":yasm_utils",
85 ]
86 }
87
88 # Used by both yasm and genperf binaries.
89 source_set("yasm_utils") {
90 sources = [
91 "source/patched-yasm/libyasm/phash.c",
92 "source/patched-yasm/libyasm/xmalloc.c",
93 "source/patched-yasm/libyasm/xstrdup.c",
94 ]
95
96 configs -= [ "//build/config/compiler:chromium_code" ]
97 configs += [
98 ":yasm_config",
99 "//build/config/compiler:no_chromium_code",
100 ]
101 }
102
103 executable("genstring") {
104 sources = [
105 "source/patched-yasm/genstring.c",
106 ]
107 configs -= [ "//build/config/compiler:chromium_code" ]
108 configs += [
109 ":yasm_config",
110 "//build/config/compiler:no_chromium_code",
111 ]
112 }
113
114 executable("genversion") {
115 sources = [
116 "source/patched-yasm/modules/preprocs/nasm/genversion.c",
117 ]
118 configs -= [ "//build/config/compiler:chromium_code" ]
119 configs += [
120 ":yasm_config",
121 "//build/config/compiler:no_chromium_code",
122 ]
123 }
124
125 executable("re2c") {
126 sources = [
127 "source/patched-yasm/tools/re2c/actions.c",
128 "source/patched-yasm/tools/re2c/code.c",
129 "source/patched-yasm/tools/re2c/dfa.c",
130 "source/patched-yasm/tools/re2c/main.c",
131 "source/patched-yasm/tools/re2c/mbo_getopt.c",
132 "source/patched-yasm/tools/re2c/parser.c",
133 "source/patched-yasm/tools/re2c/scanner.c",
134 "source/patched-yasm/tools/re2c/substr.c",
135 "source/patched-yasm/tools/re2c/translate.c",
136 ]
137
138 configs -= [ "//build/config/compiler:chromium_code" ]
139 configs += [
140 ":yasm_config",
141 "//build/config/compiler:no_chromium_code",
142 ]
143
144 # re2c is missing CLOSEVOP from one switch.
145 if (is_posix) {
146 cflags = [ "-Wno-switch" ]
147 }
148 }
149
150 executable("yasm") {
151 sources = [
152 "source/patched-yasm/frontends/yasm/yasm-options.c",
153 "source/patched-yasm/frontends/yasm/yasm.c",
154 "source/patched-yasm/libyasm/assocdat.c",
155 "source/patched-yasm/libyasm/bc-align.c",
156 "source/patched-yasm/libyasm/bc-data.c",
157 "source/patched-yasm/libyasm/bc-incbin.c",
158 "source/patched-yasm/libyasm/bc-org.c",
159 "source/patched-yasm/libyasm/bc-reserve.c",
160 "source/patched-yasm/libyasm/bitvect.c",
161 "source/patched-yasm/libyasm/bytecode.c",
162 "source/patched-yasm/libyasm/errwarn.c",
163 "source/patched-yasm/libyasm/expr.c",
164 "source/patched-yasm/libyasm/file.c",
165 "source/patched-yasm/libyasm/floatnum.c",
166 "source/patched-yasm/libyasm/hamt.c",
167 "source/patched-yasm/libyasm/insn.c",
168 "source/patched-yasm/libyasm/intnum.c",
169 "source/patched-yasm/libyasm/inttree.c",
170 "source/patched-yasm/libyasm/linemap.c",
171 "source/patched-yasm/libyasm/md5.c",
172 "source/patched-yasm/libyasm/mergesort.c",
173 "source/patched-yasm/libyasm/section.c",
174 "source/patched-yasm/libyasm/strcasecmp.c",
175 "source/patched-yasm/libyasm/strsep.c",
176 "source/patched-yasm/libyasm/symrec.c",
177 "source/patched-yasm/libyasm/valparam.c",
178 "source/patched-yasm/libyasm/value.c",
179 "source/patched-yasm/modules/arch/lc3b/lc3barch.c",
180 "source/patched-yasm/modules/arch/lc3b/lc3bbc.c",
181 "source/patched-yasm/modules/arch/x86/x86arch.c",
182 "source/patched-yasm/modules/arch/x86/x86bc.c",
183 "source/patched-yasm/modules/arch/x86/x86expr.c",
184 "source/patched-yasm/modules/arch/x86/x86id.c",
185 "source/patched-yasm/modules/dbgfmts/codeview/cv-dbgfmt.c",
186 "source/patched-yasm/modules/dbgfmts/codeview/cv-symline.c",
187 "source/patched-yasm/modules/dbgfmts/codeview/cv-type.c",
188 "source/patched-yasm/modules/dbgfmts/dwarf2/dwarf2-aranges.c",
189 "source/patched-yasm/modules/dbgfmts/dwarf2/dwarf2-dbgfmt.c",
190 "source/patched-yasm/modules/dbgfmts/dwarf2/dwarf2-info.c",
191 "source/patched-yasm/modules/dbgfmts/dwarf2/dwarf2-line.c",
192 "source/patched-yasm/modules/dbgfmts/null/null-dbgfmt.c",
193 "source/patched-yasm/modules/dbgfmts/stabs/stabs-dbgfmt.c",
194 "source/patched-yasm/modules/listfmts/nasm/nasm-listfmt.c",
195 "source/patched-yasm/modules/objfmts/bin/bin-objfmt.c",
196 "source/patched-yasm/modules/objfmts/coff/coff-objfmt.c",
197 "source/patched-yasm/modules/objfmts/coff/win64-except.c",
198 "source/patched-yasm/modules/objfmts/dbg/dbg-objfmt.c",
199 "source/patched-yasm/modules/objfmts/elf/elf-objfmt.c",
200 "source/patched-yasm/modules/objfmts/elf/elf-x86-amd64.c",
201 "source/patched-yasm/modules/objfmts/elf/elf-x86-x86.c",
202 "source/patched-yasm/modules/objfmts/elf/elf.c",
203 "source/patched-yasm/modules/objfmts/macho/macho-objfmt.c",
204 "source/patched-yasm/modules/objfmts/rdf/rdf-objfmt.c",
205 "source/patched-yasm/modules/objfmts/xdf/xdf-objfmt.c",
206 "source/patched-yasm/modules/parsers/gas/gas-parse-intel.c",
207 "source/patched-yasm/modules/parsers/gas/gas-parse.c",
208 "source/patched-yasm/modules/parsers/gas/gas-parser.c",
209 "source/patched-yasm/modules/parsers/nasm/nasm-parse.c",
210 "source/patched-yasm/modules/parsers/nasm/nasm-parser.c",
211 "source/patched-yasm/modules/preprocs/cpp/cpp-preproc.c",
212 "source/patched-yasm/modules/preprocs/nasm/nasm-eval.c",
213 "source/patched-yasm/modules/preprocs/nasm/nasm-pp.c",
214 "source/patched-yasm/modules/preprocs/nasm/nasm-preproc.c",
215 "source/patched-yasm/modules/preprocs/nasm/nasmlib.c",
216 "source/patched-yasm/modules/preprocs/raw/raw-preproc.c",
217
218 # Files generated by compile_gperf
219 "$target_gen_dir/x86cpu.c",
220 "$target_gen_dir/x86regtmod.c",
221
222 # Files generated by compile_re2c
223 "$target_gen_dir/gas-token.c",
224 "$target_gen_dir/nasm-token.c",
225
226 # File generated by compile_re2c_lc3b
227 "$target_gen_dir/lc3bid.c",
228
229 # File generated by generate_module
230 "$target_gen_dir/module.c",
231 ]
232
233 configs -= [ "//build/config/compiler:chromium_code" ]
234 configs += [
235 ":yasm_config",
236 "//build/config/compiler:no_chromium_code",
237 ]
238
239 # 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.
241 # 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.
243 include_dirs = [ yasm_gen_include_dir ]
244
245 if (!is_win) {
246 cflags = [
247 "-ansi",
248 "-pedantic",
249 ]
250 if (is_clang) {
251 cflags += [ "-Wno-incompatible-pointer-types" ]
252 }
253 }
254
255 # TODO(ajwong): This should take most of the generated output as
256 # inputs.
257 deps = [
258 ":compile_gperf",
259 ":compile_gperf_for_include",
260 ":compile_nasm_macros",
261 ":compile_nasm_version",
262 ":compile_re2c_lc3b",
263 ":compile_win64_gas",
264 ":compile_win64_nasm",
265 ":compile_re2c",
266 ":generate_license",
267 ":generate_module",
268 ":generate_version",
269 ":yasm_utils",
270 ]
271 }
272
273 compiled_action_foreach("compile_gperf") {
274 tool = ":genperf"
275 sources = [
276 "source/patched-yasm/modules/arch/x86/x86cpu.gperf",
277 "source/patched-yasm/modules/arch/x86/x86regtmod.gperf",
278 ]
279
280 outputs = [
281 "$target_gen_dir/{{source_name_part}}.c",
282 ]
283 args = [
284 "{{source}}",
285 rebase_path(target_gen_dir, root_build_dir) + "/{{source_name_part}}.c",
286 ]
287 deps = [
288 ":generate_x86_insn",
289 ]
290 }
291
292 # This differs from |compile_gperf| in where it places it output files.
293 compiled_action_foreach("compile_gperf_for_include") {
294 tool = ":genperf"
295 sources = [
296 # Make sure the generated gperf files in $target_gen_dir are synced with
297 # the outputs for the related generate_*_insn actions in the
298 # generate_files target below.
299 #
300 # The output for these two are #included by
301 # source/patched-yasm/modules/arch/x86/x86id.c
302 "$yasm_gen_include_dir/x86insn_gas.gperf",
303 "$yasm_gen_include_dir/x86insn_nasm.gperf",
304 ]
305
306 outputs = [
307 "$yasm_gen_include_dir/{{source_name_part}}.c",
308 ]
309 args = [
310 "{{source}}",
311 rebase_path(yasm_gen_include_dir, root_build_dir) +
312 "/{{source_name_part}}.c",
313 ]
314 deps = [
315 ":generate_x86_insn",
316 ]
317 }
318
319 template("compile_macro") {
320 compiled_action(target_name) {
321 tool = ":genmacro"
322
323 # Output #included by source/patched-yasm/frontends/yasm/yasm.c.
324 inputs = invoker.sources
325 outputs = invoker.outputs
326 args = [
327 rebase_path(outputs[0], root_build_dir),
328 invoker.macro_varname,
329 rebase_path(inputs[0], root_build_dir),
330 ]
331 if (defined(invoker.deps)) {
332 deps = invoker.deps
333 }
334 }
335 }
336
337 compile_macro("compile_nasm_macros") {
338 # Output #included by
339 # source/patched-yasm/modules/preprocs/nasm/nasm-parser.c
340 sources = [
341 "source/patched-yasm/modules/parsers/nasm/nasm-std.mac",
342 ]
343 outputs = [
344 "$yasm_gen_include_dir/nasm-macros.c",
345 ]
346 macro_varname = "nasm_standard_mac"
347 }
348
349 compile_macro("compile_nasm_version") {
350 # Output #included by
351 # source/patched-yasm/modules/preprocs/nasm/nasm-preproc.c
352 sources = [
353 "$target_gen_dir/$version_file",
354 ]
355 outputs = [
356 "$yasm_gen_include_dir/nasm-version.c",
357 ]
358 macro_varname = "nasm_version_mac"
359 deps = [
360 ":generate_version",
361 ]
362 }
363
364 compile_macro("compile_win64_gas") {
365 # Output #included by source/patched-yasm/frontends/yasm/yasm.c.
366 sources = [
367 "source/patched-yasm/modules/objfmts/coff/win64-gas.mac",
368 ]
369 outputs = [
370 "$yasm_gen_include_dir/win64-gas.c",
371 ]
372 macro_varname = "win64_gas_stdmac"
373 }
374
375 compile_macro("compile_win64_nasm") {
376 # Output #included by source/patched-yasm/frontends/yasm/yasm.c.
377 sources = [
378 "source/patched-yasm/modules/objfmts/coff/win64-nasm.mac",
379 ]
380 outputs = [
381 "$yasm_gen_include_dir/win64-nasm.c",
382 ]
383 macro_varname = "win64_nasm_stdmac"
384 }
385
386 compiled_action_foreach("compile_re2c") {
387 tool = ":re2c"
388 sources = [
389 "source/patched-yasm/modules/parsers/gas/gas-token.re",
390 "source/patched-yasm/modules/parsers/nasm/nasm-token.re",
391 ]
392 outputs = [
393 "$target_gen_dir/{{source_name_part}}.c",
394 ]
395 args = [
396 "-b",
397 "-o",
398 rebase_path(target_gen_dir, root_build_dir) + "/{{source_name_part}}.c",
399 "{{source}}",
400 ]
401 }
402
403 # This call doesn't fit into the re2c template above.
404 compiled_action("compile_re2c_lc3b") {
405 tool = ":re2c"
406 inputs = [
407 "source/patched-yasm/modules/arch/lc3b/lc3bid.re",
408 ]
409 outputs = [
410 "$target_gen_dir/lc3bid.c",
411 ]
412 args = [
413 "-s",
414 "-o",
415 rebase_path(outputs[0], root_build_dir),
416 rebase_path(inputs[0], root_build_dir),
417 ]
418 }
419
420 compiled_action("generate_license") {
421 tool = ":genstring"
422
423 # Output #included by source/patched-yasm/frontends/yasm/yasm.c.
424 inputs = [
425 "source/patched-yasm/COPYING",
426 ]
427 outputs = [
428 "$yasm_gen_include_dir/license.c",
429 ]
430 args = [
431 "license_msg",
432 rebase_path(outputs[0], root_build_dir),
433 rebase_path(inputs[0], root_build_dir),
434 ]
435 }
436
437 compiled_action("generate_module") {
438 tool = ":genmodule"
439 inputs = [
440 "source/patched-yasm/libyasm/module.in",
441 config_makefile,
442 ]
443 outputs = [
444 "$target_gen_dir/module.c",
445 ]
446 args = [
447 rebase_path(inputs[0], root_build_dir),
448 rebase_path(config_makefile, root_build_dir),
449 rebase_path(outputs[0], root_build_dir),
450 ]
451 }
452
453 compiled_action("generate_version") {
454 tool = ":genversion"
455 outputs = [
456 "$target_gen_dir/$version_file",
457 ]
458 args = [ rebase_path(outputs[0], root_build_dir) ]
459 }
460
461 action("generate_x86_insn") {
462 script = "source/patched-yasm/modules/arch/x86/gen_x86_insn.py"
463
464 # Output eventually #included by source/patched-yasm/frontends/yasm/x86id.c
465 outputs = [
466 "$yasm_gen_include_dir/x86insns.c",
467 "$yasm_gen_include_dir/x86insn_gas.gperf",
468 "$yasm_gen_include_dir/x86insn_nasm.gperf",
469 ]
470 args = [ rebase_path(yasm_gen_include_dir, root_build_dir) ]
471 }
472 }
OLDNEW
« no previous file with comments | « build/config/BUILD.gn ('k') | third_party/yasm/CHROMIUM.diff » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698