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.
5 # This is an gyp include to use YASM for compiling assembly files.
7 # Files to be compiled with YASM should have an extension of .asm.
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
17 # 'ultra_optimized_awesome.asm',
21 # '-I', 'assembly_include',
23 # 'yasm_output_path': '<(SHARED_INTERMEDIATE_DIR)/project',
24 # 'yasm_includes': ['ultra_optimized_awesome.inc']
27 # 'third_party/yasm/yasm_compile.gypi'
36 [ 'use_system_yasm==0', {
37 'yasm_path': '<(PRODUCT_DIR)/yasm<(EXECUTABLE_SUFFIX)',
39 'yasm_path': '<!(which yasm)',
42 # Define yasm_flags that pass into YASM.
43 [ 'os_posix==1 and OS!="mac" and OS!="ios" and target_arch=="ia32"', {
49 [ 'os_posix==1 and OS!="mac" and OS!="ios" and target_arch=="x64"', {
56 [ '(OS=="mac" or OS=="ios") and target_arch=="ia32"', {
62 [ '(OS=="mac" or OS=="ios") and target_arch=="x64"', {
68 [ 'OS=="win" and target_arch=="ia32"', {
75 [ 'OS=="win" and target_arch=="x64"', {
82 # Define output extension.
84 'asm_obj_extension': 'obj',
86 'asm_obj_extension': 'o',
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" )', {
96 '<(DEPTH)/third_party/yasm/yasm.gyp:yasm#host',
103 'rule_name': 'assemble',
105 'inputs': [ '<(yasm_path)', '<@(yasm_includes)'],
107 '<(yasm_output_path)/<(RULE_INPUT_ROOT).<(asm_obj_extension)',
112 '-o', '<(yasm_output_path)/<(RULE_INPUT_ROOT).<(asm_obj_extension)',
113 '<(RULE_INPUT_PATH)',
115 'process_outputs_as_sources': 1,
116 'message': 'Compile assembly <(RULE_INPUT_PATH)',