• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 linked 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_transport/include",
104    ],
105    srcs: [
106        "libnos/debug.cpp",
107        "libnos_transport/transport.c",
108        "libnos_transport/crc16.c",
109    ],
110    static_libs: [
111        "libbase",
112    ],
113}
114
115// A special target to be statically linked into fastboot hal.
116cc_library_static {
117    name: "libnos_for_fastboot",
118    recovery: true,
119    cflags: [
120        "-Wall",
121        "-Wextra",
122        "-Werror",
123        "-Wno-zero-length-array",
124    ],
125    export_include_dirs: [
126        "nugget/include",
127        "libnos/include",
128        "libnos_transport/include",
129    ],
130    srcs: [
131        "libnos/debug.cpp",
132        "libnos_transport/transport.c",
133        "libnos_transport/crc16.c",
134    ],
135    static_libs: [
136        "libbase",
137    ],
138}
139
140// A special target to be statically linked into recovery which is a system
141// (not vendor) component.
142cc_library_static {
143    name: "libnos_citadel_for_recovery",
144    cflags: [
145        "-Wall",
146        "-Wextra",
147        "-Werror",
148    ],
149    srcs: [
150        ":libnos_client",
151        "libnos_datagram/citadel.cpp",
152    ],
153    static_libs: [
154        "libnos_for_recovery",
155    ],
156    shared_libs: [
157        "libbase",
158    ],
159}
160
161// A special target to be statically linked into fastboot hal.
162cc_library_static {
163    name: "libnos_citadel_for_fastboot",
164    recovery: true,
165    cflags: [
166        "-Wall",
167        "-Wextra",
168        "-Werror",
169    ],
170    srcs: [
171        ":libnos_client",
172        "libnos_datagram/citadel.cpp",
173    ],
174    static_libs: [
175        "libnos_for_fastboot",
176    ],
177    shared_libs: [
178        "libbase",
179    ],
180}
181
182// Language and vendor related defaults
183cc_defaults {
184    name: "nos_cc_defaults",
185
186    cflags: [
187        "-pedantic",
188        "-Wall",
189        "-Wextra",
190        "-Werror",
191        "-Wno-gnu-zero-variadic-macro-arguments",
192        "-Wno-zero-length-array",
193    ],
194    conlyflags: [
195        "-std=c11",
196    ],
197    vendor: true,
198    owner: "google",
199}
200
201// Defaults for components under the hw subdirectory
202cc_defaults {
203    name: "nos_cc_hw_defaults",
204    defaults: ["nos_cc_defaults"],
205    relative_install_path: "hw",
206}
207
208// Defaults for components shared between the host and device
209cc_defaults {
210    name: "nos_cc_host_supported_defaults",
211    defaults: ["nos_cc_defaults"],
212    host_supported: true,
213}
214
215cc_library {
216    name: "libnos_client_citadel",
217    srcs: [":libnos_client"],
218    defaults: [
219        "libnos_client_defaults",
220        "nos_cc_defaults",
221    ],
222    shared_libs: [
223        "libnos_datagram_citadel",
224    ],
225}
226