1//
2// Copyright (C) 2016 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
17cc_defaults {
18    name: "perfprofd_defaults",
19
20    cflags: [
21        "-Wall",
22        "-Wextra",
23        "-Werror",
24
25        // Try some more extreme warnings.
26        "-Wpedantic",
27        "-Wunreachable-code-aggressive",
28        // And disable some dumb things.
29        "-Wno-zero-length-array",
30        "-Wno-c99-extensions",
31        "-Wno-language-extension-token",
32        "-Wno-gnu-zero-variadic-macro-arguments",
33        "-Wno-nested-anon-types",
34        "-Wno-gnu-statement-expression",
35        "-Wno-vla-extension",
36        "-Wno-extended-offsetof",
37    ],
38    cppflags: [
39        "-Wno-sign-compare",
40        "-Wno-unused-parameter",
41    ],
42
43    target: {
44        darwin: {
45            enabled: false,
46        },
47    },
48}
49
50cc_defaults {
51    name: "perfprofd_debug_defaults",
52
53    cflags: [
54        "-O0",
55        "-g",
56        "-UNDEBUG",
57    ],
58}
59
60// Static library for the record proto and its I/O.
61
62cc_library_static {
63    name: "libperfprofd_record_proto",
64    defaults: [
65        "perfprofd_defaults",
66    ],
67    host_supported: true,
68
69    static_libs: [
70        "libbase",
71        "libprotobuf-cpp-lite",
72        "libquipper",
73        "libz",
74    ],
75    srcs: [
76        "perfprofd_io.cc",
77        "perfprofd_record.proto",
78    ],
79
80    proto: {
81        export_proto_headers: true,
82        include_dirs: ["external/perf_data_converter/src/quipper"],
83        type: "lite",
84    },
85
86    export_include_dirs: ["."],  // Really only the -fwd.h.
87    export_static_lib_headers: ["libquipper"],
88}
89
90//
91// Static library containing guts of AWP daemon.
92//
93
94cc_defaults {
95    name: "libperfprofdcore_defaults",
96    defaults: [
97        "perfprofd_defaults",
98    ],
99    host_supported: true,
100
101    static_libs: [
102        "libbase",
103        "libsimpleperf_elf_read",
104    ],
105    whole_static_libs: [
106        "libperfprofd_dropbox",
107        "libperfprofd_record_proto",
108        "libquipper",
109    ],
110    srcs: [
111        "perf_data_converter.cc",
112        "configreader.cc",
113        "cpuconfig.cc",
114        "perfprofdcore.cc",
115        "perfprofd_cmdline.cc",
116        "symbolizer.cc"
117    ],
118
119    cflags: [
120        "-Wno-gnu-anonymous-struct",
121    ],
122
123    export_include_dirs: ["."],
124}
125
126cc_library_static {
127    name: "libperfprofdcore",
128    defaults: [
129        "libperfprofdcore_defaults",
130    ],
131}
132
133// Debug version.
134cc_library_static {
135    name: "libperfprofdcored",
136    defaults: [
137        "libperfprofdcore_defaults",
138        "perfprofd_debug_defaults",
139    ],
140}
141
142
143//
144// Main daemon
145//
146cc_binary {
147    name: "perfprofd",
148    defaults: [
149        "perfprofd_defaults",
150    ],
151
152    srcs: [
153        "perfprofdmain.cc",
154    ],
155
156    static_libs: [
157        "libperfprofdcore",
158        "libperfprofd_binder",
159        "libsimpleperf_elf_read",
160    ],
161    group_static_libs: true,
162
163    shared_libs: [
164        "liblog",
165        "libprotobuf-cpp-lite",
166        "libbase",
167        "libbinder",
168        "libservices",
169        "libutils",
170    ],
171
172    init_rc: ["perfprofd.rc"],
173
174    product_variables: {
175        pdk: {
176            enabled: false,
177        },
178    },
179
180    // We're technically independent, but ensure simpleperf is there.
181    required: [
182        "simpleperf",
183    ],
184}
185
186subdirs = [
187    "binder_interface",
188    "tests",
189]
190