Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 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 provides the yasm_assemble() template which uses YASM to assemble | 5 # This provides the yasm_assemble() template which uses YASM to assemble |
| 6 # assembly files. | 6 # assembly files. |
| 7 # | 7 # |
| 8 # Files to be assembled with YASM should have an extension of .asm. | 8 # Files to be assembled with YASM should have an extension of .asm. |
| 9 # | 9 # |
| 10 # Parameters | 10 # Parameters |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 74 "-m", "x86", | 74 "-m", "x86", |
| 75 ] | 75 ] |
| 76 } else if (cpu_arch == "x64") { | 76 } else if (cpu_arch == "x64") { |
| 77 _yasm_flags = [ | 77 _yasm_flags = [ |
| 78 "-fwin64", | 78 "-fwin64", |
| 79 "-m", "amd64", | 79 "-m", "amd64", |
| 80 ] | 80 ] |
| 81 } | 81 } |
| 82 } | 82 } |
| 83 | 83 |
| 84 # Default yasm include dirs. Make it match the native build (source root and | |
| 85 # root generated code directory). | |
| 86 _yasm_flags += [ | |
| 87 # Using "//." will produce a relative path "../.." which looks better than | |
| 88 # "../../" which will result from using "//" as the base (although both | |
| 89 # work). This is because rebase_path will terminate the result in a slash if | |
| 90 # the input ends in a slash. | |
| 91 "-I" + rebase_path("//.", root_build_dir), | |
| 92 "-I" + rebase_path(root_gen_dir, root_build_dir), | |
| 93 ] | |
| 94 | |
| 95 if (is_win) { | 84 if (is_win) { |
| 96 asm_obj_extension = "obj" | 85 asm_obj_extension = "obj" |
| 97 } else { | 86 } else { |
| 98 asm_obj_extension = "o" | 87 asm_obj_extension = "o" |
| 99 } | 88 } |
| 100 | 89 |
| 101 template("yasm_assemble") { | 90 template("yasm_assemble") { |
| 102 # TODO(ajwong): Support use_system_yasm. | 91 # TODO(ajwong): Support use_system_yasm. |
| 103 assert(defined(invoker.sources), "Need sources defined for $target_name") | 92 assert(defined(invoker.sources), "Need sources defined for $target_name") |
| 104 | 93 |
| (...skipping 28 matching lines...) Expand all Loading... | |
| 133 if (defined(invoker.deps)) { | 122 if (defined(invoker.deps)) { |
| 134 deps += invoker.deps | 123 deps += invoker.deps |
| 135 } | 124 } |
| 136 | 125 |
| 137 # Flags. | 126 # Flags. |
| 138 args += _yasm_flags | 127 args += _yasm_flags |
| 139 if (defined(invoker.yasm_flags)) { | 128 if (defined(invoker.yasm_flags)) { |
| 140 args += invoker.yasm_flags | 129 args += invoker.yasm_flags |
| 141 } | 130 } |
| 142 | 131 |
| 143 # Extra include directories. | 132 # User defined include dirs go first. |
| 144 if (defined(invoker.include_dirs)) { | 133 if (defined(invoker.include_dirs)) { |
| 145 foreach(include, invoker.include_dirs) { | 134 foreach(include, invoker.include_dirs) { |
| 146 args += [ "-I" + rebase_path(include, root_build_dir) ] | 135 args += [ "-I" + rebase_path(include, root_build_dir) ] |
| 147 } | 136 } |
| 148 } | 137 } |
| 149 | 138 |
| 139 # Default yasm include dirs. Make it match the native build (source root and | |
| 140 # root generated code directory). | |
| 141 # This goes to the end of include list. | |
| 142 args += [ | |
| 143 # Using "//." will produce a relative path "../.." which looks better than | |
| 144 # "../../" which will result from using "//" as the base (although both | |
| 145 # work). This is because rebase_path will terminate the result in a slash if | |
|
brettw
2014/09/05 21:55:07
wrap?
| |
| 146 # the input ends in a slash. | |
| 147 "-I" + rebase_path("//.", root_build_dir), | |
| 148 "-I" + rebase_path(root_gen_dir, root_build_dir), | |
| 149 ] | |
| 150 | |
| 150 # Extra defines. | 151 # Extra defines. |
| 151 if (defined(invoker.defines)) { | 152 if (defined(invoker.defines)) { |
| 152 foreach(def, invoker.defines) { | 153 foreach(def, invoker.defines) { |
| 153 args += [ "-D$def" ] | 154 args += [ "-D$def" ] |
| 154 } | 155 } |
| 155 } | 156 } |
| 156 | 157 |
| 157 # Output file. | 158 # Output file. |
| 158 # | 159 # |
| 159 # TODO(brettw) it might be nice if there was a source expansion for the | 160 # TODO(brettw) it might be nice if there was a source expansion for the |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 178 source_set(source_set_name) { | 179 source_set(source_set_name) { |
| 179 if (defined(invoker.visibility)) { | 180 if (defined(invoker.visibility)) { |
| 180 visibility = invoker.visibility | 181 visibility = invoker.visibility |
| 181 } | 182 } |
| 182 | 183 |
| 183 sources = get_target_outputs(":$action_name") | 184 sources = get_target_outputs(":$action_name") |
| 184 | 185 |
| 185 deps = [ ":$action_name" ] | 186 deps = [ ":$action_name" ] |
| 186 } | 187 } |
| 187 } | 188 } |
| OLD | NEW |