aboutsummaryrefslogtreecommitdiffhomepage
path: root/gyp/yasm.gyp
blob: 04e23cff120abe075837a730173f198166b5e015 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

# The yasm build process creates a slew of small C subprograms that
# dynamically generate files at various point in the build process.  This makes
# the build integration moderately complex.
#
# There are three classes of dynamically generated files:
#   1) C source files that should be included in the build (eg., lc3bid.c)
#   2) C source files that are #included by static C sources (eg., license.c)
#   3) Intermediate files that are used as input by other subprograms to
#      further generate files in category #1 or #2.  (eg., version.mac)
#
# This structure is represented with the following targets:
#   1) yasm -- Sources, flags for the main yasm executable. Also has most of
#              of the actions and rules that invoke the subprograms.
#   2) config_sources -- Checked in version of files generated by manually
#                        running configure that are used by all binaries.
#   3) generate_files -- Actions and rules for files of type #3.
#   4) genperf_libs -- Object files shared between yasm and the genperf
#                      subprogram.
#   5) genmacro, genmodule, etc. -- One executable target for each subprogram.
#
# You will notice that a lot of the action targets seem very similar --
# especially for genmacro invocations. This makes it seem like they should
# be a rule. The problem is that the correct invocation cannot be inferred
# purely from the file name, or extension.  Nor is it obvious whether the
# output should be processed as a source or not.  Thus, we are left with a
# large amount of repetitive code.

