| OLD | NEW |
| 1 # Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2011 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 # This is an gyp include to use YASM for compiling assembly files. | 5 # This is an gyp include to use YASM for compiling assembly files. |
| 6 # | 6 # |
| 7 # Files to be compiled with YASM should have an extension of .asm. | 7 # Files to be compiled with YASM should have an extension of .asm. |
| 8 # | 8 # |
| 9 # There are two variables for this include: | 9 # There are two variables for this include: |
| 10 # yasm_flags : Pass additional flags into YASM. | 10 # yasm_flags : Pass additional flags into YASM. |
| 11 # yasm_output_path : Output directory for the compiled object files. | 11 # yasm_output_path : Output directory for the compiled object files. |
| 12 # | 12 # |
| 13 # Sample usage: | 13 # Sample usage: |
| 14 # 'sources': [ | 14 # 'sources': [ |
| 15 # 'ultra_optimized_awesome.asm', | 15 # 'ultra_optimized_awesome.asm', |
| 16 # ], | 16 # ], |
| 17 # 'variables': { | 17 # 'variables': { |
| 18 # 'yasm_flags': [ | 18 # 'yasm_flags': [ |
| 19 # '-I', 'assembly_include', | 19 # '-I', 'assembly_include', |
| 20 # ], | 20 # ], |
| 21 # 'yasm_output_path': '<(SHARED_INTERMEDIATE_DIR)/project', | 21 # 'yasm_output_path': '<(SHARED_INTERMEDIATE_DIR)/project', |
| 22 # }, | 22 # }, |
| 23 # 'includes': [ | 23 # 'includes': [ |
| 24 # 'third_party/yasm/yasm_compile.gypi' | 24 # 'third_party/yasm/yasm_compile.gypi' |
| 25 # ], | 25 # ], |
| 26 | 26 |
| 27 { | 27 { |
| 28 'variables': { | 28 'variables': { |
| 29 'yasm_flags': [], | 29 'yasm_flags': [], |
| 30 'yasm_path': '<(PRODUCT_DIR)/yasm', | |
| 31 | 30 |
| 32 'conditions': [ | 31 'conditions': [ |
| 32 [ 'use_system_yasm==0', { |
| 33 'yasm_path': '<(PRODUCT_DIR)/yasm', |
| 34 }, { |
| 35 'yasm_path': '<!(which yasm)', |
| 36 }], |
| 37 |
| 33 # Define yasm_flags that pass into YASM. | 38 # Define yasm_flags that pass into YASM. |
| 34 [ 'OS=="linux" and target_arch=="ia32"', { | 39 [ 'OS=="linux" and target_arch=="ia32"', { |
| 35 'yasm_flags': [ | 40 'yasm_flags': [ |
| 36 '-felf32', | 41 '-felf32', |
| 37 '-m', 'x86', | 42 '-m', 'x86', |
| 38 ], | 43 ], |
| 39 }], | 44 }], |
| 40 [ 'OS=="linux" and target_arch=="x64"', { | 45 [ 'OS=="linux" and target_arch=="x64"', { |
| 41 'yasm_flags': [ | 46 'yasm_flags': [ |
| 42 '-DPIC', | 47 '-DPIC', |
| (...skipping 20 matching lines...) Expand all Loading... |
| 63 'asm_obj_extension': 'obj', | 68 'asm_obj_extension': 'obj', |
| 64 }, { | 69 }, { |
| 65 'asm_obj_extension': 'o', | 70 'asm_obj_extension': 'o', |
| 66 }], | 71 }], |
| 67 ], | 72 ], |
| 68 }, # variables | 73 }, # variables |
| 69 | 74 |
| 70 'conditions': [ | 75 'conditions': [ |
| 71 # Only depend on YASM on x86 systems, do this so that compiling | 76 # Only depend on YASM on x86 systems, do this so that compiling |
| 72 # .asm files for ARM will fail. | 77 # .asm files for ARM will fail. |
| 73 ['target_arch=="ia32" or target_arch=="x64"', { | 78 ['use_system_yasm==0 and ( target_arch=="ia32" or target_arch=="x64" )', { |
| 74 'dependencies': [ | 79 'dependencies': [ |
| 75 '<(DEPTH)/third_party/yasm/yasm.gyp:yasm#host', | 80 '<(DEPTH)/third_party/yasm/yasm.gyp:yasm#host', |
| 76 ], | 81 ], |
| 77 }], | 82 }], |
| 78 ], # conditions | 83 ], # conditions |
| 79 | 84 |
| 80 'rules': [ | 85 'rules': [ |
| 81 { | 86 { |
| 82 'rule_name': 'assemble', | 87 'rule_name': 'assemble', |
| 83 'extension': 'asm', | 88 'extension': 'asm', |
| 84 'inputs': [ '<(yasm_path)', ], | 89 'inputs': [ '<(yasm_path)', ], |
| 85 'outputs': [ | 90 'outputs': [ |
| 86 '<(yasm_output_path)/<(RULE_INPUT_ROOT).<(asm_obj_extension)', | 91 '<(yasm_output_path)/<(RULE_INPUT_ROOT).<(asm_obj_extension)', |
| 87 ], | 92 ], |
| 88 'action': [ | 93 'action': [ |
| 89 '<(yasm_path)', | 94 '<(yasm_path)', |
| 90 '<@(yasm_flags)', | 95 '<@(yasm_flags)', |
| 91 '-o', '<(yasm_output_path)/<(RULE_INPUT_ROOT).<(asm_obj_extension)', | 96 '-o', '<(yasm_output_path)/<(RULE_INPUT_ROOT).<(asm_obj_extension)', |
| 92 '<(RULE_INPUT_PATH)', | 97 '<(RULE_INPUT_PATH)', |
| 93 ], | 98 ], |
| 94 'process_outputs_as_sources': 1, | 99 'process_outputs_as_sources': 1, |
| 95 'message': 'Compile assemly <(RULE_INPUT_PATH).', | 100 'message': 'Compile assemly <(RULE_INPUT_PATH).', |
| 96 }, | 101 }, |
| 97 ], # rules | 102 ], # rules |
| 98 } | 103 } |
| OLD | NEW |