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

Side by Side Diff: third_party/yasm/yasm.gyp

Issue 300013: Add yasm and ffmpeg into the build tree for linux. (Closed)
Patch Set: Fix mark's comments. Created 11 years, 1 month 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 | « third_party/yasm/source/config/linux/libyasm-stdint.h ('k') | third_party/zlib/zlib.gyp » ('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 (c) 2009 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) config_sources -- Checked in version of files generated by manually
19 # running configure that are used by all binaries.
20 # 3) generate_files -- Actions and rules for files of type #3.
21 # 4) genperf_libs -- Object files shared between yasm and the genperf
22 # subprogram.
23 # 5) genmacro, genmodule, etc. -- One executable target for each subprogram.
24 #
25 # You will notice that a lot of the action targets seem very similar --
26 # especially for genmacro invocations. This makes it seem like they should
27 # be a rule. The problem is that the correct invocation cannot be inferred
28 # purely from the file name, or extension. Nor is it obvious whether the
29 # output should be processed as a source or not. Thus, we are left with a
30 # large amount of repetative code.
31
32 {
33 'variables': {
34 'yasm_include_dirs': [
35 'source/config/linux',
36 'source/patched-yasm',
37 ],
38
39 # The cflags used by any target that will be directly linked into yasm.
40 # These are specifically not used when building the subprograms. While
41 # it would probably be safe to use these flags there as well, the
42 # ./configure based build does not use the same flags between the main
43 # yasm executable, and its subprograms.
44 'yasm_c_flags': [
45 '-DHAVE_CONFIG_H',
46 '-std=gnu99',
47 '-ansi',
48 '-pedantic',
49 ],
50
51 # Locations for various generated artifacts.
52 'shared_generated_dir': '<(SHARED_INTERMEDIATE_DIR)/third_party/yasm',
53 'generated_dir': '<(INTERMEDIATE_DIR)/third_party/yasm',
54
55 # Various files referenced by multiple targets.
56 'version_file': 'version.mac', # Generated by genversion.
57 'genmodule_source': 'genmodule_outfile.c',
58 },
59 'targets': [
60 {
61 'target_name': 'yasm',
62 'type': 'executable',
63 'dependencies': [
64 'genmacro',
65 'genmodule',
66 'genperf',
67 'genperf_libs',
68 'generate_files', # Needed to generate gperf and instruction files.
69 'genstring',
70 're2c',
71 ],
72 'sources': [
73 'source/patched-yasm/frontends/yasm/yasm-options.c',
74 'source/patched-yasm/frontends/yasm/yasm.c',
75 'source/patched-yasm/libyasm/assocdat.c',
76 'source/patched-yasm/libyasm/bc-align.c',
77 'source/patched-yasm/libyasm/bc-data.c',
78 'source/patched-yasm/libyasm/bc-incbin.c',
79 'source/patched-yasm/libyasm/bc-org.c',
80 'source/patched-yasm/libyasm/bc-reserve.c',
81 'source/patched-yasm/libyasm/bitvect.c',
82 'source/patched-yasm/libyasm/bytecode.c',
83 'source/patched-yasm/libyasm/errwarn.c',
84 'source/patched-yasm/libyasm/expr.c',
85 'source/patched-yasm/libyasm/file.c',
86 'source/patched-yasm/libyasm/floatnum.c',
87 'source/patched-yasm/libyasm/hamt.c',
88 'source/patched-yasm/libyasm/insn.c',
89 'source/patched-yasm/libyasm/intnum.c',
90 'source/patched-yasm/libyasm/inttree.c',
91 'source/patched-yasm/libyasm/linemap.c',
92 'source/patched-yasm/libyasm/md5.c',
93 'source/patched-yasm/libyasm/mergesort.c',
94 'source/patched-yasm/libyasm/section.c',
95 'source/patched-yasm/libyasm/strcasecmp.c',
96 'source/patched-yasm/libyasm/strsep.c',
97 'source/patched-yasm/libyasm/symrec.c',
98 'source/patched-yasm/libyasm/valparam.c',
99 'source/patched-yasm/libyasm/value.c',
100 'source/patched-yasm/modules/arch/lc3b/lc3barch.c',
101 'source/patched-yasm/modules/arch/lc3b/lc3bbc.c',
102 'source/patched-yasm/modules/arch/x86/x86arch.c',
103 'source/patched-yasm/modules/arch/x86/x86bc.c',
104 'source/patched-yasm/modules/arch/x86/x86expr.c',
105 'source/patched-yasm/modules/arch/x86/x86id.c',
106 'source/patched-yasm/modules/dbgfmts/codeview/cv-dbgfmt.c',
107 'source/patched-yasm/modules/dbgfmts/codeview/cv-symline.c',
108 'source/patched-yasm/modules/dbgfmts/codeview/cv-type.c',
109 'source/patched-yasm/modules/dbgfmts/dwarf2/dwarf2-aranges.c',
110 'source/patched-yasm/modules/dbgfmts/dwarf2/dwarf2-dbgfmt.c',
111 'source/patched-yasm/modules/dbgfmts/dwarf2/dwarf2-info.c',
112 'source/patched-yasm/modules/dbgfmts/dwarf2/dwarf2-line.c',
113 'source/patched-yasm/modules/dbgfmts/null/null-dbgfmt.c',
114 'source/patched-yasm/modules/dbgfmts/stabs/stabs-dbgfmt.c',
115 'source/patched-yasm/modules/listfmts/nasm/nasm-listfmt.c',
116 'source/patched-yasm/modules/objfmts/bin/bin-objfmt.c',
117 'source/patched-yasm/modules/objfmts/coff/coff-objfmt.c',
118 'source/patched-yasm/modules/objfmts/coff/win64-except.c',
119 'source/patched-yasm/modules/objfmts/dbg/dbg-objfmt.c',
120 'source/patched-yasm/modules/objfmts/elf/elf-objfmt.c',
121 'source/patched-yasm/modules/objfmts/elf/elf-x86-amd64.c',
122 'source/patched-yasm/modules/objfmts/elf/elf-x86-x86.c',
123 'source/patched-yasm/modules/objfmts/elf/elf.c',
124 'source/patched-yasm/modules/objfmts/macho/macho-objfmt.c',
125 'source/patched-yasm/modules/objfmts/rdf/rdf-objfmt.c',
126 'source/patched-yasm/modules/objfmts/xdf/xdf-objfmt.c',
127 'source/patched-yasm/modules/parsers/gas/gas-parse.c',
128 'source/patched-yasm/modules/parsers/gas/gas-parser.c',
129 'source/patched-yasm/modules/parsers/nasm/nasm-parse.c',
130 'source/patched-yasm/modules/parsers/nasm/nasm-parser.c',
131 'source/patched-yasm/modules/preprocs/cpp/cpp-preproc.c',
132 'source/patched-yasm/modules/preprocs/nasm/nasm-eval.c',
133 'source/patched-yasm/modules/preprocs/nasm/nasm-pp.c',
134 'source/patched-yasm/modules/preprocs/nasm/nasm-preproc.c',
135 'source/patched-yasm/modules/preprocs/nasm/nasmlib.c',
136 'source/patched-yasm/modules/preprocs/raw/raw-preproc.c',
137
138 # Sources needed by re2c.
139 'source/patched-yasm/modules/parsers/gas/gas-token.re',
140 'source/patched-yasm/modules/parsers/nasm/nasm-token.re',
141
142 # Sources needed by genperf. Make sure the generated gperf files
143 # (the ones in shared_generated_dir) are synced with the outputs
144 # for the related generate_*_insn actions in the generate_files
145 # target below.
146 '<(shared_generated_dir)/x86insn_nasm.gperf',
147 '<(shared_generated_dir)/x86insn_gas.gperf',
148 '<(shared_generated_dir)/x86cpu.c',
149 '<(shared_generated_dir)/x86regtmod.c',
150 ],
151 'include_dirs': [
152 '<@(yasm_include_dirs)',
153 '<(shared_generated_dir)',
154 '<(generated_dir)',
155 ],
156 'cflags': [
157 '<@(yasm_c_flags)',
158 ],
159 'rules': [
160 {
161 'rule_name': 'generate_gperf',
162 'extension': 'gperf',
163 'inputs': [ '<(PRODUCT_DIR)/genperf' ],
164 'outputs': [
165 '<(generated_dir)/<(RULE_INPUT_ROOT).c',
166 ],
167 'action': ['<(PRODUCT_DIR)/genperf',
168 '<(RULE_INPUT_PATH)',
169 '<(generated_dir)/<(RULE_INPUT_ROOT).c',
170 ],
171 # These files are #included, so do not treat them as sources.
172 'process_outputs_as_sources': 0,
173 'message': 'yasm gperf for <(RULE_INPUT_PATH).',
174 },
175 {
176 'rule_name': 'generate_re2c',
177 'extension': 're',
178 'inputs': [ '<(PRODUCT_DIR)/re2c' ],
179 'outputs': [ '<(generated_dir)/<(RULE_INPUT_ROOT).c', ],
180 'action': [
181 '<(PRODUCT_DIR)/re2c',
182 '-b',
183 '-o',
184 '<(generated_dir)/<(RULE_INPUT_ROOT).c',
185 '<(RULE_INPUT_PATH)',
186 ],
187 'process_outputs_as_sources': 1,
188 'message': 'yasm re2c for <(RULE_INPUT_PATH).',
189 },
190 ],
191 'actions': [
192 ###
193 ### genmacro calls.
194 ###
195 {
196 'action_name': 'generate_nasm_macros',
197 'variables': {
198 'infile': 'source/patched-yasm/modules/parsers/nasm/nasm-std.mac',
199 'varname': 'nasm_standard_mac',
200 'outfile': '<(generated_dir)/nasm-macros.c',
201 },
202 'inputs': [ '<(PRODUCT_DIR)/genmacro', '<(infile)', ],
203 'outputs': [ '<(outfile)', ],
204 'action': ['<(PRODUCT_DIR)/genmacro',
205 '<(outfile)', '<(varname)', '<(infile)', ],
206 # Not a direct source because this is #included by
207 # source/patched-yasm/modules/parsers/nasm/nasm-parser.c
208 'process_outputs_as_sources': 1,
209 'message': 'yasm genmacro for <(infile).',
210 },
211 {
212 'action_name': 'generate_nasm_version',
213 'variables': {
214 'infile': '<(shared_generated_dir)/<(version_file)',
215 'varname': 'nasm_version_mac',
216 'outfile': '<(generated_dir)/nasm-version.c',
217 },
218 'inputs': [ '<(PRODUCT_DIR)/genmacro', '<(infile)', ],
219 'outputs': [ '<(outfile)', ],
220 'action': ['<(PRODUCT_DIR)/genmacro',
221 '<(outfile)', '<(varname)', '<(infile)',
222 ],
223 # Not a direct source because this is #included by
224 # source/patched-yasm/modules/preprocs/nasm/nasm-preproc.c
225 'process_outputs_as_sources': 0,
226 'message': 'yasm genmacro for <(infile).',
227 },
228 {
229 'action_name': 'generate_win64_gas',
230 'variables': {
231 'infile': 'source/patched-yasm/modules/objfmts/coff/win64-gas.mac',
232 'varname': 'win64_gas_stdmac',
233 'outfile': '<(generated_dir)/win64-gas.c',
234 },
235 'inputs': [ '<(PRODUCT_DIR)/genmacro', '<(infile)', ],
236 'outputs': [ '<(outfile)', ],
237 'action': ['<(PRODUCT_DIR)/genmacro',
238 '<(outfile)', '<(varname)', '<(infile)',
239 ],
240 # Not a direct source because this is #included by
241 # source/patched-yasm/modules/objfmts/coff/coff-objfmt.c
242 'process_outputs_as_sources': 0,
243 'message': 'yasm genmacro for <(infile).',
244 },
245 {
246 'action_name': 'generate_win64_nasm',
247 'variables': {
248 'infile': 'source/patched-yasm/modules/objfmts/coff/win64-nasm.mac',
249 'varname': 'win64_nasm_stdmac',
250 'outfile': '<(generated_dir)/win64-nasm.c',
251 },
252 'inputs': [ '<(PRODUCT_DIR)/genmacro', '<(infile)', ],
253 'outputs': [ '<(outfile)', ],
254 'action': ['<(PRODUCT_DIR)/genmacro',
255 '<(outfile)',
256 '<(varname)',
257 '<(infile)',
258 ],
259 # Not a direct source because this is #included by
260 # source/patched-yasm/modules/objfmts/coff/coff-objfmt.c
261 'process_outputs_as_sources': 0,
262 'message': 'yasm genmacro for <(infile).',
263 },
264
265 ###
266 ### genstring call.
267 ###
268 {
269 'action_name': 'generate_license',
270 'variables': {
271 'infile': 'source/patched-yasm/COPYING',
272 'varname': 'license_msg',
273 'outfile': '<(generated_dir)/license.c',
274 },
275 'inputs': [ '<(PRODUCT_DIR)/genstring', '<(infile)', ],
276 'outputs': [ '<(outfile)', ],
277 'action': ['<(PRODUCT_DIR)/genstring',
278 '<(varname)',
279 '<(outfile)',
280 '<(infile)',
281 ],
282 # Not a direct source because this is #included by
283 # source/patched-yasm/frontends/yasm/yasm.c
284 'process_outputs_as_sources': 0,
285 'message': 'Generating yasm embeddable license.',
286 },
287
288 ###
289 ### A re2c call that doesn't fit into the rule below.
290 ###
291 {
292 'action_name': 'generate_lc3b_token',
293 'variables': {
294 'infile': 'source/patched-yasm/modules/arch/lc3b/lc3bid.re',
295 # The license file is #included by yasm.c.
296 'outfile': '<(generated_dir)/lc3bid.c',
297 },
298 'inputs': [ '<(PRODUCT_DIR)/re2c', '<(infile)', ],
299 'outputs': [ '<(outfile)', ],
300 'action': [
301 '<(PRODUCT_DIR)/re2c',
302 '-s',
303 '-o', '<(outfile)',
304 '<(infile)'
305 ],
306 'process_outputs_as_sources': 1,
307 'message': 'Generating yasm tokens for lc3b.',
308 },
309
310 ###
311 ### genmodule call.
312 ###
313 {
314 'action_name': 'generate_module',
315 'variables': {
316 'makefile': 'source/config/linux/Makefile',
317 'module_in': 'source/patched-yasm/libyasm/module.in',
318 'outfile': '<(generated_dir)/module.c',
319 },
320 'inputs': [
321 '<(PRODUCT_DIR)/genmodule',
322 '<(module_in)',
323 '<(makefile)'
324 ],
325 'outputs': [ '<(generated_dir)/module.c' ],
326 'action': [
327 '<(PRODUCT_DIR)/genmodule',
328 '<(module_in)',
329 '<(makefile)',
330 '<(outfile)'
331 ],
332 'process_outputs_as_sources': 1,
333 'message': 'Generating yasm module information.',
334 },
335 ],
336 },
337 {
338 'target_name': 'config_sources',
339 'type': 'none',
340 'sources': [
341 'source/config/<(OS)/Makefile',
342 'source/config/<(OS)/config.h',
343 'source/config/<(OS)/libyasm-stdint.h',
344 ],
345 },
346 {
347 'target_name': 'generate_files',
348 'type': 'none',
349 'dependencies': [
350 'genperf',
351 'genversion',
352 ],
353 'sources': [
354 'source/patched-yasm/modules/arch/x86/x86cpu.gperf',
355 'source/patched-yasm/modules/arch/x86/x86regtmod.gperf',
356 ],
357 'rules': [
358 {
359 'rule_name': 'generate_gperf',
360 'extension': 'gperf',
361 'inputs': [ '<(PRODUCT_DIR)/genperf' ],
362 'outputs': [ '<(shared_generated_dir)/<(RULE_INPUT_ROOT).c', ],
363 'action': [
364 '<(PRODUCT_DIR)/genperf',
365 '<(RULE_INPUT_PATH)',
366 '<(shared_generated_dir)/<(RULE_INPUT_ROOT).c',
367 ],
368 'process_outputs_as_sources': 0,
369 'message': 'yasm genperf for <(RULE_INPUT_PATH).',
370 },
371 ],
372 'actions': [
373 {
374 'action_name': 'generate_x86_insn',
375 'variables': {
376 'gen_insn_path':
377 'source/patched-yasm/modules/arch/x86/gen_x86_insn.py',
378 },
379 'inputs': [ '<(gen_insn_path)', ],
380 'outputs': [
381 '<(shared_generated_dir)/x86insns.c',
382 '<(shared_generated_dir)/x86insn_gas.gperf',
383 '<(shared_generated_dir)/x86insn_nasm.gperf',
384 ],
385 'action': [
386 'python',
387 '<(gen_insn_path)',
388 '<(shared_generated_dir)',
389 ],
390 'message': 'Running <(gen_insn_path).',
391 'process_outputs_as_sources': 0,
392 },
393 {
394 'action_name': 'generate_version',
395 'inputs': [ '<(PRODUCT_DIR)/genversion' ],
396 'outputs': [ '<(shared_generated_dir)/<(version_file)', ],
397 'action': [
398 '<(PRODUCT_DIR)/genversion',
399 '<(shared_generated_dir)/<(version_file)'
400 ],
401 'message': 'Generating yasm version file: '
402 '<(shared_generated_dir)/<(version_file).',
403 'process_outputs_as_sources': 0,
404 },
405 ],
406 },
407 {
408 'target_name': 'genperf_libs',
409 'type': 'static_library',
410 'dependencies': [ 'config_sources', ],
411 'sources': [
412 'source/patched-yasm/libyasm/phash.c',
413 'source/patched-yasm/libyasm/xmalloc.c',
414 'source/patched-yasm/libyasm/xstrdup.c',
415 ],
416 'include_dirs': [
417 '<@(yasm_include_dirs)',
418 ],
419 'cflags': [
420 '<(yasm_c_flags)',
421 ],
422 },
423 {
424 'target_name': 'genstring',
425 'type': 'executable',
426 'dependencies': [ 'config_sources', ],
427 'sources': [
428 'source/patched-yasm/genstring.c',
429 ],
430 'include_dirs': [
431 '<@(yasm_include_dirs)',
432 ],
433 'cflags': [
434 '-std=gnu99',
435 ],
436 },
437 {
438 'target_name': 'genperf',
439 'type': 'executable',
440 'dependencies': [
441 'genperf_libs',
442 ],
443 'sources': [
444 'source/patched-yasm/tools/genperf/genperf.c',
445 'source/patched-yasm/tools/genperf/perfect.c',
446 ],
447 'include_dirs': [
448 '<@(yasm_include_dirs)',
449 ],
450 'cflags': [
451 '-std=gnu99',
452 ],
453 },
454 {
455 'target_name': 'genmacro',
456 'type': 'executable',
457 'dependencies': [ 'config_sources', ],
458 'sources': [
459 'source/patched-yasm/tools/genmacro/genmacro.c',
460 ],
461 'include_dirs': [
462 '<@(yasm_include_dirs)',
463 ],
464 'cflags': [
465 '-std=gnu99',
466 ],
467 },
468 {
469 'target_name': 'genversion',
470 'type': 'executable',
471 'dependencies': [ 'config_sources', ],
472 'sources': [
473 'source/patched-yasm/modules/preprocs/nasm/genversion.c',
474 ],
475 'include_dirs': [
476 '<@(yasm_include_dirs)',
477 ],
478 'cflags': [
479 '-std=gnu99',
480 ],
481 },
482 {
483 'target_name': 're2c',
484 'type': 'executable',
485 'dependencies': [ 'config_sources', ],
486 'sources': [
487 'source/patched-yasm/tools/re2c/main.c',
488 'source/patched-yasm/tools/re2c/code.c',
489 'source/patched-yasm/tools/re2c/dfa.c',
490 'source/patched-yasm/tools/re2c/parser.c',
491 'source/patched-yasm/tools/re2c/actions.c',
492 'source/patched-yasm/tools/re2c/scanner.c',
493 'source/patched-yasm/tools/re2c/mbo_getopt.c',
494 'source/patched-yasm/tools/re2c/substr.c',
495 'source/patched-yasm/tools/re2c/translate.c',
496 ],
497 'include_dirs': [
498 '<@(yasm_include_dirs)',
499 ],
500 'cflags': [
501 '-std=gnu99',
502 ],
503 },
504 {
505 'target_name': 'genmodule',
506 'type': 'executable',
507 'dependencies': [
508 'config_sources',
509 ],
510 'sources': [
511 'source/patched-yasm/libyasm/genmodule.c',
512 ],
513 'include_dirs': [
514 '<@(yasm_include_dirs)',
515
516 ],
517 'cflags': [
518 '-std=gnu99',
519 ],
520 },
521 ],
522 }
523
524 # Local Variables:
525 # tab-width:2
526 # indent-tabs-mode:nil
527 # End:
528 # vim: set expandtab tabstop=2 shiftwidth=2:
OLDNEW
« no previous file with comments | « third_party/yasm/source/config/linux/libyasm-stdint.h ('k') | third_party/zlib/zlib.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698