| OLD | NEW |
| (Empty) |
| 1 # Copyright (c) 2012 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 # This is an gyp include to use YASM for compiling assembly files. | |
| 6 # | |
| 7 # Files to be compiled with YASM should have an extension of .asm. | |
| 8 # | |
| 9 # There are three variables for this include: | |
| 10 # yasm_flags : Pass additional flags into YASM. | |
| 11 # yasm_output_path : Output directory for the compiled object files. | |
| 12 # yasm_includes : Includes used by .asm code. Changes to which should force | |
| 13 # recompilation. | |
| 14 # | |
| 15 # Sample usage: | |
| 16 # 'sources': [ | |
| 17 # 'ultra_optimized_awesome.asm', | |
| 18 # ], | |
| 19 # 'variables': { | |
| 20 # 'yasm_flags': [ | |
| 21 # '-I', 'assembly_include', | |
| 22 # ], | |
| 23 # 'yasm_output_path': '<(SHARED_INTERMEDIATE_DIR)/project', | |
| 24 # 'yasm_includes': ['ultra_optimized_awesome.inc'] | |
| 25 # }, | |
| 26 # 'includes': [ | |
| 27 # 'third_party/yasm/yasm_compile.gypi' | |
| 28 # ], | |
| 29 | |
| 30 { | |
| 31 'variables': { | |
| 32 'yasm_flags': [], | |
| 33 'yasm_includes': [], | |
| 34 | |
| 35 'conditions': [ | |
| 36 [ 'use_system_yasm==0', { | |
| 37 'yasm_path': '<(PRODUCT_DIR)/yasm<(EXECUTABLE_SUFFIX)', | |
| 38 }, { | |
| 39 'yasm_path': '<!(which yasm)', | |
| 40 }], | |
| 41 | |
| 42 # Define yasm_flags that pass into YASM. | |
| 43 [ 'os_posix==1 and OS!="mac" and OS!="ios" and target_arch=="ia32"', { | |
| 44 'yasm_flags': [ | |
| 45 '-felf32', | |
| 46 '-m', 'x86', | |
| 47 ], | |
| 48 }], | |
| 49 [ 'os_posix==1 and OS!="mac" and OS!="ios" and target_arch=="x64"', { | |
| 50 'yasm_flags': [ | |
| 51 '-DPIC', | |
| 52 '-felf64', | |
| 53 '-m', 'amd64', | |
| 54 ], | |
| 55 }], | |
| 56 [ '(OS=="mac" or OS=="ios") and target_arch=="ia32"', { | |
| 57 'yasm_flags': [ | |
| 58 '-fmacho32', | |
| 59 '-m', 'x86', | |
| 60 ], | |
| 61 }], | |
| 62 [ '(OS=="mac" or OS=="ios") and target_arch=="x64"', { | |
| 63 'yasm_flags': [ | |
| 64 '-fmacho64', | |
| 65 '-m', 'amd64', | |
| 66 ], | |
| 67 }], | |
| 68 [ 'OS=="win" and target_arch=="ia32"', { | |
| 69 'yasm_flags': [ | |
| 70 '-DPREFIX', | |
| 71 '-fwin32', | |
| 72 '-m', 'x86', | |
| 73 ], | |
| 74 }], | |
| 75 [ 'OS=="win" and target_arch=="x64"', { | |
| 76 'yasm_flags': [ | |
| 77 '-fwin64', | |
| 78 '-m', 'amd64', | |
| 79 ], | |
| 80 }], | |
| 81 | |
| 82 # Define output extension. | |
| 83 ['OS=="win"', { | |
| 84 'asm_obj_extension': 'obj', | |
| 85 }, { | |
| 86 'asm_obj_extension': 'o', | |
| 87 }], | |
| 88 ], | |
| 89 }, # variables | |
| 90 | |
| 91 'conditions': [ | |
| 92 # Only depend on YASM on x86 systems, do this so that compiling | |
| 93 # .asm files for ARM will fail. | |
| 94 ['use_system_yasm==0 and ( target_arch=="ia32" or target_arch=="x64" )', { | |
| 95 'dependencies': [ | |
| 96 '<(DEPTH)/third_party/yasm/yasm.gyp:yasm#host', | |
| 97 ], | |
| 98 }], | |
| 99 ], # conditions | |
| 100 | |
| 101 'rules': [ | |
| 102 { | |
| 103 'rule_name': 'assemble', | |
| 104 'extension': 'asm', | |
| 105 'inputs': [ '<(yasm_path)', '<@(yasm_includes)'], | |
| 106 'outputs': [ | |
| 107 '<(yasm_output_path)/<(RULE_INPUT_ROOT).<(asm_obj_extension)', | |
| 108 ], | |
| 109 'action': [ | |
| 110 '<(yasm_path)', | |
| 111 '<@(yasm_flags)', | |
| 112 '-o', '<(yasm_output_path)/<(RULE_INPUT_ROOT).<(asm_obj_extension)', | |
| 113 '<(RULE_INPUT_PATH)', | |
| 114 ], | |
| 115 'process_outputs_as_sources': 1, | |
| 116 'message': 'Compile assembly <(RULE_INPUT_PATH)', | |
| 117 }, | |
| 118 ], # rules | |
| 119 } | |
| OLD | NEW |