1// 2// Copyright (C) 2017 The Android Open Source Project 3// 4// Licensed under the Apache License, Version 2.0 (the "License"); 5// you may not use this file except in compliance with the License. 6// You may obtain a copy of the License at 7// 8// http://www.apache.org/licenses/LICENSE-2.0 9// 10// Unless required by applicable law or agreed to in writing, software 11// distributed under the License is distributed on an "AS IS" BASIS, 12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13// See the License for the specific language governing permissions and 14// limitations under the License. 15// 16 17package { 18 default_applicable_licenses: ["external_nos_host_generic_license"], 19} 20 21// Added automatically by a large-scale-change that took the approach of 22// 'apply every license found to every target'. While this makes sure we respect 23// every license restriction, it may not be entirely correct. 24// 25// e.g. GPL in an MIT project might only apply to the contrib/ directory. 26// 27// Please consider splitting the single license below into multiple licenses, 28// taking care not to lose any license_kind information, and overriding the 29// default license using the 'licenses: [...]' property on targets as needed. 30// 31// For unused files, consider creating a 'fileGroup' with "//visibility:private" 32// to attach the license to, and including a comment whether the files may be 33// used in the current project. 34// See: http://go/android-license-faq 35license { 36 name: "external_nos_host_generic_license", 37 visibility: [":__subpackages__"], 38 license_kinds: [ 39 "SPDX-license-identifier-Apache-2.0", 40 "SPDX-license-identifier-BSD", 41 ], 42 license_text: [ 43 "LICENSE", 44 ], 45} 46 47cc_library_headers { 48 name: "nos_headers", 49 defaults: ["nos_cc_host_supported_defaults"], 50 export_include_dirs: ["nugget/include"], 51} 52 53cc_defaults { 54 name: "nos_proto_defaults", 55 cflags: [ 56 "-Wno-unused-parameter", 57 ], 58} 59 60cc_defaults { 61 name: "nos_app_defaults", 62 defaults: ["nos_proto_defaults"], 63 header_libs: ["nos_headers"], 64 shared_libs: [ 65 "libnos", 66 "libprotobuf-cpp-full", 67 ], 68} 69 70cc_defaults { 71 name: "nos_app_service_defaults", 72 defaults: [ 73 "nos_app_defaults", 74 "nos_cc_defaults", 75 ], 76 shared_libs: ["libnosprotos"], 77 export_shared_lib_headers: ["libnosprotos"], 78} 79 80// Soong doesn't allow adding plugins to a protobuf compilation so we need to 81// invoke it directly. If we could pass a plugin, it could use insertion points 82// in the .pb.{cc,h} files rather than needing to generate new .client.{cpp,h} 83// files for each service. 84GEN_SERVICE = "$(location aprotoc) --plugin=protoc-gen-nos-client-cpp=$(location protoc-gen-nos-client-cpp) $(in) -Iexternal/protobuf/src -Iexternal/nos/host/generic/nugget/proto" 85 86GEN_SERVICE_SOURCE = GEN_SERVICE + " --nos-client-cpp_out=source:$(genDir) " 87GEN_SERVICE_HEADER = GEN_SERVICE + " --nos-client-cpp_out=header:$(genDir) " 88GEN_SERVICE_MOCK = GEN_SERVICE + " --nos-client-cpp_out=mock:$(genDir) " 89 90// A special target to be statically linkeed into recovery which is a system 91// (not vendor) component. 92cc_library_static { 93 name: "libnos_for_recovery", 94 cflags: [ 95 "-Wall", 96 "-Wextra", 97 "-Werror", 98 "-Wno-zero-length-array", 99 ], 100 export_include_dirs: [ 101 "nugget/include", 102 "libnos/include", 103 "libnos_datagram/include", 104 "libnos_transport/include", 105 ], 106 srcs: [ 107 "libnos/debug.cpp", 108 "libnos_transport/transport.c", 109 "libnos_transport/crc16.c", 110 ], 111 static_libs: [ 112 "libbase", 113 ], 114} 115 116// A special target to be statically linkeed into fastboot hal. 117cc_library_static { 118 name: "libnos_for_fastboot", 119 recovery: true, 120 cflags: [ 121 "-Wall", 122 "-Wextra", 123 "-Werror", 124 "-Wno-zero-length-array", 125 ], 126 export_include_dirs: [ 127 "nugget/include", 128 "libnos/include", 129 "libnos_datagram/include", 130 "libnos_transport/include", 131 ], 132 srcs: [ 133 "libnos/debug.cpp", 134 "libnos_transport/transport.c", 135 "libnos_transport/crc16.c", 136 ], 137 static_libs: [ 138 "libbase", 139 ], 140} 141 142// A special target to be statically linkeed into recovery which is a system 143// (not vendor) component. 144cc_library_static { 145 name: "libnos_citadel_for_recovery", 146 cflags: [ 147 "-Wall", 148 "-Wextra", 149 "-Werror", 150 ], 151 srcs: [ 152 ":libnos_client", 153 "libnos_datagram/citadel.c", 154 ], 155 static_libs: [ 156 "libnos_for_recovery", 157 ], 158} 159 160// A special target to be statically linkeed into fastboot hal. 161cc_library_static { 162 name: "libnos_citadel_for_fastboot", 163 recovery: true, 164 cflags: [ 165 "-Wall", 166 "-Wextra", 167 "-Werror", 168 ], 169 srcs: [ 170 ":libnos_client", 171 "libnos_datagram/citadel.c", 172 ], 173 static_libs: [ 174 "libnos_for_fastboot", 175 ], 176} 177 178// Language and vendor related defaults 179cc_defaults { 180 name: "nos_cc_defaults", 181 clang: true, 182 cflags: [ 183 "-pedantic", 184 "-Wall", 185 "-Wextra", 186 "-Werror", 187 "-Wno-gnu-zero-variadic-macro-arguments", 188 "-Wno-zero-length-array", 189 ], 190 conlyflags: [ 191 "-std=c11", 192 ], 193 vendor: true, 194 owner: "google", 195} 196 197// Defaults for components under the hw subdirectory 198cc_defaults { 199 name: "nos_cc_hw_defaults", 200 defaults: ["nos_cc_defaults"], 201 relative_install_path: "hw", 202} 203 204// Defaults for components shared between the host and device 205cc_defaults { 206 name: "nos_cc_host_supported_defaults", 207 defaults: ["nos_cc_defaults"], 208 host_supported: true, 209} 210 211cc_library { 212 name: "libnos_client_citadel", 213 srcs: [":libnos_client"], 214 defaults: [ 215 "libnos_client_defaults", 216 "nos_cc_defaults", 217 ], 218 shared_libs: ["libnos_datagram_citadel"], 219} 220