1// Copyright (C) 2007 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// 16// Definitions for building the native code needed for the core library. 17// 18 19// Defaults that apply to all of the modules 20 21cc_defaults { 22 name: "core_native_default_flags", 23 host_supported: true, 24 local_include_dirs: ["include"], 25 cflags: [ 26 "-Wall", 27 "-Wextra", 28 "-Werror", 29 ], 30 cppflags: ["-DU_USING_ICU_NAMESPACE=0"], 31 32 target: { 33 darwin: { 34 enabled: false, 35 }, 36 }, 37} 38 39cc_defaults { 40 name: "core_native_default_libs", 41 static_libs: [ 42 "libbase", 43 "libfdlibm", 44 ], 45 46 shared_libs: [ 47 "liblog", 48 "libnativehelper", 49 ], 50} 51 52cc_library_shared { 53 name: "libjavacore", 54 defaults: [ 55 "core_native_default_flags", 56 "core_native_default_libs", 57 ], 58 srcs: [ 59 ":luni_native_srcs", 60 "dalvik/src/main/native/org_apache_harmony_dalvik_NativeTestTarget.cpp", 61 ], 62 63 shared_libs: [ 64 "libcrypto", 65 "libexpat", 66 "libicuuc", 67 "libicui18n", 68 "libnativehelper", 69 "libz", 70 ], 71 static_libs: [ 72 "libziparchive", 73 "libbase", 74 ], 75 target: { 76 android: { 77 shared_libs: [ 78 "libutils", 79 ], 80 }, 81 }, 82} 83 84cc_defaults { 85 name: "libopenjdk_native_defaults", 86 defaults: [ 87 "core_native_default_flags", 88 "core_native_default_libs", 89 ], 90 srcs: [":libopenjdk_native_srcs"], 91 cflags: [ 92 // TODO(narayan): Prune down this list of exclusions once the underlying 93 // issues have been fixed. Most of these are small changes except for 94 // -Wunused-parameter. 95 "-Wno-unused-parameter", 96 "-Wno-unused-variable", 97 "-Wno-parentheses-equality", 98 "-Wno-constant-logical-operand", 99 "-Wno-sometimes-uninitialized", 100 101 // TODO(http://b/64362645): remove when upstream replaces readdir_r with readdir. 102 "-Wno-deprecated-declarations", 103 ], 104 105 shared_libs: [ 106 "libcrypto", 107 "libicuuc", 108 "libssl", 109 "libz", 110 111 "libnativehelper", 112 ], 113 static_libs: ["libfdlibm"], 114 115 target: { 116 linux_glibc: { 117 cflags: [ // Sigh. 118 "-D_LARGEFILE64_SOURCE", 119 "-D_GNU_SOURCE", 120 "-DLINUX", 121 "-D__GLIBC__", 122 ], 123 }, 124 }, 125 126 notice: "ojluni/NOTICE", 127} 128 129cc_library_shared { 130 name: "libopenjdk", 131 defaults: ["libopenjdk_native_defaults"], 132 shared_libs: [ 133 "libopenjdkjvm", 134 ], 135} 136 137// Debug version of libopenjdk. Depends on libopenjdkjvmd. 138cc_library_shared { 139 name: "libopenjdkd", 140 defaults: ["libopenjdk_native_defaults"], 141 shared_libs: [ 142 "libopenjdkjvmd", 143 ], 144} 145 146// Test JNI library. 147cc_library_shared { 148 name: "libjavacoretests", 149 defaults: ["core_native_default_flags"], 150 host_supported: true, 151 152 srcs: [ 153 "luni/src/test/native/libcore_dalvik_system_JniTest.cpp", 154 "luni/src/test/native/libcore_java_io_FileTest.cpp", 155 "luni/src/test/native/libcore_java_lang_ThreadTest.cpp", 156 "luni/src/test/native/libcore_java_nio_BufferTest.cpp", 157 "luni/src/test/native/libcore_libcore_util_NativeAllocationRegistryTest.cpp", 158 ], 159 target: { 160 android: { 161 shared_libs: ["libnativehelper_compat_libc++"], 162 }, 163 host: { 164 shared_libs: ["libnativehelper"], 165 }, 166 }, 167 168 strip: { 169 keep_symbols: true, 170 }, 171} 172 173// Set of gtest unit tests. 174cc_test { 175 name: "libjavacore-unit-tests", 176 defaults: ["core_native_default_flags"], 177 178 // Add -fno-builtin so that the compiler doesn't attempt to inline 179 // memcpy calls that are not really aligned. 180 cflags: ["-fno-builtin"], 181 srcs: ["luni/src/test/native/libcore_io_Memory_test.cpp"], 182 183 shared_libs: ["libnativehelper"], 184} 185 186// Set of benchmarks for libjavacore functions. 187cc_benchmark { 188 name: "libjavacore-benchmarks", 189 defaults: ["core_native_default_flags"], 190 191 srcs: ["luni/src/benchmark/native/libcore_io_Memory_bench.cpp"], 192 test_suites: ["device-tests"], 193 194 shared_libs: ["libnativehelper"], 195} 196 197subdirs = [ 198 "luni/src/main/native", 199 "ojluni/src/main/native", 200] 201