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 "-I.", | |
|
piman
2014/09/18 20:14:57
This (recently added) line was lost in the merge.
| |
| 88 # Using "//." will produce a relative path "../.." which looks better than | |
| 89 # "../../" which will result from using "//" as the base (although both | |
| 90 # work). This is because rebase_path will terminate the result in a slash if | |
| 91 # the input ends in a slash. | |
| 92 "-I" + rebase_path("//.", root_build_dir), | |
| 93 "-I" + rebase_path(root_gen_dir, root_build_dir), | |
| 94 ] | |
| 95 | |
| 96 if (is_win) { | 84 if (is_win) { |
| 97 asm_obj_extension = "obj" | 85 asm_obj_extension = "obj" |
| 98 } else { | 86 } else { |
| 99 asm_obj_extension = "o" | 87 asm_obj_extension = "o" |
| 100 } | 88 } |
| 101 | 89 |
| 102 template("yasm_assemble") { | 90 template("yasm_assemble") { |
| 103 # TODO(ajwong): Support use_system_yasm. | 91 # TODO(ajwong): Support use_system_yasm. |
| 104 assert(defined(invoker.sources), "Need sources defined for $target_name") | 92 assert(defined(invoker.sources), "Need sources defined for $target_name") |
| 105 | 93 |
| (...skipping 29 matching lines...) Expand all Loading... | |
| 135 if (defined(invoker.deps)) { | 123 if (defined(invoker.deps)) { |
| 136 deps += invoker.deps | 124 deps += invoker.deps |
| 137 } | 125 } |
| 138 | 126 |
| 139 # Flags. | 127 # Flags. |
| 140 args += _yasm_flags | 128 args += _yasm_flags |
| 141 if (defined(invoker.yasm_flags)) { | 129 if (defined(invoker.yasm_flags)) { |
| 142 args += invoker.yasm_flags | 130 args += invoker.yasm_flags |
| 143 } | 131 } |
| 144 | 132 |
| 145 # Extra include directories. | 133 # User defined include dirs go first. |
| 146 if (defined(invoker.include_dirs)) { | 134 if (defined(invoker.include_dirs)) { |
| 147 foreach(include, invoker.include_dirs) { | 135 foreach(include, invoker.include_dirs) { |
| 148 args += [ "-I" + rebase_path(include, root_build_dir) ] | 136 args += [ "-I" + rebase_path(include, root_build_dir) ] |
| 149 } | 137 } |
| 150 } | 138 } |
| 151 | 139 |
| 140 # Default yasm include dirs. Make it match the native build (source root and | |
| 141 # root generated code directory). | |
| 142 # This goes to the end of include list. | |
| 143 args += [ | |
| 144 # Using "//." will produce a relative path "../.." which looks better than | |
| 145 # "../../" which will result from using "//" as the base (although both | |
| 146 # work). This is because rebase_path will terminate the result in a | |
| 147 # slash if the input ends in a slash. | |
| 148 "-I" + rebase_path("//.", root_build_dir), | |
| 149 "-I" + rebase_path(root_gen_dir, root_build_dir), | |
| 150 ] | |
| 151 | |
| 152 | |
| 152 # Extra defines. | 153 # Extra defines. |
| 153 if (defined(invoker.defines)) { | 154 if (defined(invoker.defines)) { |
| 154 foreach(def, invoker.defines) { | 155 foreach(def, invoker.defines) { |
| 155 args += [ "-D$def" ] | 156 args += [ "-D$def" ] |
| 156 } | 157 } |
| 157 } | 158 } |
| 158 | 159 |
| 159 # Output file. | 160 # Output file. |
| 160 # | 161 # |
| 161 # TODO(brettw) it might be nice if there was a source expansion for the | 162 # TODO(brettw) it might be nice if there was a source expansion for the |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 180 source_set(source_set_name) { | 181 source_set(source_set_name) { |
| 181 if (defined(invoker.visibility)) { | 182 if (defined(invoker.visibility)) { |
| 182 visibility = invoker.visibility | 183 visibility = invoker.visibility |
| 183 } | 184 } |
| 184 | 185 |
| 185 sources = get_target_outputs(":$action_name") | 186 sources = get_target_outputs(":$action_name") |
| 186 | 187 |
| 187 deps = [ ":$action_name" ] | 188 deps = [ ":$action_name" ] |
| 188 } | 189 } |
| 189 } | 190 } |
| OLD | NEW |