{
  'xcode_settings': {
    'SYMROOT': '<(DEPTH)/xcodebuild',
  },
  'variables': {
    'yasm_include_dirs': [
      '../third_party/yasm/config/<(skia_os)',
      '../third_party/externals/yasm/source/patched-yasm',
    ],

    # The cflags used by any target that will be directly linked into yasm.
    # These are specifically not used when building the subprograms.  While
    # it would probably be safe to use these flags there as well, the
    # ./configure based build does not use the same flags between the main
    # yasm executable, and its subprograms.
    'yasm_defines': ['HAVE_CONFIG_H'],
    'yasm_cflags': [
      '-std=gnu99',
      '-ansi',
      '-pedantic',
      '-w',
    ],

    # Locations for various generated artifacts.
    'shared_generated_dir': '<(SHARED_INTERMEDIATE_DIR)/third_party/yasm',
    'generated_dir': '<(INTERMEDIATE_DIR)/third_party/yasm',

    # Various files referenced by multiple targets.
    'version_file': 'version.mac',  # Generated by genversion.
    'genmodule_source': 'genmodule_outfile.c',
  },
  'target_defaults': {
    # Silence warnings in libc++ builds (C code doesn't need this flag).
    'ldflags!': [ '-stdlib=libc++', '-fsanitize=<(skia_sanitizer)' ],
    # https://crbug.com/489901
    'cflags!': [
        '-fsanitize=bounds',
        '-fsanitize=<(skia_sanitizer)',
        '-fsanitize-memory-track-origins',
    ],
    'libraries!': [ '-llog', ],
  },
  'targets': [
    {
      'target_name': 'yasm',
      'type': 'executable',
      'toolsets': ['host'],
      'dependencies': [
        'config_sources',
        'genmacro',
        'genmodule',
        'genperf',
        'genperf_libs',
        'generate_files',  # Needed to generate gperf and instruction files.
        'genstring',
        're2c',
      ],
      'variables': {
        'clang_warning_flags': [
          # yasm passes a `const elf_machine_sym*` through `void*`.
          '-Wno-incompatible-pointer-types',
        ],
      },
      'conditions': [
        ['skia_os == "win"', {
          # As of VS 2013 Update 3, building this project with /analyze hits an
          # internal compiler error on elf-x86-amd64.c in release builds with
          # the amd64_x86 compiler. This halts the build and prevents subsequent
          # analysis. Therefore, /analyze is disabled for this project. See this
          # bug for details:
          # https://connect.microsoft.com/VisualStudio/feedback/details/1014799/internal-compiler-error-when-using-analyze
          'msvs_settings': {
            'VCCLCompilerTool': {
              'AdditionalOptions!': [ '/analyze' ]
            },
          },
        }],
      ],
      'sources': [
         '../third_party/externals/yasm/source/patched-yasm/frontends/yasm/yasm-options.c',
         '../third_party/externals/yasm/source/patched-yasm/frontends/yasm/yasm.c',
         '../third_party/externals/yasm/source/patched-yasm/libyasm/assocdat.c',
         '../third_party/externals/yasm/source/patched-yasm/libyasm/bc-align.c',
         '../third_party/externals/yasm/source/patched-yasm/libyasm/bc-data.c',
         '../third_party/externals/yasm/source/patched-yasm/libyasm/bc-incbin.c',
         '../third_party/externals/yasm/source/patched-yasm/libyasm/bc-org.c',
         '../third_party/externals/yasm/source/patched-yasm/libyasm/bc-reserve.c',
         '../third_party/externals/yasm/source/patched-yasm/libyasm/bitvect.c',
         '../third_party/externals/yasm/source/patched-yasm/libyasm/bytecode.c',
         '../third_party/externals/yasm/source/patched-yasm/libyasm/errwarn.c',
         '../third_party/externals/yasm/source/patched-yasm/libyasm/expr.c',
         '../third_party/externals/yasm/source/patched-yasm/libyasm/file.c',
         '../third_party/externals/yasm/source/patched-yasm/libyasm/floatnum.c',
         '../third_party/externals/yasm/source/patched-yasm/libyasm/hamt.c',
         '../third_party/externals/yasm/source/patched-yasm/libyasm/insn.c',
         '../third_party/externals/yasm/source/patched-yasm/libyasm/intnum.c',
         '../third_party/externals/yasm/source/patched-yasm/libyasm/inttree.c',
         '../third_party/externals/yasm/source/patched-yasm/libyasm/linemap.c',
         '../third_party/externals/yasm/source/patched-yasm/libyasm/md5.c',
         '../third_party/externals/yasm/source/patched-yasm/libyasm/mergesort.c',
         '../third_party/externals/yasm/source/patched-yasm/libyasm/section.c',
         '../third_party/externals/yasm/source/patched-yasm/libyasm/strcasecmp.c',
         '../third_party/externals/yasm/source/patched-yasm/libyasm/strsep.c',
         '../third_party/externals/yasm/source/patched-yasm/libyasm/symrec.c',
         '../third_party/externals/yasm/source/patched-yasm/libyasm/valparam.c',
         '../third_party/externals/yasm/source/patched-yasm/libyasm/value.c',
         '../third_party/externals/yasm/source/patched-yasm/modules/arch/lc3b/lc3barch.c',
         '../third_party/externals/yasm/source/patched-yasm/modules/arch/lc3b/lc3bbc.c',
         '../third_party/externals/yasm/source/patched-yasm/modules/arch/x86/x86arch.c',
         '../third_party/externals/yasm/source/patched-yasm/modules/arch/x86/x86bc.c',
         '../third_party/externals/yasm/source/patched-yasm/modules/arch/x86/x86expr.c',
         '../third_party/externals/yasm/source/patched-yasm/modules/arch/x86/x86id.c',
         '../third_party/externals/yasm/source/patched-yasm/modules/dbgfmts/codeview/cv-dbgfmt.c',
         '../third_party/externals/yasm/source/patched-yasm/modules/dbgfmts/codeview/cv-symline.c',
         '../third_party/externals/yasm/source/patched-yasm/modules/dbgfmts/codeview/cv-type.c',
         '../third_party/externals/yasm/source/patched-yasm/modules/dbgfmts/dwarf2/dwarf2-aranges.c',
         '../third_party/externals/yasm/source/patched-yasm/modules/dbgfmts/dwarf2/dwarf2-dbgfmt.c',
         '../third_party/externals/yasm/source/patched-yasm/modules/dbgfmts/dwarf2/dwarf2-info.c',
         '../third_party/externals/yasm/source/patched-yasm/modules/dbgfmts/dwarf2/dwarf2-line.c',
         '../third_party/externals/yasm/source/patched-yasm/modules/dbgfmts/null/null-dbgfmt.c',
         '../third_party/externals/yasm/source/patched-yasm/modules/dbgfmts/stabs/stabs-dbgfmt.c',
         '../third_party/externals/yasm/source/patched-yasm/modules/listfmts/nasm/nasm-listfmt.c',
         '../third_party/externals/yasm/source/patched-yasm/modules/objfmts/bin/bin-objfmt.c',
         '../third_party/externals/yasm/source/patched-yasm/modules/objfmts/coff/coff-objfmt.c',
         '../third_party/externals/yasm/source/patched-yasm/modules/objfmts/coff/win64-except.c',
         '../third_party/externals/yasm/source/patched-yasm/modules/objfmts/dbg/dbg-objfmt.c',
         '../third_party/externals/yasm/source/patched-yasm/modules/objfmts/elf/elf-objfmt.c',
         '../third_party/externals/yasm/source/patched-yasm/modules/objfmts/elf/elf-x86-amd64.c',
         '../third_party/externals/yasm/source/patched-yasm/modules/objfmts/elf/elf-x86-x86.c',
         '../third_party/externals/yasm/source/patched-yasm/modules/objfmts/elf/elf.c',
         '../third_party/externals/yasm/source/patched-yasm/modules/objfmts/macho/macho-objfmt.c',
         '../third_party/externals/yasm/source/patched-yasm/modules/objfmts/rdf/rdf-objfmt.c',
         '../third_party/externals/yasm/source/patched-yasm/modules/objfmts/xdf/xdf-objfmt.c',
         '../third_party/externals/yasm/source/patched-yasm/modules/parsers/gas/gas-parse.c',
         '../third_party/externals/yasm/source/patched-yasm/modules/parsers/gas/gas-parse-intel.c',
         '../third_party/externals/yasm/source/patched-yasm/modules/parsers/gas/gas-parser.c',
         '../third_party/externals/yasm/source/patched-yasm/modules/parsers/nasm/nasm-parse.c',
         '../third_party/externals/yasm/source/patched-yasm/modules/parsers/nasm/nasm-parser.c',
         '../third_party/externals/yasm/source/patched-yasm/modules/preprocs/cpp/cpp-preproc.c',
         '../third_party/externals/yasm/source/patched-yasm/modules/preprocs/nasm/nasm-eval.c',
         '../third_party/externals/yasm/source/patched-yasm/modules/preprocs/nasm/nasm-pp.c',
         '../third_party/externals/yasm/source/patched-yasm/modules/preprocs/nasm/nasm-preproc.c',
         '../third_party/externals/yasm/source/patched-yasm/modules/preprocs/nasm/nasmlib.c',
         '../third_party/externals/yasm/source/patched-yasm/modules/preprocs/raw/raw-preproc.c',

         # Sources needed by re2c.
         '../third_party/externals/yasm/source/patched-yasm/modules/parsers/gas/gas-token.re',
         '../third_party/externals/yasm/source/patched-yasm/modules/parsers/nasm/nasm-token.re',

         # Sources needed by genperf. Make sure the generated gperf files
         # (the ones in shared_generated_dir) are synced with the outputs
         # for the related generate_*_insn actions in the generate_files
         # target below.
         '<(shared_generated_dir)/x86insn_nasm.gperf',
         '<(shared_generated_dir)/x86insn_gas.gperf',
         '<(shared_generated_dir)/x86cpu.c',
         '<(shared_generated_dir)/x86regtmod.c',
      ],
      'include_dirs': [
        '<@(yasm_include_dirs)',
        '<(shared_generated_dir)',
        '<(generated_dir)',
      ],
      'defines': [ '<@(yasm_defines)' ],
      'cflags': [ '<@(yasm_cflags)', ],
      'cflags!': [
        '-mfpu=neon',
        '-mthumb',
        '-march=armv7-a',
      ],
      'xcode_settings': {
        'WARNING_CFLAGS': [
          '-w',
        ],
      },
      'msvs_disabled_warnings': [ 4267 ],
      'rules': [
        {
          'rule_name': 'generate_gperf',
          'extension': 'gperf',
          'inputs': [ '<(PRODUCT_DIR)/'
                      '<(EXECUTABLE_PREFIX)genperf<(EXECUTABLE_SUFFIX)' ],
          'outputs': [
            '<(generated_dir)/<(RULE_INPUT_ROOT).c',
          ],
          'action': ['<(PRODUCT_DIR)/genperf',
                     '<(RULE_INPUT_PATH)',
                     '<(generated_dir)/<(RULE_INPUT_ROOT).c',
          ],
          # These files are #included, so do not treat them as sources.
          'process_outputs_as_sources': 0,
          'message': 'yasm gperf for <(RULE_INPUT_PATH)',
        },
        {
          'rule_name': 'generate_re2c',
          'extension': 're',
          'inputs': [ '<(PRODUCT_DIR)/'
                      '<(EXECUTABLE_PREFIX)re2c<(EXECUTABLE_SUFFIX)' ],
          'outputs': [ '<(generated_dir)/<(RULE_INPUT_ROOT).c', ],
          'action': [
            '<(PRODUCT_DIR)/re2c',
            '-b',
            '-o',
            '<(generated_dir)/<(RULE_INPUT_ROOT).c',
            '<(RULE_INPUT_PATH)',
          ],
          'process_outputs_as_sources': 1,
          'message': 'yasm re2c for <(RULE_INPUT_PATH)',
        },
      ],
      'actions': [
        ###
        ###  genmacro calls.
        ###
        {
          'action_name': 'generate_nasm_macros',
          'variables': {
            'infile': '../third_party/externals/yasm/source/patched-yasm/modules/parsers/nasm/nasm-std.mac',
            'varname': 'nasm_standard_mac',
            'outfile': '<(generated_dir)/nasm-macros.c',
          },
          'inputs': [ '<(PRODUCT_DIR)/'
                      '<(EXECUTABLE_PREFIX)genmacro<(EXECUTABLE_SUFFIX)',
                      '<(infile)', ],
          'outputs': [ '<(outfile)', ],
          'action': ['<(PRODUCT_DIR)/genmacro',
                     '<(outfile)', '<(varname)', '<(infile)', ],
           # Not a direct source because this is #included by
           #   source/patched-yasm/modules/parsers/nasm/nasm-parser.c
          'process_outputs_as_sources': 1,
          'xcode_settings': {
            'WARNING_CFLAGS': [
            '-w',
          ],
        },
          'message': 'yasm genmacro for <(infile)',
        },
        {
          'action_name': 'generate_nasm_version',
          'variables': {
            'infile': '<(shared_generated_dir)/<(version_file)',
            'varname': 'nasm_version_mac',
            'outfile': '<(generated_dir)/nasm-version.c',
          },
          'inputs': [ '<(PRODUCT_DIR)/'
                      '<(EXECUTABLE_PREFIX)genmacro<(EXECUTABLE_SUFFIX)',
                      '<(infile)', ],
          'outputs': [ '<(outfile)', ],
          'action': ['<(PRODUCT_DIR)/genmacro',
                     '<(outfile)', '<(varname)', '<(infile)',
          ],
           # Not a direct source because this is #included by
           #   source/patched-yasm/modules/preprocs/nasm/nasm-preproc.c
          'process_outputs_as_sources': 0,
          'message': 'yasm genmacro for <(infile)',
        },
        {
          'action_name': 'generate_win64_gas',
          'variables': {
            'infile': '../third_party/externals/yasm/source/patched-yasm/modules/objfmts/coff/win64-gas.mac',
            'varname': 'win64_gas_stdmac',
            'outfile': '<(generated_dir)/win64-gas.c',
          },
          'inputs': [ '<(PRODUCT_DIR)/'
                      '<(EXECUTABLE_PREFIX)genmacro<(EXECUTABLE_SUFFIX)',
                      '<(infile)', ],
          'outputs': [ '<(outfile)', ],
          'action': ['<(PRODUCT_DIR)/genmacro',
                     '<(outfile)', '<(varname)', '<(infile)',
          ],
           # Not a direct source because this is #included by
           #   source/patched-yasm/modules/objfmts/coff/coff-objfmt.c
          'process_outputs_as_sources': 0,
          'message': 'yasm genmacro for <(infile)',
        },
        {
          'action_name': 'generate_win64_nasm',
          'variables': {
            'infile': '../third_party/externals/yasm/source/patched-yasm/modules/objfmts/coff/win64-nasm.mac',
            'varname': 'win64_nasm_stdmac',
            'outfile': '<(generated_dir)/win64-nasm.c',
          },
          'inputs': [ '<(PRODUCT_DIR)/'
                      '<(EXECUTABLE_PREFIX)genmacro<(EXECUTABLE_SUFFIX)',
                      '<(infile)', ],
          'outputs': [ '<(outfile)', ],
          'action': ['<(PRODUCT_DIR)/genmacro',
                     '<(outfile)',
                     '<(varname)',
                     '<(infile)',
          ],
           # Not a direct source because this is #included by
           #   source/patched-yasm/modules/objfmts/coff/coff-objfmt.c
          'process_outputs_as_sources': 0,
          'message': 'yasm genmacro for <(infile)',
        },

        ###
        ###  genstring call.
        ###
        {
          'action_name': 'generate_license',
          'variables': {
            'infile': '../third_party/externals/yasm/source/patched-yasm/COPYING',
            'varname': 'license_msg',
            'outfile': '<(generated_dir)/license.c',
          },
          'inputs': [ '<(PRODUCT_DIR)/'
                      '<(EXECUTABLE_PREFIX)genstring<(EXECUTABLE_SUFFIX)',
                      '<(infile)', ],
          'outputs': [ '<(outfile)', ],
          'action': ['<(PRODUCT_DIR)/genstring',
                     '<(varname)',
                     '<(outfile)',
                     '<(infile)',
          ],
          # Not a direct source because this is #included by
          #   source/patched-yasm/frontends/yasm/yasm.c
          'process_outputs_as_sources': 0,
          'message': 'Generating yasm embeddable license',
        },

        ###
        ###  A re2c call that doesn't fit into the rule below.
        ###
        {
          'action_name': 'generate_lc3b_token',
          'variables': {
            'infile': '../third_party/externals/yasm/source/patched-yasm/modules/arch/lc3b/lc3bid.re',
            # The license file is #included by yasm.c.
            'outfile': '<(generated_dir)/lc3bid.c',
          },
          'inputs': [ '<(PRODUCT_DIR)/'
                      '<(EXECUTABLE_PREFIX)re2c<(EXECUTABLE_SUFFIX)',
                      '<(infile)', ],
          'outputs': [ '<(outfile)', ],
          'action': [
            '<(PRODUCT_DIR)/re2c',
            '-s',
            '-o', '<(outfile)',
            '<(infile)'
          ],
          'process_outputs_as_sources': 1,
          'message': 'Generating yasm tokens for lc3b',
        },

        ###
        ###  genmodule call.
        ###
        {
          'action_name': 'generate_module',
          'variables': {
            'makefile': '../third_party/yasm/config/<(skia_os)/Makefile',
            'module_in': '../third_party/externals/yasm/source/patched-yasm/libyasm/module.in',
            'outfile': '<(generated_dir)/module.c',
          },
          'inputs': [
            '<(PRODUCT_DIR)/<(EXECUTABLE_PREFIX)genmodule<(EXECUTABLE_SUFFIX)',
            '<(module_in)',
            '<(makefile)'
          ],
          'outputs': [ '<(generated_dir)/module.c' ],
          'action': [
            '<(PRODUCT_DIR)/genmodule',
            '<(module_in)',
            '<(makefile)',
            '<(outfile)'
          ],
          'process_outputs_as_sources': 1,
          'message': 'Generating yasm module information',
        },
      ],
    },
    {
      'target_name': 'config_sources',
      'type': 'none',
      'toolsets': ['host'],
      'sources': [
        '../third_party/yasm/config/<(skia_os)/Makefile',
        '../third_party/yasm/config/<(skia_os)/config.h',
        '../third_party/yasm/config/<(skia_os)/libyasm-stdint.h',
      ],
    },
    {
      'target_name': 'generate_files',
      'type': 'none',
      'toolsets': ['host'],
      'dependencies': [
        'genperf',
        'genversion',
      ],
      'sources': [
         '../third_party/externals/yasm/source/patched-yasm/modules/arch/x86/x86cpu.gperf',
         '../third_party/externals/yasm/source/patched-yasm/modules/arch/x86/x86regtmod.gperf',
      ],
      'rules': [
        {
          'rule_name': 'generate_gperf',
          'extension': 'gperf',
          'inputs': [ '<(PRODUCT_DIR)/'
                      '<(EXECUTABLE_PREFIX)genperf<(EXECUTABLE_SUFFIX)' ],
          'outputs': [ '<(shared_generated_dir)/<(RULE_INPUT_ROOT).c', ],
          'action': [
            '<(PRODUCT_DIR)/genperf',
            '<(RULE_INPUT_PATH)',
            '<(shared_generated_dir)/<(RULE_INPUT_ROOT).c',
          ],
          'process_outputs_as_sources': 0,
          'message': 'yasm genperf for <(RULE_INPUT_PATH)',
        },
      ],
      'actions': [
        {
          'action_name': 'generate_x86_insn',
          'variables': {
            'gen_insn_path':
                '../third_party/externals/yasm/source/patched-yasm/modules/arch/x86/gen_x86_insn.py',
          },
          'inputs': [ '<(gen_insn_path)', ],
          'outputs': [
            '<(shared_generated_dir)/x86insns.c',
            '<(shared_generated_dir)/x86insn_gas.gperf',
            '<(shared_generated_dir)/x86insn_nasm.gperf',
          ],
          'action': [
            'python',
            '<(gen_insn_path)',
            '<(shared_generated_dir)',
          ],
          'message': 'Running <(gen_insn_path)',
          'process_outputs_as_sources': 0,
        },
        {
          'action_name': 'generate_version',
          'inputs': [ '<(PRODUCT_DIR)/'
                      '<(EXECUTABLE_PREFIX)genversion<(EXECUTABLE_SUFFIX)' ],
          'outputs': [ '<(shared_generated_dir)/<(version_file)', ],
          'action': [
            '<(PRODUCT_DIR)/genversion',
            '<(shared_generated_dir)/<(version_file)'
          ],
          'message': 'Generating yasm version file: '
                     '<(shared_generated_dir)/<(version_file)',
          'process_outputs_as_sources': 0,
        },
      ],
    },
    {
      'target_name': 'genperf_libs',
      'type': 'static_library',
      'toolsets': ['host'],
      'dependencies': [ 'config_sources', ],
      'sources': [
         '../third_party/externals/yasm/source/patched-yasm/libyasm/phash.c',
         '../third_party/externals/yasm/source/patched-yasm/libyasm/xmalloc.c',
         '../third_party/externals/yasm/source/patched-yasm/libyasm/xstrdup.c',
      ],
      'include_dirs': [
        '<@(yasm_include_dirs)',
      ],
      'defines': [ '<@(yasm_defines)' ],
      'cflags': [
        '<@(yasm_cflags)',
      ],
      'cflags!': [
        '-mfpu=neon',
        '-mthumb',
        '-march=armv7-a',
      ],
    },
    {
      'target_name': 'genstring',
      'type': 'executable',
      'toolsets': ['host'],
      'dependencies': [ 'config_sources', ],
      'sources': [
         '../third_party/externals/yasm/source/patched-yasm/genstring.c',
      ],
      'include_dirs': [
        '<@(yasm_include_dirs)',
      ],
      'cflags': [
        '-std=gnu99',
        '-w',
      ],
      'cflags!': [
        '-mfpu=neon',
        '-mthumb',
        '-march=armv7-a',
      ],
    },
    {
      'target_name': 'genperf',
      'type': 'executable',
      'toolsets': ['host'],
      'dependencies': [
        'genperf_libs',
      ],
      'sources': [
         '../third_party/externals/yasm/source/patched-yasm/tools/genperf/genperf.c',
         '../third_party/externals/yasm/source/patched-yasm/tools/genperf/perfect.c',
      ],
      'include_dirs': [
        '<@(yasm_include_dirs)',
      ],
      'cflags': [
        '-std=gnu99',
        '-w',
      ],
      'cflags!': [
        '-mfpu=neon',
        '-mthumb',
        '-march=armv7-a',
      ],
    },
    {
      'target_name': 'genmacro',
      'type': 'executable',
      'toolsets': ['host'],
      'dependencies': [ 'config_sources', ],
      'sources': [
        '../third_party/externals/yasm/source/patched-yasm/tools/genmacro/genmacro.c',
      ],
      'include_dirs': [
        '<@(yasm_include_dirs)',
      ],
      'cflags': [
        '-std=gnu99',
        '-w',
      ],
      'cflags!': [
        '-mfpu=neon',
        '-mthumb',
        '-march=armv7-a',
      ],
    },
    {
      'target_name': 'genversion',
      'type': 'executable',
      'toolsets': ['host'],
      'dependencies': [ 'config_sources', ],
      'sources': [
         '../third_party/externals/yasm/source/patched-yasm/modules/preprocs/nasm/genversion.c',
      ],
      'include_dirs': [
        '<@(yasm_include_dirs)',
      ],
      'cflags': [
        '-std=gnu99',
        '-w',
      ],
      'cflags!': [
        '-mfpu=neon',
        '-mthumb',
        '-march=armv7-a',
      ],
    },
    {
      'target_name': 're2c',
      'type': 'executable',
      'toolsets': ['host'],
      'dependencies': [ 'config_sources', ],
      'sources': [
         '../third_party/externals/yasm/source/patched-yasm/tools/re2c/main.c',
         '../third_party/externals/yasm/source/patched-yasm/tools/re2c/code.c',
         '../third_party/externals/yasm/source/patched-yasm/tools/re2c/dfa.c',
         '../third_party/externals/yasm/source/patched-yasm/tools/re2c/parser.c',
         '../third_party/externals/yasm/source/patched-yasm/tools/re2c/actions.c',
         '../third_party/externals/yasm/source/patched-yasm/tools/re2c/scanner.c',
         '../third_party/externals/yasm/source/patched-yasm/tools/re2c/mbo_getopt.c',
         '../third_party/externals/yasm/source/patched-yasm/tools/re2c/substr.c',
         '../third_party/externals/yasm/source/patched-yasm/tools/re2c/translate.c',
      ],
      'include_dirs': [
        '<@(yasm_include_dirs)',
      ],
      'cflags': [
        '-std=gnu99',
        '-w',
      ],
      'cflags!': [
        '-mfpu=neon',
        '-mthumb',
        '-march=armv7-a',
      ],
      'xcode_settings': {
        'WARNING_CFLAGS': [
          '-w',
        ],
      },
      'variables': {
          # re2c is missing CLOSEVOP from one switch.
        'clang_warning_flags': [ '-Wno-switch' ],
      },
      'msvs_disabled_warnings': [ 4267 ],
    },
    {
      'target_name': 'genmodule',
      'type': 'executable',
      'toolsets': ['host'],
      'dependencies': [
        'config_sources',
      ],
      'sources': [
        '../third_party/externals/yasm/source/patched-yasm/libyasm/genmodule.c',
      ],
      'include_dirs': [
        '<@(yasm_include_dirs)',

      ],
      'cflags': [
        '-std=gnu99',
      ],
      'cflags!': [
        '-mfpu=neon',
        '-mthumb',
        '-march=armv7-a',
      ],
    },
  ],
}