1// Copyright (C) 2018 The Android Open Source Project 2// 3// Licensed under the Apache License, Version 2.0 (the "License"); 4// you may not use this file except in compliance with the License. 5// You may obtain a copy of the License at 6// 7// http://www.apache.org/licenses/LICENSE-2.0 8// 9// Unless required by applicable law or agreed to in writing, software 10// distributed under the License is distributed on an "AS IS" BASIS, 11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12// See the License for the specific language governing permissions and 13// limitations under the License. 14// 15 16package { 17 default_applicable_licenses: ["Android-Apache-2.0"], 18} 19 20python_binary_host { 21 name: "gen_asm_x86", 22 main: "gen_asm_x86.py", 23 srcs: ["gen_asm_x86.py"], 24 libs: ["asm_defs_lib"], 25} 26 27python_binary_host { 28 name: "gen_asm_tests_x86", 29 main: "gen_asm_tests_x86.py", 30 srcs: [ 31 "gen_asm_tests_x86.py", 32 "gen_asm_x86.py", 33 ], 34 libs: ["asm_defs_lib"], 35} 36 37python_library_host { 38 name: "asm_defs_lib", 39 srcs: ["asm_defs.py"], 40} 41 42filegroup { 43 name: "libberberis_assembler_gen_inputs_x86_32", 44 srcs: [ 45 "instructions/insn_def_x86.json", 46 "instructions/insn_def_x86_32.json", 47 ], 48} 49 50filegroup { 51 name: "libberberis_assembler_gen_inputs_x86_64", 52 srcs: [ 53 "instructions/insn_def_x86.json", 54 "instructions/insn_def_x86_64.json", 55 ], 56} 57 58genrule { 59 name: "libberberis_assembler_gen_public_headers_x86_32", 60 out: [ 61 "berberis/assembler/gen_assembler_common_x86-inl.h", 62 "berberis/assembler/gen_assembler_x86_32-inl.h", 63 ], 64 srcs: [":libberberis_assembler_gen_inputs_x86_32"], 65 tools: ["gen_asm_x86"], 66 cmd: "$(location gen_asm_x86) --binary-assembler $(out) $(in)", 67} 68 69genrule { 70 name: "libberberis_assembler_gen_public_headers_x86_64", 71 out: [ 72 "berberis/assembler/gen_assembler_common_x86-inl.h", 73 "berberis/assembler/gen_assembler_x86_64-inl.h", 74 ], 75 srcs: [":libberberis_assembler_gen_inputs_x86_64"], 76 tools: ["gen_asm_x86"], 77 cmd: "$(location gen_asm_x86) --binary-assembler $(out) $(in)", 78} 79 80cc_library_headers { 81 name: "libberberis_assembler_headers", 82 defaults: ["berberis_defaults"], 83 host_supported: true, 84 header_libs: ["libberberis_base_headers"], 85 export_header_lib_headers: ["libberberis_base_headers"], 86 generated_headers: [ 87 "libberberis_assembler_gen_public_headers_x86_32", 88 "libberberis_assembler_gen_public_headers_x86_64", 89 ], 90 export_generated_headers: [ 91 "libberberis_assembler_gen_public_headers_x86_32", 92 "libberberis_assembler_gen_public_headers_x86_64", 93 ], 94 export_include_dirs: ["include"], 95} 96 97cc_library_static { 98 name: "libberberis_assembler", 99 defaults: ["berberis_defaults"], 100 host_supported: true, 101 srcs: [ 102 "machine_code.cc", 103 ], 104 header_libs: ["libberberis_assembler_headers"], 105 export_header_lib_headers: ["libberberis_assembler_headers"], 106} 107 108cc_genrule { 109 name: "libberberis_assembler_test_gen_sources", 110 host_supported: true, 111 out: [ 112 "gen_asm_tests_ref.S", 113 "gen_asm_tests_test.cc", 114 ], 115 arch: { 116 x86: { 117 srcs: [":libberberis_assembler_gen_inputs_x86_32"], 118 }, 119 x86_64: { 120 srcs: [":libberberis_assembler_gen_inputs_x86_64"], 121 }, 122 }, 123 tools: ["gen_asm_tests_x86"], 124 cmd: "$(location gen_asm_tests_x86) $(out) $(in) --fast", 125} 126 127cc_test_library { 128 name: "libberberis_assembler_unit_tests", 129 defaults: ["berberis_defaults"], 130 host_supported: true, 131 header_libs: ["berberis_test_utils_headers"], 132 srcs: [ 133 "assembler_test.cc", 134 "machine_code_test.cc", 135 ], 136 generated_sources: ["libberberis_assembler_test_gen_sources"], 137 static_libs: [ 138 "libberberis_assembler", 139 "libberberis_base", 140 ], 141 shared: { 142 enabled: false, 143 }, 144} 145