1//
2// Copyright (C) 2008-2014 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
17liblog_sources = [
18    "config_read.c",
19    "config_write.c",
20    "local_logger.c",
21    "log_event_list.c",
22    "log_event_write.c",
23    "log_ratelimit.cpp",
24    "logger_lock.c",
25    "logger_name.c",
26    "logger_read.c",
27    "logger_write.c",
28    "logprint.c",
29    "stderr_write.c",
30]
31liblog_host_sources = [
32    "fake_log_device.c",
33    "fake_writer.c",
34]
35liblog_target_sources = [
36    "event_tag_map.cpp",
37    "log_time.cpp",
38    "properties.c",
39    "pmsg_reader.c",
40    "pmsg_writer.c",
41    "logd_reader.c",
42    "logd_writer.c",
43]
44
45// Shared and static library for host and device
46// ========================================================
47cc_library {
48    name: "liblog",
49    host_supported: true,
50
51    srcs: liblog_sources,
52
53    target: {
54        host: {
55            srcs: liblog_host_sources,
56            cflags: ["-DFAKE_LOG_DEVICE=1"],
57        },
58        android: {
59            srcs: liblog_target_sources,
60            // AddressSanitizer runtime library depends on liblog.
61            sanitize: {
62                address: false,
63            },
64        },
65        android_arm: {
66            // TODO: This is to work around b/24465209. Remove after root cause is fixed
67            ldflags: ["-Wl,--hash-style=both"],
68        },
69        windows: {
70            srcs: ["uio.c"],
71            enabled: true,
72        },
73        not_windows: {
74            srcs: ["event_tag_map.cpp"],
75        },
76        linux: {
77            host_ldlibs: ["-lrt"],
78        },
79        linux_bionic: {
80            enabled: true,
81        },
82    },
83
84    export_include_dirs: ["include"],
85
86    cflags: [
87        "-Werror",
88        "-fvisibility=hidden",
89        // This is what we want to do:
90        //  liblog_cflags := $(shell \
91        //   sed -n \
92        //       's/^\([0-9]*\)[ \t]*liblog[ \t].*/-DLIBLOG_LOG_TAG=\1/p' \
93        //       $(LOCAL_PATH)/event.logtags)
94        // so make sure we do not regret hard-coding it as follows:
95        "-DLIBLOG_LOG_TAG=1006",
96        "-DSNET_EVENT_LOG_TAG=1397638484",
97    ],
98    logtags: ["event.logtags"],
99    compile_multilib: "both",
100}
101
102ndk_headers {
103    name: "liblog_headers",
104    from: "include/android",
105    to: "android",
106    srcs: ["include/android/log.h"],
107    license: "NOTICE",
108}
109
110ndk_library {
111    name: "liblog",
112    symbol_file: "liblog.map.txt",
113    first_version: "9",
114    unversioned_until: "current",
115}
116
117llndk_library {
118    name: "liblog",
119    symbol_file: "liblog.map.txt",
120    unversioned: true,
121    export_include_dirs: ["include_vndk"],
122}
123